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
Exemplo n.º 2
0
	def create( layoutName, classNameOrParameterised, classVersion=None, envVarName=None ) :

		with IECoreMaya.UndoDisabled() :

			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" "python( \\\"import IECoreMaya; IECoreMaya.FnTransientParameterisedHolderNode._deleteNode( \'%s\' )\\\" )" -protected' % ( layoutName, nodeName ) )

			fnTPH = FnTransientParameterisedHolderNode( nodeName )

			if isinstance( classNameOrParameterised, str ) :
				fnTPH.setParameterised( classNameOrParameterised, classVersion, envVarName )
			else :
				assert( not classVersion )
				assert( not envVarName )

				fnTPH.setParameterised( classNameOrParameterised )

			parameterised = fnTPH.getParameterised()[0]

			if parameterised :
				maya.cmds.setParent( layoutName )
				IECoreMaya.ParameterUI.create( fnTPH.fullPathName(), parameterised.parameters() )
				maya.cmds.setParent( layoutName )

		return fnTPH
Exemplo n.º 3
0
	def __showEditor( self, attributeName ) :

		split = attributeName.split('.', 1 )
		node = split[0]

		melCmd = 'showEditor "' + node + '"'

		IECoreMaya.mel( melCmd.encode('ascii') )
Exemplo n.º 4
0
    def __showEditor(self, attributeName):

        split = attributeName.split('.', 1)
        node = split[0]

        melCmd = 'showEditor "' + node + '"'

        IECoreMaya.mel(melCmd.encode('ascii'))
Exemplo n.º 5
0
	def __expressionEditor( self, attributeName = None ) :

		split = attributeName.split('.', 1 )
		node = split[0]
		attr = split[1]

		melCmd = 'expressionEditor EE "' + node + '" "' + attr + '"'

		IECoreMaya.mel( melCmd.encode('ascii') )
Exemplo n.º 6
0
    def __expressionEditor(self, attributeName=None):

        split = attributeName.split('.', 1)
        node = split[0]
        attr = split[1]

        melCmd = 'expressionEditor EE "' + node + '" "' + attr + '"'

        IECoreMaya.mel(melCmd.encode('ascii'))
Exemplo n.º 7
0
	def label( self ):

		if self.__labelWithNodeName :

			n = self.nodeName() + "." + self.__longParameterName
			if not self.__longParameterName :
				# Top-level parameter comes through into here without a name
				n = self.nodeName() + ".parameters"

			return IECoreMaya.mel( "interToUI(\"" + n + "\")" ).value

		else :

			return IECoreMaya.mel( "interToUI(\"" + self.parameter.name + "\")" ).value
Exemplo n.º 8
0
    def label(self):

        if self.__labelWithNodeName:

            n = self.nodeName() + "." + self.__longParameterName
            if not self.__longParameterName:
                # Top-level parameter comes through into here without a name
                n = self.nodeName() + ".parameters"

            return IECoreMaya.mel("interToUI(\"" + n + "\")").value

        else:

            return IECoreMaya.mel("interToUI(\"" + self.parameter.name +
                                  "\")").value
Exemplo n.º 9
0
def create(meshDagPath, className, classVersion, **kw):

    if type(meshDagPath) is str:
        sel = OpenMaya.MSelectionList()
        sel.add(meshDagPath)
        meshDagPath = OpenMaya.MDagPath()
        sel.getDagPath(0, meshDagPath)
        meshDagPath.extendToShape()

    constructionHistoryEnabled = IECoreMaya.mel(
        "constructionHistory -q -tgl").value

    if not __hasHistory(meshDagPath) and constructionHistoryEnabled == 0:

        # \todo we can't actually do this right now because we're unable to convert the resultant MeshPrimitive
        # back into the original meshNode MObject given to us
        raise RuntimeError("Currently unable to apply MeshOp in-place ")

        meshNode = meshDagPath.node()

        __applyMeshOp(meshNode, className, classVersion, **kw)

        return None
    else:
        modifierNode = __createMeshOpNode(className, classVersion, **kw)

        __connectNodes(modifierNode, meshDagPath)

        fnDN = OpenMaya.MFnDependencyNode(modifierNode)

        return str(fnDN.name())
Exemplo n.º 10
0
def create(meshDagPath, className, classVersion, **kw):

    if type(meshDagPath) is str:
        sel = OpenMaya.MSelectionList()
        sel.add(meshDagPath)
        meshDagPath = OpenMaya.MDagPath()
        sel.getDagPath(0, meshDagPath)
        meshDagPath.extendToShape()

    constructionHistoryEnabled = IECoreMaya.mel("constructionHistory -q -tgl").value

    if not __hasHistory(meshDagPath) and constructionHistoryEnabled == 0:

        # \todo we can't actually do this right now because we're unable to convert the resultant MeshPrimitive
        # back into the original meshNode MObject given to us
        raise RuntimeError("Currently unable to apply MeshOp in-place ")

        meshNode = meshDagPath.node()

        __applyMeshOp(meshNode, className, classVersion, **kw)

        return None
    else:
        modifierNode = __createMeshOpNode(className, classVersion, **kw)

        __connectNodes(modifierNode, meshDagPath)

        fnDN = OpenMaya.MFnDependencyNode(modifierNode)

        return str(fnDN.name())
    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