def run(self, *args, **kwargs): uid = self.fetch('uid', None) props = self.fetch('props', dict()) if not uid: self.puts( success=False, error=True, message='Invalid or missing UID') 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 + '.track_uid'): continue if uid == cmds.getAttr(node + '.track_uid'): TrackSceneUtils.setTokenProps(node, props) self.puts(success=True, nodeName=node) return self.response.puts(success=False)
def run(self, *args, **kwargs): uid = self.fetch('uid', None) node = self.fetch('nodeName', None) if not uid: self.puts( success=False, error=True, message='Invalid or missing UID') return if node and TrackSceneUtils.checkNodeUidMatch(uid, node): self.puts( success=True, nodeName=node, props=TrackSceneUtils.getTrackProps(node)) return node = TrackSceneUtils.getTrackNode(uid) if node: self.puts( success=True, nodeName=node, props=TrackSceneUtils.getTrackProps(node)) return self.response.puts(success=False)
def run(self, *args, **kwargs): """ This script first gets the UID, from which it creates a track node in Maya. """ uid = self.fetch("uid", None) if uid is None: self.putErrorResult("Invalid or missing UID. Unable to create track nodeName.") return node = TrackSceneUtils.createTrackNode(uid) self.puts(nodeName=node, props=TrackSceneUtils.getTrackProps(node))
def run(self, *args, **kwargs): """ This fetches the list of props (each a dictionary specifying a token) and creates the corresponding tokens in Maya. """ propsList = self.fetch('propsList', None) if not propsList: self.putErrorResult( u'No list of props specified. Unable to create tokens.', code=self.NO_PROPSLIST) return for props in propsList: TrackSceneUtils.createToken(props['uid'], props)
def run(self, *args, **kwargs): """Doc...""" # Load the Cadence Trackway Plugin cmds.loadPlugin(CadenceTrackwayPlugin.__file__) # Create the track set nodeName trackSetNode = TrackSceneUtils.getTrackSetNode(createIfMissing=True) self.put('trackSet', trackSetNode) trackManagerNode = TrackSceneUtils.getTrackManagerNode( trackSetNode=trackSetNode, createIfMissing=True) self.put('trackManager', trackManagerNode)
def run(self, *args, **kwargs): uid = self.fetch('uid', None) if not uid: self.puts(success=False, error=True, message='Invalid/missing UID') return node = TrackSceneUtils.getTokenNode(uid) if node: self.puts( success=True, nodeName=node, props=TrackSceneUtils.getTokenProps(node)) return self.response.puts(success=False)
def run(self, *args, **kwargs): trackList = self.fetch('trackList', None) if not trackList: self.putErrorResult( u'No trackList specified. Unable to create tracks.', code=self.NO_TRACKLIST) return trackSetNode = TrackSceneUtils.getTrackSetNode(createIfMissing=True) trackNodeList = dict() for track in trackList: uid = track.get(TrackPropEnum.UID.maya) if not uid: continue trackNodeList[uid] = TrackSceneUtils.createTrackNode( uid, trackSetNode, track) self.put('nodes', trackNodeList)
def run(self, *args, **kwargs): """ Fetches the nodes in the current trackSetNode, then for each such node, appends its UID to a list l which is then returned. """ setNode = TrackSceneUtils.getTrackSetNode() nodes = cmds.sets(setNode, q=True) if len(nodes) == 0: self.puts(success=False, uidList=[]) return l = [] for n in nodes: uid = TrackSceneUtils.getUid(node=n, trackSetNode=setNode) if uid is not None: l.append(uid) self.puts(success=True, uidList=l) return
def run(self, *args, **kwargs): """ This script first gets the UID and the property list for the given proxy node to be created in Maya. """ uid = self.fetch('uid', None) props = self.fetch('props', None) if uid is None: self.putErrorResult( u'Invalid or missing UID. Unable to create token.') return node = TrackSceneUtils.createToken(uid, props) self.puts(nodeName=node, props=props)
def run(self, *args, **kwargs): selectedNodes = cmds.ls(selection=True, exactType='transform') selectedUidList = list() if len(selectedNodes) == 0: self.puts(success=False, selectedUidList=selectedUidList) return for n in selectedNodes: uid = TrackSceneUtils.getUid(n) if uid is not None: selectedUidList.append(uid) self.puts(success=True, selectedUidList=selectedUidList) return
def run(self, *args, **kwargs): """ Fetches the nodes in the current trackSetNode, then for each such node, those that start with 'Token' are deleted. """ setNode = TrackSceneUtils.getTrackSetNode() nodes = cmds.sets(setNode, q=True) if len(nodes) == 0: self.puts(success=False, uidList=[]) return for node in nodes: if node.startswith('Token'): cmds.delete(node) # and remove the annotations (objects with name starting with 'Token' objects = cmds.ls(transforms=True) for object in objects: if object.startswith('Token'): cmds.delete(object) return