用于简化Maya GUI编码的脚本 使Maya GUI创建更快,更轻松的脚本 

      |      2019-09-23 23:53 发布

插件下载
1708 0 0

简介


兼容:MAYA2012以上
用于简化Maya GUI编码的模块基本
mGui是一个Python模块,用于使用Maya的内置GUI小部件简化GUI创建。因此,它不能替代更复杂的功能(例如PyQT或PySide),而是一种可以更快速,更可靠地制作简单UI(并且无需在较早版本的Maya中分发任何DLL)的方法。
目的是提供在Maya中创建简单GUI的最一致且最少花哨的方式。代替这个:
items = ("pCube1", "pPlane2")window  = cmds.window()w, margin = 400, 10mainform = cmds.formLayout( width=w ) maincol = cmds.columnLayout( adj=True ) main_attach = [( maincol, 'top', margin ), ( maincol, 'left', margin ), ( maincol, 'right', margin )]col_w = int( ( w - ( margin * 2 ) ) / 3 ) - 1cmds.setParent( mainform ) dis_row = cmds.rowLayout( nc=3, ct3=( 'both', 'both', 'both' ), cw3=( col_w, col_w, col_w ) ) dis_attach = [( dis_row, 'bottom', margin ), ( dis_row, 'left', margin ), ( dis_row, 'right', margin )]cmds.formLayout( mainform, e=True, attachForm=main_attach + dis_attach ) cmds.formLayout( mainform, e=True, ac=( maincol, 'bottom', margin, dis_row ) ) cmds.setParent( dis_row ) cmds.button( "Refresh", width=col_w)cmds.text( ' ' ) cmds.button( "Close", width=col_w)cmds.setParent( maincol ) cmds.text( " " ) cmds.text( "The following items don't have vertex colors:", align='left' ) cmds.text( " " ) Itemlist = cmds.textScrollList( numberOfRows=8, allowMultiSelection=True, append=items ) dis_row = cmds.rowLayout( nc=5, ct5=( 'both', 'both', 'both', 'both', 'both' ) ) cmds.showWindow(window)你可以这样写:bound = ObservableCollection("pCube1", "pPlane1")with BindingWindow(title = 'example window') as test_window:    with VerticalForm() as main:        Text(label = "The following items don't have vertex colors")        list_view = VerticalList()        list_view.bind.collection < bind() < bound        with HorizontalStretchForm() as buttons:            Button('refresh', l='Refresh')            Button('close', l='Close')test_window.show()            
并进行如下调整:
main.buttons.refresh.backgroundColor =(. 7,.7,.5)

快速回复 返回顶部 返回列表