def __init__( self, layoutName, classNameOrParameterised, classVersion=None, envVarName=None ) : """ Creates a temporary TransientParameterisedHolderNode in order to present the UI for the specified parameterised object in the given layout. The node is automatically deleted when the holding layout is destroyed """ nodeName = maya.cmds.createNode( "ieTransientParameterisedHolderNode", skipSelect = True ) # Script jobs aren't available from maya.cmds. Maya Python bindings generate swig warnings # such as "swig/python detected a memory leak of type 'MCallbackId *', no destructor found" IECoreMaya.mel( 'scriptJob -uiDeleted "%s" "delete %s" -protected' % ( layoutName, nodeName ) ) object = StringUtil.dependencyNodeFromString( nodeName ) maya.OpenMaya.MFnDependencyNode.__init__( self, object ) if isinstance( classNameOrParameterised, str ) : res = _IECoreMaya._parameterisedHolderSetParameterised( self, classNameOrParameterised, classVersion, envVarName ) else : assert( not classVersion ) assert( not envVarName ) res = _IECoreMaya._parameterisedHolderSetParameterised( self, classNameOrParameterised ) parameterised = self.getParameterised()[0] if parameterised: maya.cmds.setParent( layoutName ) IECoreMaya.ParameterUI.create( object, parameterised.parameters() ) maya.cmds.setParent( layoutName ) return res
def setParameterised( self, classNameOrParameterised, classVersion=None, envVarName=None, undoable=True ) : if isinstance( classNameOrParameterised, str ) : if classVersion is None or classVersion < 0 : classVersions = IECore.ClassLoader.defaultLoader( envVarName ).versions( classNameOrParameterised ) classVersion = classVersions[-1] if classVersions else 0 if undoable : if self.getParameterised()[0] : self.setParameterisedValues() _IECoreMaya._parameterisedHolderAssignModificationState( self.getParameterised()[0].parameters().getValue().copy(), self._classParameterStates(), None, None ) else : _IECoreMaya._parameterisedHolderAssignModificationState( None, None, None, None ) maya.cmds.ieParameterisedHolderModification( self.fullPathName(), classNameOrParameterised, classVersion, envVarName ) # no need to despatch callbacks as that is done by the command, so that the callbacks happen on undo and redo too. else : _IECoreMaya._parameterisedHolderSetParameterised( self, classNameOrParameterised, classVersion, envVarName ) self._despatchSetParameterisedCallbacks( self.fullPathName() ) else : result = _IECoreMaya._parameterisedHolderSetParameterised( self, classNameOrParameterised ) self._despatchSetParameterisedCallbacks( self.fullPathName() )
def setParameterised(self, classNameOrParameterised, classVersion=None, envVarName=None, undoable=True): if isinstance(classNameOrParameterised, str): if classVersion is None or classVersion < 0: classVersions = IECore.ClassLoader.defaultLoader( envVarName).versions(classNameOrParameterised) classVersion = classVersions[-1] if classVersions else 0 if undoable: if self.getParameterised()[0]: self.setParameterisedValues() _IECoreMaya._parameterisedHolderAssignModificationState( self.getParameterised() [0].parameters().getValue().copy(), self._classParameterStates(), None, None) else: _IECoreMaya._parameterisedHolderAssignModificationState( None, None, None, None) maya.cmds.ieParameterisedHolderModification( self.fullPathName(), classNameOrParameterised, classVersion, envVarName) # no need to despatch callbacks as that is done by the command, so that the callbacks happen on undo and redo too. else: _IECoreMaya._parameterisedHolderSetParameterised( self, classNameOrParameterised, classVersion, envVarName) self._despatchSetParameterisedCallbacks(self.fullPathName()) else: result = _IECoreMaya._parameterisedHolderSetParameterised( self, classNameOrParameterised) self._despatchSetParameterisedCallbacks(self.fullPathName())
def __init__(self, layoutName, classNameOrParameterised, classVersion=None, envVarName=None): """ Creates a temporary TransientParameterisedHolderNode in order to present the UI for the specified parameterised object in the given layout. The node is automatically deleted when the holding layout is destroyed """ nodeName = maya.cmds.createNode("ieTransientParameterisedHolderNode", skipSelect=True) # Script jobs aren't available from maya.cmds. Maya Python bindings generate swig warnings # such as "swig/python detected a memory leak of type 'MCallbackId *', no destructor found" IECoreMaya.mel('scriptJob -uiDeleted "%s" "delete %s" -protected' % (layoutName, nodeName)) object = StringUtil.dependencyNodeFromString(nodeName) maya.OpenMaya.MFnDependencyNode.__init__(self, object) if isinstance(classNameOrParameterised, str): res = _IECoreMaya._parameterisedHolderSetParameterised( self, classNameOrParameterised, classVersion, envVarName) else: assert (not classVersion) assert (not envVarName) res = _IECoreMaya._parameterisedHolderSetParameterised( self, classNameOrParameterised) parameterised = self.getParameterised()[0] if parameterised: maya.cmds.setParent(layoutName) IECoreMaya.ParameterUI.create(object, parameterised.parameters()) maya.cmds.setParent(layoutName) return res