LocalModData *EditPolyMod::GetPrimaryLocalModData () { if (!ip) return NULL; ModContextList list; INodeTab nodes; ip->GetModContexts(list,nodes); for (int i=0; i<list.Count(); i++) { if (list[i]->localData == NULL) continue; EditPolyData *pData = (EditPolyData *) list[i]->localData; if (pData->GetFlag (kEPDataPrimary)) return pData; } // No primary? Ok, return first mesh we get to (and make it primary). for (int i=0; i<list.Count(); i++) { if (list[i]->localData == NULL) continue; EditPolyData *pData = (EditPolyData *) list[i]->localData; pData->SetFlag (kEPDataPrimary); return pData; } return NULL; }
Matrix3 EditPolyMod::EpModGetNodeTM (TimeValue t, INode *node) { if (node) return node->GetObjectTM (t); if (!ip) return Matrix3(true); ModContextList list; INodeTab nodes; ip->GetModContexts(list,nodes); for (int i=0; i<list.Count(); i++) { if (list[i]->localData == NULL) continue; EditPolyData *pData = (EditPolyData *) list[i]->localData; if (pData->GetFlag (kEPDataPrimary)) return nodes[i]->GetObjectTM (t); } // No primary? Ok, return first node we get to (and set it to primary): for (int i=0; i<list.Count(); i++) { if (list[i]->localData == NULL) continue; EditPolyData *pData = (EditPolyData *) list[i]->localData; pData->SetFlag (kEPDataPrimary); return nodes[i]->GetObjectTM (t); } return Matrix3(true); }
INode *EditPolyMod::EpModGetPrimaryNode () { if (!ip) return NULL; ModContextList list; INodeTab nodes; ip->GetModContexts(list,nodes); INode *ret = NULL; for (int i=0; i<list.Count(); i++) { if (list[i]->localData == NULL) continue; EditPolyData *pData = (EditPolyData *) list[i]->localData; if (pData->GetFlag (kEPDataPrimary)) { ret = nodes[i]; break; } } if (!ret) { // No primary? Ok, return first one we get to (and make it primary). for (int i=0; i<list.Count(); i++) { if (list[i]->localData == NULL) continue; EditPolyData *pData = (EditPolyData *) list[i]->localData; pData->SetFlag (kEPDataPrimary); ret = nodes[i]; break; } } if (ret) ret = ret->GetActualINode (); nodes.DisposeTemporary(); return ret; }