Ejemplo n.º 1
0
 def __init__(self):
     '''
     create UI elements (layouts, buttons)
     show window
     '''
     # formLayout base
     form = pm.verticalLayout()
     with form:
         formDeformer = pm.horizontalLayout()
         with formDeformer:
             pm.button(l='Create', c=pm.Callback(self.create))
             pm.button(l='Load', c=pm.Callback(self.load))
             self.heatTextField = pm.textField(en=0)
         formDeformer.redistribute()
         formConnect = pm.horizontalLayout()
         with formConnect:
             pm.button(l='Connect Squash',
                       c=pm.Callback(self.connect, 'squash'))
             pm.button(l='Connect Stretch',
                       c=pm.Callback(self.connect, 'stretch'))
             pm.button(l='Connect Base',
                       c=pm.Callback(self.connect, 'base'))
         formConnect.redistribute()
         self.formResult = pm.horizontalLayout()
         self.formResult.setBackgroundColor([0, 0, 0])
         self.formResult.setEnableBackground(0)
         with self.formResult:
             self.resultTextField = pm.textField(en=0)
         self.formResult.redistribute()
     form.redistribute()
     # show window
     self.show()
Ejemplo n.º 2
0
	def create(self):
		try:
			pm.deleteUI(self.WINDOW_NAME,window=True)
		except:pass
		
		with pm.window(self.WINDOW_NAME) as res_window:
			with pm.columnLayout(adjustableColumn=True):
				with pm.horizontalLayout():
					pm.text(label='Resolution')
					with pm.optionMenu() as self.res_menu:
						pm.menuItem(l='Low')
						pm.menuItem(l='Med')
						pm.menuItem(l='Hig')
					set_res_btn = pm.button(
						label:'Set LOD',
						command=pm.Callback(self.on_set_res_btn)
					)
				pm.separator(style='in',height=4)
				with pm.horizontalLayout() as h1:
					pm.text(label = 'Low')
					select_low_btn=pm.button(
						label='Select All',
						command=pm.Callback(
							self.on_select_btn,
							'Low'
						)
					)
 def create(self):
     # destroy the window if it already exists
     try:
         pm.deleteUI(self.WINDOW_NAME, window=True)
     except: pass
         # draw the window
     with pm.window(self.WINDOW_NAME) as res_window:
         with pm.columnLayout(adjustableColumn=True):
             with pm.horizontalLayout():
                 pm.text(label='Resolution')
                 with pm.optionMenu() as self.res_menu:
                     pm.menuItem(l='Low')
                     pm.menuItem(l='Med')
                     pm.menuItem(l='Hi')
                 set_res_btn = pm.button(label='Set LOD', command=pm.Callback(self.on_set_res_btn))
             pm.separator(style='in', height=4)
             with pm.horizontalLayout() as h1:
                 pm.text(label='Low')
                 select_low_btn = pm.button(label='Select All', command=pm.Callback(self.on_select_btn,'Low'))
                 toggle_low_btn = pm.button(label='Toggle Visibility', command=pm.Callback(self.on_vis_btn, 'Low'))
             with pm.horizontalLayout() as h1:
                 pm.text(label='Medium')
                 select_med_btn = pm.button(label='Select All', command=pm.Callback(self.on_select_btn, 'Med'))
                 toggle_med_btn = pm.button(label='Toggle Visibility', command=pm.Callback(self.on_vis_btn, 'Med'))
             with pm.horizontalLayout() as h1:
                 pm.text(label='High')
                 select_hi_btn = pm.button(label='Select All', command=pm.Callback(self.on_select_btn, 'Hi'))
                 toggle_hi_btn = pm.button(label='Toggle Visibility', command=pm.Callback(self.on_vis_btn, 'Hi'))
             self.status_line = pm.textField(editable=False)
         res_window.setWidthHeight((350,140))
Ejemplo n.º 4
0
 def create_ui(self):
     if (pm.window(self.name, q=1, exists=1)):
         pm.deleteUI(self.name)
         
     with pm.window(self.name, title=self.title + " v" + str(self.version), width=200, menuBar=True) as win:
         with pm.verticalLayout() as mainLayout:
             for row in range(4):
                 with pm.horizontalLayout() as layout:
                     for i, eachColor in enumerate(self._COLORS[0+(5*row):5+(5*row)]):
                         with pm.verticalLayout() as buttonLayout:
                             colorName, rgbColor, indexOverride = eachColor
                             btn = pm.button(
                                     label = str(i+(5*row)),
                                     command = pm.Callback (self.set_color_button, i+(5*row) ),
                                     backgroundColor=(rgbColor),
                                     )
                             txt = pm.text(label=colorName)
                         buttonLayout.redistribute(40,10)
                 layout.redistribute()
             with pm.horizontalLayout() as bottomButtons:
                 pm.button(label='Switch to RGB', command = pm.Callback(self.switch_to_rgb))
                 pm.button(label='Turn OFF RGB', command = pm.Callback(self.turn_off_rgb))
         mainLayout.redistribute(20, 20, 20, 20, 10)
         
     pm.showWindow()
Ejemplo n.º 5
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Define Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout(ratios=[2,1])

        #=======================================================================
        # Define Reorder Buttons Layout
        #=======================================================================
        pm.setParent(self.widgets['top_level_layout'])
        
        self.widgets['reorder_buttons_layout'] = pm.horizontalLayout()
        
        self.widgets['button_top'] = pm.button(label='TOP' ,command=self.attr_top_cmd)
        self.widgets['button_up'] = pm.button(label='UP' ,command=self.attr_up_cmd)
        self.widgets['button_dn'] = pm.button(label='DN' ,command=self.attr_dn_cmd)
        self.widgets['button_bot'] = pm.button(label='BOT' ,command=self.attr_bot_cmd)

        #=======================================================================
        # Define Reorder Buttons Layout
        #=======================================================================        
        pm.setParent(self.widgets['top_level_layout'])
        
        self.widgets['separator_layout'] = pm.horizontalLayout(ratios=[1,2,1])
        self.widgets['separator_text'] = pm.text('Separator :')
        self.widgets['separator_name'] = pm.textField()
        self.widgets['button_separator'] = pm.button(label = "Add", command=self.add_separator_cmd)

        #=======================================================================
        # Redistribute
        #=======================================================================
        self.widgets['reorder_buttons_layout'].redistribute()
        self.widgets['separator_layout'].redistribute()
        self.widgets['top_level_layout'].redistribute()
Ejemplo n.º 6
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Define Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout()


        #=======================================================================
        # Define Layout
        #=======================================================================
        # Title Layout
        pm.setParent(self.widgets['top_level_layout'])
        self.widgets['title_layout'] = pm.horizontalLayout()
        pm.text('Multi Attributes')
        pm.text('Connection Index')
        pm.text('Connection Target')
        
        #List Layout
        pm.setParent(self.widgets['top_level_layout'])
        self.widgets['list_layout'] = pm.horizontalLayout()
        
        pm.setParent(self.widgets['list_layout'])
        self.widgets["attributes_list"] = pm.textScrollList(selectCommand=self.refresh_connections)

        pm.setParent(self.widgets['list_layout'])
        self.widgets["index_list"] = pm.textScrollList(ams=True)
        
        pm.setParent(self.widgets['list_layout'])
        self.widgets["connections_list"] = pm.textScrollList(enable=False)

        #refresh Button
        pm.setParent(self.widgets['top_level_layout'])
        self.widgets["refresh_button"] = pm.button(label="Load Selection", command=self.refresh)

        # Add Attribute
        pm.setParent(self.widgets['top_level_layout'])
        pm.separator()
        self.widgets['addAttr_layout'] = pm.horizontalLayout()
        pm.text('Add Attribute:') 
        self.widgets['attr_name'] = pm.textField() 
        self.widgets["add_button"] = pm.button(label="Add", c=self.addAttr_selected)

        # Misc Buttons        
        pm.setParent(self.widgets['top_level_layout'])
        self.widgets['buttons_layout'] = pm.horizontalLayout()
        self.widgets["append_button"] = pm.button(label="Append", command=self.append_selected)
        self.widgets["remove_button"] = pm.button(label="Remove", command=self.remove_selected)
        self.widgets["clear_button"] = pm.button(label="Clear", command=self.clear_selected)

                
        #=======================================================================
        # Redistribute
        #=======================================================================
        self.widgets['addAttr_layout'].redistribute(1,2,1)
        self.widgets['list_layout'].redistribute()
        self.widgets['title_layout'].redistribute()
        self.widgets['buttons_layout'].redistribute()
        self.widgets['top_level_layout'].redistribute(1,10,1,1,1,1)
Ejemplo n.º 7
0
    def __init__(self, **options):
        super(UI, self).__init__(**options)
        
        pm.menu(label='Options', tearOff=True, parent=self)
        pm.menuItem(label='Export members', c=pm.Callback(self.export_members))
        pm.menuItem(label='Import members', c=pm.Callback(self.import_members))
        pm.menuItem(label='---', enable=False)
        self.select_members_in_scene = pm.menuItem('Select members in scene', checkBox=DEFAULTS['select_members_in_scene'])

        with pm.verticalLayout() as main_layout:
            with pm.horizontalLayout() as content_layout:
                with pm.verticalLayout() as set_layout:
                    with pm.verticalLayout() as set_top_layout:
                        pm.button(label='load selection', c=pm.Callback(self.load_sets_from_selection))
                        pm.button(label='load all', c=pm.Callback(self.load_sets_from_scene))
                        pm.separator()
                        pm.button(label='select in scene', c=pm.Callback(self.select_sets_in_scene))
                    set_top_layout.redistribute()
                    self.sets_list = pm.textScrollList(allowMultiSelection=True, sc=pm.Callback(self.load_members))
                    # load_members
                set_layout.redistribute(0, 1)
                with pm.verticalLayout() as member_layout:
                    with pm.verticalLayout() as member_head_layout:
                        self.active_set = pm.textField(enable=False)
                        with pm.horizontalLayout() as member_selection_layout:
                            pm.button(label='+', c=pm.Callback(self.add_members_from_selection))
                            pm.button(label='-', c=pm.Callback(self.remove_members_from_selection))
                            pm.button(label='fix', c=pm.Callback(self.fix_member_order))
                        member_selection_layout.redistribute()
                        pm.separator()
                    member_head_layout.redistribute()

                    with pm.horizontalLayout() as dag_layout:
                        self.dag_member_list = pm.textScrollList(allowMultiSelection=True, sc=pm.Callback(self.dag_selection))
                        with pm.verticalLayout(w=20) as dag_button_layout:
                            pm.text('dag')
                            pm.button(label='UP', c=pm.Callback(self.move_dag_members_up))
                            pm.button(label='DN', c=pm.Callback(self.move_dag_members_down))
                            pm.button(label='-', c=pm.Callback(self.remove_active_dag_member))
                        dag_button_layout.redistribute()
                    dag_layout.redistribute(3, 1)

                    with pm.horizontalLayout() as dn_layout:
                        self.dn_member_list = pm.textScrollList(allowMultiSelection=True, sc=pm.Callback(self.dn_selection))
                        with pm.verticalLayout(w=20) as dn_button_layout:
                            pm.text('dn')
                            pm.button(label='UP', c=pm.Callback(self.move_dn_members_up))
                            pm.button(label='DN', c=pm.Callback(self.move_dn_members_down))
                            pm.button(label='-', c=pm.Callback(self.remove_active_dn_member))
                        dn_button_layout.redistribute()
                    dn_layout.redistribute(3, 1)
                member_layout.redistribute(0, 1, 1)
            content_layout.redistribute(4, 5)
        main_layout.redistribute()

        self.show()
        self.load_sets_from_selection()
