void SolidifyPW::ActivateSubobjSel(int level, XFormModes& modes) { if (ip) { ip->PipeSelLevelChanged(); NotifyDependents(FOREVER, PART_SELECT|PART_DISPLAY|PART_SUBSEL_TYPE, REFMSG_CHANGE); } }
void EditFaceDataMod::ActivateSubobjSel(int level, XFormModes& modes) { // Set the meshes level selLevel = level; // Fill in modes with our sub-object modes if (level!=SEL_OBJECT) { modes = XFormModes(NULL,NULL,NULL,NULL,NULL,selectMode); } // Update UI UpdateDialog (); ip->PipeSelLevelChanged(); NotifyDependents(FOREVER, SELECT_CHANNEL|DISP_ATTRIB_CHANNEL|SUBSEL_TYPE_CHANNEL, REFMSG_CHANGE); }
void SolidifyPW::ModifyObject(TimeValue t, ModContext &mc, ObjectState * os, INode *node) { //TODO: Add the code for actually modifying the object meshInfo.Free(); if (os->obj->IsSubClassOf(triObjectClassID)) { TriObject *tobj = (TriObject*)os->obj; Mesh &mesh = tobj->GetMesh(); Interval iv = FOREVER; float a,oa; pblock->GetValue(pb_amount,t,a,iv); pblock->GetValue(pb_oamount,t,oa,iv); if (a == oa) oa += 0.00001f; BOOL overrideMatID; int matid; pblock->GetValue(pb_overridematid,t,overrideMatID,iv); pblock->GetValue(pb_matid,t,matid,iv); matid--; if (!overrideMatID) matid = -1; BOOL overridesg; int sg; pblock->GetValue(pb_overridesg,t,overridesg,iv); pblock->GetValue(pb_sg,t,sg,iv); if (!overridesg) sg = -1; int edgeMap; pblock->GetValue(pb_edgemap,t,edgeMap,iv); float tvOffset; pblock->GetValue(pb_tvoffset,t,tvOffset,iv); BOOL ioverrideMatID; int imatid; pblock->GetValue(pb_overrideinnermatid,t,ioverrideMatID,iv); pblock->GetValue(pb_innermatid,t,imatid,iv); imatid--; if (!ioverrideMatID) imatid = -1; BOOL ooverrideMatID; int omatid; pblock->GetValue(pb_overrideoutermatid,t,ooverrideMatID,iv); pblock->GetValue(pb_outermatid,t,omatid,iv); omatid--; if (!ooverrideMatID) omatid = -1; BOOL selEdges, selInner,selOuter; static BOOL selEdgesPrev = FALSE; static BOOL selInnerPrev = FALSE; static BOOL selOuterPrev = FALSE; BOOL updateUI = FALSE; pblock->GetValue(pb_seledges,t,selEdges,iv); pblock->GetValue(pb_selinner,t,selInner,iv); pblock->GetValue(pb_selouter,t,selOuter,iv); if (selEdges && (!selEdgesPrev)) updateUI = TRUE; if (selInner && (!selInnerPrev)) updateUI = TRUE; if (selOuter && (!selOuterPrev)) updateUI = TRUE; selEdgesPrev = selEdges; selInnerPrev = selInner; selOuterPrev = selOuter; if (selEdges || selInner|| selOuter) { mesh.dispFlags = DISP_SELFACES; mesh.selLevel = MESH_FACE; } int segments = 1; pblock->GetValue(pb_segments,t,segments,iv); if (segments < 1) segments = 1; BOOL fixupCorners; pblock->GetValue(pb_fixupcorners,t,fixupCorners,iv); BOOL autoSmooth; float smoothAngle; pblock->GetValue(pb_autosmooth,t,autoSmooth,iv); pblock->GetValue(pb_autosmoothangle,t,smoothAngle,iv); BOOL bevel; INode *node; pblock->GetValue(pb_bevel,t,bevel,iv); pblock->GetValue(pb_bevelshape,t,node,iv); PolyShape shape; if ((bevel) && node) { ObjectState nos = node->EvalWorldState(t); if (nos.obj->IsShapeObject()) { ShapeObject *pathOb = (ShapeObject*)nos.obj; if (!pathOb->NumberOfCurves()) { bevel = FALSE; } else { pathOb->MakePolyShape(t, shape,PSHAPE_BUILTIN_STEPS,TRUE); if (shape.lines[0].IsClosed()) bevel = FALSE; ; } } } DWORD selLevel = mesh.selLevel; mesh.faceSel.ClearAll(); if (bevel) meshInfo.MakeSolid(&mesh,segments, a,oa,matid, sg,edgeMap,tvOffset,imatid,omatid,selEdges,selInner,selOuter,fixupCorners,autoSmooth,smoothAngle,&shape.lines[0]); else meshInfo.MakeSolid(&mesh,segments, a,oa,matid, sg,edgeMap,tvOffset,imatid,omatid,selEdges,selInner,selOuter,fixupCorners,autoSmooth,smoothAngle,NULL); mesh.selLevel = selLevel; mesh.InvalidateTopologyCache (); for (int i = 0; i < mesh.numFaces; i++) { for (int j = 0; j < 3; j++) { int index = mesh.faces[j].v[j]; if ((index < 0) || (index >= mesh.numVerts)) DebugPrint(_T("Invalid face %d(%d) %d\n"),i,j,index); } } int numMaps = mesh.getNumMaps(); for (int mp = -NUM_HIDDENMAPS; mp < numMaps; mp++) { if (!mesh.mapSupport(mp)) continue; Point3 *uvw = mesh.mapVerts(mp); TVFace *uvwFace = mesh.mapFaces(mp); if ((uvw) && (uvwFace)) { int numberTVVerts = mesh.getNumMapVerts(mp); for (int i = 0; i < mesh.numFaces; i++) { for (int j = 0; j < 3; j++) { int index = uvwFace[i].t[j]; if ((index < 0) || (index >= numberTVVerts)) DebugPrint(_T("Invalid Map %d tvface %d(%d) %d\n"),mp,i,j,index); } } } } os->obj->UpdateValidity(GEOM_CHAN_NUM,iv); os->obj->UpdateValidity(TOPO_CHAN_NUM,iv); MeshNormalSpec *pNormSpec = (MeshNormalSpec *) mesh.GetInterface (MESH_NORMAL_SPEC_INTERFACE); if (pNormSpec && pNormSpec->GetNumFaces() > 0) { pNormSpec->SetParent(&mesh); pNormSpec->BuildNormals(); pNormSpec->ComputeNormals(); } if ((updateUI) && (ip)) { ip->PipeSelLevelChanged(); } } EnableUIControls(); }