当前位置: 首页>>代码示例>>Python>>正文


Python cmds.setParent函数代码示例

本文整理汇总了Python中maya.cmds.setParent函数的典型用法代码示例。如果您正苦于以下问题:Python setParent函数的具体用法?Python setParent怎么用?Python setParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setParent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
	mc.python('from kmAnimImpExp import *')

	if mc.window( 'AnimImpExpUI', exists=True ):
		mc.deleteUI('AnimImpExpUI')
		
	WinName = mc.window( 
		'AnimImpExpUI', 
		title='Anim Import/Export with select', 
		iconName='AnimImpExpUI', 
		width=100, 
		height=200,
		menuBar=True
	)
	mc.menu( label='Menu', tearOff=False )
	mc.menuItem( label='Reload',command='from kmAnimImpExp import *;main()')
	mc.menuItem( divider=True )
	mc.menuItem( label='Quit' )
	
	mc.columnLayout(adj=True)
	mc.button(label='Import Anim',command='kmAnimImp()')
	mc.button(label='Export Anim',command='kmAnimExp()')
	mc.setParent('..') #columnLayout
		
	mc.showWindow(WinName)
开发者ID:smymc,项目名称:Maya-Python,代码行数:25,代码来源:kmAnimImpExp.py

示例2: build

 def build(self):
     if mc.window( self.win, ex=1 ): mc.deleteUI( self.win )
     if mc.windowPref( self.win, ex=1 ): mc.windowPref( self.win, remove=1 )
     mc.window(self.win, title=self.title, wh=(410,378))
     mc.columnLayout( 'mainColumn', adj=True )
     mc.separator( h=10 )
     mc.rowLayout( numberOfColumns=2, columnWidth2=(200, 200), columnAttach=[(1, "both", 5),(2 ,"both", 5)] )
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.text( l=self.textsk )
     self.skcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True  )
     mc.setParent('..')
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.text( l=self.textqp )
     self.qpcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True  )
     mc.setParent( '..' )
     mc.setParent('..')
     mc.separator ( h=10 )
     mc.rowLayout( numberOfColumns=4, columnWidth4=(100, 100, 100, 100), columnAttach=[(1, "both", 1),(2 ,"both", 1), (3 ,"both", 1), (4 ,"both", 1)] )
     mc.button( l=self.buttonsk, c=self.selSKItem )
     mc.button( l=self.buttonAllSk, c=self.mainSK )
     mc.button( l=self.buttonqp, c=self.selQPItem )
     mc.button( l=self.buttonAllQp, c=self.mainQP )
     mc.setParent('..')
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.separator ( h=10 )
     mc.setParent('..')
     self.addSKList()
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:27,代码来源:SKQP_new.py

示例3: buildTimeMenu

	def buildTimeMenu( self, parent, uiItem ):
		cmd.menu( parent, e=True, dai=True )
		cmd.setParent( parent, m=True )

		cmd.menuItem( l="! - use current range", c=lambda a: cmd.textField( uiItem, e=True, tx='!' ) )
		cmd.menuItem( l=". - use current frame", c=lambda a: cmd.textField( uiItem, e=True, tx='.' ) )
		cmd.menuItem( l="$ - use scene range", c=lambda a: cmd.textField( uiItem, e=True, tx='$' ) )
开发者ID:Italic-,项目名称:maya-prefs,代码行数:7,代码来源:xferAnimUI.py

示例4: __enter__

    def __enter__(self):
        '''
        Initialize the UI
        '''
        if mc.window(self.name, exists=True):
            mc.deleteUI(self.name)

        mc.window(self.name, title='ml :: '+self.title, iconName=self.title, width=self.width, height=self.height, menuBar=self.menu)
        
        
        if self.menu:
            self.createMenu()
        
        self.form = mc.formLayout()
        self.column = mc.columnLayout(adj=True)

        
        mc.rowLayout( numberOfColumns=2, columnWidth2=(34, self.width-34), adjustableColumn=2, 
                    columnAlign2=('right','left'),
                    columnAttach=[(1, 'both', 0), (2, 'both', 8)] )

        #if we can find an icon, use that, otherwise do the text version
        if self.icon:
            mc.iconTextStaticLabel(style='iconOnly', image1=self.icon)
        else:
            mc.text(label=' _ _ |\n| | | |')
            
        if not self.menu:
            mc.popupMenu(button=1)
            mc.menuItem(label='Help', command=(_showHelpCommand(wikiURL+'#'+self.name)))
        
        mc.text(label=self.info)
        mc.setParent('..')
        mc.separator(height=8, style='single')
        return self
开发者ID:Bumpybox,项目名称:Tapp,代码行数:35,代码来源:ml_utilities.py