Ejemplo n.º 8
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Define Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout(w=self.windowWidth, h=self.windowHeight)
        
        #=======================================================================
        # OVERALL LAYOUT
        #=======================================================================
        h = pm.horizontalLayout(ratios=[1,3])
        
        pm.setParent(h)
        v2 = pm.verticalLayout(ratios=[1, 20, 1, 10])

        pm.setParent(v2)
        pm.text(label="Directory", bgc=[0.1,0.1,0.1])
        
        pm.setParent(v2)
        self.widgets["directory_vertical"] = pm.verticalLayout(bgc=[0.2,0.2,0.2])
        pm.popupMenu()
        pm.menuItem(label='Create New Directory', c=pm.Callback(self.create_new_directory_prompt))
        pm.menuItem(label='Refresh', c=pm.Callback(self.populate_directory_layout))
        self.populate_directory_layout()
        
        pm.setParent(v2)
        pm.text(label="Selection Set", bgc=[0.1,0.1,0.1])
        
        pm.setParent(v2)
        self.widgets['selectionSet_vertical'] = pm.verticalLayout(bgc=[0.2,0.2,0.2])
        pm.popupMenu()
        pm.menuItem(label='Create New Selection Set', c=pm.Callback(self.create_new_selection_prompt))
        pm.menuItem(label='Refresh', c=pm.Callback(self.populate_selection_layout))        
        self.populate_selection_layout()
        
        pm.setParent(h)
        v = pm.verticalLayout(ratios=[1, 6, 10])
        pm.setParent(v)        
        self.widgets["namespace_horizontal"] = pm.horizontalLayout(ratios = [2,5,1], bgc=[0.3,0.3,0.4])
        self.populate_namespace_horizontal()        

        pm.setParent(v)        
        self.widgets["detail_vertical"] = pm.verticalLayout(bgc=[0.2,0.2,0.3])
        self.populate_detail_layout()
        
        pm.setParent(v)
        self.widgets["library_vertical"] = pm.verticalLayout(bgc=[0.3,0.2,0.2])
        pm.popupMenu()
        pm.menuItem(label='Create New Pose', c=pm.Callback(self.create_new_pose_prompt))
        pm.menuItem(label='Refresh', c=pm.Callback(self.populate_library_layout))        
        self.populate_library_layout()
        
        v.redistribute()
        v2.redistribute()
        h.redistribute()
        
        self.widgets['top_level_layout'].redistribute()
Ejemplo n.º 9
0
    def __init__(self):
        windowID = 'selNodeWnd'

        if pm.window('selNodeWnd', exists=1):
            pm.deleteUI('selNodeWnd')

        tmpl = pm.uiTemplate(windowID + '_uiTmpl', force=1)
        tmpl.define('columnLayout', adj=1, cat=('both', 5), rs=5)
        tmpl.define('button', h=40)
        tmpl.define('textFieldGrp',
                    cl2=['center', 'left'],
                    ad2=2,
                    cw2=[30, 40])
        tmpl.define('checkBoxGrp', v1=0, cw=[1, 80])

        wnd = pm.window(windowID, t='Sel Node Editor', s=1, rtf=1, toolbox=1)

        with tmpl:
            with pm.columnLayout():
                with pm.horizontalLayout() as createLayout:
                    pm.textFieldGrp(
                        'nameTxt',
                        l='Node Name',
                        ann=self.uiAnn['kwTxt'],
                        cw2=[80, 80],
                        cal=[1, 'left'],
                        en=1,
                        tx="userNode",
                    )
                    pm.button('createNodeBtn',
                              l='Create Node',
                              ann=self.uiAnn['createNode'],
                              w=30,
                              c=self.createNodeBtnCmd)
                with pm.horizontalLayout() as kwTxtLayout:
                    pm.textFieldGrp('kwTxt',
                                    l='Searching KeyWords',
                                    ann=self.uiAnn['kwTxt'],
                                    cw2=[110, 40],
                                    cal=[1, 'left'],
                                    en=1)
                with pm.horizontalLayout() as btnLayout3:
                    pm.button('readNodeBtn',
                              l='Read Node',
                              ann=self.uiAnn['selNode'],
                              c=self.readNodeBtnCmd)
                    pm.button('addToNodeBtn',
                              l='Add to Node',
                              ann=self.uiAnn['addToNode'],
                              c=self.addToNodeBtnCmd)
                    pm.button('reMoveFrmNodeBtn',
                              l='Remove Frm Node',
                              ann=self.uiAnn['reMoveFrmNode'],
                              c=self.reMoveFrmNodeCmd)

        wnd.show()
Ejemplo n.º 10
0
 def initialiseLayout(self):
     """ define the layout of the ui,
         also find every module under the TOOL_FOLDER, create a button for each module found"""
     
     #=======================================================================
     #DEFINE LAYOUT
     #=======================================================================
     self.widgets["toplevel_column"] = pm.columnLayout(adj=True)
     
     # ASSET LAYOUT
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Asset', collapsable=False, labelVisible=False)
     h = pm.horizontalLayout(ratios=[1,5])
     pm.text("Search :")
     self.widgets['assets_searchFilter_textField'] = pm.textField(cc=self.refresh_asset_textScroll)
     h.redistribute()
     pm.setParent("..")
     self.widgets['assets_textScroll'] = pm.textScrollList(ams=True, h=200, selectCommand=self.select_asset_callback)
     
     # IMAGE LAYOUT
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Image', collapsable=True, labelVisible=True)
     pm.scrollLayout(h=130)
     pm.popupMenu()        
     pm.menuItem(label='Open Thumbnail Directory', c=self.thumbnail_directory_open_callback)
     self.widgets['thumbnails_brower'] = pm.horizontalLayout()
     self.widgets['thumbnails_brower'].redistribute()
     
     #
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Settings', collapsable=True, labelVisible=True)
     pm.rowColumnLayout(numberOfColumns=4)
     pm.text(label='Zoom', w=100)
     self.widgets['zoom_field'] = pm.floatField(minValue=1, value=1, precision=2, w=100)
     pm.separator(style='none')
     pm.separator(style='none')
     pm.text(label='Width', w=100)
     self.widgets['width_field'] = pm.intField(value=100, w=100)
     pm.text(label='Height', w=100)
     self.widgets['height_field'] = pm.intField(value=100, w=100)
     pm.text(label='Offset W', w=100)
     self.widgets['shiftWidth_field'] = pm.floatField( value=0, precision=2, w=100)
     pm.text(label='Offset H', w=100)
     self.widgets['shiftHeight_field'] = pm.floatField( value=0, precision=2, w=100)
     
     
     #
     pm.setParent(self.widgets["toplevel_column"])
     pm.button(label='Generate Thumbnails', c=self.generate_thumbnail)
     
     #INITIAL
     self.refresh_asset_textScroll()
Ejemplo n.º 11
0
    def __init__(self):

        # Make a new window
        win_title = "Control Creator"
        win_title_safe = win_title.replace(" ", "_")
        if pm.window(win_title_safe, q=True, exists=True):
            pm.deleteUI(win_title_safe)

        window = pm.window(win_title_safe,
                           title=win_title,
                           toolbox=True,
                           backgroundColor=(0.158, 0.254, 0.290))
        window.show()

        with pm.verticalLayout():
            pm.text(
                "1. Select joint in scene\n\n 2. Click controller shape that you want for it"
            )
            pm.button("Cube", command=lambda x: create_control("cube"))
            pm.button("Circle", command=lambda x: create_control("circle"))
            with pm.horizontalLayout() as scale_layout:
                self.scale_float = pm.floatSliderGrp(field=True,
                                                     maxValue=2,
                                                     value=1.1,
                                                     step=0.01)
                pm.button("Scale Control", command=self.increment_scale)
            scale_layout.redistribute(4, 2)
Ejemplo n.º 12
0
    def build(self):
        """
        Creates the GUI.
        """
        # if window exists, delete it
        if pm.window(self.window_name, exists=True):
            pm.deleteUI(self.window_name)

        with pm.window(self.window_name,
                       rtf=True,
                       menuBar=True,
                       menuBarVisible=True,
                       title='HairTool') as hairTool_window:
            with pm.verticalLayout():
                with pm.frameLayout(label='Make Hair Curve', collapsable=True):
                    # assign controls field
                    pm.text(label='Control List:', align='left')
                    self.control_scroll_field = pm.scrollField(
                        w=300,
                        h=35,
                        wordWrap=1,
                        ed=0,
                        en=0,
                        tx=
                        "Select control chain in order then press Assign Controls."
                    )
                    pm.button(l='Assign Controls', c=self._assignControls)

                    # Assign parent field
                    pm.separator(h=15, w=300, style="in")
                    pm.text(l='Parent', al='left')
                    self.parent_scroll_field = pm.scrollField(
                        w=300,
                        h=35,
                        wordWrap=1,
                        ed=0,
                        en=0,
                        tx=
                        'Select the parent control and then press Assign Parent'
                    )
                    pm.button(l='Assign Parent', c=self._assignParent)

                    pm.separator(h=15, w=300, style="in")
                    pm.button(l='Create Hair Curve',
                              c=pm.Callback(self._makeHair))
                    pm.separator(h=15, w=300, style="in")

                with pm.frameLayout(label='Bake Curve Motion',
                                    collapsable=True,
                                    h=20):
                    with pm.horizontalLayout():
                        pm.button(l='Bake Motion',
                                  c=pm.Callback(self._bakeClean, clean=True),
                                  h=10)
                        pm.button(l='Bake and keep nodes',
                                  c=pm.Callback(self._bakeClean, clean=False),
                                  h=10)
Ejemplo n.º 13
0
def main():
    tc = pm.columnLayout(adj=True)
    
    pm.setParent(tc)
    h2 = pm.horizontalLayout()
    #pm.rowColumnLayout(numberOfColumns=3)
    pm.checkBox( label='All' )
    pm.checkBox( label='PSD' )
    pm.checkBox( label='Wires' )
    h2.redistribute()
    
    pm.setParent(tc)
    h2 = pm.horizontalLayout()
    #pm.rowColumnLayout(numberOfColumns=3)
    pm.checkBox( label='Cloth' )
    pm.checkBox( label='Hair' )
    pm.text(label='')
    #pm.checkBox( label='Three' )
    h2.redistribute()    
Ejemplo n.º 14
0
    def options_buttons(self, *args):
        pm.separator(style="none", h=10)
        pm.button(label = "Generate Sets", c=self.custom_sets)

        pm.separator(h=15)
                       
        pm.text('ClientAnimCtrl Tag')
        h = pm.horizontalLayout()
        pm.button(label = "Add", c=self.add_control_tag)
        pm.button(label = "Remove", c=self.remove_control_tag)
        h.redistribute()
        pm.setParent("..")
