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


Python cmds.rowLayout方法代码示例

本文整理汇总了Python中maya.cmds.rowLayout方法的典型用法代码示例。如果您正苦于以下问题:Python cmds.rowLayout方法的具体用法?Python cmds.rowLayout怎么用?Python cmds.rowLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maya.cmds的用法示例。


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

示例1: colorControlLayout

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def colorControlLayout(self, label=''):
        mc.rowLayout( numberOfColumns=4,
                      columnWidth4=(150, 200, 90, 80),
                      adjustableColumn=2,
                      columnAlign=(1, 'right'),
                      columnAttach=[(1, 'both', 0),
                                    (2, 'both', 0),
                                    (3, 'both', 0),
                                    (4, 'both', 0)] )
        mc.text(label=label)
        colorSlider = mc.colorSliderGrp( label='', adj=2, columnWidth=((1,1),(3,1)))
        mc.button(label='From Selected',
                  ann='Get the color of the selected object.',
                  command=partial(self.setFromSelected, colorSlider))
        mc.button(label='Randomize',
                  ann='Set a random color.',
                  command=partial(self.randomizeColors, colorSlider))
        controls = mc.layout(colorSlider, query=True, childArray=True)

        mc.setParent('..')

        return colorSlider 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:24,代码来源:ml_colorControl.py

示例2: reCreateEditSelectedModuleLayout

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def reCreateEditSelectedModuleLayout(self, bSelect=False, *args):
        Layout.LayoutClass.reCreateEditSelectedModuleLayout(self, bSelect)
        # style layout:
        self.styleLayout = cmds.rowLayout(numberOfColumns=4, columnWidth4=(100, 50, 50, 70), columnAlign=[(1, 'right'), (2, 'left'), (3, 'right')], adjustableColumn=4, columnAttach=[(1, 'both', 2), (2, 'left', 2), (3, 'left', 2), (3, 'both', 10)], parent="selectedColumn")
        cmds.text(label=self.langDic[self.langName]['m041_style'], visible=True, parent=self.styleLayout)
        self.styleMenu = cmds.optionMenu("styleMenu", label='', changeCommand=self.changeStyle, parent=self.styleLayout)
        styleMenuItemList = [self.langDic[self.langName]['m042_default'], self.langDic[self.langName]['m026_biped']]
        for item in styleMenuItemList:
            cmds.menuItem(label=item, parent=self.styleMenu)
        # read from guide attribute the current value to style:
        currentStyle = cmds.getAttr(self.moduleGrp+".style")
        cmds.optionMenu(self.styleMenu, edit=True, select=int(currentStyle+1)) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:14,代码来源:dpSpine.py

示例3: add_brush_btn

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def add_brush_btn(self, attr):
        """ replace the default combobox with a button for each entry """

        cmds.rowLayout('instanceLayout', nc=8 ) #, adjustableColumn=6) #, w=270 ) #, columnWidth3=(80, 75, 150),  columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
        cmds.text(l='Tool', align='right', w=145)
        cmds.button('placeBtn', l='Place', c=pm.Callback(self.activateContext, 'place', attr, 0))
        cmds.button('sprayBtn', l='Spray', c=pm.Callback(self.activateContext, 'spray', attr, 1))
        cmds.button('scaleBtn', l='Scale', c=pm.Callback(self.activateContext, 'scale', attr, 2))
        cmds.button('alignBtn', l='Align', c=pm.Callback(self.activateContext, 'align', attr, 3))
        cmds.button('moveBtn', l='Move', c=pm.Callback(self.activateContext, 'move', attr, 4))
        cmds.button('idBtn', l='Id', c=pm.Callback(self.activateContext, 'id', attr, 5))
        cmds.button('removeBtn', l='Remove', c=pm.Callback(self.activateContext, 'remove', attr, 6))
        cmds.setParent('..') 
开发者ID:wiremas,项目名称:spore,代码行数:15,代码来源:AEsporeNodeTemplate.py

示例4: buildUI

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def buildUI(self):
        column = cmds.columnLayout()
        cmds.text(label="Use this slider to set the tween amount")

        cmds.rowLayout(numberOfColumns=2)
        self.slider = cmds.floatSlider(min=0, max=100, value=50, step=1, changeCommand=tweener.tween)
        cmds.button(label="Reset", command=self.reset)

        cmds.setParent(column)
        cmds.button(label="Close", command=self.close)

    # And again, we just need to override the reset method
    # We don't need to define the close, or show methods because it gets those from BaseWindow 