示例5: new

 def new(self):
     cmds.setParent(self.parent)
     self.name = cmds.button(self.name, label=self.label, c=self.cmd, h=self.h)
     if self.bgc:
         cmds.button(self.name, e=True, bgc=self.bgc)
     attachForm = [(self.name, 'bottom', self.moveUp), (self.name, 'right', 0), (self.name, 'left', 0)]
     cmds.formLayout(self.parent, edit=True, attachForm=attachForm)
开发者ID:boochos,项目名称:work,代码行数:7,代码来源:ui_micro_lib.py

示例6: create

    def create(self):
        
        if cmds.window( WinA_Global.winName, ex=1 ):
            cmds.deleteUI( WinA_Global.winName, wnd=1 )
        cmds.window( WinA_Global.winName, title= WinA_Global.title, titleBarMenu = WinA_Global.titleBarMenu )

        form = cmds.formLayout()
        importPathForm     = self.uiImportPath.create()
        importByMatrixForm = self.importByMatrix.create()
        buttonForm         = self.uiButton.create()
        cmds.setParent( '..' )
        
        cmds.formLayout( form, e=1,
                         af=[(importPathForm, 'top', 8), (importPathForm, 'left', 0), (importPathForm, 'right', 0),
                             (importByMatrixForm, 'left', 120 ), (importByMatrixForm, 'right', 0 ),
                             (buttonForm,     'left', 0 ), (buttonForm,    'right', 0 )],
                         ac=[(importByMatrixForm, 'top', 8, importPathForm),
                             (buttonForm, 'top', 8, importByMatrixForm)] )
        
        cmds.window( WinA_Global.winName, e=1, w= WinA_Global.width, h= WinA_Global.height, rtf=1 )
        cmds.showWindow( WinA_Global.winName )
    
        WinA_uiCmd.setUiDefault()
        WinA_uiCmd.loadInfo()
        WinA_uiCmd.setUiCommand()
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:sgPWindow_file_mesh_importGroup.py

示例7: transfertSelectionToTarget_window

def transfertSelectionToTarget_window():
	"""
	This definition creates the 'Transfert Selection To Target' main window.
	"""

	cmds.windowPref(enableAll=False)

	if (cmds.window("transfertSelectionToTarget_window", exists=True)):
		cmds.deleteUI("transfertSelectionToTarget_window")

	cmds.window("transfertSelectionToTarget_window",
		title="Transfert Selection To Target",
		width=320)

	spacing = 5

	cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing)

	cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)])
	cmds.text(label="Target:")
	sources_textField = cmds.textField("target_textField")
	cmds.button("pickTarget_button", label="Pick Target!", command=pickTarget_button_OnClicked)
	cmds.setParent(topLevel=True)

	cmds.separator(style="single")

	cmds.button("transfertSelection_button", label="Transfert Selection!", command=transfertSelection_button_OnClicked)

	setUnsetContextHotkeys()
	scriptJob = cmds.scriptJob(uiDeleted=("transfertSelectionToTarget_window", setUnsetContextHotkeys), runOnce=True)

	cmds.showWindow("transfertSelectionToTarget_window")

	cmds.windowPref(enableAll=True)
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:34,代码来源:others.py

示例8: secondaryUI

def secondaryUI():
    sec_UIname = 'secondary'
    if cmds.window(sec_UIname,exists = True):
        cmds.deleteUI(sec_UIname)
    cmds.window(sec_UIname,title = 'rosa_secondary')
    clmLot = cmds.columnLayout( adjustableColumn=True)
    cmds.textField('ctrl_name',text = 'ctrl_name')
    cmds.button('createctrl',label = 'create ctrl',h = 30,c = 'ctrl()')
    cmds.button('load_model',label = 'load "org" model',c = 'load_org()')
    cmds.textField('org_model',text = '"org" model')
    cmds.button('load_property_obj',label = 'loading property add object',c = 'load_vis()')
    cmds.textField('vis',text = 'Visibility')
    #
    flLot = cmds.flowLayout(columnSpacing = 6)
    cmds.text(label = 'ctrl axial:')
    cmds.radioCollection()
    cmds.radioButton('follic',label = 'follic',select = 0)
    cmds.radioButton('Custom',label = 'Custom',select = 1)
    #
    cmds.setParent( clmLot)
    cmds.button(label = 'Generate',c = 'secondary_add()')
    cmds.button('add_ctrl',label = 'add controller',c = 'add_controller()')
    cmds.button('Add_modelSec',label = 'Add_modelSec',c = 'Add_modelSec()')
    cmds.button(label = 'inverse_connect',c =  'inverse_connect01()')
    #
    cmds.frameLayout( label='modify ctrl:',borderStyle='etchedOut')
    cmds.setParent( clmLot)
    cmds.button(label = 'loding want to modify the controller',c = 'load_ctrl()')
    cmds.textField('sec_ctrl',text = 'secondary_ctrl')
    cmds.button(label = 'modify the controller position',c = 'ctrl_modify()')
    cmds.button(label = 'complete controller modifies',c = 'modify_complete()')
    cmds.showWindow()