Ejemplo n.º 15
0
    def initialiseLayout(self):
        
        #Layout
        self.widgets['top_horizontal'] = pm.horizontalLayout()
        
        pm.setParent(self.widgets['top_horizontal'])
        self.widgets['result_vertical'] = pm.verticalLayout()
        self.widgets['result_textScrollList'] = pm.textScrollList(allowMultiSelection=True, sc=self.select_result_callback)
        
        
        pm.setParent(self.widgets['top_horizontal'])
        self.widgets['main_vertical'] = pm.verticalLayout()

        pm.setParent(self.widgets['main_vertical'])
        self.widgets['main_horizontal'] = pm.horizontalLayout()

        pm.setParent(self.widgets['main_horizontal'])
        self.widgets['check_vertical'] = pm.verticalLayout()
        self.widgets['checks_column'] = pm.columnLayout(adj=True)
        pm.text(label='Checks', bgc=[0,0,0])
        pm.separator()
        
        pm.setParent(self.widgets['main_horizontal'])
        self.widgets['options_vertical'] = pm.verticalLayout()
        
        pm.setParent(self.widgets['main_vertical'])
        self.widgets['log_vertical'] = pm.verticalLayout()
        self.widgets['log_scrollField'] = pm.scrollField(font = 'smallFixedWidthFont')

        self.widgets['top_horizontal'].redistribute(1,3)
        self.widgets['main_horizontal'].redistribute(2,1)        
        self.widgets['main_vertical'].redistribute(6,4)
        
        self.widgets['log_vertical'].redistribute()
        self.widgets['result_vertical'].redistribute()
        self.widgets['check_vertical'].redistribute()
        self.widgets['options_vertical'].redistribute()

        self.propagate_check_buttons()
Ejemplo n.º 16
0
    def populate_detail_layout(self):
        
        pm.setParent(self.widgets["detail_vertical"])
        v1 = pm.verticalLayout(ratios=[6,1])
 
        h1 = pm.horizontalLayout(parent=v1, ratios=[1,1])
        self.widgets['thrumbnail_image'] = pm.iconTextButton(style='iconOnly', parent=h1, w=100, h=100, bgc=[0.4,0.4,0.4])

        v2 = pm.verticalLayout(parent=h1, ratios=[1,4,1,4])
        pm.text (label='Info :', bgc=[0.1,0.1,0.2])
        self.widgets['info_text'] = pm.text(parent=v2, bgc=[0.3,0.3,0.3], label='')
        pm.text (label = "Selection :", bgc = [0.1,0.1,0.2])
        self.widgets['selection_text'] = pm.text(parent=v2, bgc=[0.3,0.3,0.3], label='')
 
        h2 = pm.horizontalLayout(parent=v1, ratios=[4,1])
        self.widgets['weight_slider'] = pm.floatSlider(parent=h2, min=-0, max=1, value=1, step=0.01, dragCommand=pm.Callback(self.slider_drag_command))
        self.widgets['key_button'] = pm.button(label='Key Pose', parent=h2)
 
        h1.redistribute()
        h2.redistribute()
        v1.redistribute()
        v2.redistribute()
        
        self.widgets['detail_vertical'].redistribute()
Ejemplo n.º 17
0
def ui():
    '''
    update : 2015-04-24
    '''
    if pm.window(win, q=True, exists=True ): 
        pm.deleteUI(win)

    with pm.window(win, wh=[300,600], t=title):
        with pm.frameLayout( lv=False, cll=False, mw=1, mh=1):
            with pm.formLayout() as mainForm:
                #with pm.columnLayout(adj=True)
                with pm.tabLayout(tv=False) as top:
                    with pm.frameLayout(lv=False, cll=False, mw=2, mh=2, bv=False):
                        with pm.rowLayout(nc=3, adj=2):
                            pm.image( image = shelfIcon )
                            pm.text(l='  %s'%title, fn='boldLabelFont', align='left')
                            pm.image( image = alfredIcon )
               
                with pm.tabLayout(tv=False, scr=True, childResizable=True) as mid:                  
                    with pm.columnLayout(adj=True):
                        uiContents()

                #with pm.columnLayout(adj=True) as btm:
                #   pm.helpLine()

                with pm.horizontalLayout() as btm:         
                    pm.button()
                    pm.button()
                    pm.button()

    pm.formLayout( mainForm, e=True, 
        attachForm=[
            (top, 'top', 3), 
            (top, 'left', 3), 
            (top, 'right', 3), 

            (mid, 'left', 3), 
            (mid, 'right', 3), 

            (btm, 'left', 3), 
            (btm, 'right', 3), 
            (btm, 'bottom', 3),
            ], 
        attachControl=[
            (mid, 'top', 3, top), 
            (mid, 'bottom', 3, btm)            
            ]          
        )
Ejemplo n.º 18
0
 def window(cls):
     if pm.window(cls.winName,exists=True):
         pm.deleteUI(cls.winName, window=True)
     myWindow=pm.window(cls.winName,mnb=False,mxb=False,s=True)
     with myWindow:
         mainLayout=pm.columnLayout(adj=True)
         with mainLayout:
             with pm.horizontalLayout(spacing=0) as hLayout:
                 pm.text(l='reference')
                 cls.widgets['h1_txf'] = pm.textField(tx='None',en=False)
                 pm.button(l='set',c=pm.Callback(cls.setObject))
                 hLayout.redistribute(1,2,1)
             pm.button(l='snap',c=pm.Callback(cls.snap))
             pm.separator()
             pm.button(l='combine(no History)',c=pm.Callback(cls.combine))
             pm.button(l='merge(no History)',c=pm.Callback(cls.merge))
Ejemplo n.º 19
0
 def UI(self):
     ui_development = True
     
     # Clean up old windows which share the name
     if pm.window(self.win_name, exists=True):
         pm.deleteUI(self.win_name)
     
     # Clean up existing window preferences
     try:
         if pm.windowPref(self.win_name, query=True, exists=True) and ui_development:
             pm.windowPref(self.win_name, remove=True)
     except RuntimeError:
         pass
     
     # Declare the GUI window which we want to work with
     self.toolbox_ui = pm.window( self.win_name, 
                         title='Toolbox UI',
                         widthHeight=[200,440] )
     
     with pm.verticalLayout() as base:
         with pm.verticalLayout() as self.header:
             pm.text('Source Path', font='boldLabelFont')
         pm.separator(height=1)
         with pm.verticalLayout():
             with pm.horizontalLayout() as path:
                 self.ui_path = pm.textField(placeholderText = self.toolbox_path)
                 pm.button(label='Browse', command= self.ui_set_path)
             pm.button(label='Reload Toolbox', command= self.ui_reload_tools)
         pm.separator()
         with pm.verticalLayout() as tool_header:
             pm.text('Tools List', font='boldLabelFont')
             pm.separator()
         with pm.columnLayout(adjustableColumn=True) as self.ui_toolbox_layout:
             # Placeholder for adding new tools.
             pass
     
     # Fix spacing of layout elements
     base.redistribute(.01,.01,.15,.01,.01)
     tool_header.redistribute(.01,.01)
     
     # Last lines of code
     self.toolbox_ui.show()
     self.ui_reload_tools()
Ejemplo n.º 20
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Define Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout()

        #=======================================================================
        # Define PSD Create Layout
        #=======================================================================
        pm.setParent(self.widgets['top_level_layout'])
        self.widgets["blend_shaper_column"] = pm.columnLayout(adj=True, rowSpacing=1, columnAttach = ['both', 5])
        self.widgets["object_textField"] = pm.textFieldButtonGrp(label="Object :",
                                                                 adj=2,
                                                                 cw=[[1,100],[2,60],[3,30]],
                                                                 bc=self.load_selected_object)
        self.widgets["blendShapeNode_textField"] = pm.textFieldButtonGrp(label='BlendShape Node :',
                                                                         adj=2,
                                                                         cw=[[1,100],[2,60],[3,30]],                                                                         
                                                                         bc=self.load_blendShapeNode)
                
        
        pm.setParent(self.widgets['blend_shaper_column'])
        self.widgets["blendShape_textScroll"] = pm.textScrollList(selectCommand=pm.Callback( self.select_shape, 'blendShape' ))
        self.widgets["mask_textScroll"] = pm.textScrollList(selectCommand=pm.Callback( self.select_shape, 'mask' ))

        buttonsHL = pm.horizontalLayout(h=40)
        self.widgets['new_weight_button'] = pm.button(label='New', c=self.newWeight)
                
        self.widgets['invert_weight_button'] = pm.button(label='Invert', c=self.invertWeight)
        self.widgets['multiply_weight_button'] = pm.button(label='Multiply', c=self.multiplyWeight)

        self.widgets['copy_weight_button'] = pm.button(label='Copy', c=self.copyWeight)
        self.widgets['paste_weight_button'] = pm.button(label='Paste', c=self.pasteWeight)


        buttonsHL.redistribute()
        #=======================================================================
        # Redistribute
        #=======================================================================

        self.widgets['top_level_layout'].redistribute()
Ejemplo n.º 21
0
def UI():
    # Clean up old windows which share the name
    if pm.window(win_name, exists=True):
        pm.deleteUI(win_name)
    
    # Clean up existing window preferences
    try:
        if pm.windowPref(win_name, query=True, exists=True) and window_development:
            pm.windowPref(win_name, remove=True)
    except RuntimeError:
        pass
    
    # Declare the GUI window which we want to work with
    my_win = pm.window( win_name, widthHeight=[200,150] )
    base = pm.verticalLayout()
    
    with base: # Using the variable created 2 lines above, we can nest inside that layout element
        with pm.verticalLayout() as header: # We can also assign a variable while creating the layout element
            pm.text('Some title')
            pm.separator()
        with pm.verticalLayout(): # The assignment of a variable to the layout is optional
            #pm.button( ) # This button does nothing!
            pm.button( label='Function A', command= 'function_A()' ) # First way to execute a command with a button
        with pm.horizontalLayout() as utility:
            pm.button( label='Function B', command= function_B ) # Second way to execute a command with a button
            btn_ID = pm.button( label='Function C', backgroundColor=[0,1,0] )
                # If we were to assign the command and pass the btn_ID within the same line as creating
                # the btn_ID variable, the command errors out and will stop the script from executing
                # rather than doing it that way, we can add a command to the button after it's been created
                # and give the callback identity of the element which was created.
            btn_ID.setCommand( pm.Callback(function_C, 'test', btn_ID) ) # Third way to assign/execute a command with a button
    
    # Fix spacing of layout elements
    base.redistribute(.1)
    header.redistribute(1,.1)
    
    # Last lines of code
    my_win.show()
 def toBakeLayout(self, plug) :
     """
     Layout for the geometryToBake connections.
     """
     self.currentNode = pm.PyNode(plug.split(".")[0]) # store the node linked to the AE
     
     pm.setUITemplate ("attributeEditorTemplate", pst=True)
     vLayout = pm.verticalLayout(ratios=[4, 1])
     
     # geometry textScrollList
     self.geometryToBakeTSL = pm.uitypes.TextScrollList(parent=vLayout)
     self.geometryToBakeTSL.setAllowMultiSelection(True)
     
     # button
     hLayout = pm.horizontalLayout(spacing=2)
     pm.uitypes.Button(parent=hLayout, l="Add", command=pm.Callback(self.bakeAddButtonCommand))
     pm.uitypes.Button(parent=hLayout, l="Remove", command=pm.Callback(self.bakeRemoveButtonCommand))
     pm.uitypes.Button(parent=hLayout, l="Refresh", command=pm.Callback(self.bakeRefreshButtonCommand))
     hLayout.redistribute()
     
     vLayout.redistribute()
     pm.setUITemplate(ppt=True)
     
     self.bakeRefreshButtonCommand()
