void PolyOpWeldVertex::Do(MNMesh & mesh) { // Weld the suitable border vertices: bool haveWelded = false; if (mesh.WeldBorderVerts (mThreshold, MN_USER)) { mesh.CollapseDeadStructs (); haveWelded = true; } // Weld vertices that share short edges: if (WeldShortPolyEdges (mesh, MN_USER)) haveWelded = true; if (haveWelded) { mesh.InvalidateTopoCache (); mesh.FillInMesh (); } }
void VWeldMod::ModifyPolyObject (TimeValue t, ModContext &mc, PolyObject *pobj) { MNMesh &mesh = pobj->GetMesh(); if (mUseRampageWeldMath) mesh.SetFlag(MN_MESH_USE_MAX2012_WELD_MATH,TRUE); // Luna task 747 // We cannot support specified normals in Vertex Weld at this time. mesh.ClearSpecifiedNormals(); Interval iv = FOREVER; float thresh; mp_pblock->GetValue (kVwThreshold, t, thresh, iv); if (thresh<0.0f) thresh=0.0f; SetPolyFlags (mesh, MN_USER); // Weld the suitable border vertices: bool haveWelded = false; if (mesh.WeldBorderVerts (thresh, MN_USER)) { mesh.CollapseDeadStructs (); haveWelded = true; } // Weld vertices that share short edges: if (WeldShortPolyEdges (mesh, thresh, MN_USER)) haveWelded = true; if (haveWelded) { mesh.InvalidateTopoCache (); mesh.FillInMesh (); } pobj->UpdateValidity (GEOM_CHAN_NUM, iv); pobj->UpdateValidity (TOPO_CHAN_NUM, iv); pobj->UpdateValidity (VERT_COLOR_CHAN_NUM, iv); pobj->UpdateValidity (TEXMAP_CHAN_NUM, iv); pobj->UpdateValidity (SELECT_CHAN_NUM, iv); }