Пример #1
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()
Пример #2
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)
Пример #3
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()
Пример #4
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()
    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)
Пример #6
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)
Пример #7
0
 def __init__(self, window_title="b_tools_window"):
     if pm.window(window_title, exists=True):
         pm.deleteUI(window_title)
         
     self.win = pm.window(window_title)
     self.mainLayout = pm.verticalLayout()
     self.setup_ui()
     self.create_execute_buttons()
     self.win.show()
Пример #8
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()
Пример #9
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()
Пример #10
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()
Пример #11
0
    def addCallback(self):
        """ Create UI and parent any editors. """
        # delete window
        if pm.window(self.winName, ex=True):
            pm.deleteUI(self.winName)
        
        self._win = None
        self.applyMetrics()
        
        p = pm.currentParent()

        self.deleteViews()
        with pm.window(title=self.title) as self._win:
            self._mainLayout = pm.verticalLayout()
        pm.verticalLayout(self._mainLayout, e=True, p=p)

        self._win = self._mainLayout
        self.mainControl = self._mainLayout
        self.showDefaultView()
        pm.evalDeferred(self.refreshScriptJobs)
Пример #12
0
    def UI(self):
        # 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 self.window_development:
                pm.windowPref(self.win_name, remove=True)
        except RuntimeError:
            pass

        # Declare the GUI window which we want to work with
        self.my_win = pm.window(self.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('FK/IK Setup')
                pm.separator()
            with pm.verticalLayout(
            ):  # The assignment of a variable to the layout is optional
                #pm.button( ) # This button does nothing!
                pm.button(label='Create Guides',
                          command=self.FKIK_create_guides
                          )  # First way to execute a command with a button
                pm.button(label='Create Joints',
                          command=self.FKIK_create_joints_from_guides
                          )  # First way to execute a command with a button
                #pm.button( label='Create Orient Helper', command= self.FKIK_query_guide_orient )

        # Fix spacing of layout elements
        base.redistribute(.1)
        header.redistribute(1, .1)

        # Last lines of code
        self.my_win.show()
Пример #13
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()
Пример #14
0
    def doIt(self, args):

        result = pm.promptDialog(title='Kraken: Build Biped',
                                 message='Rig Name',
                                 button=['OK', 'Cancel'],
                                 defaultButton='OK',
                                 cancelButton='Cancel',
                                 text='Biped')

        if result == 'OK':
            guideName = pm.promptDialog(query=True, text=True)
            guideName.replace(' ', '')
            guideName += '_guide'

            guideRig = BipedGuideRig(guideName)

            builder = plugins.getBuilder()

            OpenMaya.MGlobal.displayInfo('Kraken: Building Guide Rig: ' +
                                         guideName)

            try:
                main_window = pm.ui.Window(pm.MelGlobals.get('gMainWindow'))
                main_win_width = pm.window(main_window, query=True, width=True)

                buildMsgWin = pm.window("KrakenBuildBipedWin",
                                        title="Kraken: Build Biped",
                                        width=200,
                                        height=100,
                                        sizeable=False,
                                        titleBar=False,
                                        leftEdge=(main_win_width / 2) - 100)

                buildMsglayout = pm.verticalLayout(spacing=10)
                buildMsgText = pm.text('Kraken: Building Biped')
                buildMsglayout.redistribute()
                buildMsgWin.show()

                pm.refresh()

                builtRig = builder.build(guideRig)

                return builtRig

            finally:
                if pm.window("KrakenBuildBipedWin", exists=True) is True:
                    pm.deleteUI(buildMsgWin)

        else:
            OpenMaya.MGlobal.displayWarning(
                'Kraken: Build Guide Rig Cancelled!')
Пример #15
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()
Пример #16
0
    def refreshAssetButtonList(self, *args):
        pm.setParent(self.widgets["asset_scroll"])

        pm.deleteUI(self.widgets['asset_layout'])
        
        self.widgets['asset_layout'] = pm.verticalLayout()
        
        search = pm.textField(self.widgets['asset_filter'], q=True, text=True)
        
        for asset in cmds.ls("*%s*:master" %search, assemblies=True):
            self.createAssetButton(asset)
            pm.setParent(self.widgets["asset_layout"])
            
        self.widgets['asset_layout'].redistribute()
Пример #17
0
    def doIt(self, args):

        result = pm.promptDialog(title='Kraken: Build Biped',
                                 message='Rig Name',
                                 button=['OK', 'Cancel'],
                                 defaultButton='OK',
                                 cancelButton='Cancel',
                                 text='Biped')

        if result == 'OK':
            guideName = pm.promptDialog(query=True, text=True)
            guideName.replace(' ', '')
            guideName += '_guide'

            guideRig = BipedGuideRig(guideName)

            builder = plugins.getBuilder()

            OpenMaya.MGlobal.displayInfo('Kraken: Building Guide Rig: ' + guideName)

            try:
                main_window = pm.ui.Window(pm.MelGlobals.get('gMainWindow'))
                main_win_width = pm.window(main_window, query=True, width=True)

                buildMsgWin = pm.window("KrakenBuildBipedWin",
                                        title="Kraken: Build Biped",
                                        width=200,
                                        height=100,
                                        sizeable=False,
                                        titleBar=False,
                                        leftEdge=(main_win_width / 2) - 100)

                buildMsglayout = pm.verticalLayout(spacing=10)
                buildMsgText = pm.text('Kraken: Building Biped')
                buildMsglayout.redistribute()
                buildMsgWin.show()

                pm.refresh()

                builtRig = builder.build(guideRig)

                return builtRig

            finally:
                if pm.window("KrakenBuildBipedWin", exists=True) is True:
                    pm.deleteUI(buildMsgWin)

        else:
            OpenMaya.MGlobal.displayWarning('Kraken: Build Guide Rig Cancelled!')
Пример #18
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()
Пример #19
0
def lookupTricode(*a):
    def _lookup(*a):
        _team = team.Team(pm.textFieldGrp(text, q=True, text=True))

        try:
            _tri = _team.tricode
        except AttributeError:
            _tri = None

        if _tri:
            pm.text(tri,
                    edit=True,
                    label='         Tricode :  ' + str(_team.tricode))
            pm.colorSliderGrp(color_pri,
                              edit=True,
                              rgb=rendering.convertColor(_team.primary))
            pm.colorSliderGrp(color_sec,
                              edit=True,
                              rgb=rendering.convertColor(_team.secondary))
        else:
            pm.text(tri, edit=True, label='         Tricode :  NOT FOUND')

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

    win = pm.window('lookupTricode',
                    tlb=True,
                    rtf=True,
                    s=False,
                    title='Lookup Team Tricode')
    lay = pm.verticalLayout(width=200, p=win)
    text = pm.textFieldGrp(label='Team Name : ',
                           p=lay,
                           cw2=(70, 130),
                           cc=_lookup)
    tri = pm.text(label='         Tricode : ', p=lay, align='left')
    color_pri = pm.colorSliderGrp(label='Primary : ',
                                  rgb=(0, 0, 0),
                                  cw3=(70, 130, 0))
    color_sec = pm.colorSliderGrp(label='Secondary : ',
                                  rgb=(0, 0, 0),
                                  cw3=(70, 130, 0))
    lay.redistribute()

    win.show()
Пример #20
0
    def showUI(self):
        self.interface = {}
        windowTitle = 'Out Placeholder'
        if pmc.window(windowTitle.replace(" ", "_"), exists=True):
            pmc.deleteUI(windowTitle.replace(" ", "_"), window=True)

        columWidth = [[1,60], [2,60], [3,250]]
        self.interface['mainWindow'] = pmc.window(windowTitle, title=windowTitle)
        self.interface['layout'] = pmc.verticalLayout()
        self.interface['text'] = pmc.text(l=str(self.shaders.keys()), fn='boldLabelFont', h=30)
        self.interface['rotate'] = pmc.floatSliderGrp(label='Rotate UV', value=0, field=True, columnWidth=columWidth, step=0.01, minValue=-360.0, maxValue=360.0, fieldMinValue=-360.0, fieldMaxValue=360.0, dragCommand=functools.partial(self.rotate), changeCommand=functools.partial(self.rotate))
        self.interface['repeat'] = pmc.floatSliderGrp(label='Repeat UV', value=1, field=True, columnWidth=columWidth, step=0.01, minValue=0.001, maxValue=10.0, fieldMinValue=0.001, fieldMaxValue=10.0, dragCommand=functools.partial(self.repeat), changeCommand=functools.partial(self.repeat))
        self.interface['offsetV'] = pmc.floatSliderGrp(label='Offset U', value=0, field=True, columnWidth=columWidth, step=0.01, minValue=-1.0, maxValue=1.0, fieldMinValue=-1.0, fieldMaxValue=1.0, fs=0.01, dragCommand=functools.partial(self.offsetU), changeCommand=functools.partial(self.offsetU))
        self.interface['offsetV'] = pmc.floatSliderGrp(label='Offset V', value=0, field=True, columnWidth=columWidth, step=-0.01, minValue=-1.0, maxValue=1.0, fieldMinValue=-1.0, fieldMaxValue=1.0, fs=0.01, dragCommand=functools.partial(self.offsetV), changeCommand=functools.partial(self.offsetV))
        self.interface['execute'] = cmds.button(l='Get the (real) power!', c=functools.partial(self.execute))
        self.interface['layout'].redistribute()
        self.interface['mainWindow'].show()
Пример #21
0
def setup_window():
    win_name = "twinPipeSetupUI"
    if pm.window(win_name, exists=True):
        pm.deleteUI(win_name)

    with pm.window(win_name, title="TwinPipe Setup", height=400):
        with pm.verticalLayout():
            pm.button(label="Install Git Tools...",
                      bgc=(0.5, 0.6, 0.4),
                      c=lambda _: git_setup())
            pm.button(label="Clone Project from MBOXX",
                      bgc=(0.5, 0.6, 0.65),
                      c=lambda _: clone_project())
            pm.button(label="Set Project",
                      bgc=(0.4, 0.55, 0.45),
                      c=lambda _: set_project())
            pm.separator()
            pm.button(label="Map MBOXX to M:\\ drive",
                      c=lambda _: mboxx_setup())
Пример #22
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()
Пример #23
0
    def show(self):
        if self.dock :
            if pm.dockControl(self.window+"_dock", exists = True):
                pm.deleteUI(self.window+"_dock")
        else:
            if pm.window (self.window, exists = True) :
                pm.deleteUI (self.window)
            
        if pm.windowPref(self.window, exists=True ):
            pm.windowPref(self.window, remove=True ) 

        # Initalise Window Layout
        self.widgets["window"] = pm.window(self.window,
                                           title=self.title,
                                           sizeable=self.dock or self.sizeable,
                                           mnb=False,
                                           mxb=False,
                                           width=self.windowWidth,
                                           height=self.windowHeight)
        
        self.widgets["master_layout"] = pm.verticalLayout()
        
        # Initalise Layout
        self.initialiseLayout()
        
        # Redistribute Layout
        self.widgets["master_layout"].redistribute()
        
        if self.dock:
            pm.dockControl(self.window + "_dock",
                           label = self.title,
                           area=self.allowArea[0],
                           allowedArea=self.allowArea ,
                           content = self.window)
        else:
            pm.showWindow(self.window)
        
        return self.widgets["window"]
Пример #24
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["prefix_textField"] = pm.textFieldGrp(label='prefix', text='testRibbon', cw=[1,100], adj=2)
        self.widgets["numJoint_intField"] = pm.intFieldGrp(label='number of joints', cw=[1,100], adj=2, value1=10)
        self.widgets["spans_intField"] = pm.intFieldGrp(label='number of spans', cw=[1,100], adj=2, value1=5)
        
        self.widgets["create_button"] = pm.button(label="Create", command=self.create_ribbon_callback)        
        
        #=======================================================================
        # Redistribute
        #=======================================================================
        self.widgets['top_level_layout'].redistribute()
Пример #25
0
    def setup_ui(self):
        with pm.verticalLayout():
            pm.separator(height=40, style="none")

            pm.checkBox(label='Setup General Hotkeys',
                        value=pm.optionVar.get(
                            HotkeyOptionsMenu.kSetupGeneralHotkeys, True),
                        changeCommand=self.set_option_var_general)

            pm.checkBox(label='Setup Animation Hotkeys',
                        value=pm.optionVar.get(
                            HotkeyOptionsMenu.kSetupAnimationHotkeys, True),
                        changeCommand=self.set_option_var_animation)

            pm.checkBox(label='Setup Modeling Hotkeys',
                        value=pm.optionVar.get(
                            HotkeyOptionsMenu.kSetupModelingHotkeys, True),
                        changeCommand=self.set_option_var_modeling)

            pm.checkBox(label='Setup Rigging Hotkeys',
                        value=pm.optionVar.get(
                            HotkeyOptionsMenu.kSetupRiggingHotkeys, True),
                        changeCommand=self.set_option_var_rigging)
 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()
Пример #27
0
    def showUI(self):
        self.interface = {}
        windowTitle = 'Out Placeholder'
        if pmc.window(windowTitle.replace(" ", "_"), exists=True):
            pmc.deleteUI(windowTitle.replace(" ", "_"), window=True)

        columWidth = [[1, 60], [2, 60], [3, 250]]
        self.interface['mainWindow'] = pmc.window(windowTitle,
                                                  title=windowTitle)
        self.interface['layout'] = pmc.verticalLayout()
        self.interface['text'] = pmc.text(l=str(self.shaders.keys()),
                                          fn='boldLabelFont',
                                          h=30)
        self.interface['rotate'] = pmc.floatSliderGrp(
            label='Rotate UV',
            value=0,
            field=True,
            columnWidth=columWidth,
            step=0.01,
            minValue=-360.0,
            maxValue=360.0,
            fieldMinValue=-360.0,
            fieldMaxValue=360.0,
            dragCommand=functools.partial(self.rotate),
            changeCommand=functools.partial(self.rotate))
        self.interface['repeat'] = pmc.floatSliderGrp(
            label='Repeat UV',
            value=1,
            field=True,
            columnWidth=columWidth,
            step=0.01,
            minValue=0.001,
            maxValue=10.0,
            fieldMinValue=0.001,
            fieldMaxValue=10.0,
            dragCommand=functools.partial(self.repeat),
            changeCommand=functools.partial(self.repeat))
        self.interface['offsetV'] = pmc.floatSliderGrp(
            label='Offset U',
            value=0,
            field=True,
            columnWidth=columWidth,
            step=0.01,
            minValue=-1.0,
            maxValue=1.0,
            fieldMinValue=-1.0,
            fieldMaxValue=1.0,
            fs=0.01,
            dragCommand=functools.partial(self.offsetU),
            changeCommand=functools.partial(self.offsetU))
        self.interface['offsetV'] = pmc.floatSliderGrp(
            label='Offset V',
            value=0,
            field=True,
            columnWidth=columWidth,
            step=-0.01,
            minValue=-1.0,
            maxValue=1.0,
            fieldMinValue=-1.0,
            fieldMaxValue=1.0,
            fs=0.01,
            dragCommand=functools.partial(self.offsetV),
            changeCommand=functools.partial(self.offsetV))
        self.interface['execute'] = cmds.button(l='Get the (real) power!',
                                                c=functools.partial(
                                                    self.execute))
        self.interface['layout'].redistribute()
        self.interface['mainWindow'].show()
Пример #28
0
    p = sel[len(sel) - 1]  #last item in the list is the parent

    for obj in sel:
        if obj == p:  #if the object is the target
            continue  #skip it
        else:
            const = pm.parentConstraint(p, obj,
                                        mo=mo)  #parent constrain command

    pm.select(sel)


### UI
try:
    pm.deleteUI('mpcwin')
except:
    pass
mpcwin = pm.window('mpcwin',
                   title='Multiple pConstraint:',
                   width=75,
                   tlb=True,
                   rtf=True)
col = pm.verticalLayout(width=75)
but = pm.button('but',
                l='Parent Constrain',
                c=lambda *args: multiParentConstraint(mo=pm.checkBox(
                    'cbox', q=True, v=True)))
cbox = pm.checkBox('cbox', l='Maintain offset ')
col.redistribute(1, 1)
pm.showWindow(mpcwin)
Пример #29
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()
Пример #30
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()
Пример #31
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()
Пример #32
0
    def setup_ui(self):
        slider_params = dict()
        slider_params["field"] = True
        slider_params["min"] = 0
        slider_params["max"] = 1
        slider_params["fmn"] = -500
        slider_params["fmx"] = 500
        slider_params["value"] = 0.5
        slider_params["sliderStep"] = 0.01

        main_layout = pm.verticalLayout()

        with pm.verticalLayout():
            self.strengthSlider = pm.floatSliderGrp(label="Strength: ",
                                                    **slider_params)
            self.keyDistanceSlider = pm.intSliderGrp(label="Key Distance: ",
                                                     field=True,
                                                     min=1,
                                                     max=30,
                                                     fmx=5000,
                                                     v=3)
            self.relativeCheckbox = pm.checkBox(label='Relative (Additive)',
                                                value=True)
            pm.separator(style='in')

        with pm.verticalLayout():
            slider_params["enable"] = False

            # Translation Sliders
            slider_params["value"] = 1
            pm.checkBox(label='Set Translation Multipliers',
                        changeCommand=self.toggle_translate_sliders)
            self.translationMultiplierSlider = pm.floatSliderGrp(
                label="Translation Multiplier: ", **slider_params)
            for axis in ["X", "Y", "Z"]:
                t_slider = pm.floatSliderGrp(
                    label="Translate {}: ".format(axis), **slider_params)
                self.translateSliders.append(t_slider)

            pm.separator(style='in')

            # Rotation Sliders
            pm.checkBox(label='Set Rotation Multipliers',
                        changeCommand=self.toggle_rotate_sliders)
            self.rotationMultiplierSlider = pm.floatSliderGrp(
                label="Rotation Multiplier", **slider_params)
            slider_params["max"] = 45
            slider_params["value"] = 45
            for axis in ["X", "Y", "Z"]:
                rSlider = pm.floatSliderGrp(label="Rotate {}: ".format(axis),
                                            **slider_params)
                self.rotateSliders.append(rSlider)

        pm.separator(style='in', height=20)

        # with pm.verticalLayout():
        #     targetsLayout = pm.horizontalLayout()
        #     with targetsLayout:
        #         self.targetsList = pm.textScrollList()
        #         pm.button("Set Targets", c=self.setTargets)

        # with pm.verticalLayout():
        pm.button("Make Some Noise",
                  c=self.make_shake,
                  backgroundColor=[0.2, 0.25, 0.49])
        # pm.button("Reset Settings")

        main_layout.redistribute(1, 1, 1)
    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()                           
Пример #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()
Пример #35
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'])
Пример #36
0
"""
Create a button that flashes green when you click it, before going back to its normal color
Very hacky, just for fun
"""

import time
import pymel.core as pmc


def gradient(*args):
    for i in xrange(0, 385, 40):
        pmc.button(interface['button'],
                   edit=True,
                   backgroundColor=(i / 1000., 0.385, i / 1000.))
        pmc.refresh()
        time.sleep(0.03)
    pmc.button(interface['button'], edit=True, noBackground=False)


windowName = 'Gradient'
if pmc.window(windowName, exists=True):
    pmc.deleteUI(windowName, window=True)

interface = {}
interface['mainWindow'] = pmc.window(windowName, title='test')
interface['layout'] = pmc.verticalLayout()
interface['button'] = pmc.button(label="Gradient me!", command=gradient)
interface['layout'].redistribute()
interface['mainWindow'].show()
Пример #37
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()
Пример #38
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()
Пример #39
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()