Ejemplo n.º 23
0
def playoffMatchupWin(*a):
    def run(*a):
        matchups = {
            'ROSE': (),
            'SUGAR': (),
            'ORANGE': (),
            'COTTON': (),
            'FIESTA': (),
            'PEACH': ()
        }

        matchups['ROSE'] = rose_bowl_grp.getText().replace(" ", "").split(',')
        matchups['ROSE'].append(rose_bowl_bool.getValue())

        matchups['SUGAR'] = sugar_bowl_grp.getText().replace(" ",
                                                             "").split(',')
        matchups['SUGAR'].append(sugar_bowl_bool.getValue())

        matchups['ORANGE'] = orange_bowl_grp.getText().replace(" ",
                                                               "").split(',')
        matchups['ORANGE'].append(orange_bowl_bool.getValue())

        matchups['COTTON'] = cotton_bowl_grp.getText().replace(" ",
                                                               "").split(',')
        matchups['COTTON'].append(cotton_bowl_bool.getValue())

        matchups['FIESTA'] = fiesta_bowl_grp.getText().replace(" ",
                                                               "").split(',')
        matchups['FIESTA'].append(fiesta_bowl_bool.getValue())

        matchups['PEACH'] = peach_bowl_grp.getText().replace(" ",
                                                             "").split(',')
        matchups['PEACH'].append(peach_bowl_bool.getValue())

        do_cgd = cgd_chk.getValue()
        do_nys = nys_chk.getValue()
        do_cfp = cfp_chk.getValue()

        build.nysOpensBuild(matchups, cgd=do_cgd, nys=do_nys, playoff=do_cfp)

    try:
        pm.deleteUI('matchup_win')
    except:
        pass

    matchup_win = pm.window('matchup_win',
                            tlb=True,
                            rtf=0,
                            s=1,
                            title='NYS / Playoff Matchup Selector')
    top = pm.verticalLayout(width=200, p=matchup_win)

    lay = pm.horizontalLayout(p=top)
    inst_text = """    Enter the matchups for each bowl, separated by commas.
        Then check the boxes to the right to indicate the two PLAYOFF bowls."""
    inst_text_ui = pm.text(label=inst_text,
                           font='boldLabelFont',
                           align='left',
                           p=lay)
    lay.redistribute()

    lay = pm.horizontalLayout(p=top)
    cgd_chk = pm.checkBox(l='Gameday', p=lay)
    nys_chk = pm.checkBox(l='NYS', p=lay)
    cfp_chk = pm.checkBox(l='Playoffs', p=lay)
    lay.redistribute()

    lay = pm.horizontalLayout(height=10, p=top)
    rose_bowl_grp = pm.textFieldGrp(label='Rose Bowl:', p=lay, cw2=(70, 300))
    rose_bowl_bool = pm.checkBox(label='', p=lay)
    lay.redistribute(40, 5)

    lay = pm.horizontalLayout(p=top)
    sugar_bowl_grp = pm.textFieldGrp(label='Sugar Bowl:', p=lay, cw2=(70, 300))
    sugar_bowl_bool = pm.checkBox(label='', p=lay)
    lay.redistribute(40, 5)

    lay = pm.horizontalLayout(p=top)
    orange_bowl_grp = pm.textFieldGrp(label='Orange Bowl:',
                                      p=lay,
                                      cw2=(70, 300))
    orange_bowl_bool = pm.checkBox(label='', p=lay)
    lay.redistribute(40, 5)

    lay = pm.horizontalLayout(p=top)
    cotton_bowl_grp = pm.textFieldGrp(label='Cotton Bowl:',
                                      p=lay,
                                      cw2=(70, 300))
    cotton_bowl_bool = pm.checkBox(label='', p=lay)
    lay.redistribute(40, 5)

    lay = pm.horizontalLayout(p=top)
    fiesta_bowl_grp = pm.textFieldGrp(label='Fiesta Bowl:',
                                      p=lay,
                                      cw2=(70, 300))
    fiesta_bowl_bool = pm.checkBox(label='', p=lay)
    lay.redistribute(40, 5)

    lay = pm.horizontalLayout(p=top)
    peach_bowl_grp = pm.textFieldGrp(label='Peach Bowl:', p=lay, cw2=(70, 300))
    peach_bowl_bool = pm.checkBox(label='', p=lay)
    lay.redistribute(40, 5)

    lay = pm.horizontalLayout(p=top)
    exec_btn = pm.button(label='Build', height=30, align='right', c=run)
    lay.redistribute()

    top.redistribute(1)
    matchup_win.setHeight(200)
    matchup_win.setWidth(250)
    matchup_win.show()
Ejemplo n.º 24
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Define Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout()

        #=======================================================================
        # Define PSD Create Layout
        #=======================================================================
        pm.setParent(self.widgets['top_level_layout'])
        self.widgets["psd_create_column"] = pm.columnLayout(adj=True, rowSpacing=1, columnAttach = ['both', 5])
        pm.text(label = "Create PSD Driver")
        pm.separator()
        
        pm.setParent(self.widgets['psd_create_column'])
        self.widgets["psd_prefix_row"] = pm.rowLayout( numberOfColumns = 3 , adj=2)
        pm.text('Prefix :')
        self.widgets["psd_prefix_textField"] = pm.textField()
        self.widgets["psd_prefix_button"] = pm.button(label="<<", command = pm.Callback(self.selected_to_textField_cmd, self.widgets["psd_prefix_textField"]))

        pm.setParent(self.widgets['psd_create_column'])
        self.widgets["psd_parent_obj_row"] = pm.rowLayout( numberOfColumns = 3 , adj=2)
        pm.text('Parent Object :')
        self.widgets["psd_parent_obj_textField"] = pm.textField()
        self.widgets["psd_parent_obj_button"] = pm.button(label="<<", command = pm.Callback(self.selected_to_textField_cmd, self.widgets["psd_parent_obj_textField"]))
        
        pm.setParent(self.widgets['psd_create_column'])
        self.widgets["psd_base_obj_row"] = pm.rowLayout( numberOfColumns = 3 , adj=2)
        pm.text('Base Object :')
        self.widgets["psd_base_obj_textField"] = pm.textField()
        self.widgets["psd_base_obj_button"] = pm.button(label="<<", command = pm.Callback(self.selected_to_textField_cmd, self.widgets["psd_base_obj_textField"]))
        
        pm.setParent(self.widgets['psd_create_column'])
        self.widgets["psd_target_obj_row"] = pm.rowLayout( numberOfColumns = 3 , adj=2)
        pm.text('Target Object :')
        self.widgets["psd_target_obj_textField"] = pm.textField()
        self.widgets["psd_target_obj_button"] = pm.button(label="<<", command = pm.Callback(self.selected_to_textField_cmd, self.widgets["psd_target_obj_textField"]))

        pm.setParent(self.widgets['psd_create_column'])        
        self.widgets['psd_start_angle_layout'] = pm.horizontalLayout()
        pm.text(label = 'Start Angle')
        self.widgets["psd_start_angle_intField"] = pm.intField( minValue=0, max=180, value=45 )
        self.widgets["psd_create_button"] = pm.button(label="Create", command = self.create_psd_driver_cmd)
        self.widgets['psd_start_angle_layout'].redistribute(0,1,1)

        pm.setParent(self.widgets['psd_create_column'])
        pm.text('')
        pm.text(label="PSD Driver Display")
        pm.separator()
        
        self.widgets['psd_driver_display_layout'] = pm.horizontalLayout()
        self.widgets["psd_create_display_button"] = pm.button(label="On", command = self.display_psd_driver_on_cmd)
        self.widgets["psd_delete_display_button"] = pm.button(label="Off", command = self.display_psd_driver_off_cmd)
        self.widgets['psd_driver_display_layout'].redistribute()

        #=======================================================================
        # Redistribute
        #=======================================================================

        self.widgets['top_level_layout'].redistribute()
Ejemplo n.º 25
0
def select_same_components():
    """ Selects same components on multiple objects after storing component type/number
    Args (None)
    Returns (None)
    Usage:
        select_same_components()
    """
    title='ssc'
    w, h = 250, 100
    if pm.window(title, q=True, ex=True):
        pm.deleteUI(title)
    if pm.windowPref(title, q=True, ex=True):
        pm.windowPref(title, r=True)
    
    # Experimenting with nested definitions for a simple call and integration into bigger code
    def on_btn_get_select_press(options, text_field, *args):
        if pm.ls(sl=True):
            components = pm.ls(sl=True, fl=True)
            type = None
            if isinstance(components[0], pm.nt.general.MeshEdge):
                type = 'edge'
            elif isinstance(components[0], pm.nt.general.MeshVertex):
                type = 'vertex'
            elif isinstance(components[0], pm.nt.general.MeshFace):
                type = 'face'
            
            if type:
                options.setSelect(lut[type])
                text_field.setText(', '.join([str(component.index()) for component in components]))

    # Experimenting with nested definitions for a simple call and integration into bigger code
    def on_btn_exec_press(options, text_field, *args):
        type = lut_reverse[str(options.getSelect())]
        indices = [int(index_str) for index_str in text_field.getText().split(', ') if index_str != '']
        to_select = []
        for xform in pm.ls(sl=True, type='transform'):
            for index in indices:
                if type=='edge':
                    to_select.append(xform.e[index])
                elif type=='vertex':
                    to_select.append(xform.v[index])
                elif type=='face':
                    to_select.append(xform.f[index])
        pm.select(to_select, r=True)
            
    # Actual window
    win = pm.window(title, w=w, h=h, title='select same components!')
    
    layout_overall = pm.formLayout()
    layout_frame = pm.frameLayout('Select Same Components', p=layout_overall)
    layout_main = pm.columnLayout(p=layout_frame)
    pm.text('Store your selection and then run on all objects', p=layout_main)
    
    option_menu_component = pm.optionMenu( label='Component Type', p=layout_main, en=False)
    pm.menuItem( label='v' )
    pm.menuItem( label='f' )
    pm.menuItem( label='e' )
    lut = {'vertex':1, 'face':2, 'edge':3}
    lut_reverse = {'1':'vertex', '2':'face', '3':'edge'}
    
    layout_textfield = pm.horizontalLayout(p=layout_main, w=w)
    textfield_input = pm.textField(p=layout_textfield,en=False)
    btn_get_select = pm.button('Store Index', p=layout_textfield, c=pm.Callback(on_btn_get_select_press, option_menu_component, textfield_input))
    
    btn_exec = pm.button('run', w=w, p=layout_main, c=pm.Callback(on_btn_exec_press, option_menu_component, textfield_input))
    
    # Finalize
    layout_textfield.redistribute(2.5,1)
    win.show()