开发者ID:dgovil,项目名称:PythonForMayaSamples,代码行数:15,代码来源:reusableUI.py

示例5: buildUI

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def buildUI(self):
        # To start with we create a layout to hold our UI objects
        # A layout is a UI object that lays out its children, in this case in a column
        column = cmds.columnLayout()

        # Now we create a text label to tell a user how to use our UI
        cmds.text(label="Use this slider to set the tween amount")

        # We want to put our slider and a button side by side. This is not possible in a columnLayout, so we use a row
        row = cmds.rowLayout(numberOfColumns=2)

        # We create a slider, set its minimum, maximum and default value.
        # The changeCommand needs to be given a function to call, so we give it our tween function
        # We need to hold on to our slider's name so we can edit it later, so we hold it in a variable
        self.slider = cmds.floatSlider(min=0, max=100, value=50, step=1, changeCommand=tween)

        # Now we make a button to reset our UI, and it calls our reset method
        cmds.button(label="Reset", command=self.reset)

        # Finally we don't want to add anymore to our row layout but want to add it to our column again
        # So we must change the active parent layout
        cmds.setParent(column)

        # We add a button to close our UI
        cmds.button(label="Close", command=self.close)

    # *args will be a new concept for you
    # It basically means I do not know how many arguments I will get, so please put them all inside this one list (tuple) called args 
开发者ID:dgovil,项目名称:PythonForMayaSamples,代码行数:30,代码来源:tweener.py

示例6: buildWindow

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def buildWindow(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(TOOL_URL+self.name+'/')))

        mc.text(label=self.info)
        mc.setParent('..')
        mc.separator(height=8, style='single', horizontal=True) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:37,代码来源:ml_utilities.py

示例7: createGuideButton

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def createGuideButton(self, guideModule, guideDir, layout):
        """ Create a guideButton for guideModule in the respective colMiddleLeftA guidesLayout.
        """
        # especific import command for guides storing theses guides modules in a variable:
        #guide = __import__("dpAutoRigSystem."+guideDir+"."+guideModule, {}, {}, [guideModule])
        basePath = utils.findEnv("PYTHONPATH", "dpAutoRigSystem")

        # Sandbox the module import process so a single guide cannot crash the whole Autorig.
        # https://github.com/SqueezeStudioAnimation/dpAutoRigSystem/issues/28
        try:
            guideDir = guideDir.replace("/", ".")
            guide = __import__(basePath+"."+guideDir+"."+guideModule, {}, {}, [guideModule])
            reload(guide)
        except Exception as e:
            print e
            errorString = self.langDic[self.langName]['e017_loadingExtension']+" "+guideModule+" : "+e
            mel.eval('warning \"'+errorString+'\";')
            return

        # getting data from guide module:
        title = self.langDic[self.langName][guide.TITLE]
        description = self.langDic[self.langName][guide.DESCRIPTION]
        icon = guide.ICON
        # find path where 'dpAutoRig.py' is been executed to get the icon:
        path = utils.findPath("dpAutoRig.py")
        iconDir = path+icon
        iconInfo = path+"/Icons/"+INFO_ICON
        guideName = guide.CLASS_NAME
        
        # creating a basic layout for guide buttons:
        if guideDir == CONTROLS or guideDir == COMBINED.replace("/", "."):
            controlInstance = self.initControlModule(guideModule, guideDir)
            cmds.iconTextButton(image=iconDir, label=guideName, annotation=guideName, height=32, width=32, command=partial(self.installControlModule, controlInstance, True), parent=self.allUIs[layout])
            self.controlInstanceList.append(controlInstance)
        else:
            moduleLayout = cmds.rowLayout(numberOfColumns=3, columnWidth3=(32, 55, 17), height=32, adjustableColumn=2, columnAlign=(1, 'left'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)], parent=self.allUIs[layout])
            cmds.image(i=iconDir, width=32, parent=moduleLayout)

            if guideDir == MODULES:
                '''
                We need to passe the rigType parameters because the cmds.button command will send a False parameter that
                will be stock in the rigType if we don't pass the parameter
                https://stackoverflow.com/questions/24616757/maya-python-cmds-button-with-ui-passing-variables-and-calling-a-function
                '''
                cmds.button(label=title, height=32, command=partial(self.initGuide, guideModule, guideDir, Base.RigType.biped), parent=moduleLayout)
            elif guideDir == SCRIPTS:
                cmds.button(label=title, height=32, command=partial(self.execScriptedGuide, guideModule, guideDir), parent=moduleLayout)
            elif guideDir == EXTRAS:
                cmds.button(label=title, height=32, width=200, command=partial(self.initExtraModule, guideModule, guideDir), parent=moduleLayout)
            
            cmds.iconTextButton(i=iconInfo, height=30, width=17, style='iconOnly', command=partial(self.info, guide.TITLE, guide.DESCRIPTION, None, 'center', 305, 250), parent=moduleLayout)
        cmds.setParent('..')
    
    #@utils.profiler 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:56,代码来源:dpAutoRig.py

