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())
예제 #2
0
	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 __exit__(self, type, value, traceBack):

        _IECoreMaya._parameterisedHolderAssignModificationState(
            self.__originalValues,
            self.__originalClasses,
            self.__fnPH.getParameterised()[0].parameters().getValue().copy(),
            self.__fnPH._classParameterStates(),
        )

        maya.cmds.ieParameterisedHolderModification(self.__fnPH.fullPathName())
예제 #4
0
	def __exit__( self, type, value, traceBack ) :
	
		_IECoreMaya._parameterisedHolderAssignModificationState(
			self.__originalValues,
			self.__originalClasses,
			self.__fnPH.getParameterised()[0].parameters().getValue().copy(),
			self.__fnPH._classParameterStates(),
		)
		
		maya.cmds.ieParameterisedHolderModification( self.__fnPH.fullPathName() )