def strandRemovedSlot(self, strand): """ Receives notification from the model when a strand is removed. Deletes the strand related mapping in mayaObjectManager, deletes all the Maya nodes, deletes all the decorators(live in the virtualHelixItem right now), deletes itself from the virtualHelixItem, and disconnects itself from the controller. """ mom = Mom() mID = mom.strandMayaID(strand) mom.removeIDMapping(mID, strand) # print "solidview.StrandItem.strandRemovedSlot %s" % mID transformName = "%s%s" % (mom.helixTransformName, mID) cylinderName = "%s%s" % (mom.helixNodeName, mID) meshName = "%s%s" % (mom.helixMeshName, mID) if cmds.objExists(transformName): cmds.delete(transformName) if cmds.objExists(cylinderName): cmds.delete(cylinderName) if cmds.objExists(meshName): cmds.delete(meshName) if mID in self._virtualHelixItem.StrandIDs(): self._virtualHelixItem.StrandIDs().remove(mID) self._virtualHelixItem.updateDecorators() self._virtualHelixItem.removeStrandItem(self) self._virtualHelixItem = None self._modelStrand = None self._controller.disconnectSignals() self._controller = None
def dagParentRemovedCallback(child, parent, clientData): """ Callback function that removes the strands from the model if the 3D strand is delete in 3D view. """ mom = Mom() children = child.fullPathName().split("|") for c in children: if c.startswith(mom.helixMeshName): if c in mom.mayaToCn: strand = mom.mayaToCn[c] if strand: # print "Strand %s : %s needs removal" % (c, strand) mID = mom.strandMayaID(strand) mom.removeIDMapping(mID, strand) strand.strandSet().removeStrand(strand) else: print("Error: no Strand inside mayaObjectModel") else: pass # print "dagParentRemovedCallback: %s already deleted" % c elif c.startswith(mom.decoratorMeshName): if c in mom.decoratorToVirtualHelixItem: pass
def dagParentRemovedCallback(child, parent, clientData): """ Callback function that removes the strands from the model if the 3D strand is delete in 3D view. """ mom = Mom() children = child.fullPathName().split("|") for c in children: if c.startswith(mom.helixMeshName): if c in mom.mayaToCn: strand = mom.mayaToCn[c] if strand: # print "Strand %s : %s needs removal" % (c, strand) mID = mom.strandMayaID(strand) mom.removeIDMapping(mID, strand) strand.strandSet().removeStrand(strand) else: print "Error: no Strand inside mayaObjectModel" else: pass # print "dagParentRemovedCallback: %s already deleted" % c elif c.startswith(mom.decoratorMeshName): if c in mom.decoratorToVirtualHelixItem: pass