Ejemplo n.º 26
0
 def __init__(self, baseFilePath, placerMapping, indMapping, meshNames):
     '''
     create UI and init vars
     '''
     self.imageRefPath = baseFilePath
     self.placerMapping = placerMapping
     self.indMapping = indMapping
     self.mesh = meshNames['face']
     self.lf_eye = meshNames['leftEye']
     self.rt_eye = meshNames['rightEye']
     self.locTweakWidgets = {}
     self.placementGrp = None
     
     with pm.menu(l='Options') as menuOptions:
         pm.menuItem(l='Refresh')
         pm.menuItem(l='Reset')
     
     with pm.menu(l='Help') as menuHelp:
         pm.menuItem(l='Documentation')
         pm.menuItem(l='About')
     
     with pm.tabLayout() as mainTab:
         
         with pm.columnLayout(adj=True) as geoSelectionLayout:
             pass
         
         with pm.columnLayout(adj=True) as jntPlacementLayout:
         
             with pm.verticalLayout(ratios=(1,10,1), spacing=10) as jntPlacementVertLayout:
                 
                 #self.chk_symmetry = pm.checkBox(l='Symmetry', v=True)
                 with pm.horizontalLayout() as startPlacementLayout:
                     self.btn_startJntPlacement = pm.button(l='Start Joint Placement', 
                                                            c=pm.Callback(self.startJointPlacement),
                                                            w=180)
                 
                 self.img_jntReference = pm.image(image=self.imageRefPath+'default.jpg')
             
                 with pm.rowLayout(numberOfColumns=3, adj=2) as jntRowLayout:
                     self.btn_jntScrollLt = pm.button(l='<<', w=40, en=False)
                     self.txt_jntCurrent = pm.text(label='Click "Start Joint Placement" above to begin.', align='center')
                     self.btn_jntScrollRt = pm.button(l='>>', w=40, c=pm.Callback(self.selectNextItem), en=False)
             
             pm.separator(style='in')
             
             with pm.horizontalLayout(ratios=(1,5), spacing=5):
                 
                 with pm.verticalLayout():
                     # left labels
                     self.locTweakWidgets['txt_position'] = pm.text(label='Position', 
                                                                    align='right', en=False)
                     self.locTweakWidgets['txt_orient'] = pm.text(label='Orient', 
                                                                    align='right', en=False)
                     self.locTweakWidgets['txt_scale'] = pm.text(label='Scale', 
                                                                    align='right', en=False)
                     self.locTweakWidgets['txt_mirror'] = pm.text(label='Mirror', 
                                                                    align='right', en=False)
                 with pm.verticalLayout():
                     # right buttons
                     with pm.horizontalLayout():
                         self.locTweakWidgets['btn_prevCV'] = pm.button(l='Prev CV', en=False,
                                                                        c=pm.Callback(self.stepCV, -1))
                         self.locTweakWidgets['btn_nextCV'] = pm.button(l='Next CV', en=False,
                                                                        c=pm.Callback(self.stepCV, 1))
                         self.locTweakWidgets['btn_snapToVtx'] = pm.button(l='Snap to Vtx', en=False)
                         self.locTweakWidgets['btn_user'] = pm.button(l='User', en=False)
                         
                     with pm.horizontalLayout():
                         self.locTweakWidgets['btn_normal'] = pm.button(l='Normal', en=False)
                         self.locTweakWidgets['btn_normal_yup'] = pm.button(l='Normal + Y-up', en=False)
                         self.locTweakWidgets['btn_world'] = pm.button(l='World', en=False)
                         self.locTweakWidgets['btn_orient_user'] = pm.button(l='User', en=False)
                         
                     with pm.horizontalLayout():
                         self.locTweakWidgets['float_scale'] = pm.floatSliderGrp(f=True,
                                                                 min=0.01, max=1.0, v=0.5,
                                                             pre=2, fmx=10.0, en=False,
                                                             dc=pm.Callback(self.editLocScale))
                     with pm.horizontalLayout():
                         self.locTweakWidgets['btn_mirLtToRt'] = pm.button(l='Left to Right', en=False,
                                                                           c=pm.Callback(self.mirrorLocs))
                         self.locTweakWidgets['btn_mirRtToLt'] = pm.button(l='Right to Left', en=False)
             
             pm.separator(style='in')
             
             
             
             with pm.verticalLayout(spacing=5) as buildRigVertLayout:
                 self.btn_updateLocs = pm.button(l='Update All Locators', en=False)
                 self.btn_buildRig = pm.button(l='Build Rig', c=pm.Callback(self.buildRig), en=False)
         
         with pm.columnLayout(adj=True) as deformationLayout:
             pass
         
         with pm.columnLayout(adj=True) as motionLayout:
             pass
         
         with pm.columnLayout(adj=True) as actionsLayout:
             pass
             
     mainTab.setTabLabel((geoSelectionLayout,'Geometry'))
     mainTab.setTabLabel((jntPlacementLayout,'Joints'))
     mainTab.setTabLabel((deformationLayout,'Deformation'))
     mainTab.setTabLabel((motionLayout,'Motion'))
     mainTab.setTabLabel((actionsLayout,'Action Units'))
     mainTab.setSelectTab(jntPlacementLayout)
     
     self.show()
Ejemplo n.º 27
0
        print '接続元' ,sList[i],'⇒','接続先',dList[i]

    # plugsObj = cmds.listConnections(selectObj,plugs=True)
    # destinationObj = cmds.listConnections(selectObj,destination=True)
    # sourceObj = cmds.listConnections(selectObj,source=True,destination=True)
    # skipConversionNodesObj = cmds.listConnections(selectObj,skipConversionNodes = True)
    # printConnectionInfo(selectObj,'in')
    # print '接続リスト', connectList,'plugs',plugsObj,'destination',destinationObj,'source',sourceObj,'skipConversionNodes',skipConversionNodesObj




with pm.window( title = 'アタッチ!', width=300) as testWin:
    with pm.columnLayout( adjustableColumn=True):
        with pm.frameLayout( label='アタッチ'):
            with pm.horizontalLayout( ):
                attach = pm.button( label='アタッチ!' , command='print attachObj(0)  ')
                locate = pm.button( label='アタッチ!(ローカル軸)' , command='print attachObj(1)  ')
        with pm.frameLayout( label='ロケーター作成'):
            with pm.horizontalLayout( ):
                attach = pm.button( label='ロケーター作成' , command='print createLocate(0)  ')
                locate = pm.button( label='ロケーター作成(ローカル軸)' , command='print createLocate(1)  ')
        with pm.frameLayout( label='オフセットオブジェクトの作成'):
            prefix = pm.radioButtonGrp( numberOfRadioButtons=2, #radioButtonGrp: 最大4個1グループのラジオボタンを作成 numberOfRadioButtons:[nrb]の短縮系でも可。ラジオボタンの個数を指定。
            label='接頭辞の設定:', #グループの名前
            labelArray2=['置き換え','追加'],
            select=1)
            pm.separator()
            offsetname = pm.textFieldGrp( label='オフセットの接頭辞',pht='Offset')
            pm.button( label='オフセット実行' , command='print createJointOffset(offsetname.getText())')
        with pm.frameLayout( label='ノードの接続'):
Ejemplo n.º 28
0
    def initialiseLayout(self):
        #=======================================================================
        # Define Layout
        #=======================================================================
        self.widgets['toplevelLayout'] = pm.horizontalLayout(ratios=[2,5])
        
        #=======================================================================
        # Left Layout
        #=======================================================================
        pm.setParent(self.widgets['toplevelLayout'])
        
        self.widgets["leftLayout"] = pm.verticalLayout(ratios=[1,1,30])
        
        pm.text(label='Asset Filter :', align='left')
        self.widgets['asset_filter'] = pm.textField(changeCommand=self.refreshAssetButtonList)
        self.widgets["asset_scroll"] = pm.scrollLayout(childResizable=True)
        self.widgets['asset_layout'] = pm.verticalLayout()
        
        self.refreshAssetButtonList()

        self.widgets["leftLayout"].redistribute()  

        #=======================================================================
        # Right Layout
        #=======================================================================
        pm.setParent(self.widgets['toplevelLayout'])

        self.widgets["rightLayout"] = pm.verticalLayout(ratios=[8, 1, 2])

        self.widgets["PickerLayout"] = pm.verticalLayout(ratios=[8, 1])
        pm.setParent("..")
        self.widgets["ToolLayout"] = pm.frameLayout(lv=False)
        pm.setParent("..")
        self.widgets["OptionLayout"] = pm.frameLayout(lv=False)
        
        self.widgets["rightLayout"].redistribute()          

        #=======================================================================
        # Redistribute
        #=======================================================================
        self.widgets['toplevelLayout'].redistribute()        
        
        #=======================================================================
        # Picker
        #=======================================================================
        pm.setParent(self.widgets['PickerLayout'])
        
        pm.frameLayout(lv=False)
        
        pm.setParent(self.widgets['PickerLayout'])
        
        v = pm.verticalLayout(ratios=[1, 1, 1], spacing=0)
        
        h1 = pm.horizontalLayout(spacing=0)
        pm.button(label = "Global")
        pm.button(label = "Local")
        pm.setParent("..")
        
        h2 = pm.horizontalLayout(spacing=0)
        pm.button(label = "Root")
        pm.button(label = "Custome Attr")
        pm.setParent("..")

        pm.button(label = "Select All")
        pm.setParent("..")        
        
        v.redistribute()
        h1.redistribute()
        h2.redistribute()
        self.widgets['PickerLayout'].redistribute()
        
        
        #=======================================================================
        # Tools Bar
        #=======================================================================
        pm.setParent(self.widgets['ToolLayout'])
        
        v = pm.verticalLayout(spacing=0)
        
        h1 = pm.horizontalLayout(spacing=0)
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.setParent("..")
        
        h2 = pm.horizontalLayout(spacing=0)
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.iconTextButton(style='iconOnly', image='circle.png')
        pm.setParent("..")
             
        
        v.redistribute()
        h1.redistribute()
        h2.redistribute()

        #=======================================================================
        # Options Bar
        #=======================================================================
        pm.setParent(self.widgets['OptionLayout'])
