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


Python cmds.formLayout方法代码示例

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


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

示例1: ui

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def ui():
    '''
    User interface for ml_tangentWeight
    '''

    with utl.MlUi('ml_tangentWeight', 'Weight Keyframe Tangents', width=400, height=140,
                  info='''Increase or decrease tangents length without affecting tangent angle.
Select keyframes and press buttons to weight their tangents.
If no keys are selected, the keys on the current frame will be affected.''') as win:

        form = mc.formLayout()
        b11 = win.buttonWithPopup(label='-', command=minus, annotation='Scale tangent down.')
        b12 = win.buttonWithPopup(label='+', command=plus, annotation='Scale tangent up.')
        b21 = win.buttonWithPopup(label='<', command=sharkFinLeft, annotation='Weight tangent toward the left.')
        b22 = win.buttonWithPopup(label='>', command=sharkFinRight, annotation='Weight tangent toward the right.')

        utl.formLayoutGrid(form, (
            (b11,b12),
            (b21,b22)
            )) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:22,代码来源:ml_tangentWeight.py

示例2: formLayoutGrid

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def formLayoutGrid(form, controls, offset=1):
    '''
    Controls should be a list of lists, and this will arrange them in a grid
    '''

    kwargs = {'edit':True, 'attachPosition':[]}
    rowInc = 100/len(controls)
    colInc = 100/len(controls[0])
    position = {'left':0,'right':100,'top':0,'bottom':100}

    for r,row in enumerate(controls):
        position['top'] = r*rowInc
        position['bottom'] = (r+1)*rowInc
        for c,ctrl in enumerate(row):
            position['left'] = c*colInc
            position['right'] = (c+1)*colInc
            for k in position.keys():
                kwargs['attachPosition'].append((ctrl, k, offset, position[k]))

    mc.formLayout(form, **kwargs) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:22,代码来源:ml_utilities.py

示例3: finish

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def finish(self):
        '''
        Finalize the UI
        '''

        mc.setParent(self.form)

        frame = mc.frameLayout(labelVisible=False)
        mc.helpLine()

        mc.formLayout( self.form, edit=True,
                       attachForm=((self.column, 'top', 0), (self.column, 'left', 0),
                                   (self.column, 'right', 0), (frame, 'left', 0),
                                   (frame, 'bottom', 0), (frame, 'right', 0)),
                       attachNone=((self.column, 'bottom'), (frame, 'top')) )

        mc.showWindow(self.name)
        mc.window(self.name, edit=True, width=self.width, height=self.height) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:20,代码来源:ml_utilities.py

示例4: ui

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def ui():
    '''
    User interface for ml_lockAndHideAttributes
    '''

    with utl.MlUi('ml_lockAndHideAttributes', 'Lock and Hide', width=400, height=140, info='''Select channels in the channel box to be locked or hidden.
then hit the appropriate button.''') as win:

        form = mc.formLayout()
        b11 = win.buttonWithPopup(label='Lock', command=lock, annotation='Lock selected attributes.')
        b12 = win.buttonWithPopup(label='Hide', command=hide, annotation='Hide selected attributes.')
        b13 = win.buttonWithPopup(label='Lock and Hide', command=lockAndHide, annotation='Lock and hide selected attributes.')
        b21 = win.buttonWithPopup(label='Unlock', command=unlock, annotation='Unlock selected attributes.')
        b22 = win.buttonWithPopup(label='Unhide', command=unhide, annotation='Unhide all core attributes.')
        b23 = win.buttonWithPopup(label='Unlock and Unhide', command=unlockAndUnhide, annotation='Unlock and unhide selected attributes.')

        utl.formLayoutGrid(form, (
            (b11,b21),
            (b12,b22),
            (b13,b23)
            )) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:23,代码来源:ml_lockAndHideAttributes.py

示例5: add_instance_list

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def add_instance_list(self, *args):
        """ builde the instance list layout """

        instanced_geo = node_utils.get_instanced_geo(self._node)
        if instanced_geo:
            instanced_geo = ['[{}]: {}'.format(i, name) for i, name in enumerate(instanced_geo)]

        form = cmds.formLayout()
        help_lbl = cmds.text(l='Select item(s) to specify an index',
                             align='left')
        scroll_list = cmds.textScrollList('instanceList', ams=True,
                                          append=instanced_geo)
        add_btn = cmds.symbolButton('addInstanceBtn', width=30, i='setEdAddCmd.png',
                                    c=pm.Callback(self.add_instance),
                                    ann='Add Selected Object')
        rm_btn = cmds.symbolButton('removeInstanceBtn', width=30,
                                   i='setEdRemoveCmd.png',
                                   c=pm.Callback(self.remove_instance),
                                   ann='Remove Selected Objects')
        instancer_btn = cmds.symbolButton('instancerBtn', width=30, i='info.png',
                                          c=pm.Callback(self.select_instancer),
                                          ann='Highlight Instancer')

        cmds.formLayout(form, e=True, height=115,
                        attachForm=[(help_lbl, 'left', 2),
                                    (help_lbl, 'right', 2),
                                    (help_lbl, 'top', 0),
                                    (add_btn, 'right', 2),
                                    (add_btn, 'top', 17),
                                    (rm_btn, 'top', 45),
                                    (rm_btn, 'right', 2),
                                    (instancer_btn, 'right', 2),
                                    (instancer_btn, 'bottom', 2),
                                    (scroll_list, 'right', 35),
                                    (scroll_list, 'top', 17),
                                    (scroll_list, 'left', 2),
                                    (scroll_list, 'bottom', 2)]) 
