void EditFaceDataMod::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp *vpt, Box3& box, ModContext *mc) { if (!ip->GetShowEndResult() || !mc->localData) return; if (!selLevel) return; EditFaceDataModData *modData = (EditFaceDataModData *) mc->localData; Matrix3 tm = inode->GetObjectTM(t); if (modData->GetCacheMesh ()) box = modData->GetCacheMesh()->getBoundingBox (&tm); else if (modData->GetCacheMNMesh()) box = modData->GetCacheMNMesh()->getBoundingBox(&tm); }
int EditFaceDataMod::Display (TimeValue t, INode* inode, ViewExp *vpt, int flags, ModContext *mc) { if (!ip->GetShowEndResult ()) return 0; if (!selLevel) return 0; if (!mc->localData) return 0; EditFaceDataModData *modData = (EditFaceDataModData *) mc->localData; Mesh *mesh = modData->GetCacheMesh(); MNMesh *mnmesh = modData->GetCacheMNMesh(); AdjEdgeList *mpAdjEdge = modData->GetEdgeList(); if (!mesh && !mnmesh) return 0; // Set up GW GraphicsWindow *gw = vpt->getGW(); Matrix3 tm = inode->GetObjectTM(t); int savedLimits; gw->setRndLimits((savedLimits = gw->getRndLimits()) & ~GW_ILLUM); gw->setTransform(tm); // We need to draw a "gizmo" version of the mesh: Point3 colSel=GetSubSelColor(); Point3 colTicks=GetUIColor (COLOR_VERT_TICKS); Point3 colGiz=GetUIColor(COLOR_GIZMOS); Point3 colGizSel=GetUIColor(COLOR_SEL_GIZMOS); gw->setColor (LINE_COLOR, colGiz); int i; Point3 rp[3]; int es[3]; if (mesh) { DbgAssert (mpAdjEdge); for (i=0; i<mpAdjEdge->edges.Count(); i++) { MEdge & me = mpAdjEdge->edges[i]; if (me.Hidden (mesh->faces)) continue; if (me.Visible (mesh->faces)) es[0] = GW_EDGE_VIS; else es[0] = GW_EDGE_INVIS; if (mpAdjEdge->edges[i].AFaceSelected (modData->GetFaceSel())) gw->setColor (LINE_COLOR, colGizSel); else gw->setColor (LINE_COLOR, colGiz); rp[0] = mesh->verts[me.v[0]]; rp[1] = mesh->verts[me.v[1]]; gw->polyline (2, rp, NULL, NULL, FALSE, es); } } else { es[0] = GW_EDGE_VIS; if (mnmesh->GetFlag (MN_MESH_FILLED_IN)) { for (i=0; i<mnmesh->nume; i++) { if (mnmesh->e[i].GetFlag (MN_DEAD)) continue; bool hidden = true, sel = false; hidden &= mnmesh->f[mnmesh->e[i].f1].GetFlag (MN_HIDDEN); sel |= (modData->GetFaceSel()[mnmesh->e[i].f1] ? true : false); if (mnmesh->e[i].f2 >= 0) { hidden &= mnmesh->f[mnmesh->e[i].f2].GetFlag (MN_HIDDEN); sel |= (modData->GetFaceSel()[mnmesh->e[i].f2] ? true : false); } if (hidden) continue; if (sel) gw->setColor (LINE_COLOR, colGizSel); else gw->setColor (LINE_COLOR, colGiz); rp[0] = mnmesh->P(mnmesh->e[i].v1); rp[1] = mnmesh->P(mnmesh->e[i].v1); gw->polyline (2, rp, NULL, NULL, FALSE, es); } } else { for (i=0; i<mnmesh->numf; i++) { if (mnmesh->f[i].GetFlag (MN_HIDDEN|MN_DEAD)) continue; if (modData->GetFaceSel()[i]) gw->setColor (LINE_COLOR, colGizSel); else gw->setColor (LINE_COLOR, colGiz); for (int j=0; j<mnmesh->f[i].deg; j++) { rp[0] = mnmesh->P(mnmesh->f[i].vtx[j]); rp[1] = mnmesh->P(mnmesh->f[i].vtx[(j+1)%mnmesh->f[i].deg]); gw->polyline (2, rp, NULL, NULL, FALSE, es); } } } } gw->setRndLimits(savedLimits); return 0; }