Ejemplo n.º 29
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout()
        
        #=======================================================================
        # Select By Name
        #=======================================================================
        cmds.setParent(self.widgets['top_level_layout'])
        self.widgets["select_by_name_column"] = pm.columnLayout(adj=True, rowSpacing=2, columnAttach = ['both', 5])

        cmds.setParent(self.widgets["select_by_name_column"])
        pm.text(label = "Select By Name")
        pm.separator()
        self.widgets['select_by_name_button_layout'] = pm.horizontalLayout()
        self.widgets["select_by_name_textField"] = pm.textField(enterCommand = self.select_by_name_cmd, aie = True)
        self.widgets["select_by_name_button"] = pm.button(label="Select", command=self.select_by_name_cmd)
        self.widgets["select_hi_button"] = pm.button(label="-hi", command=self.select_hierarchy_cmd)
        self.widgets['select_by_name_button_layout'].redistribute(8,3,1)        
        
        cmds.setParent(self.widgets["select_by_name_column"])        
        self.widgets['select_by_name_filter_button_layout'] = pm.horizontalLayout()
        pm.text(label = 'Type :')
        self.widgets["select_by_name_filter_textField"] = pm.textField()
        self.widgets["select_by_name_filter_button"] = pm.button(label="Filter Selected", command=self.filter_selected_cmd)
        self.widgets['select_by_name_filter_button_layout'].redistribute(0,2,1)
        
        cmds.setParent(self.widgets["select_by_name_column"])
        self.widgets['select_by_name_preset_layout'] = pm.horizontalLayout()
        self.widgets['sbn_preset_transform_button'] = pm.button(label = 'Transform', command=pm.Callback(self.sbn_filter_preset_cmd, "transform"))
        self.widgets['sbn_preset_mesh_button'] = pm.button(label = 'Mesh', command=pm.Callback(self.sbn_filter_preset_cmd, "mesh"))
        self.widgets['sbn_preset_locator_button'] = pm.button(label = 'Locator', command=pm.Callback(self.sbn_filter_preset_cmd, "locator"))
        self.widgets['sbn_preset_curve_button'] = pm.button(label = 'Curve', command=pm.Callback(self.sbn_filter_preset_cmd, "nurbsCurve"))
        self.widgets['sbn_preset_joint_button'] = pm.button(label = 'Joint', command=pm.Callback(self.sbn_filter_preset_cmd, "joint"))
        self.widgets['select_by_name_preset_layout'].redistribute()
        
        #=======================================================================
        # Hash Rename Layout
        #=======================================================================
        cmds.setParent(self.widgets['top_level_layout'])
        self.widgets["hash_rename_column"] = pm.columnLayout(adj=True, rowSpacing=2, columnAttach = ['both', 5])

        pm.text(label = "Hash Rename")
        pm.text(label = "(example : arm_##_joint)")
        pm.separator()        
        self.widgets["rename_textField"] = pm.textField(enterCommand = self.hash_rename_cmd, aie = True)
        
        self.widgets['hash_rename_button_layout'] = pm.horizontalLayout()
        pm.text(label = 'Start #')
        self.widgets["start_num_intField"] = pm.intField( minValue=1, value=1 )
        self.widgets["rename_button"] = pm.button(label="Rename", command=self.hash_rename_cmd)
        self.widgets['hash_rename_button_layout'].redistribute(0,1,1)
 
        #=======================================================================
        # Search and Replace
        #=======================================================================
        cmds.setParent(self.widgets['top_level_layout'])
        self.widgets["search_replace_column"] = pm.columnLayout(adj=True, rowSpacing=2, columnAttach = ['both', 5])

        pm.text(label = "Search and Replace")
        pm.separator()        
        self.widgets['search_replace_button_layout'] = pm.horizontalLayout()
        self.widgets["search_replace_field_column"] = pm.rowColumnLayout( numberOfColumns = 2 )
        pm.text("Search : ")
        self.widgets["search_textFieldGrp"] = pm.textField()
        pm.text("Replace : ")
        self.widgets["replace_textFieldGrp"] = pm.textField()
        
        cmds.setParent(self.widgets['search_replace_button_layout'])
        self.widgets['sr_preset_clear_button'] = pm.button(label = 'X', command=pm.Callback(self.search_replace_preset_cmd, '', ''))
        self.widgets["search_replace_button"] = pm.button(label="Go", command=self.search_replace_cmd)
        self.widgets['search_replace_button_layout'].redistribute(10, 1, 5)
        
        cmds.setParent(self.widgets["search_replace_column"])
        self.widgets['search_replace_preset_layout'] = pm.horizontalLayout()
        self.widgets['sr_preset_LR_button'] = pm.button(label = '_L >> _R', command=pm.Callback(self.search_replace_preset_cmd, '_L', '_R'))
        self.widgets['sr_preset_RL_button'] = pm.button(label = '_R >> _L', command=pm.Callback(self.search_replace_preset_cmd, '_R', '_L'))
        self.widgets['search_replace_preset_layout'].redistribute()
        
        #=======================================================================
        # Prefix & Suffix
        #=======================================================================
        cmds.setParent(self.widgets['top_level_layout'])
        self.widgets["prefix_suffix_column"] = pm.columnLayout(adj=True, rowSpacing=2, columnAttach = ['both', 5])

        pm.text(label = "Prefix & Suffix")
        pm.separator()   

        cmds.setParent(self.widgets["prefix_suffix_column"])    
        self.widgets['prefix_suffix_button_layout'] = pm.horizontalLayout()
        self.widgets["prefix_suffix_field_column"] = pm.rowColumnLayout( numberOfColumns = 2 )
        pm.text('Prefix : ')
        self.widgets["prefix_textFieldGrp"] = pm.textField()
        pm.text('Suffix : ')
        self.widgets["suffix_textFieldGrp"] = pm.textField()
        
        cmds.setParent(self.widgets['prefix_suffix_button_layout'])
        self.widgets['p_preset_clear_button'] = pm.button(label = 'X', command=self.prefix_suffix_clear_cmd)        
        self.widgets["prefix_suffix_button"] = pm.button(label="Go", command=self.prefix_suffix_cmd)
        self.widgets['prefix_suffix_button_layout'].redistribute(10,1,5)

        cmds.setParent(self.widgets["prefix_suffix_column"])
        self.widgets['prefix_preset_layout'] = pm.horizontalLayout()
        self.widgets['p_preset_L_button'] = pm.button(label = 'LO_', command=pm.Callback(self.prefix_preset_cmd, "LO_"))
        self.widgets['p_preset_C_button'] = pm.button(label = 'bind_', command=pm.Callback(self.prefix_preset_cmd, "bind_"))
        pm.button(label='', enable=False)
        pm.button(label='', enable=False)
        pm.button(label='', enable=False)
        self.widgets['prefix_preset_layout'].redistribute()
        
        cmds.setParent(self.widgets["prefix_suffix_column"])
        self.widgets['suffix_preset_layout'] = pm.horizontalLayout()
        self.widgets['s_preset_L_button'] = pm.button(label = '_L', command=pm.Callback(self.suffix_preset_cmd, "_L"))
        self.widgets['s_preset_C_button'] = pm.button(label = '_C', command=pm.Callback(self.suffix_preset_cmd, "_C"))        
        self.widgets['s_preset_R_button'] = pm.button(label = '_R', command=pm.Callback(self.suffix_preset_cmd, "_R"))
        pm.button(label='', enable=False)
        pm.button(label='', enable=False)        
        self.widgets['suffix_preset_layout'].redistribute()
        
        #=======================================================================
        # Unqiue Rename
        #=======================================================================
        cmds.setParent(self.widgets['top_level_layout'])
        self.widgets["unqiue_rename_column"] = pm.columnLayout(adj=True, rowSpacing=2, columnAttach = ['both', 5])

        pm.text("")
        pm.text(label = "Unqiue Rename")
        pm.separator()
        self.widgets["select_non_unqiue_button"] = pm.button(label="Select Non-Unqiue Objects", command=self.select_non_unqiue_cmd)
        self.widgets["unqiue_rename_button"] = pm.button(label="Unqiue Rename", command=self.unqiue_rename_cmd)
              
        #=======================================================================
        # Redistribute
        #=======================================================================
        self.widgets['top_level_layout'].redistribute()
Ejemplo n.º 30
0
    def initialiseLayout(self):
        
        #=======================================================================
        # Top Level Layout
        #=======================================================================
        self.widgets['top_level_layout'] = pm.verticalLayout()
        self.widgets['top_level_column'] = pm.columnLayout(adj=True, rowSpacing=2, columnAttach = ['both', 5])

        #=======================================================================
        # NAME
        #=======================================================================
        #------------------------------------------------------------- Separator
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.separator(style='out')
        pm.text(label=' Name ')
        pm.separator(style='out')
        h.redistribute(1,1,1)           

        #------------------------------------------------------- Prefix / Suffix
        pm.setParent(self.widgets['top_level_column'])
        self.widgets["suffix_TFG"] = pm.textFieldGrp(label='Suffix :', cw=[1,50], adj=2, text='ctrl')

        #=======================================================================
        # CONTROL
        #=======================================================================
        #------------------------------------------------------------- Separator
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.separator(style='out')
        pm.text(label=' Control ')
        pm.separator(style='out')
        h.redistribute(1,1,1)        

        #----------------------------------------------------------- Offset Node
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        self.widgets['offsetNode_CB'] = pm.checkBox( label = 'Offset Node ', value=True)
        self.widgets['offsetNode_TF'] = pm.textField(text='Offset')
        h.redistribute(1,2)
        
        #--------------------------------------------------------------- Cluster
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        self.widgets['cluster_CB'] = pm.checkBox( label = 'Control Cluster', value=False)
        self.widgets['clusterGroup_RBG'] = pm.radioButtonGrp( labelArray2=['Each', 'All'], 
                                                              numberOfRadioButtons=2 , 
                                                              cw=[1,100], 
                                                              adj=3, 
                                                              select=1)
        h.redistribute(1,2)
        
        #------------------------------------------------------------- ShapeNode
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        self.widgets['shape_CB'] = pm.checkBox( label = 'Shape Node ', value=True)
        self.widgets['shape_TSL'] = pm.textScrollList( numberOfRows=5, 
                                                       allowMultiSelection=False, 
                                                       append = self.shapeList, 
                                                       selectIndexedItem=1)
        h.redistribute(1,2)
        
        #------------------------------------------------------------ Shape Axis
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.text(label = 'Shape Axis')
        self.widgets['shapeAxis_OM'] = pm.optionMenu()
        pm.menuItem(label = "+x")
        pm.menuItem(label = "+y")
        pm.menuItem(label = "+z")
        pm.menuItem(label = "-x")
        pm.menuItem(label = "-y")
        pm.menuItem(label = "-z")        
        h.redistribute(1,2)
        
        #------------------------------------------------------------- Hierarchy
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()  
        pm.text(label='Parent')      
        self.widgets['hierarchry_RB'] = pm.radioButtonGrp( labelArray2=['World', 'Selection Order'], 
                                                           numberOfRadioButtons=2 , 
                                                           cw=[1,100], 
                                                           adj=3, 
                                                           select=1)
        h.redistribute(1,2)        
        
        #------------------------------------------------------- Constraint Type
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.text(label='Constraint Type:')
        self.widgets['tConst_CB'] = pm.checkBox(label='Point', value=False)
        self.widgets['rConst_CB'] = pm.checkBox(label='Orient', value=False)
        h.redistribute(1,1,1)
        
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.text(label="")
        self.widgets['pConst_CB'] = pm.checkBox(label='Parent', value=True)
        self.widgets['sConst_CB'] = pm.checkBox(label='Scale', value=True)
        h.redistribute(1,1,1)   
        
        #--------------------------------------------------------- Create Button
        pm.setParent(self.widgets['top_level_column'])
        self.widgets['create_BTN'] = pm.button( label="Create Control(s)",
                                                h=50, 
                                                c=pm.Callback(self.create_BTN_pressed))
        
        
        #=======================================================================
        # EDIT
        #=======================================================================

        #------------------------------------------------------------- Separator
        pm.setParent(self.widgets['top_level_column'])
        pm.separator(style="none", h=10)
                
        h = pm.horizontalLayout()
        pm.separator(style='out')
        pm.text(label=' Edit Color')
        pm.separator(style='out')
        h.redistribute(1,1,1)            
        
        #----------------------------------------------------------------- Color
        pm.setParent(self.widgets['top_level_column'])
        main_layout = pm.formLayout()
        columns = 32 / 2
        rows = 2
        cell_width = 24
        cell_height = 24

        self.widgets['color_palette'] = pm.palettePort( dimensions=(columns, rows), 
                                                        transparent=0,
                                                        width=(columns*cell_width),
                                                        height=(rows*cell_height),
                                                        topDown=True,
                                                        colorEditable=False,
                                                        changeCommand=pm.Callback(self.color_palette_changed));
        for index in range(1, 32):
            color_component = pm.colorIndex(index, q=True)
            pm.palettePort( self.widgets['color_palette'],
                            edit=True,
                            rgbValue=(index, color_component[0], color_component[1], color_component[2]))


        #------------------------------------------------------------- Separator
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.separator(style='out')
        pm.text(label=' Edit Channels')
        pm.separator(style='out')
        h.redistribute(1,1,1)     
        
        #--------------------------------------------------------------- Channel
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.text(label='Translate')
        self.widgets['tHide_BTN'] = pm.button(label='Hide', command=pm.Callback(self.tHide_BTN_pressed))        
        self.widgets['tShow_BTN'] = pm.button(label='Show', command=pm.Callback(self.tShow_BTN_pressed))
        pm.text(label='Rotate')
        self.widgets['rHide_BTN'] = pm.button(label='Hide', command=pm.Callback(self.rHide_BTN_pressed))        
        self.widgets['rShow_BTN'] = pm.button(label='Show', command=pm.Callback(self.rShow_BTN_pressed))
        h.redistribute(1,1,1,1,1,1)

        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.text(label='Scale')
        self.widgets['sHide_BTN'] = pm.button(label='Hide', command=pm.Callback(self.sHide_BTN_pressed))        
        self.widgets['sShow_BTN'] = pm.button(label='Show', command=pm.Callback(self.sShow_BTN_pressed))
        pm.text(label='Visibility')
        self.widgets['vHide_BTN'] = pm.button(label='Hide', command=pm.Callback(self.vHide_BTN_pressed))        
        self.widgets['vShow_BTN'] = pm.button(label='Show', command=pm.Callback(self.vShow_BTN_pressed))
        h.redistribute(1,1,1,1,1,1)        

        #------------------------------------------------------------ Separator
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.separator(style='out')
        pm.text(label=' Pivot Offset Control')
        pm.separator(style='out')
        h.redistribute(1,1,1)     
        
        #---------------------------------------------------------- Pivot Offset
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        self.widgets['pivotOffset_IFG'] = pm.intFieldGrp( numberOfFields=1, 
                                                          value1=1, 
                                                          label='Control Size :', 
                                                          cw2=[100, 50], 
                                                          adj=2)        
        self.widgets['add_pivotOffset_BTN'] = pm.button( label = 'Add', command=pm.Callback(self.add_pivotOffset_BTN_pressed))
        self.widgets['remove_pivotOffset_BTN'] = pm.button( label = 'Remove', command=pm.Callback(self.remove_pivotOffset_BTN_pressed))
        h.redistribute(3,1,1)
        
        #------------------------------------------------------------ Separator
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        pm.separator(style='out')
        pm.text(label=' Text Shape')
        pm.separator(style='out')
        h.redistribute(1,1,1)     
                
        #------------------------------------------------------------ Text Shape
        pm.setParent(self.widgets['top_level_column'])
        h = pm.horizontalLayout()
        self.widgets['textShape_TFG'] = pm.textFieldGrp(  label='Text :', 
                                                          cw2=[100, 50], 
                                                          adj=2)        
        self.widgets['add_textShape_BTN'] = pm.button( label = 'Add', command=pm.Callback(self.add_textShape_BTN_pressed))
        h.redistribute(3,2)        
        
        #=======================================================================
        # Redistribute
        #=======================================================================
        self.widgets['top_level_layout'].redistribute()                           
