示例#1
0
 def strandResizedSlot(self, strand, indices):
     """Receives notification from the model when a strand is resized"""
     #print "solid.StrandItem.strandResizedSlot", self._modelStrand.idxs()
     self.updateSize()
     self._virtualHelixItem.updateDecorators()
     m = Mom()
     m.updateSelectionBoxes()
示例#2
0
def selectionCallback(clientData):
    """
    Callback function that is called when the selection changes in Maya.
    """
    clientData.deleteManipulators()
    #print "mayaSelcectionContex: selectionCallback called"
    selectionList = OpenMaya.MSelectionList()
    OpenMaya.MGlobal.getActiveSelectionList(selectionList)
    selectionIter = OpenMaya.MItSelectionList(selectionList)
    decoratorList = []
    helixList = []

    m = Mom()

    manipulator = None
    manipObject = OpenMaya.MObject()

    while not selectionIter.isDone():
        transformNode = OpenMaya.MObject()
        dagNode = OpenMaya.MFnDagNode()
        try:
            selectionIter.getDependNode(transformNode)
            if transformNode.isNull() or not transformNode.hasFn( \
                                    OpenMaya.MFn.kDependencyNode):
                selectionIter.next()
                continue
            dagNode = OpenMaya.MFnDagNode(transformNode)
        except:
            selectionIter.next()
            continue
        if dagNode.name().startswith(m.decoratorTransformName):
            if dagNode.name() not in decoratorList:
                decoratorList.append(dagNode.name())
        elif dagNode.name().startswith(m.helixTransformName):
            Unused, HNumber = dagNode.name().split("_")
            helixName = "%s%s" % (m.helixNodeName, HNumber)
            helixNode = m.getNodeFromName(helixName)
            if helixNode:
                helixList.append(helixName)
                if manipulator is None:
                    manipulator = \
                            OpenMayaMPx.MPxManipContainer.newManipulator(
                                                "spHelixManip", manipObject)
                    if manipulator is not None:
                        clientData.addManipulator(manipObject)
                manipulator.addHelix(HNumber)
                #print "selectionCallback ", dagNode.name(), helixNode
        selectionIter.next()
    m.staplePreDecoratorSelected(decoratorList)
    if manipulator is not None:
        manipulator.finishedAddingHelices()
    m.strandsSelected(helixList)

    m.updateSelectionBoxes()