开发者ID:wangqinghuaTudou,项目名称:test,代码行数:32,代码来源:rosa_SecCtrl.py

示例9: createMenu

    def createMenu(self,menuDic,menuOrder=None):
        """ Define and draw the window/widget top file menu
        @type  menuDic: dictionary
        @param menuDic: the menu elements, ie entry, callback and submenu
        @type  menuOrder: array
        @param menuOrder: the menu keys oredered
        """        
        
        if menuOrder : 
            lookat = menuOrder
        else :
            lookat = menuDic.keys()
        for mitem in lookat:
            cmds.menu( label=mitem, tearOff=True , parent = self.winName)
            for elem in menuDic[mitem]:            
                if elem["sub"] is not None:
                    elem['id']=cmds.menuItem(subMenu=True, label=elem["name"])
                    for sub in elem['sub'].keys():
                        checkBox = False#elem['sub'][sub]['checkBox']
                        if elem['sub'][sub]["action"] is not None :
                            elem['sub'][sub]['id']=cmds.menuItem( label=elem['sub'][sub]["name"],
#                                                            checkBox=checkBox,
                                                            c=partial(elem['sub'][sub]["action"],sub))
                        else :
                            elem['sub'][sub]['id']=cmds.menuItem( label=elem['sub'][sub]["name"],)
#                                                            checkBox=checkBox,)
#                        if checkBox and elem['sub'][sub].has_key("var"):
#                            cmds.menuItem(elem['sub'][sub]['id'],e=1,checkBox=bool(elem['sub'][sub]['var']))
                    cmds.setParent( '..', menu=True )
                else:
                    if elem["action"] is not None :
                        elem['id']=cmds.menuItem( label=elem["name"],c=elem["action"])
                    else :
                        elem['id']=cmds.menuItem( label=elem["name"])
开发者ID:gj210,项目名称:upy,代码行数:34,代码来源:mayaUI.py

示例10: renameGui

def renameGui(parent):
	renCol = cmds.columnLayout()
	colWidth = winWidth/4
	cmds.rowColumnLayout(nc=4, cw=[[1,colWidth],[2,colWidth+40],[3,colWidth-40],[4,colWidth]],
		co=[[1,"both",3],[2,"both",3],[3,"both", 3],[4,"both",3]])
	cmds.text( label="Prefix", al="center" )
	cmds.text( label="Name", al="center" )
	cmds.text( label="###", al="center" )
	cmds.text( label="Suffix", al="center" )	
	
	cmds.textField( "mecRenPre" )
	cmds.textField( "mecRenName" )
	cmds.intField( "mecRenCount" )
	cmds.textField( "mecRenSuf" )
	cmds.setParent(renCol)
	
	cmds.rowColumnLayout( nc=3, cw=[[1,winWidth/3-20],[2,winWidth/3+40],[3,winWidth/3-20]],
		co=[[1,"both",3],[3,"both",3]])
	cmds.button(label="Prefix",
		c=Callback(prefix))
	cmds.button(label="Full Rename",
		c=Callback(fullRename))
	cmds.button(label="Suffix",
		c=Callback(suffix))
	cmds.setParent( parent )	
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:25,代码来源:mecRenameTools.py

示例11: create

    def create(self):
        
        if cmds.window( Win_Global.winName, q=1, ex=1 ):
            cmds.deleteUI( Win_Global.winName )
        cmds.window( Win_Global.winName, title=Win_Global.title )
        
        form  = cmds.formLayout()
        text   = cmds.text( l= "Select joint tops", al='center', h=30, bgc=[.5,.5,.5] )
        check = cmds.checkBox( l='Add Pin Control' )
        controllerName = self.ui_controllerName.create()
        colorIndex = self.ui_colorIndex.create()
        controllerSize = self.ui_controllerSize.create()
        button = self.ui_buttons.create()
        cmds.setParent( '..' )

        cmds.formLayout( form, e=1, af=[ (text, 'top', 0 ), (text, 'left', 0 ), (text, 'right', 0 ),
                                         (check, 'top', 5 ), (check, 'left', 10 ), (check, 'right', 0 ),
                                         (controllerName, 'left', 10 ), (controllerName, 'right', 5 ),
                                         (colorIndex, 'left', 10 ), (colorIndex, 'right', 5 ),
                                         (controllerSize, 'left', 10 ), (controllerSize, 'right', 5 ),
                                         (button, 'left', 0 ), (button, 'right', 0 ), (button, 'bottom', 0 )],
                                    ac=[ (check, 'top', 5, text),
                                         (controllerName, 'top', 5, check),
                                         (colorIndex, 'top', 5, controllerName), 
                                         (controllerSize, 'top', 5, colorIndex), 
                                         (button, 'top', 5, controllerSize) ] )
        
        cmds.window( Win_Global.winName, e=1,
                     width = Win_Global.width, height = Win_Global.height,
                     rtf=1 )
        cmds.showWindow( Win_Global.winName )
        
        Win_Global.checkBox = check
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:createLineController.py