Ejemplo n.º 31
0
 def create(self):
     # destroy the window if it already exists
     try:
         pm.deleteUI(self.WINDOW_NAME, window=True)
     except: pass
     # draw the window
     with pm.window(self.WINDOW_NAME) as res_window:
         with pm.columnLayout(adjustableColumn=True):
             with pm.horizontalLayout():
                 pm.text(label='Resolution')
                 with pm.optionMenu() as self.res_menu:
                     pm.menuItem(l='Low')
                     pm.menuItem(l='Med')
                     pm.menuItem(l='Hi')
                 set_res_btn = pm.button(
                     label='Set LOD',
                     command=pm.Callback(self.on_set_res_btn)
                 )
             pm.separator(style='in', height=4)
             with pm.horizontalLayout() as h1:
                 pm.text(label='Low')
                 select_low_btn = pm.button(
                     label='Select All',
                     command=pm.Callback(
                         self.on_select_btn,
                         'Low'
                     )
                 )
                 toggle_low_btn = pm.button(
                     label='Toggle Visibility',
                     command=pm.Callback(
                         self.on_vis_btn,
                         'Low'
                     )
                 )
             with pm.horizontalLayout() as h1:
                 pm.text(label='Medium')
                 select_med_btn = pm.button(
                     label='Select All',
                     command=pm.Callback(
                         self.on_select_btn,
                         'Med'
                     )
                 )
                 toggle_med_btn = pm.button(
                     label='Toggle Visibility',
                     command=pm.Callback(
                         self.on_vis_btn,
                         'Med'
                     )
                 )
             with pm.horizontalLayout() as h1:
                 pm.text(label='High')
                 select_hi_btn = pm.button(
                     label='Select All',
                     command=pm.Callback(
                         self.on_select_btn,
                         'Hi'
                     )
                 )
                 toggle_hi_btn = pm.button(
                     label='Toggle Visibility',
                     command=pm.Callback(
                         self.on_vis_btn,
                         'Hi'
                     )
                 )
             self.status_line = pm.textField(editable=False)
         res_window.setWidthHeight((350,140))
Ejemplo n.º 32
0
	pm.deleteUI('sketch_deformer_ui')


# -------------------------- UI -----------------------------------------------------

with pm.window("sketch_deformer_ui", title="sketch_deformer_ui", width=300 ) as sketch_deformer_ui:
    with pm.columnLayout( adjustableColumn=True, rowSpacing=0):
        
        
        # ----------------------------------------------------------------------------
        pm.separator(height=20, style ="double")
        
        # 基本的なコマンド
        with pm.frameLayout( label='basic operation', labelAlign='top',  cll = 1, cl = 0) :
        
            with pm.horizontalLayout(spacing = 10):
                pm.button (label = "clean", c =lambda *args:tools.deltemp())
            
                pm.button (
                        label  = "形状の初期化",
                        c      = lambda *args: shape_initialization(),
                        h = 40
                    )

                pm.button(
                    label = "Reset",
                    c = lambda *args : reset(),
                    h = 40
                )

        
Ejemplo n.º 33
0
    def initialiseLayout(self):

        # Layout
        self.widgets["top_column"] = pm.columnLayout(adj=True)

        pm.setParent(self.widgets["top_column"])
        h1 = pm.horizontalLayout()
        pm.text("Control Label : ", align="right")
        self.widgets["control_label"] = pm.textField()
        h1.redistribute(1, 2)

        pm.setParent(self.widgets["top_column"])
        h2 = pm.horizontalLayout()
        pm.text("Input Type : ", align="right")
        self.widgets["input_type"] = pm.optionMenu(changeCommand=self.init_options_layout)
        pm.menuItem(label="Single Shape")
        pm.menuItem(label="Two Shapes")
        pm.menuItem(label="Pair Shape")
        pm.menuItem(label="Two Pair Shapes")
        pm.menuItem(label="Four Shapes")
        h2.redistribute(1, 2)

        pm.setParent(self.widgets["top_column"])
        h7 = pm.horizontalLayout()
        pm.text("Parent Group : ", align="right")
        self.widgets["parent_group"] = pm.optionMenu()
        pm.menuItem(label="Eyes_Ctrl")
        pm.menuItem(label="Mouth_Ctrl")
        h7.redistribute(1, 2)

        pm.setParent(self.widgets["top_column"])
        pm.separator(h=15)
        pm.text("Control Type :", h=20)
        self.widgets["control_type"] = pm.textScrollList(ams=False, height=40)

        pm.setParent(self.widgets["top_column"])
        pm.text("Direction :", h=20)
        self.widgets["control_direction"] = pm.textScrollList(ams=False, height=40)

        pm.separator(h=15)

        pm.setParent(self.widgets["top_column"])
        h3 = pm.horizontalLayout()
        self.widgets["input_shape_1_text"] = pm.text("Shape 1 : ", align="right")
        self.widgets["input_shape_1"] = pm.textField()
        self.widgets["assign_input_shape_1_button"] = pm.button(
            label="<<", c=pm.Callback(self.assign_input_shape, self.widgets["input_shape_1"])
        )
        h3.redistribute(2, 5, 1)

        pm.setParent(self.widgets["top_column"])
        h4 = pm.horizontalLayout()
        self.widgets["input_shape_2_text"] = pm.text("Shape 2 : ", align="right")
        self.widgets["input_shape_2"] = pm.textField()
        self.widgets["assign_input_shape_2_button"] = pm.button(
            label="<<", c=pm.Callback(self.assign_input_shape, self.widgets["input_shape_2"])
        )
        h4.redistribute(2, 5, 1)

        pm.setParent(self.widgets["top_column"])
        h5 = pm.horizontalLayout()
        self.widgets["input_shape_3_text"] = pm.text("Shape 3 : ", align="right")
        self.widgets["input_shape_3"] = pm.textField()
        self.widgets["assign_input_shape_3_button"] = pm.button(
            label="<<", c=pm.Callback(self.assign_input_shape, self.widgets["input_shape_3"])
        )
        h5.redistribute(2, 5, 1)

        pm.setParent(self.widgets["top_column"])
        h6 = pm.horizontalLayout()
        self.widgets["input_shape_4_text"] = pm.text("Shape 4 : ", align="right")
        self.widgets["input_shape_4"] = pm.textField()
        self.widgets["assign_input_shape_4_button"] = pm.button(
            label="<<", c=pm.Callback(self.assign_input_shape, self.widgets["input_shape_4"])
        )
        h6.redistribute(2, 5, 1)

        pm.setParent(self.widgets["top_column"])
        pm.separator(h=20)
        self.widgets["create_button"] = pm.button(label="Create", c=self.create_facial_control, h=40)

        self.init_options_layout()