示例8: reCreateEditSelectedModuleLayout

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def reCreateEditSelectedModuleLayout(self, bSelect=False, *args):
        Layout.LayoutClass.reCreateEditSelectedModuleLayout(self, bSelect)
        # if there is a type attribute:
        cmds.text(self.nSegmentsText, edit=True, visible=False, parent=self.segDelColumn)
        cmds.intField(self.nJointsIF, edit=True, editable=False, visible=False, parent=self.segDelColumn)

        self.typeLayout = cmds.rowLayout(numberOfColumns=4, columnWidth4=(100, 50, 77, 70), columnAlign=[(1, 'right'), (2, 'left'), (3, 'right')], adjustableColumn=4, columnAttach=[(1, 'both', 2), (2, 'left', 2), (3, 'left', 2), (3, 'both', 10)], parent="selectedColumn")
        cmds.text(self.langDic[self.langName]['m021_type'], parent=self.typeLayout)
        self.typeMenu = cmds.optionMenu("typeMenu", label='', changeCommand=self.changeType, parent=self.typeLayout)
        typeMenuItemList = [self.langDic[self.langName]['m028_arm'], self.langDic[self.langName]['m030_leg']]
        for item in typeMenuItemList:
            cmds.menuItem(label=item, parent=self.typeMenu)
        # read from guide attribute the current value to type:
        currentType = cmds.getAttr(self.moduleGrp + ".type")
        cmds.optionMenu(self.typeMenu, edit=True, select=int(currentType + 1))
        self.reOrientBT = cmds.button(label=self.langDic[self.langName]['m022_reOrient'], annotation=self.langDic[self.langName]['m023_reOrientDesc'], command=self.reOrientGuide, parent=self.typeLayout)

        # style layout:
        self.styleLayout = cmds.rowLayout(numberOfColumns=4, columnWidth4=(100, 50, 50, 70), columnAlign=[(1, 'right'), (2, 'left'), (3, 'right')], adjustableColumn=4, columnAttach=[(1, 'both', 2), (2, 'left', 2), (3, 'left', 2), (3, 'both', 10)], parent="selectedColumn")
        cmds.text(label=self.langDic[self.langName]['m041_style'], visible=True, parent=self.styleLayout)
        self.styleMenu = cmds.optionMenu("styleMenu", label='', changeCommand=self.changeStyle, parent=self.styleLayout)
        styleMenuItemList = [self.langDic[self.langName]['m042_default'], self.langDic[self.langName]['m026_biped'], self.langDic[self.langName]['m037_quadruped'], self.langDic[self.langName]['m043_quadSpring'], self.langDic[self.langName]['m155_quadrupedExtra']]
        for item in styleMenuItemList:
            cmds.menuItem(label=item, parent=self.styleMenu)
        # read from guide attribute the current value to style:
        currentStyle = cmds.getAttr(self.moduleGrp + ".style")
        cmds.optionMenu(self.styleMenu, edit=True, select=int(currentStyle + 1))

        # bend layout:
        self.bendLayout = cmds.rowLayout(numberOfColumns=4, columnWidth4=(100, 20, 50, 20), columnAlign=[(1, 'right'), (2, 'left'), (3, 'left'), (4, 'right')], adjustableColumn=4, columnAttach=[(1, 'both', 2), (2, 'left', 2), (3, 'left', 2), (4, 'both', 10)], parent="selectedColumn")
        cmds.text(label=self.langDic[self.langName]['m044_addBend'], visible=True, parent=self.bendLayout)
        self.bendChkbox = cmds.checkBox(value=self.getHasBend(), label=' ', ofc=self.setBendFalse, onc=self.setBendTrue, parent=self.bendLayout)
        self.bendNumJointsMenu = cmds.optionMenu("bendNumJointsMenu", label='Ribbon Joints', changeCommand=self.changeNumBend, enable=self.getHasBend(), parent=self.bendLayout)
        bendNumMenuItemList = [3, 5, 7]
        for item in bendNumMenuItemList:
            cmds.menuItem(label=item, parent=self.bendNumJointsMenu)
        # read from guide attribute the current value to number of joints for bend:
        currentNumberBendJoints = cmds.getAttr(self.moduleGrp + ".numBendJoints")
        for i, item in enumerate(bendNumMenuItemList):
            if currentNumberBendJoints == item:
                cmds.optionMenu(self.bendNumJointsMenu, edit=True, select=i + 1)
                break
                
        # align world layout:
        self.alignWorldLayout = cmds.rowLayout(numberOfColumns=4, columnWidth4=(100, 20, 50, 20), columnAlign=[(1, 'right'), (2, 'left'), (3, 'left'), (4, 'right')], adjustableColumn=4, columnAttach=[(1, 'both', 2), (2, 'left', 2), (3, 'left', 2), (4, 'both', 10)], parent="selectedColumn")
        cmds.text(label=self.langDic[self.langName]['m080_alignWorld'], visible=True, parent=self.alignWorldLayout)

        self.bendChkbox = cmds.checkBox(value=self.getAlignWorld(), label=' ', ofc=self.setAlignWorldFalse, onc=self.setAlignWorldTrue, parent=self.alignWorldLayout) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:50,代码来源:dpLimb.py

