def apply(self, nodes, attributes=None, **kwargs): self.load() # do a version check - if older version clip is being used - perhaps we can write conversion functionality? try: if self._so.version != VER: printWarningStr("the anim clip version being loaded is old. YMMV!") except KeyError: printErrorStr("this is an old VER 1 pose clip - I don't know how to load them anymore...") return # generate the name mapping slamApply = kwargs.pop("slam", False) if slamApply: mapping = mappingUtils.matchNames(cmd.ls(typ="transform"), nodes) else: mapping = mappingUtils.matchNames(self._nodes, nodes) self._clip.applyToNodes(nodes)
def apply( self, nodes, attributes=None, **kwargs ): self.load() #do a version check - if older version clip is being used - perhaps we can write conversion functionality? try: if self._so.version != VER: printWarningStr( "the anim clip version being loaded is old. YMMV!" ) except KeyError: printErrorStr( "this is an old VER 1 pose clip - I don't know how to load them anymore..." ) return #generate the name mapping slamApply = kwargs.pop( 'slam', False ) if slamApply: mapping = mappingUtils.matchNames( cmd.ls( typ='transform' ), nodes ) else: mapping = mappingUtils.matchNames( self._nodes, nodes ) self._clip.applyToNodes( nodes )
def GetControlName( cls, control ): ''' returns the name of the control as defined in the CONTROL_NAMES attribute for the part class ''' cons = listConnections( control.message, s=False, p=True, type='objectSet' ) for c in cons: typeClassStr = getAttr( '%s._rigPrimitive.typeName' % c.node() ) typeClass = RigPart.GetNamedSubclass( typeClassStr ) if typeClass.CONTROL_NAMES is None: return str( control ) idx = c[ c.rfind( '[' )+1:-1 ] try: name = typeClass.CONTROL_NAMES[ idx ] except ValueError: printErrorStr( 'type: %s control: %s' % (typeClass, control) ) raise RigPartError( "Doesn't have a name!" ) return name raise RigPartError( "The control isn't associated with a rig primitive" )
continue foundControlDir = False for f in dirToSearch.files(recursive=True): if f.hasExtension('shape'): if f.name().startswith('control'): CONTROL_DIRECTORY = f.up() foundControlDir = True break if foundControlDir: break if CONTROL_DIRECTORY is None: printErrorStr( "Cannot determine the directory that contains the *.control files - please open '%s' and set the CONTROL_DIRECTORY variable appropriately" % Path(__file__)) AX_X, AX_Y, AX_Z, AX_X_NEG, AX_Y_NEG, AX_Z_NEG = map(Axis, range(6)) DEFAULT_AXIS = AX_X AXIS_ROTATIONS = { AX_X: (0, 0, -90), AX_Y: (0, 0, 0), AX_Z: (90, 0, 0), AX_X_NEG: (0, 0, 90), AX_Y_NEG: (180, 0, 0), AX_Z_NEG: (-90, 0, 0) }
if not dirToSearch.isDir(): continue foundControlDir = False for f in dirToSearch.files( recursive=True ): if f.hasExtension( 'shape' ): if f.name().startswith( 'control' ): CONTROL_DIRECTORY = f.up() foundControlDir = True break if foundControlDir: break if CONTROL_DIRECTORY is None: printErrorStr( "Cannot determine the directory that contains the *.control files - please open '%s' and set the CONTROL_DIRECTORY variable appropriately" % Path( __file__ ) ) AX_X, AX_Y, AX_Z, AX_X_NEG, AX_Y_NEG, AX_Z_NEG = map( Axis, range( 6 ) ) DEFAULT_AXIS = AX_X AXIS_ROTATIONS = { AX_X: (0, 0, -90), AX_Y: (0, 0, 0), AX_Z: (90, 0, 0), AX_X_NEG: (0, 0, 90), AX_Y_NEG: (180, 0, 0), AX_Z_NEG: (-90, 0, 0) } class BreakException(Exception): pass def getArgDefault( function, argName ):