Ejemplo n.º 34
0
    def __init__(self,
                 operation=0,
                 setTargetFromSelection=True,
                 menuBarVisible=True,
                 space=om.MSpace.kObject,
                 minDeltaLength=0.00001,
                 templateDuplicate=True,
                 visibleDuplicate=True):
        """
        :param operation: (int) 0=Smooth delta, 1=Copy vertex, 2=Closest point,
        3=Closest vertex, 4=Average vertex
        :param setTargetFromSelection: (bool) if there is no previous target
        stored (=first time running the UI in the maya instance) use the current
        selection
        :param space: (int) om.MSpace.k___
        :param menuBarVisible: (bool) settings menuBar visibility
        :param minDeltaLength: (float) deltas shorter than this are ignored
        :param templateDuplicate: (bool) duplicate.template=___
        :param visibleDuplicate: (bool) duplicate.visibility=___
        """
        initializeMaya()
        self.minDeltaLengthDefault = minDeltaLength
        with pm.verticalLayout() as mainLayout:
            with pm.menuBarLayout() as self.menuBar:
                self.space = pm.menu(label='Space', tearOff=True)
                pm.radioMenuItemCollection()
                self.spaces = []
                for name, value in self.getSpaceStrings(space):
                    self.spaces.append(
                        pm.menuItem(label=name,
                                    radioButton=value,
                                    command=pm.Callback(
                                        self.syncMelVariablesWithUi)))

                pm.menu(label='Settings')
                self.templateDuplicate = pm.menuItem(
                    label='template DUPLICATE', checkBox=templateDuplicate)
                self.visibleDuplicate = pm.menuItem(label='visible DUPLICATE',
                                                    checkBox=visibleDuplicate)
                self.minDeltaLength = pm.menuItem(
                    label='minDeltaLength: {}'.format(minDeltaLength),
                    command=pm.Callback(self.setMinDeltaLengthDialog))
                pm.menu(label='Help')
                # pm.menuItem(label='TODO: demo video (vimeo)')
                # pm.menuItem(label='TODO: latest installer (...)')
                pm.menuItem(label='latest version (github)',
                            command=pm.Callback(self.getLatestVersion))
            self.menuBar.setMenuBarVisible(menuBarVisible)
            with pm.horizontalLayout() as targetLayout:
                pm.button(l='Target:',
                          c=pm.Callback(self.setTargetFromSelection))
                self.target = pm.textField(en=False)
                variableTest = mm.eval('whatIs "$prDP_operation"')
                if variableTest != 'Unknown':
                    self.target.setText(mm.eval('$tempMelVar=$prDP_driver'))
            targetLayout.redistribute(0, 1)
            pm.popupMenu(parent=targetLayout, button=3)
            pm.menuItem(label='intermediate of selection',
                        c=pm.Callback(self.setTargetFromSelectionIntermediate))
            pm.menuItem(label='DUPLICATE of selection',
                        c=pm.Callback(self.setTargetFromDuplicateOfSelection))

            with pm.verticalLayout() as operationLayout:
                self.operation1 = pm.radioButtonGrp(
                    labelArray2=['Smooth delta', 'Copy vertex'],
                    numberOfRadioButtons=2,
                    columnWidth2=[110, 110],
                    columnAlign2=['left', 'left'],
                    changeCommand=pm.Callback(self.syncMelVariablesWithUi))
                self.operation1.setSelect(operation + 1)
                self.operation2 = pm.radioButtonGrp(
                    shareCollection=self.operation1,
                    labelArray2=['Closest point', 'Closest vertex'],
                    numberOfRadioButtons=2,
                    columnWidth2=[110, 110],
                    columnAlign2=['left', 'left'],
                    changeCommand=pm.Callback(self.syncMelVariablesWithUi))
                pm.separator()
                self.operation3 = pm.radioButtonGrp(
                    shareCollection=self.operation1,
                    label1='Average vertex',
                    numberOfRadioButtons=1,
                    columnWidth=[1, 110],
                    columnAlign=[1, 'left'],
                    changeCommand=pm.Callback(self.syncMelVariablesWithUi))
            operationLayout.redistribute(5, 5, 1, 5)

            pm.popupMenu(parent=operationLayout, button=3)
            pm.menuItem(label='toggle menuBar',
                        c=pm.Callback(self.toggleMenuBar))

            with pm.horizontalLayout() as toolLayout:
                pm.button(label='Enter Tool',
                          command=pm.Callback(self.enterTool))
                pm.button(label='Close', command=pm.Callback(self.close))
            toolLayout.redistribute()
        mainLayout.redistribute(0, 0, 0, 1)

        if setTargetFromSelection and not self.target.getText():
            self.setTargetFromSelection()

        self.show()
        self.syncMelVariablesWithUi()
Ejemplo n.º 35
0
    ) == 'nurbsCurve':  #obj.getChildren()の場合、transformじゃなくてshapeが取れるっぽい?よくわからない。getparentの場合、この処理は必要ない。なぜ?
        return True
    if pm.objectType(obj) == 'transform' and obj.getShape(
    ):  #オブジェクトタイプがtransform かつシェイプを持っている場合。'transform'の条件式付け足すと上手くいくっぽい理由がわからない。
        shape = obj.getShape()
        if pm.objectType(shape) == 'nurbsCurve':
            return True
        else:
            return False
    else:
        return False


with pm.window(title='リグセレクターユーティリティ', width=300) as testWin:
    with pm.columnLayout(adjustableColumn=True):
        with pm.horizontalLayout():
            pm.toolCollection()
            rotateButton = pm.toolButton(tool='RotateSuperContext',
                                         toolImage1=('RotateSuperContext',
                                                     'rotate_M.xpm'),
                                         style='iconAndTextHorizontal')
            moveButton = pm.toolButton(tool='moveSuperContext',
                                       toolImage1=('moveSuperContext',
                                                   'move_M.xpm'),
                                       style='iconAndTextHorizontal')
        with pm.frameLayout(label='リセット'):
            # pm.text(label='リセット')
            with pm.horizontalLayout() as reset_Rotate:
                # pm.iconTextButton( label='リセット' , command='print resetRotate("")  ',image1='rotate_M.xpm',style='iconAndTextHorizontal',bgc=[0.35,0.35,0.35])
                pm.button(label='リセット',
                          command='print resetRotate("")  ',
Ejemplo n.º 36
0
    def uIGenerator(self):

        if pm.window(self.myWinName, query=True, exists=True):
            pm.deleteUI(self.myWinName)

        try:
            if pm.windowPref(self.myWinName, query=True,
                             exists=True) and self.window_development:
                pm.windowPref(self.myWinName, remove=True)
        except RuntimeError:
            pass

        myWindow = pm.window(self.myWinName,
                             title='Object Instancer',
                             widthHeight=[600, 300])

        base = pm.verticalLayout()

        with base:
            with pm.verticalLayout() as header:

                title = pm.text(label='Object Instancer'.upper())
                pm.separator()

            with pm.verticalLayout() as target:

                self.targetInstances = pm.intSliderGrp(
                    label="Target Instances",
                    field=True,
                    minValue=0,
                    maxValue=1000,
                    changeCommand=self.storeTargetInstances)

                pm.separator()

            with pm.verticalLayout() as randomization:

                title3 = pm.text(label='Randomization')
                self.rotation = pm.checkBoxGrp(
                    numberOfCheckBoxes=3,
                    label="Rotation    ",
                    labelArray3=("RotateX", "RotateY", "RotateZ"),
                    changeCommand=self.storeRotations)
                self.translation = pm.checkBoxGrp(
                    numberOfCheckBoxes=3,
                    label="Translation    ",
                    labelArray3=("TransX", "TransY", "TransZ"),
                    changeCommand=self.storeTranslation)
                pm.separator()

            with pm.verticalLayout() as Randomness:

                self.rRPecentage = pm.floatSliderGrp(
                    label="Rotation Randomness",
                    field=True,
                    minValue=0,
                    maxValue=100)
                self.tRPecentage = pm.floatSliderGrp(
                    label="Translation Randomness",
                    field=True,
                    minValue=0,
                    maxValue=100)

            with pm.horizontalLayout() as Button:

                pm.button(label='Generate',
                          backgroundColor=[0, 1, 0.5],
                          align='left',
                          command=self.generate)

        base.redistribute(.4)

        header.redistribute(1, .1)

        myWindow.show()
Ejemplo n.º 37
0
    def __init__(self, baseFilePath, placerMapping, indMapping, meshNames):
        '''
        create UI and init vars
        '''
        self.imageRefPath = baseFilePath
        self.placerMapping = placerMapping
        self.indMapping = indMapping
        self.mesh = meshNames['face']
        self.lf_eye = meshNames['leftEye']
        self.rt_eye = meshNames['rightEye']
        self.locTweakWidgets = {}
        self.placementGrp = None

        with pm.menu(l='Options') as menuOptions:
            pm.menuItem(l='Refresh')
            pm.menuItem(l='Reset')

        with pm.menu(l='Help') as menuHelp:
            pm.menuItem(l='Documentation')
            pm.menuItem(l='About')

        with pm.tabLayout() as mainTab:

            with pm.columnLayout(adj=True) as geoSelectionLayout:
                pass

            with pm.columnLayout(adj=True) as jntPlacementLayout:

                with pm.verticalLayout(ratios=(1, 10, 1),
                                       spacing=10) as jntPlacementVertLayout:

                    #self.chk_symmetry = pm.checkBox(l='Symmetry', v=True)
                    with pm.horizontalLayout() as startPlacementLayout:
                        self.btn_startJntPlacement = pm.button(
                            l='Start Joint Placement',
                            c=pm.Callback(self.startJointPlacement),
                            w=180)

                    self.img_jntReference = pm.image(image=self.imageRefPath +
                                                     'default.jpg')

                    with pm.rowLayout(numberOfColumns=3,
                                      adj=2) as jntRowLayout:
                        self.btn_jntScrollLt = pm.button(l='<<',
                                                         w=40,
                                                         en=False)
                        self.txt_jntCurrent = pm.text(
                            label=
                            'Click "Start Joint Placement" above to begin.',
                            align='center')
                        self.btn_jntScrollRt = pm.button(
                            l='>>',
                            w=40,
                            c=pm.Callback(self.selectNextItem),
                            en=False)

                pm.separator(style='in')

                with pm.horizontalLayout(ratios=(1, 5), spacing=5):

                    with pm.verticalLayout():
                        # left labels
                        self.locTweakWidgets['txt_position'] = pm.text(
                            label='Position', align='right', en=False)
                        self.locTweakWidgets['txt_orient'] = pm.text(
                            label='Orient', align='right', en=False)
                        self.locTweakWidgets['txt_scale'] = pm.text(
                            label='Scale', align='right', en=False)
                        self.locTweakWidgets['txt_mirror'] = pm.text(
                            label='Mirror', align='right', en=False)
                    with pm.verticalLayout():
                        # right buttons
                        with pm.horizontalLayout():
                            self.locTweakWidgets['btn_prevCV'] = pm.button(
                                l='Prev CV',
                                en=False,
                                c=pm.Callback(self.stepCV, -1))
                            self.locTweakWidgets['btn_nextCV'] = pm.button(
                                l='Next CV',
                                en=False,
                                c=pm.Callback(self.stepCV, 1))
                            self.locTweakWidgets['btn_snapToVtx'] = pm.button(
                                l='Snap to Vtx', en=False)
                            self.locTweakWidgets['btn_user'] = pm.button(
                                l='User', en=False)

                        with pm.horizontalLayout():
                            self.locTweakWidgets['btn_normal'] = pm.button(
                                l='Normal', en=False)
                            self.locTweakWidgets['btn_normal_yup'] = pm.button(
                                l='Normal + Y-up', en=False)
                            self.locTweakWidgets['btn_world'] = pm.button(
                                l='World', en=False)
                            self.locTweakWidgets[
                                'btn_orient_user'] = pm.button(l='User',
                                                               en=False)

                        with pm.horizontalLayout():
                            self.locTweakWidgets[
                                'float_scale'] = pm.floatSliderGrp(
                                    f=True,
                                    min=0.01,
                                    max=1.0,
                                    v=0.5,
                                    pre=2,
                                    fmx=10.0,
                                    en=False,
                                    dc=pm.Callback(self.editLocScale))
                        with pm.horizontalLayout():
                            self.locTweakWidgets['btn_mirLtToRt'] = pm.button(
                                l='Left to Right',
                                en=False,
                                c=pm.Callback(self.mirrorLocs))
                            self.locTweakWidgets['btn_mirRtToLt'] = pm.button(
                                l='Right to Left', en=False)

                pm.separator(style='in')

                with pm.verticalLayout(spacing=5) as buildRigVertLayout:
                    self.btn_updateLocs = pm.button(l='Update All Locators',
                                                    en=False)
                    self.btn_buildRig = pm.button(l='Build Rig',
                                                  c=pm.Callback(self.buildRig),
                                                  en=False)

            with pm.columnLayout(adj=True) as deformationLayout:
                pass

            with pm.columnLayout(adj=True) as motionLayout:
                pass

            with pm.columnLayout(adj=True) as actionsLayout:
                pass

        mainTab.setTabLabel((geoSelectionLayout, 'Geometry'))
        mainTab.setTabLabel((jntPlacementLayout, 'Joints'))
        mainTab.setTabLabel((deformationLayout, 'Deformation'))
        mainTab.setTabLabel((motionLayout, 'Motion'))
        mainTab.setTabLabel((actionsLayout, 'Action Units'))
        mainTab.setSelectTab(jntPlacementLayout)

        self.show()