示例12: deleteChannelsUI

def deleteChannelsUI( win):
    chnlUI = mkList( mc.layout( win.channelsParent, q=1, ca=1))
    if len(chnlUI): mc.deleteUI( chnlUI)
    win.cRange = []
    win.cOffset = []
    win.cStep = []
    mc.setParent( win.channelsParent)
开发者ID:cyrillef,项目名称:apps.exchange.packager,代码行数:7,代码来源:bt_randomizer.py

示例13: setOptionMenuList

def setOptionMenuList(OMG,itemList,add=False):
	'''
	Set the list of items for the specified optionMenuGrp control
	@param OMG: OptionMenuGrp to set the item list for
	@type OMG: str
	@param itemList: List of items to add to optionMenuGrp
	@type itemList: list
	@param add: Add to existing menu items
	@type add: bool
	'''
	# Check optionMenuGrp
	if not mc.optionMenuGrp(OMG,q=True,ex=True):
		raise UIError('OptionMenu "'+OMG+'" does not exist!')
	
	# Get existing items
	exItemList = mc.optionMenuGrp(OMG,q=True,ill=True)
	
	# Add items
	for item in itemList:
		mc.setParent(OMG)
		mc.menuItem(l=item)
	
	# Remove previous items
	if exItemList:
		for item in exItemList:
			mc.deleteUI(item)
开发者ID:auqeyjf,项目名称:glTools,代码行数:26,代码来源:utils.py

示例14: snapOnClosestVertex_window

def snapOnClosestVertex_window():
	"""
	Creates the 'Snap On Closest Vertex' vertex window.
	"""

	cmds.windowPref(enableAll=False)

	if (cmds.window("snapOnClosestVertex_window", exists=True)):
		cmds.deleteUI("snapOnClosestVertex_window")

	cmds.window("snapOnClosestVertex_window",
		title="Snap On Closest Vertex",
		width=320)

	spacing = 5

	cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing)

	cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)])
	cmds.text(label="Reference Object:")
	referenceObject_textField = cmds.textField("referenceObject_textField")
	cmds.button("getReferenceObject_button", label="Get Reference Object!", command=getReferenceObject_button_OnClicked)
	cmds.setParent(topLevel=True)

	cmds.separator(style="single")

	cmds.button("snapIt_button", label="Snap It!", al="center", command=snapIt_button_OnClicked)

	cmds.showWindow("snapOnClosestVertex_window")
	cmds.windowPref(enableAll=True)
开发者ID:KelSolaar,项目名称:Snippets,代码行数:30,代码来源:snapOnClosestVertex.py

示例15: create

    def create(self):
        
        if cmds.window( Win_Global.winName, q=1, ex=1 ):
            cmds.deleteUI( Win_Global.winName )
        
        cmds.window( Win_Global.winName, title= Win_Global.title )
        
        formOuter = cmds.formLayout()
        stdForm = self.stdArea.create()
        rigForm = self.rigArea.create()
        followForm = self.followArea.create()
        addRigForm = self.addRigArea.create()
        cmds.setParent( '..' )

        cmds.formLayout( formOuter, e=1, 
                         af = [ (stdForm, 'left', 5), (stdForm, 'right', 5), (stdForm, 'top', 5),
                                (rigForm, 'left', 5), (rigForm, 'right', 5),
                                (followForm, 'left', 5), (followForm, 'right', 5),
                                (addRigForm, 'left', 5), (addRigForm, 'right', 5), (addRigForm, 'bottom', 5) ],
                         ac = [ (rigForm, 'top', 5, stdForm ),
                                (followForm, 'top', 5, rigForm ),
                                (addRigForm, 'top', 5, followForm )] )
        
        cmds.window( Win_Global.winName, e=1, width = Win_Global.width, height= Win_Global.height )
        cmds.showWindow( Win_Global.winName )
        
        Win_Global.loadInfo()
开发者ID:jonntd,项目名称:mayadev-1,代码行数:27,代码来源:widget.py


注:本文中的maya.cmds.setParent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。