- modify CCG to not crash when passed invalid faces, just ignores

that face... this situation should still not happen with well
   written modifiers but at least it won't crash now
 - bug fix in mirror modifier, calculation during editmode did not
   check to make sure built mface's had valid indices... grr the
   ==0 tagging system is really a pain.
 - convert a few uiDefBut calls to use explicit type
This commit is contained in:
2005-08-03 19:27:19 +00:00
parent 45386aeb3c
commit 1db88bd065
4 changed files with 26 additions and 64 deletions

View File

@@ -1016,15 +1016,22 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
for (k=0; k<numVerts; k++) { for (k=0; k<numVerts; k++) {
ss->tempVerts[k] = _ehash_lookup(ss->vMap, vHDLs[k]); ss->tempVerts[k] = _ehash_lookup(ss->vMap, vHDLs[k]);
if (!ss->tempVerts[k])
return eCCGError_InvalidValue;
} }
for (k=0; k<numVerts; k++) { for (k=0; k<numVerts; k++) {
ss->tempEdges[k] = _vert_findEdgeTo(ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts]); ss->tempEdges[k] = _vert_findEdgeTo(ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts]);
if (ss->allowEdgeCreation && !ss->tempEdges[k]) { if (!ss->tempEdges[k]) {
CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) -1, ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts], ss->defaultCreaseValue, ss->subdivLevels, ss->meshIFC.vertDataSize, ss); if (ss->allowEdgeCreation) {
_ehash_insert(ss->eMap, (EHEntry*) e); CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) -1, ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts], ss->defaultCreaseValue, ss->subdivLevels, ss->meshIFC.vertDataSize, ss);
e->v0->flags |= Vert_eEffected; _ehash_insert(ss->eMap, (EHEntry*) e);
e->v1->flags |= Vert_eEffected; e->v0->flags |= Vert_eEffected;
e->v1->flags |= Vert_eEffected;
} else {
return eCCGError_InvalidValue;
}
} }
} }

View File