示例9: basicModuleLayout

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def basicModuleLayout(self, *args):
        """ Create a Basic Module Layout.
        """
        # BASIC MODULE LAYOUT:
        self.basicColumn = cmds.rowLayout(numberOfColumns=5, width=190, columnWidth5=(30, 20, 80, 20, 35), adjustableColumn=3, columnAlign=[(1, 'left'), (2, 'left'), (3, 'left'), (4, 'left'), (5, 'left')], columnAttach=[(1, 'both', 2), (2, 'both', 2), (3, 'both', 2), (4, 'both', 2), (5, 'both', 2)], parent=self.topColumn)
        # create basic module UI:
        self.selectButton = cmds.button(label=" ", annotation=self.langDic[self.langName]['m004_select'], command=partial(self.reCreateEditSelectedModuleLayout, True), backgroundColor=(0.5, 0.5, 0.5), parent=self.basicColumn)
        self.annotationCheckBox = cmds.checkBox(label=" ", annotation=self.langDic[self.langName]['m014_annotation'], onCommand=partial(self.displayAnnotation, 1), offCommand=partial(self.displayAnnotation, 0), value=0, parent=self.basicColumn)
        self.userName = cmds.textField('userName', annotation=self.langDic[self.langName]['m006_customName'], text=cmds.getAttr(self.moduleGrp+".customName"), changeCommand=self.editUserName, parent=self.basicColumn)
        self.colorButton = cmds.button(label=" ", annotation=self.langDic[self.langName]['m013_color'], command=self.colorizeModuleUI, backgroundColor=(0.5, 0.5, 0.5), parent=self.basicColumn)
        shapeSizeValue = cmds.getAttr(self.moduleGrp+'.shapeSize')
        self.shapeSizeFF = cmds.floatField('shapeSizeFF', annotation=self.langDic[self.langName]['m067_shapeSize'], minValue=0.001, value=shapeSizeValue, precision=2, step=0.01, changeCommand=self.changeShapeSize, parent=self.basicColumn)
        # edit values reading from guide:
        displayAnnotationValue = cmds.getAttr(self.moduleGrp+'.displayAnnotation')
        cmds.checkBox(self.annotationCheckBox, edit=True, value=displayAnnotationValue)
        
        # declaring the index color list to override and background color of buttons:
        # Manually add the "none" color
        self.colorList = [[0.627, 0.627, 0.627]]
        #WARNING --> color index in maya start to 1
        self.colorList += [cmds.colorIndex(iColor, q=True) for iColor in range(1,32)]

        '''
        self.colorList = [  [0.627, 0.627, 0.627],
                            [0, 0, 0],
                            [0.247, 0.247, 0.247],
                            [0.498, 0.498, 0.498],
                            [0.608, 0, 0.157],
                            [0, 0.016, 0.373],
                            [0, 0, 1],
                            [0, 0.275, 0.094],
                            [0.145, 0, 0.263],
                            [0.780, 0, 0.78],
                            [0.537, 0.278, 0.2],
                            [0.243, 0.133, 0.122],
                            [0.600, 0.145, 0],
                            [1, 0, 0],
                            [0, 1, 0],
                            [0, 0.255, 0.6],
                            [1, 1, 1],
                            [1, 1, 0],
                            [0.388, 0.863, 1],
                            [0.263, 1, 0.635],
                            [1, 0.686, 0.686],
                            [0.890, 0.675, 0.475],
                            [1, 1, 0.384],
                            [0, 0.6, 0.325],
                            [0.627, 0.412, 0.188],
                            [0.620, 0.627, 0.188],
                            [0.408, 0.627, 0.188],
                            [0.188, 0.627, 0.365],
                            [0.188, 0.627, 0.627],
                            [0.188, 0.404, 0.627],
                            [0.435, 0.188, 0.627],
                            [0.627, 0.188, 0.412] ]
        '''
        
        # edit current colorIndex:
        currentIndexColor = cmds.getAttr(self.moduleGrp+'.guideColor')
        self.setColorModule(currentIndexColor)
        self.reCreateEditSelectedModuleLayout(self) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:63,代码来源:dpLayoutClass.py

