Ejemplo n.º 1
0
    def run(self, *args, **kwargs):
        uid   = self.fetch('uid', None)
        node  = self.fetch('nodeName', None)
        props = self.fetch('props', dict())

        if not uid:
            self.puts(
                success=False, error=True, message='Invalid or missing UID')
            return

        if node and TrackSceneUtils.checkNodeUidMatch(uid, node):
            TrackSceneUtils.setTrackProps(node, props)
            self.puts(success=True, nodeName=node)
            return

        trackSetNode = TrackSceneUtils.getTrackSetNode()
        if not trackSetNode:
            self.puts(
                success=False,
                error=True,
                message='Scene not initialized for Cadence')
            return

        for node in cmds.sets(trackSetNode, query=True):
            if not cmds.hasAttr(node + '.' + TrackPropEnum.UID.maya):
                continue
            if uid == cmds.getAttr(node + '.' + TrackPropEnum.UID.maya):
                TrackSceneUtils.setTrackProps(node, props)
                self.puts(success=True, nodeName=node)
                return

        self.response.puts(success=False)
Ejemplo n.º 2
0
    def getTrackNode(cls, uid, trackSetNode =None):
        trackSetNode = cls.getTrackSetNode() if not trackSetNode\
            else trackSetNode
        if not trackSetNode:
            return None

        nodes = cmds.sets(trackSetNode, query=True)
        if not nodes:
            return None

        for node in nodes:
            if not cmds.hasAttr(node + '.' + TrackPropEnum.UID.maya):
                continue
            if uid == cmds.getAttr(node + '.' + TrackPropEnum.UID.maya):
                return node

        return None
Ejemplo n.º 3
0
    def getTrackNode(cls, uid):
        """ This returns the (string) name of the track node for a given UID,
            else None. """

        trackSetNode = cls.getTrackSetNode()

        if not trackSetNode:
            return None

        nodes = cmds.sets(trackSetNode, query=True)
        if not nodes:
            return None

        for node in nodes:
            if not cmds.hasAttr(node + '.' + TrackPropEnum.UID.maya):
                continue
            if uid == cmds.getAttr(node + '.' + TrackPropEnum.UID.maya):
                return node
        return None
Ejemplo n.º 4
0
    def getTokenNode(cls, uid, trackSetNode =None):
        """ This returns the name (string) of the node in the trackSet
            for the object with matching UID attribute. """

        if not trackSetNode:
            trackSetNode = cls.getTrackSetNode()
        if not trackSetNode:
            return None

        nodes = cmds.sets(trackSetNode, query=True)
        if not nodes:
            return None

        for node in nodes:
            if not cmds.hasAttr(node + '.' + 'track_uid'):
                continue
            if uid == cmds.getAttr(node + '.' + 'track_uid'):
                return node

        return None