@@ -543,53 +543,6 @@ static void mirrorModifier__doMirror(MirrorModifierData *mmd, DispListMesh *ndlm
if (nmf->v1==mf->v1 && nmf->v2==mf->v2 && nmf->v3==mf->v3 && nmf->v4==mf->v4) if (nmf->v1==mf->v1 && nmf->v2==mf->v2 && nmf->v3==mf->v3 && nmf->v4==mf->v4)
continue; continue;
/* Decided this wasn't worth the effort, esp. because the mesh still
* has wierd topology. Can put it back if it appears useful in the end.
* Note it needs some test_mface or so added.
*/
#if 0
int copyIdx;
/* If three in order vertices are shared then duplicating the face
* will be strange (don't want two quads sharing three vertices in a
* mesh. Instead modify the original quad to leave out the middle vertice
* and span the gap. Vertice will remain in mesh and still have edges
* to it but will not interfere with normals.
*/
if (nmf->v4==mf->v4 && nmf->v1==mf->v1 && nmf->v2==mf->v2) {
mf->v1 = nmf->v3;
copyIdx = 0;
} else if (nmf->v1==mf->v1 && nmf->v2==mf->v2 && nmf->v3==mf->v3) {
mf->v2 = nmf->v4;
copyIdx = 1;
} else if (nmf->v2==mf->v2 && nmf->v3==mf->v3 && nmf->v4==mf->v4) {
mf->v3 = nmf->v1;
copyIdx = 2;
} else if (nmf->v3==mf->v3 && nmf->v4==mf->v4 && nmf->v1==mf->v1) {
mf->v4 = nmf->v2;
copyIdx = 3;
} else {
copyIdx = -1;
}
if (copyIdx!=-1) {
int fromIdx = (copyIdx+2)%4;
if (ndlm->tface) {
tf->col[copyIdx] = ntf->col[fromIdx];
tf->uv[copyIdx][0] = ntf->uv[fromIdx][0];
tf->uv[copyIdx][1] = ntf->uv[fromIdx][1];
} else if (ndlm->mcol) {
mc[copyIdx] = nmc[fromIdx];
}
if (mf->v3==0 || nmf->v3==0 || (has4 && (mf->v4==0 || nmf->v4==0))) {
int i = 0;
}
continue;
}
#endif
if (nmf->v3) { if (nmf->v3) {
/* Need to flip face normal, pick which verts to flip /* Need to flip face normal, pick which verts to flip
* in order to prevent nmf->v3==0 or nmf->v4==0 * in order to prevent nmf->v3==0 or nmf->v4==0
@@ -740,6 +693,8 @@ static void *mirrorModifier_applyModifierEM(ModifierData *md, Object *ob, void *
mf->v4 = efa->v4?(int) efa->v4->prev:0; mf->v4 = efa->v4?(int) efa->v4->prev:0;
mf->mat_nr = efa->mat_nr; mf->mat_nr = efa->mat_nr;
mf->flag = efa->flag; mf->flag = efa->flag;
test_index_mface(mf, efa->v4?4:3);
} }
mirrorModifier__doMirror(mmd, ndlm, vertexCos); mirrorModifier__doMirror(mmd, ndlm, vertexCos);

View File

@@ -486,20 +486,20 @@ static void nla_panel_properties(short cntrl) // NLA_HANDLER_PROPERTIES
uiDefBut(block, LABEL, 0, "Options:", 10,60,300,19, 0, 0, 0, 0, 0, ""); uiDefBut(block, LABEL, 0, "Options:", 10,60,300,19, 0, 0, 0, 0, 0, "");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefBut(block, NUM|FLO, B_REDR, "Strip Start:", 10,160,150,19, &strip->start, 1.0, MAXFRAMEF, 100, 0, "First frame in the timeline"); uiDefButF(block, NUM, B_REDR, "Strip Start:", 10,160,150,19, &strip->start, 1.0, MAXFRAMEF, 100, 0, "First frame in the timeline");
uiDefBut(block, NUM|FLO, B_REDR, "Strip End:", 160,160,150,19, &strip->end, 1.0, MAXFRAMEF, 100, 0, "Last frame in the timeline"); uiDefButF(block, NUM, B_REDR, "Strip End:", 160,160,150,19, &strip->end, 1.0, MAXFRAMEF, 100, 0, "Last frame in the timeline");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefBut(block, NUM|FLO, B_REDR, "Action Start:", 10,120,150,19, &strip->actstart, 1.0, MAXFRAMEF, 100, 0, "First frame of the action to map to the playrange"); uiDefButF(block, NUM, B_REDR, "Action Start:", 10,120,150,19, &strip->actstart, 1.0, MAXFRAMEF, 100, 0, "First frame of the action to map to the playrange");
uiDefBut(block, NUM|FLO, B_REDR, "Action End:", 160,120,150,19, &strip->actend, 1.0, MAXFRAMEF, 100, 0, "Last frame of the action to map to the playrange"); uiDefButF(block, NUM, B_REDR, "Action End:", 160,120,150,19, &strip->actend, 1.0, MAXFRAMEF, 100, 0, "Last frame of the action to map to the playrange");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefBut(block, NUM|FLO, B_REDR, "Blendin:", 10,80,150,19, &strip->blendin, 0.0, MAXFRAMEF, 100, 0, "Number of frames of ease-in"); uiDefButF(block, NUM, B_REDR, "Blendin:", 10,80,150,19, &strip->blendin, 0.0, MAXFRAMEF, 100, 0, "Number of frames of ease-in");
uiDefBut(block, NUM|FLO, B_REDR, "Blendout:", 160,80,150,19, &strip->blendout, 0.0, MAXFRAMEF, 100, 0, "Number of frames of ease-out"); uiDefButF(block, NUM, B_REDR, "Blendout:", 160,80,150,19, &strip->blendout, 0.0, MAXFRAMEF, 100, 0, "Number of frames of ease-out");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefBut(block, NUM|FLO, B_REDR, "Repeat:", 10,40,150,19, &strip->repeat, 0.0001, MAXFRAMEF, 100, 0, "Number of times the action should repeat"); uiDefButF(block, NUM, B_REDR, "Repeat:", 10,40,150,19, &strip->repeat, 0.0001, MAXFRAMEF, 100, 0, "Number of times the action should repeat");
uiDefBut(block, NUM|FLO, B_REDR, "Stride:", 160,40,150,19, &strip->stridelen, 0.0001, MAXFRAMEF, 100, 0, "Distance covered by one complete cycle of the action specified in the Action Range"); uiDefButF(block, NUM, B_REDR, "Stride:", 160,40,150,19, &strip->stridelen, 0.0001, MAXFRAMEF, 100, 0, "Distance covered by one complete cycle of the action specified in the Action Range");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, ACTSTRIP_USESTRIDE, B_REDR, "Use Path", 10,0,100,19, &strip->flag, 0, 0, 0, 0, "Plays action based on path position & stride. Only armatures parented to a path"); uiDefButBitS(block, TOG, ACTSTRIP_USESTRIDE, B_REDR, "Use Path", 10,0,100,19, &strip->flag, 0, 0, 0, 0, "Plays action based on path position & stride. Only armatures parented to a path");

View File

@@ -2664,12 +2664,12 @@ void drawinfospace(ScrArea *sa, void *spacedata)
(xpos+edgsp+mpref+midsp),y2,mpref,buth, (xpos+edgsp+mpref+midsp),y2,mpref,buth,
&U.fontsize, 0, 0, 0, 0, "Restores to using the default included antialised font"); &U.fontsize, 0, 0, 0, 0, "Restores to using the default included antialised font");
uiDefButI(block, MENU|INT, B_SETFONTSIZE, fontsize_pup(), uiDefButI(block, MENU, B_SETFONTSIZE, fontsize_pup(),
(xpos+edgsp+mpref+midsp),y1,mpref,buth, (xpos+edgsp+mpref+midsp),y1,mpref,buth,
&U.fontsize, 0, 0, 0, 0, "Current interface font size (points)"); &U.fontsize, 0, 0, 0, 0, "Current interface font size (points)");
/* /*
uiDefButS(block, MENU|SHO, B_SETENCODING, encoding_pup(), uiDefButS(block, MENU, B_SETENCODING, encoding_pup(),
(xpos+edgsp+mpref+midsp),y1,mpref,buth, (xpos+edgsp+mpref+midsp),y1,mpref,buth,
&U.encoding, 0, 0, 0, 0, "Current interface font encoding"); &U.encoding, 0, 0, 0, 0, "Current interface font encoding");
@@ -2691,7 +2691,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
(xpos+edgsp+(2.2*mpref)+(5*midsp)+(2*spref)),y1,spref,buth, (xpos+edgsp+(2.2*mpref)+(5*midsp)+(2*spref)),y1,spref,buth,
&(U.transopts), 0, 0, 0, 0, "Translate toolbox menu"); &(U.transopts), 0, 0, 0, 0, "Translate toolbox menu");
uiDefButI(block, MENU|SHO, B_SETLANGUAGE, language_pup(), uiDefButI(block, MENU, B_SETLANGUAGE, language_pup(),
(xpos+edgsp+(2.2*mpref)+(3*midsp)),y2,mpref+(0.5*mpref)+3,buth, (xpos+edgsp+(2.2*mpref)+(3*midsp)),y2,mpref+(0.5*mpref)+3,buth,
&U.language, 0, 0, 0, 0, "Select interface language"); &U.language, 0, 0, 0, 0, "Select interface language");
@@ -2791,7 +2791,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
(xpos+edgsp),y2,lpref,buth, (xpos+edgsp),y2,lpref,buth,
&(U.uiflag), 0, 0, 0, 0, "Display a list of input events in the console"); &(U.uiflag), 0, 0, 0, 0, "Display a list of input events in the console");
uiDefButS(block, MENU|SHO, B_CONSOLEOUT, consolemethod_pup(), uiDefButS(block, MENU, B_CONSOLEOUT, consolemethod_pup(),
(xpos+edgsp), y1, lpref,buth, (xpos+edgsp), y1, lpref,buth,
&U.console_out, 0, 0, 0, 0, "Select console output method"); &U.console_out, 0, 0, 0, 0, "Select console output method");