コード例 #1
0
	def __init__( self, node, parameter, **kw ) :
		
		IECoreMaya.ParameterUI.__init__(
			
			self,
			node,
			parameter,
			maya.cmds.frameLayout(
				labelVisible = False,
				collapsable = False,
			),
			**kw
			
		)
		
		# passing borderVisible=False to the constructor does bugger all so we do it here instead.
		maya.cmds.frameLayout( self._topLevelUI(), edit=True, borderVisible=False )
				
		collapsible = self.__parameterIsCollapsible()
		
		self.__kw = kw.copy()
		if collapsible :
			self.__kw["hierarchyDepth"] = self.__kw.get( "hierarchyDepth", -1 ) + 1
		
		collapsed = self._retrieveCollapsedState( collapsible )
		
		self.__collapsible = IECoreMaya.Collapsible(
		
			annotation = self.description(),
			label = self.label(),
			labelFont = IECoreMaya.CompoundParameterUI._labelFont( self.__kw["hierarchyDepth"] ),
			labelIndent = IECoreMaya.CompoundParameterUI._labelIndent( self.__kw["hierarchyDepth"] ),
			labelVisible = collapsible,
			collapsed = collapsed,
			expandCommand = self.__expand,
			collapseCommand = self.__collapse,
			
		)
					
		self.__formLayout = maya.cmds.formLayout( parent=self.__collapsible.frameLayout() )
	
		self.__buttonRow = maya.cmds.rowLayout( nc=3, adj=3, cw3=( 25, 25, 40 ), parent=self.__formLayout )
	
		self.__addButton = maya.cmds.picture( image="ie_addIcon_grey.xpm", parent=self.__buttonRow, width=21 )
		IECoreMaya.Menu( IECore.curry( self.__classMenuDefinition, None ), self.__addButton )
		IECoreMaya.Menu( IECore.curry( self.__classMenuDefinition, None ), self.__addButton, button=1 )
		
		self.__toolsButton = maya.cmds.picture( image="ie_actionIcon_grey.xpm", parent=self.__buttonRow, width=21 )
		IECoreMaya.Menu( IECore.curry( self.__toolsMenuDefinition, None ), self.__toolsButton )
		IECoreMaya.Menu( IECore.curry( self.__toolsMenuDefinition, None ), self.__toolsButton, button=1 )

		self.__classInfo = []
		self.__childUIs = {} # mapping from parameter name to ui name
		
		self.replace( node, parameter )
コード例 #2
0
    def __init__(self, node, parameter, labelVisible=None, **kw):

        self.__childUIs = {}
        self.__headerCreated = False
        self.__kw = kw.copy()

        self.__kw["hierarchyDepth"] = self.__kw.get("hierarchyDepth", -1) + 1

        originalParent = maya.cmds.setParent(query=True)

        collapsible = self.__parameterIsCollapsible(node, parameter)
        collapsed = self._retrieveCollapsedState(collapsible, parameter)

        # we always use a Collapsible ui to hold our children, and just hide
        # the header if we don't actually want to collapse it ever.

        self.__collapsible = IECoreMaya.Collapsible(

            # need to specify a label on creation or maya gets the size wrong.
            # we'll update the label below, once we can call the base class label() method.
            label="mustSpecifySomething",
            labelFont=self._labelFont(self.__kw["hierarchyDepth"]),
            labelIndent=self._labelIndent(self.__kw["hierarchyDepth"]),
            labelVisible=labelVisible
            if labelVisible is not None else collapsible,
            collapsed=collapsed,
            expandCommand=self.__expand,
            preExpandCommand=self.__preExpand,
            collapseCommand=self.__collapse,
        )

        IECoreMaya.ParameterUI.__init__(
            self,
            node,
            parameter,
            # stealing someone else's top level ui for use as your own is really breaking the rules.
            # but we need to do it to reduce the nesting associated with making a new top level to put
            # the Collapsible class in, because otherwise maya 2010 will crash with deeply nested
            # hierarchies. we could stop doing this when we no longer need maya 2010 support.
            self.__collapsible._topLevelUI(),
            **kw)

        self.__collapsible.setLabel(self.label())
        self.__collapsible.setAnnotation(self.description())

        self.__columnLayout = maya.cmds.columnLayout(
            parent=self.__collapsible.frameLayout(), width=381)

        if not collapsed:
            self.__preExpand()

        maya.cmds.setParent(originalParent)