def addTrackwayToLayer(self, layer, tracks): """ Populates the specified display layer with the track nodes corresponding to the specified tracks. """ nodes = list() for track in tracks: trackNode = self.getTrackNode(track) if trackNode: nodes.append(trackNode) if len(nodes) == 0: return # now add those nodes to the layer cmds.editDisplayLayerMembers(layer, nodes, noRecurse=True)
def addPath(self, tracks, degree =1): """ Creates a list of the (x, z) track coordinates in a scene from a given track series. The hidden tracks are not included, nor are tracks that are still at the origin. The path is specified as a list of 3D points, with the y coordinate zeroed out.""" path = list() for track in tracks: if not track.hidden and track.x != 0.0 and track.z != 0.0: path.append((track.x, 0.0, track.z)) curve = cmds.curve(point=path, degree=degree) layer = self.PATH_LAYER self.createLayer(layer) cmds.editDisplayLayerMembers(layer, curve, noRecurse=True)
def deleteAllPaths(self): """ Deletes all curves that have been placed in the PATH_LAYER. """ curves = cmds.editDisplayLayerMembers( self.PATH_LAYER, query=True, noRecurse=True) for curve in curves: cmds.delete(curve) cmds.delete(self.PATH_LAYER)
def selectAllTracks(self): """ All tracks are selected, by accumulating a list of all track nodes in the trackway layers. """ layers = cmds.ls( type='displayLayer') nodes = list() for layer in layers: if layer.endswith(self.LAYER_SUFFIX): nodes.extend(cmds.editDisplayLayerMembers( layer, query=True, noRecurse=True)) cmds.select(nodes)
def selectTracksInLayer(self, layer): """ A fast way to select the track nodes within a given layer. """ nodes = cmds.editDisplayLayerMembers(layer, query=True, noRecurse=True) cmds.select(nodes)