开发者ID:wiremas,项目名称:spore,代码行数:39,代码来源:AEsporeNodeTemplate.py

示例6: _fill

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def _fill(self, ctrl, *sides, **kwargs):
        """
        convenience wrapper for tedious formLayout editing
        """
        margin = kwargs.get('margin', None)
        ct = [ctrl for _ in sides]
        mr = [margin for _ in sides]
        if margin is None:
            mr = [self.margin[_] for _ in sides]
        self.attachForm = zip(ct, sides, mr) 
开发者ID:theodox,项目名称:mGui,代码行数:12,代码来源:forms.py

示例7: dock

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def dock(self, ctrl, top=None, left=None, right=None, bottom=None):
        """
        docks ctrl into the form.

        for each of the optional flags (top, bottom, left, & right), the arguments are interpreted as follows:
        None (default):  Ignore this edge
        Number (eg 10):  dock to form with this margin along this edge
        (ctrl2, number): dock to other control 'ctrl2' along this edge, with supplied margin
        """

        if not hasattr(top, '__iter__'): top = (None, top)
        if not hasattr(bottom, '__iter__'): bottom = (None, bottom)
        if not hasattr(left, '__iter__'): left = (None, left)
        if not hasattr(right, '__iter__'): right = (None, right)

        ac = lambda edge, other, margin: cmds.formLayout(self.widget, e=True, ac=(ctrl, edge, margin, other))
        af = lambda edge, ignore, margin: cmds.formLayout(self.widget, e=True, af=(ctrl, edge, margin))

        if top[0]:
            ac('top', *top)
        elif top[1]:
            af('top', *top)

        if left[0]:
            ac('left', *left)
        elif left[1]:
            af('left', *left)

        if bottom[0]:
            ac('bottom', *bottom)
        elif bottom[1]:
            af('bottom', *bottom)

        if right[0]:
            ac('right', *right)
        elif right[1]:
            af('right', *right) 
开发者ID:theodox,项目名称:mGui,代码行数:39,代码来源:forms.py

示例8: detach

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def detach(self, *controls):
        """
        call AttachNone on all
        """
        sides = ('top', 'bottom', 'left', 'right')
        # note the order : it's backwards from the others!
        cmds.formLayout(self.widget, an=[(ctl, side) for side, ctl in itertools.product(sides, controls)]) 
开发者ID:theodox,项目名称:mGui,代码行数:9,代码来源:forms.py

示例9: about

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def about():
    """Displays the CMT About dialog."""
    name = "cmt_about"
    if cmds.window(name, exists=True):
        cmds.deleteUI(name, window=True)
    if cmds.windowPref(name, exists=True):
        cmds.windowPref(name, remove=True)
    window = cmds.window(
        name, title="About CMT", widthHeight=(600, 500), sizeable=False
    )
    form = cmds.formLayout(nd=100)
    text = cmds.scrollField(editable=False, wordWrap=True, text=cmt.__doc__.strip())
    button = cmds.button(
        label="Documentation", command="import cmt.menu; cmt.menu.documentation()"
    )
    margin = 8
    cmds.formLayout(
        form,
        e=True,
        attachForm=(
            (text, "top", margin),
            (text, "right", margin),
            (text, "left", margin),
            (text, "bottom", 40),
            (button, "right", margin),
            (button, "left", margin),
            (button, "bottom", margin),
        ),
        attachControl=((button, "top", 2, text)),
    )
    cmds.showWindow(window) 
开发者ID:chadmv,项目名称:cmt,代码行数:33,代码来源:menu.py

示例10: ui

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [as 别名]
def ui():
    '''
    User interface for graph editor mask
    '''

    with utl.MlUi('ml_graphEditorMask', 'Graph Editor Mask', width=400, height=120, info='''Quickly mask the curves visible in the graph editor.
''') as win:

        #check box to cull selection to what's visible.

        form = mc.formLayout()
        b11 = win.buttonWithPopup(label='Channel Box', command=channelBox, annotation='Isolate curves based on channels highlighted in the channel box')
        b12 = win.buttonWithPopup(label='Selected', command=selected, annotation='Isolate the selected curves')
        b13 = win.buttonWithPopup(label='All', command=showAll, annotation='Show all animation curves')
        b21 = win.buttonWithPopup(label='Translate', command=translate, annotation='Isolate translation curves')
        b22 = win.buttonWithPopup(label='Rotate', command=rotate, annotation='Isolate rotation curves')
        b23 = win.buttonWithPopup(label='Scale', command=scale, annotation='Isolate scale curves')
        b31 = win.buttonWithPopup(label='X', command=x, annotation='Isolate X axis curves')
        b32 = win.buttonWithPopup(label='Y', command=y, annotation='Isolate Y axis curves')
        b33 = win.buttonWithPopup(label='Z', command=z, annotation='Isolate Z axis curves')

        #b41 = win.buttonWithPopup(label='null', command=z, annotation='Isolate Z axis curves')
        #b42 = win.buttonWithPopup(label='TRS', command=z, annotation='Isolate Z axis curves')
        #b43 = win.buttonWithPopup(label='Custom', command=z, annotation='Isolate Z axis curves')

        utl.formLayoutGrid(form, (
            (b11,b21,b31),
            (b12,b22,b32),
            (b13,b23,b33)
            )) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:32,代码来源:ml_graphEditorMask.py

示例11: buildWindow

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [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

示例12: showBuildWindow

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import formLayout [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.formLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。