示例10: showBuildWindow

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import rowLayout [as 别名]
def showBuildWindow(arg):
    labelWidth = 100
    fieldWidth = 100

    cmds.window(uiWindowName, title = 'SSDS')
    cmds.formLayout(uiFormName)
    cmds.columnLayout(uiFormLayoutName, rowSpacing = 5)

    # joints
    cmds.rowLayout(uiNumJointsName[0], numberOfColumns = 2,
                   columnWidth2 = (labelWidth, fieldWidth),
                   columnAlign2 = ('right', 'right'))
    cmds.text(label = '# Joints')
    cmds.intField(uiNumJointsName[1], minValue = 0, maxValue = 100, value = 1, width = fieldWidth)
    cmds.setParent('..')

    # max influences
    cmds.rowLayout(uiMaxInfluenceName[0], numberOfColumns = 2,
                   columnWidth2 = (labelWidth, fieldWidth),
                   columnAlign2 = ('right', 'right'))
    cmds.text(label = 'Max Influences')
    cmds.intField(uiMaxInfluenceName[1], minValue = 1, maxValue = 8, value = 4, width = fieldWidth)
    cmds.setParent('..')

    # iterations
    cmds.rowLayout(uiNumIterationsName[0], numberOfColumns = 2,
                   columnWidth2 = (labelWidth, fieldWidth),
                   columnAlign2 = ('right', 'right'))
    cmds.text(label = '# Iterations')
    cmds.intField(uiNumIterationsName[1], minValue = 0, maxValue = 100, value = 10, width = fieldWidth)
    cmds.setParent('..')

    # transform type
    cmds.rowLayout('SsdsTransformTypeLayout', numberOfColumns = 2,
                   columnWidth2 = (labelWidth, fieldWidth),
                   columnAlign2 = ('right', 'right'))
    cmds.text(label = 'Transform Type')
    cmds.columnLayout('temporary', rowSpacing = 3)
    cmds.radioCollection(uiTransformRadioCollectionName)
    cmds.radioButton(uiTransformNames[0], label = 'T')
    cmds.radioButton(uiTransformNames[1], label = 'R+T')
    cmds.radioButton(uiTransformNames[2], label = 'S+R+T')
    cmds.radioCollection(uiTransformRadioCollectionName, edit = True, select = uiTransformNames[2])
    cmds.setParent(uiFormLayoutName)

    # concentrate
    cmds.rowLayout(uiConcentrateName[0], numberOfColumns = 2,
                   columnWidth2 = (labelWidth, fieldWidth),
                   columnAlign2 = ('right', 'right'))
    cmds.text(label = 'Concentrate')
    cmds.floatField(uiConcentrateName[1], minValue = 0, maxValue = 100, value = 0.0, precision = 3, width = fieldWidth)
    cmds.setParent('..')

    # build
    cmds.button(uiBuildButtonName, label='Build', command = invokeBuild, width = labelWidth + fieldWidth)
    
    cmds.formLayout(uiFormName, edit = True,
                    attachForm = [(uiFormLayoutName, 'top', 5),
                                  (uiFormLayoutName, 'left', 5),
                                  (uiFormLayoutName, 'right', 5)])
    cmds.showWindow(uiWindowName) 
开发者ID:TomohikoMukai,项目名称:ssds,代码行数:63,代码来源:mlSSDS.py


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