def __init__(self, parent):
   self.parent = parent
   self.win = pm.window('Attribute Setter', resizeToFitChildren=True)
   with self.win:
     self.col = pm.columnLayout()
     with self.col:
       self.helpButton = pm.button(
         label="Show Help",
         command=lambda x: self.showHelp(),
       )      
       ## Text label that says "Attribute to change:"
       self.attributeLabel = pm.text( 'Attribute to change:' )
       ## Text entry field, a place where the user will type in the attribute to change
       self.attributeField = pm.textField(  width=600   )
       ## Text label that says "New value for attribute:"
       self.valueLabel = pm.text( 'New value for attribute:' )
       ## Text entry field, a place where the user will type the new value to set the attribute to
       self.valueField = pm.textField(   width=600  )
       
       self.go = pm.button(
         label="Set Attributes",
         command=lambda x: self.parent.setAttributes(
           attribute=self.attributeField.getText(),
           value=self.valueField.getText(),
         )
       ) 
Beispiel #2
0
 def run(self):
     self.win = pm.window( title="Mmmm Baker Tool" )
     with self.win:
         self.col = pm.columnLayout()
         with self.col:
             self.spacers = []
             self.xnormalPathTextLabel = pm.text("Path and filename of xNormal executable:")
             self.xnormalPathTextField = pm.textField( width = 500, text="C:/Program Files/S.Orgaz/xNormal 3.19.2/x64/xNormal.exe" )
             self.spacers.append(  pm.text(" ")  )
             
             self.modelsPathTextLabel = pm.text("Path where models are:")
             self.modelsPathTextField = pm.textField( width = 500, text="C:/Users/Public/mmmmBaker" )
             self.modelsPathTextLabel2 = pm.text(
                 "(Warning, if changed, requires custom xnormal settings xml which points to new path.)"
             )                
             self.spacers.append(  pm.text(" ")  )
             
             self.highSuffixTextLabel = pm.text( 'High Suffix, on models for xnormals "high" model files, no extension' )
             self.highSuffixTextField = pm.textField( width = 500, text="_hi" )
             self.spacers.append(  pm.text(" ")  )
             
             #self.highSuffixTextLabel = pm.text( "Suffix on files: (not extension)" )
             #self.cageSuffixTextField = pm.textField( width = 500, text="_cage" )
             
             self.xmlFilesTextLabel = pm.text( "Xml files to bake, comma separated list:" )
             self.xmlFilesTextLabel2 = pm.text( "(xnormal settings files, should be in the same folder as models)" )
             self.xmlFilesTextField = pm.textField( width = 500, text="xnormal_settings_for_mmmmbaker_example.xml,xnormal_settings_for_mmmmbaker_example2.xml" )
             self.goButton = pm.button(  label="Go!  (Bake selected models) )", command=lambda x: self.go()  )
    def go(self):
        with self.win:
            self.col = pm.columnLayout()

            self.sourceText = pm.text("Attribute source")
            self.sourceField = pm.textField(width=300)

            self.text7 = pm.text(" ")
            self.targetText = pm.text("Attribute target")

            ## text that says attribute
            ## place to enter text for which attribute
            self.targetField = pm.textField(width=300)

            self.text5 = pm.text(" ")
            self.text6 = pm.text(
                "Multiplier (Only has affects resut if it is changed from the default 0.0 to another number.)"
            )
            self.multField = pm.floatField(width=300)

            self.button = pm.button(
                "Connect the attribute of the source to all the targets \n (source is first selected)",
                command=lambda x: self.parent.connectAttributes(
                    sourceAttrName=self.sourceField.getText(),
                    targetAttrName=self.targetField.getText(),
                    multiplier=self.multField.getValue(),
                ),
            )
            ## text that says value
            ## place to enter the new value
        self.win.show()
    def go(self):
        with self.win:
            self.col = pm.columnLayout()

            self.sourceText = pm.text("Attribute source")
            self.sourceField = pm.textField(width=300)

            self.text7 = pm.text(" ")
            self.targetText = pm.text("Attribute target")

            ## text that says attribute
            ## place to enter text for which attribute
            self.targetField = pm.textField(width=300)

            self.text5 = pm.text(" ")
            self.text6 = pm.text(
                "Multiplier (Only has affects resut if it is changed from the default 0.0 to another number.)"
            )
            self.multField = pm.floatField(width=300)

            self.button = pm.button(
                "Connect the attribute of the source to all the targets \n (source is first selected)",
                command=lambda x: self.parent.connectAttributes(
                    sourceAttrName=self.sourceField.getText(),
                    targetAttrName=self.targetField.getText(),
                    multiplier=self.multField.getValue()))
            ## text that says value
            ## place to enter the new value
        self.win.show()
Utils = UtilsMod.Utils

class ScripterEditorUi(object):
    def __init__(self,mmmmToolsRef=None,makeUi=True):
        widthForAll = 900 
        self.mmmmTools = mmmmToolsRef
        self.attrName = 'notes'   ##'mmmmScriptStringAttr'
        self.activeScriptText = ''
        self.scriptModule = None
        self.node = None
        self.codeString = ''
        self.activeScriptLabelStartText = "Actice Script being Edited is:  "
        self.win = pm.window("Scripter - Editor", width=widthForAll)
        initialUuid = str( uuid.uuid4() ).replace('-','_')

        with self.win:
            self.col = pm.columnLayout( width=600 )
            with self.col:
                self.notice = pm.text( '''NOTICE: Script Objects Use Object Notes attributes, which don't exist when blank. \n You may have to add to them manually if you can't use "get from selection".''')
                pm.text( " ")
                pm.text( "Script prefix: (it is recommended this be left as the default)" )
                self.scriptPrefixTextField = pm.textField(
                    text="script__",
                    width=widthForAll,
                )
                pm.text( "Script name: (it is recommended that you use a unique and descriptive name)" )                
                self.scriptNameTextField = pm.textField(
                    text=initialUuid,
                    width=widthForAll,
                )

                self.scriptGetButton = pm.button(
                    label="Make the script, or get the script if it already exists. (Works using the above fields, prefix and name.)",
                    command=lambda x: self.getScriptContents(),
                    width=widthForAll,
                )
                self.getScriptFromSelectionButton = pm.button(
                    label="Get Script From Selection / Make new script if no script on selection \n Autofills above fields when it find a script.",
                    command=lambda x: self.getScriptFromSelection(),
                    width=widthForAll,
                )
                
                pm.text( " " )
                pm.text( "   " )  ## different spaces used to keep unique names
                self.activeScriptText = pm.text( self.activeScriptLabelStartText )
                pm.text( "Script contents: (Editing here will immediately edit the corresponding mmmmScriptStringAttr attribute on the object.)" )
                self.scriptContentsScrollField = pm.scrollField(
                    keyPressCommand = lambda x: self.setScriptContents(),
                    changeCommand = lambda x: self.setScriptContents(),
                    width=widthForAll, height=500,                    
    def __init__(self, parentRef=None, mmmmToolsRef=None):
        self.mmmmTools = mmmmToolsRef
        self.parentRef = parentRef

        self.scriptFileRunner = MmmmScriptFileRunner(
            parentRef=self, mmmmToolsRef=self.mmmmTools)
        self.scriptFileRunner.findScripts()
        self.win = pm.window("Script File Runner")

        self.ddMenuEntires = []

        with self.win:
            self.col = pm.columnLayout()
            with self.col:
                self.textPath = pm.text("Path to scripts:")
                self.textFieldPath = pm.textField(
                    text=self.scriptFileRunner.searchPath,
                    width=400,
                    changeCommand=lambda x: self.onTextPathChangeCommand())
                self.btnRefresh = pm.button("Refresh Scripts",
                                            command=lambda x: self.buildMenu())

                self.text = pm.text("Script File To Run:")
                self.ddMenu = pm.optionMenu(changeCommand=self.onDdMenuChange)
                self.buildMenu()
                ## self.textFieldScript = pm.textField( width=500 )
                self.btnRunScript = pm.button(
                    "Run Script",
                    command=lambda x: self.scriptFileRunner.runScript(
                        self.chosenScript))
        self.win.show()
def insert_joints_UI():
    WINDOW = 'InsertJoints'
    if pm.window(WINDOW, query=True, exists=True):
        pm.deleteUI(WINDOW)
    pm.window(WINDOW,
              title="Insert Joints",
              iconName='CS',
              widthHeight=(200, 70))
    main_col = pm.columnLayout(adjustableColumn=True)
    pm.separator(height=5, style='none', parent=main_col)
    textip_col = pm.rowColumnLayout(numberOfColumns=2,
                                    parent=main_col,
                                    columnOffset=(1, "left", 5),
                                    columnSpacing=(2, 5))
    pm.separator(height=5, style='none', parent=main_col)
    butn_col = pm.rowColumnLayout(numberOfColumns=3,
                                  parent=main_col,
                                  columnOffset=(2, "left", 65))
    pm.text(label="number of joints", parent=textip_col)
    textip = pm.textField(text="", parent=textip_col)
    pm.text(label="", parent=butn_col)
    pm.button(label="Create",
              parent=butn_col,
              command=lambda x: call_fun(textip.getText()))
    pm.showWindow(WINDOW)
    pm.window(WINDOW, edit=True, widthHeight=(200, 70))
    return None
Beispiel #8
0
    def run(self):
        self.win = pm.window(title="Mmmm Baker Tool")
        with self.win:
            self.col = pm.columnLayout()
            with self.col:
                self.spacers = []
                self.xnormalPathTextLabel = pm.text(
                    "Path and filename of xNormal executable:")
                self.xnormalPathTextField = pm.textField(
                    width=500,
                    text=
                    "C:/Program Files/S.Orgaz/xNormal 3.19.2/x64/xNormal.exe")
                self.spacers.append(pm.text(" "))

                self.modelsPathTextLabel = pm.text("Path where models are:")
                self.modelsPathTextField = pm.textField(
                    width=500, text="C:/Users/Public/mmmmBaker")
                self.modelsPathTextLabel2 = pm.text(
                    "(Warning, if changed, requires custom xnormal settings xml which points to new path.)"
                )
                self.spacers.append(pm.text(" "))

                self.highSuffixTextLabel = pm.text(
                    'High Suffix, on models for xnormals "high" model files, no extension'
                )
                self.highSuffixTextField = pm.textField(width=500, text="_hi")
                self.spacers.append(pm.text(" "))

                #self.highSuffixTextLabel = pm.text( "Suffix on files: (not extension)" )
                #self.cageSuffixTextField = pm.textField( width = 500, text="_cage" )

                self.xmlFilesTextLabel = pm.text(
                    "Xml files to bake, comma separated list:")
                self.xmlFilesTextLabel2 = pm.text(
                    "(xnormal settings files, should be in the same folder as models)"
                )
                self.xmlFilesTextField = pm.textField(
                    width=500,
                    text=
                    "xnormal_settings_for_mmmmbaker_example.xml,xnormal_settings_for_mmmmbaker_example2.xml"
                )
                self.goButton = pm.button(
                    label="Go!  (Bake selected models) )",
                    command=lambda x: self.go())
 def __init__(self):
     self.window = pm.window( "Rename UI" )
     self.window.show()
     with self.window:
         self.col = pm.columnLayout()
         with self.col:
             pm.text( "Prefix Field" )
             self.prefixField = pm.textField( text="", width=300 )
             pm.text( "Search Field" )
             self.searchField = pm.textField( text="", width=300 )
             pm.text( "Replace Field" )
             self.replaceField = pm.textField( text="",width=300 )
             pm.text( "Suffix Field" )                
             self.suffixField = pm.textField( text="",width=300 )
             self.button = pm.button(
                 "Rename Selected",
                 command = lambda x: self.renameSelected()
             )
             self.button.setBackgroundColor( [0,0.5,0] )
             self.window.setWidth( 380 )
             self.window.setHeight( 180 )
Beispiel #10
0
    def manage_shape_ui(self):
        WINDOW = "add_control"
        chk_win = pm.window(WINDOW, query=True, exists=True)
        if chk_win:
            pm.deleteUI(WINDOW)
        pm.window(WINDOW, title="Manage_Shapes", iconName="MS")
        main_col = pm.columnLayout(parent=WINDOW, adjustableColumn=True)

        main_split_col = pm.rowColumnLayout(parent=main_col,
                                            numberOfColumns=2,
                                            columnOffset=(2, "left", 5))
        cmd_col = pm.columnLayout(parent=main_split_col)
        pm.separator(parent=main_col, height=10)
        mel_cmd_col = pm.columnLayout(parent=cmd_col,
                                      columnOffset=("left", 10))
        pm.text("\t\t\t\tShape Name", parent=mel_cmd_col)
        nm_txt = pm.textField(text="", parent=mel_cmd_col, width=300)
        pm.text("\t\t\t\tShape mel command", parent=mel_cmd_col)
        txt = pm.scrollField("",
                             wordWrap=True,
                             parent=mel_cmd_col,
                             height=130,
                             width=300)
        pm.separator(parent=main_col, height=10)
        add_btn_col = pm.columnLayout(parent=cmd_col,
                                      columnOffset=("left", 100))
        pm.button("add",
                  parent=add_btn_col,
                  width=100,
                  command=lambda x: self.add_ctr(cmd=txt.getText(),
                                                 nm=nm_txt.getText()))

        list_col = pm.columnLayout(parent=main_split_col)
        pm.text("\t\tExisting Shapes", parent=list_col)
        self.shp_lst_bx = pm.textScrollList(parent=list_col,
                                            height=165,
                                            width=170)

        edit_btn_col = pm.rowColumnLayout(numberOfColumns=3, parent=list_col)
        pm.button("Delete",
                  parent=edit_btn_col,
                  width=82,
                  command=lambda x: self.delete_selection())
        pm.separator(parent=edit_btn_col, horizontal=False)
        pm.button("rename",
                  parent=edit_btn_col,
                  width=82,
                  command=lambda x: self.rename_ui())

        pm.showWindow(WINDOW)
        pm.window(WINDOW, edit=True, widthHeight=(500, 220))
        return None
Beispiel #11
0
 def __init__(self):
     self.simpleScripter = SimpleScripter()
     self.win = pm.window("Simple Scripter")
     with self.win:
         self.col = pm.columnLayout()
         with self.col:
             self.text = pm.text("Mel Script code to repeat:")
             self.textFieldScript = pm.textField(width=500,
                                                 text=mel_command)
             self.btnOneToMany = pm.button(
                 "Run as One To Many",
                 command=lambda x: self.simpleScripter.oneToMany(
                     self.textFieldScript.getText()))
Beispiel #12
0
def create( layout ) :
	container = pm.verticalLayout( p=layout )
	top_layout = pm.columnLayout( p=container, adj=True )
	# top_layout = pm.verticalLayout( bgc=(1,0,0), p=container )		
	bottom_layout = pm.scrollLayout( p=container, cr=True )	
	bottom_horiz = pm.horizontalLayout( p=bottom_layout )

	left = pm.frameLayout( label='Old Name', mh=4, mw=4, p=bottom_horiz )
	right = pm.frameLayout( label='New Name', mh=4, mw=4, p=bottom_horiz )		
	list_left = pm.columnLayout( 'th_rename_preview_left', p=left, rs=4 )
	list_right = pm.columnLayout( 'th_rename_preview_right', p=right, rs=4 )
	
	bottom_horiz.redistribute()
	
	# regex
	rename_frame = pm.frameLayout( label='Regex', mh=4, mw=4, p=top_layout )
	rename_layout = pm.columnLayout( p=rename_frame, adj=True, rs=4 )
	
	rename_search = pm.textField( 'th_rename_search', pht='Search', p=rename_layout,
		cc=lambda *args : __update_rename_preview()
	)
	rename_replace = pm.textField( 'th_rename_replace', pht='Replace', p=rename_layout,
		cc=lambda *args : __update_rename_preview()
	)


	rename_prefix = pm.textField( 'th_rename_prefix', pht='Prefix', p=rename_layout,
		cc=lambda *args : __update_rename_preview()
	)
	rename_suffix = pm.textField( 'th_rename_suffix', pht='Suffix', p=rename_layout,
		cc=lambda *args : __update_rename_preview()
	)
	renumber_layout = pm.rowLayout( p=rename_layout, nc=2, adj=True )
	rename_from = pm.textField( 'th_rename_from', pht='Renumber From', p=renumber_layout,
		cc=lambda *args : __update_rename_preview()
	)
	rename_by = pm.textField( 'th_rename_by', pht='Renumber By', p=renumber_layout,
		cc=lambda *args : __update_rename_preview()
	)
	

	pm.button( 
		label='Rename', 
		p=rename_layout,
		c=lambda *args : __rename_from_ui()
	)

	# setup a script job to update preview grids
	pm.scriptJob( 
		p=container,
		e=(		
		'SelectionChanged',
		lambda *args : __populate_preview_grids( list_left, list_right )
	) )

	__populate_preview_grids( list_left, list_right )
	container.redistribute( 1, 3 )
Beispiel #13
0
def create(layout):
    container = pm.verticalLayout(p=layout)
    top_layout = pm.columnLayout(p=container, adj=True)
    # top_layout = pm.verticalLayout( bgc=(1,0,0), p=container )
    bottom_layout = pm.scrollLayout(p=container, cr=True)
    bottom_horiz = pm.horizontalLayout(p=bottom_layout)

    left = pm.frameLayout(label='Old Name', mh=4, mw=4, p=bottom_horiz)
    right = pm.frameLayout(label='New Name', mh=4, mw=4, p=bottom_horiz)
    list_left = pm.columnLayout('th_rename_preview_left', p=left, rs=4)
    list_right = pm.columnLayout('th_rename_preview_right', p=right, rs=4)

    bottom_horiz.redistribute()

    # regex
    rename_frame = pm.frameLayout(label='Regex', mh=4, mw=4, p=top_layout)
    rename_layout = pm.columnLayout(p=rename_frame, adj=True, rs=4)

    rename_search = pm.textField('th_rename_search',
                                 pht='Search',
                                 p=rename_layout,
                                 cc=lambda *args: __update_rename_preview())
    rename_replace = pm.textField('th_rename_replace',
                                  pht='Replace',
                                  p=rename_layout,
                                  cc=lambda *args: __update_rename_preview())

    rename_prefix = pm.textField('th_rename_prefix',
                                 pht='Prefix',
                                 p=rename_layout,
                                 cc=lambda *args: __update_rename_preview())
    rename_suffix = pm.textField('th_rename_suffix',
                                 pht='Suffix',
                                 p=rename_layout,
                                 cc=lambda *args: __update_rename_preview())
    renumber_layout = pm.rowLayout(p=rename_layout, nc=2, adj=True)
    rename_from = pm.textField('th_rename_from',
                               pht='Renumber From',
                               p=renumber_layout,
                               cc=lambda *args: __update_rename_preview())
    rename_by = pm.textField('th_rename_by',
                             pht='Renumber By',
                             p=renumber_layout,
                             cc=lambda *args: __update_rename_preview())

    pm.button(label='Rename',
              p=rename_layout,
              c=lambda *args: __rename_from_ui())

    # setup a script job to update preview grids
    pm.scriptJob(
        p=container,
        e=('SelectionChanged',
           lambda *args: __populate_preview_grids(list_left, list_right)))

    __populate_preview_grids(list_left, list_right)
    container.redistribute(1, 3)
Beispiel #14
0
 def __init__(self):
     self.simpleScripter = SimpleScripter()
     self.win = pm.window("Simple Scripter")
     with self.win:
         self.col = pm.columnLayout()
         with self.col:
             self.text = pm.text( "Mel Script code to repeat:" )
             self.textFieldScript = pm.textField( width=500, text=mel_command )
             self.btnOneToMany = pm.button(
                 "Run as One To Many",
                 command = lambda x:
                  self.simpleScripter.oneToMany(
                      self.textFieldScript.getText()
                  )
             )
Beispiel #15
0
    def create_atr_ui(self):
        self.ATTR_WINDOW = "Create_Attr"
        if pm.window(self.ATTR_WINDOW, query=True, exists=True):
            pm.deleteUI(self.ATTR_WINDOW)
        pm.window(self.ATTR_WINDOW,
                  title="create attribute",
                  iconName="CA",
                  widthHeight=(250, 200))
        attr_main_col = pm.columnLayout(adjustableColumn=True,
                                        parent=self.ATTR_WINDOW)

        attr_nm_col = pm.rowColumnLayout(parent=attr_main_col,
                                         numberOfColumns=2)

        pm.text(label="Enum Attribute Name  :  ", parent=attr_nm_col)

        self.attr_nm = pm.textField("", parent=attr_nm_col, width=120)

        pm.separator(parent=attr_main_col, style="in")

        attr_val_col = pm.rowColumnLayout(parent=attr_main_col,
                                          numberOfColumns=2,
                                          columnOffset=(1, "right", 5))

        attr_val_ch_col = pm.rowColumnLayout(parent=attr_val_col,
                                             numberOfRows=2)

        attr_val_btn_ch_col = pm.rowColumnLayout(parent=attr_val_col,
                                                 numberOfRows=2)

        pm.text(label="Enum Attribute values", parent=attr_val_ch_col)

        self.enum_val = pm.scrollField(parent=attr_val_ch_col,
                                       width=130,
                                       height=150)

        pm.text(label=" ", parent=attr_val_btn_ch_col)

        pm.button(label="Create Attr\non selected\ncontrol",
                  parent=attr_val_btn_ch_col,
                  height=150,
                  width=100,
                  command=lambda x: self.create_attr())
        pm.showWindow(self.ATTR_WINDOW)
        pm.window(self.ATTR_WINDOW, edit=True, widthHeight=(250, 200))

        return None
 def __init__(self):
     self.win=pm.window()
     with self.win:
         self.col = pm.columnLayout()
         with self.col:
             self.label1 = pm.text( "Attribute Group Name (To Be Added)" )
             self.dropdown = pm.optionMenu( "menu", 
                 changeCommand = self.onDropDownChange                
             )
             with self.dropdown:
                 for i,v in enumerate(addableAttrList):
                     pm.menuItem( v )
             self.attrNameField = pm.textField( )
             self.addAttrButton = pm.button(
                 "Add Attribtutes!",
                 command = lambda x:  self.addAttributeGroup(
                    self.attrNameField.getText()
                 )
             )
             
     self.win.show()
    def main_rearrange_ui(self):
        WIN = "rearrange_nodes"
        if pm.window(WIN, query=True, exists=True):
            pm.deleteUI(WIN)
        pm.window(WIN, title="Rearrange Nodes", iconName="ReArNd")
        main_col = pm.columnLayout(parent=WIN, adjustableColumn=True)
        list_ord_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=3)
        ord_col_ch = pm.columnLayout(parent=list_ord_col,
                                     adjustableColumn=True)
        pm.separator(parent=list_ord_col, horizontal=False, width=10)
        list_col_ch = pm.columnLayout(parent=list_ord_col,
                                      adjustableColumn=True)

        self.ord_lst = pm.textScrollList('deformers_reorder',
                                         numberOfRows=10,
                                         parent=ord_col_ch,
                                         height=235,
                                         width=150,
                                         allowMultiSelection=False,
                                         enable=False)

        pm.separator(style="none", height=20, parent=list_col_ch)
        self.nd_typ_txt = pm.textField(parent=list_col_ch, width=150)
        pm.separator(style="none", height=10, parent=list_col_ch)
        pm.button(label="Get Selected Node Type",
                  parent=list_col_ch,
                  command=lambda x: self.show_type())
        pm.separator(style="in", height=50, parent=list_col_ch)
        pm.button(label="Rearrange",
                  height=130,
                  parent=list_col_ch,
                  backgroundColor=(0.561, 0.737, 0.561),
                  command=lambda x: self.reorder_deformer_nodes())
        pm.button(label="Edit Order List",
                  parent=ord_col_ch,
                  command=lambda x: self.reorder_edit_ui())
        pm.showWindow(WIN)
        pm.window(WIN, edit=True, widthHeight=(320, 260))
        return None
class ScriptFileRunnerUi(object):
    def __init__(self, parentRef=None, mmmmToolsRef=None):
        self.mmmmTools = mmmmToolsRef
        self.parentRef = parentRef

        self.scriptFileRunner = MmmmScriptFileRunner(
            parentRef = self,
            mmmmToolsRef=self.mmmmTools
        )
        self.scriptFileRunner.findScripts()
        self.win = pm.window("Script File Runner")
        
        self.ddMenuEntires = [ ]
        with self.win:
            self.col = pm.columnLayout()
            with self.col:
                self.textPath = pm.text( "Path to scripts:" )
                self.textFieldPath = pm.textField(
                    text=self.scriptFileRunner.searchPath,
                    width=400,
                    changeCommand= lambda x : self.onTextPathChangeCommand()
                )
                self.btnRefresh = pm.button( "Refresh Scripts",
                    command = lambda x: self.buildMenu( )
    def ui(self):
        WINDOW = "jointSequence"
        if pm.window(WINDOW, query=True, exists=True):
            pm.deleteUI(WINDOW)
        pm.window(WINDOW, title="Continue Joints along loops", iconName="JNTS")
        main_col = pm.columnLayout(adjustableColumn=True)
        guide_col = pm.columnLayout(parent=main_col)
        info_txt = "INFO:"+\
                   "\nFrom selected edges as starting point and"+\
                   "\ndirection guide, every next edge loop is"+\
                   "\nobtained till it reaches the end or the"+\
                   "\nstaring selection edge or the selected end point"
        guide_txt = "GUIDE:\nSelect 2 edges, each from adjacent loops"+\
                    "\nfirst edge is the starting point"+\
                    "\nsecond edge to guide the direction"+\
                    "\nif third edge is selected, acts as end point"
        pm.text(guide_txt, align="left", parent=guide_col)
        pm.separator(parent=guide_col, height=5, style="in")
        pm.text(info_txt, align="left", parent=guide_col)
        pm.separator(parent=main_col, height=10)
        text_col = pm.rowColumnLayout(parent=main_col,
                                      numberOfColumns=2,
                                      columnOffset=(2, "left", 25))
        pm.text("number of loops to\nskip inbetween", parent=text_col)
        self.skip_val = pm.textField(text="0", parent=text_col, width=50)
        check_col = pm.rowColumnLayout(numberOfColumns=2,
                                       parent=main_col,
                                       columnOffset=(2, "left", 120))
        pm.text("", parent=check_col)
        self.skn_chk = pm.checkBox("skin", parent=check_col)
        pm.separator(parent=main_col, style="none", height=5)
        pm.button("create", parent=main_col, command=lambda x: self.run())

        pm.showWindow(WINDOW)
        pm.window(WINDOW, edit=True, widthHeight=(220, 230))
        return None
Beispiel #20
0
    def __init__(self, mmmmToolsRef=None, makeUi=True):
        widthForAll = 900
        self.mmmmTools = mmmmToolsRef
        self.attrName = 'notes'  ##'mmmmScriptStringAttr'
        self.activeScriptText = ''
        self.scriptModule = None
        self.node = None
        self.codeString = ''
        self.activeScriptLabelStartText = "Actice Script being Edited is:  "
        self.win = pm.window("Scripter - Editor", width=widthForAll)
        initialUuid = str(uuid.uuid4()).replace('-', '_')

        with self.win:
            self.col = pm.columnLayout(width=600)
            with self.col:
                self.notice = pm.text(
                    '''NOTICE: Script Objects Use Object Notes attributes, which don't exist when blank. \n You may have to add to them manually if you can't use "get from selection".'''
                )
                pm.text(" ")
                pm.text(
                    "Script prefix: (it is recommended this be left as the default)"
                )
                self.scriptPrefixTextField = pm.textField(
                    text="script__",
                    width=widthForAll,
                )
                pm.text(
                    "Script name: (it is recommended that you use a unique and descriptive name)"
                )
                self.scriptNameTextField = pm.textField(
                    text=initialUuid,
                    width=widthForAll,
                )

                self.scriptGetButton = pm.button(
                    label=
                    "Make the script, or get the script if it already exists. (Works using the above fields, prefix and name.)",
                    command=lambda x: self.getScriptContents(),
                    width=widthForAll,
                )

                self.getScriptFromSelectionButton = pm.button(
                    label=
                    "Get Script From Selection / Make new script if no script on selection \n Autofills above fields when it find a script.",
                    command=lambda x: self.getScriptFromSelection(),
                    width=widthForAll,
                )

                pm.text(" ")
                pm.text("   ")  ## different spaces used to keep unique names
                self.activeScriptText = pm.text(
                    self.activeScriptLabelStartText)
                pm.text(
                    "Script contents: (Editing here will immediately edit the corresponding mmmmScriptStringAttr attribute on the object.)"
                )
                self.scriptContentsScrollField = pm.scrollField(
                    keyPressCommand=lambda x: self.setScriptContents(),
                    changeCommand=lambda x: self.setScriptContents(),
                    width=widthForAll,
                    height=500,
                )
                self.scriptRunButton = pm.button(
                    label="Run Script Contents",
                    command=lambda x: self.runScript(),
                    width=widthForAll,
                )
Beispiel #21
0
def spline_ik_setup_UI():
    WINDOW = 'SplineIK'
    if pm.window(WINDOW, query=True, exists=True):
        pm.deleteUI(WINDOW)
    pm.window(WINDOW,
              title="Spline IK",
              iconName='SplineIK',
              widthHeight=(250, 310))

    main_column = pm.columnLayout(adjustableColumn=True)
    pm.separator(height=5, style='in', parent=main_column)
    name_col = pm.rowColumnLayout(numberOfColumns=2,
                                  parent=main_column,
                                  columnOffset=(1, "left", 30),
                                  columnSpacing=(2, 5),
                                  columnWidth=(2, 130))
    pm.separator(height=5, style='in', parent=main_column)
    joint_col = pm.rowColumnLayout(numberOfColumns=3,
                                   parent=main_column,
                                   columnOffset=(1, "left", 30),
                                   columnSpacing=(2, 5))
    pm.separator(height=5, style='in', parent=main_column)
    dense_col = pm.rowColumnLayout(numberOfColumns=4,
                                   columnOffset=(1, "left", 5),
                                   parent=main_column,
                                   columnSpacing=(3, 10))
    pm.separator(height=5, style='in', parent=main_column)
    curve_option_col = pm.rowColumnLayout(numberOfColumns=2,
                                          columnOffset=(1, "left", 5),
                                          parent=main_column,
                                          columnSpacing=(2, 70))
    pm.separator(height=5, style='none', parent=main_column)
    curve_name_col = pm.rowColumnLayout(numberOfColumns=3,
                                        columnOffset=(1, "left", 40),
                                        parent=main_column,
                                        columnSpacing=(2, 5))
    pm.separator(height=5, style='none', parent=main_column)
    curve_simplify_col = pm.rowColumnLayout(numberOfColumns=4,
                                            columnOffset=(1, "left", 5),
                                            parent=main_column,
                                            columnSpacing=(3, 5))
    pm.separator(height=5, style='in', parent=main_column)
    stretch_col = pm.rowColumnLayout(numberOfColumns=2,
                                     columnWidth=(1, 100),
                                     parent=main_column,
                                     columnOffset=(1, "left", 5))
    pm.separator(height=5, style='in', parent=main_column)

    global_scale_col = pm.rowColumnLayout(numberOfColumns=3,
                                          columnWidth=(1, 100),
                                          parent=main_column,
                                          columnOffset=(1, "left", 5),
                                          columnSpacing=(3, 10))

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

    ctrl_jnt_col = pm.rowColumnLayout(numberOfColumns=3,
                                      columnOffset=(1, "left", 5),
                                      parent=main_column,
                                      columnWidth=(3, 50),
                                      columnSpacing=(3, 5))
    pm.separator(height=20, style='in', parent=main_column)

    create_btn_col = pm.rowColumnLayout(numberOfColumns=3,
                                        parent=main_column,
                                        columnOffset=(2, "left", 65),
                                        columnWidth=(2, 300))

    pm.text(label="Ik name", parent=name_col)
    name_text = pm.TextField(text="", parent=name_col)
    pm.text(label="base joint", parent=joint_col)
    joint_name = pm.textField(text="", parent=joint_col)
    pm.button(
        label="<<",
        parent=joint_col,
        command=lambda x: joint_name.setText(str(pm.ls(selection=True)[0])))

    dense_div_label = pm.text()
    dense_div_text = pm.textField()
    dense_chain_chb = pm.checkBox(
        "dense chain",
        parent=dense_col,
        changeCommand=lambda x:
        (dense_div_label.setEnable(dense_chain_chb.getValue()),
         dense_div_text.setEditable(dense_chain_chb.getValue())))
    pm.separator(style='single', horizontal=False, parent=dense_col, width=20)

    pm.text(dense_div_label,
            edit=True,
            label="divisions",
            parent=dense_col,
            enable=dense_chain_chb.getValue())
    pm.textField(dense_div_text,
                 edit=True,
                 text="3",
                 parent=dense_col,
                 editable=dense_chain_chb.getValue(),
                 width=50)

    curve_label = pm.text(label="Curve", parent=curve_name_col)
    curve_text = pm.textField(text="", parent=curve_name_col, editable=False)
    curve_btn = pm.button(
        label="<<",
        parent=curve_name_col,
        enable=False,
        command=lambda x: curve_text.setText(str(pm.ls(selection=True)[0])))

    spans_label = pm.text()
    spans_text = pm.TextField()
    curve_simple_chb = pm.checkBox(
        label="simplify curve",
        parent=curve_simplify_col,
        enable=True,
        changeCommand=lambda x:
        (spans_label.setEnable(curve_simple_chb.getValue()),
         spans_text.setEditable(curve_simple_chb.getValue())))
    pm.separator(style='single',
                 horizontal=False,
                 parent=curve_simplify_col,
                 width=5)
    pm.text(spans_label,
            edit=True,
            label="spans    ",
            parent=curve_simplify_col,
            enable=curve_simple_chb.getValue())
    pm.textField(spans_text,
                 edit=True,
                 text="3",
                 parent=curve_simplify_col,
                 editable=curve_simple_chb.getValue())

    curve_create = pm.radioCollection(parent=curve_option_col)
    pm.radioButton(
        "AutoCurve",
        label="Auto Curve",
        select=True,
        parent=curve_option_col,
        onCommand=lambda x:
        (curve_btn.setEnable(False), curve_label.setEnable(False),
         curve_text.setEditable(False), curve_simple_chb.setEnable(True),
         spans_label.setEnable(curve_simple_chb.getValue()),
         spans_text.setEditable(curve_simple_chb.getValue())))
    pm.radioButton(
        "UseCurve",
        label="use Curve",
        select=False,
        parent=curve_option_col,
        onCommand=lambda x:
        (curve_btn.setEnable(True), curve_label.setEnable(True),
         curve_text.setEditable(True), curve_simple_chb.setEnable(False),
         spans_label.setEnable(False), spans_text.setEditable(False)))

    stretch_scale_chb = pm.checkBox()
    global_scale_chb = pm.checkBox()
    scale_attr_text = pm.TextField()
    scale_label = pm.text()

    stretch_chb = pm.checkBox(
        label="stretch",
        parent=stretch_col,
        changeCommand=lambda x:
        (stretch_scale_chb.setEditable(stretch_chb.getValue()),
         global_scale_chb.setEditable(stretch_chb.getValue()),
         scale_attr_text.setEditable(stretch_chb.getValue() and
                                     global_scale_chb.getValue()),
         scale_label.setEnable(stretch_chb.getValue() and global_scale_chb.
                               getValue())))

    pm.checkBox(stretch_scale_chb,
                edit=True,
                label="connect scale",
                parent=stretch_col,
                editable=stretch_chb.getValue())

    pm.checkBox(global_scale_chb,
                edit=True,
                label="global scale",
                parent=global_scale_col,
                editable=stretch_chb.getValue(),
                changeCommand=lambda x:
                (scale_attr_text.setEditable(global_scale_chb.getValue()),
                 scale_label.setEnable(global_scale_chb.getValue())))
    pm.text(scale_label,
            edit=True,
            label="scale attr",
            parent=global_scale_col,
            enable=(stretch_scale_chb.getValue() and stretch_chb.getValue))
    pm.textField(scale_attr_text,
                 edit=True,
                 text="",
                 parent=global_scale_col,
                 editable=stretch_chb.getValue(),
                 width=90)
    pm.text(label="number of control joints ", parent=ctrl_jnt_col)
    ctrl_jnt_num = pm.textField(text="3", parent=ctrl_jnt_col, width=50)
    pm.text(label="", parent=create_btn_col)
    pm.button(label="create",
              align="center",
              parent=create_btn_col,
              width=100,
              command=lambda x: call_fun(name_text.getText(
              ), joint_name.getText(), dense_chain_chb.getValue(
              ), int(dense_div_text.getText()), curve_create.getSelect(
              ), curve_text.getText(), curve_simple_chb.getValue(
              ), int(spans_text.getText()), stretch_chb.getValue(
              ), stretch_scale_chb.getValue(), int(ctrl_jnt_num.getText(
              )), global_scale_chb.getValue(), scale_attr_text.getText()))

    pm.showWindow(WINDOW)
    pm.window(WINDOW, edit=True, widthHeight=(250, 310))
    return None
Beispiel #22
0
    def makeUi(self):
        self.window = pm.Window(title="Mmmm Rename By Regular Expression Tool")
        with self.window:
            self.col = pm.ColumnLayout()
            with self.col:
                ## We should put a button in here for more help, giving some examples.
                ## ****
                #self.helpButton = pm.Button( label="Help - CLick here for more help." )

                #self.row0 = pm.RowLayout( numberOfColumns=2  )
                #with self.row0:
                #    self.textFieldFrom = pm.textField()

                self.row1 = pm.RowLayout(numberOfColumns=2)
                with self.row1:
                    self.textFrom = pm.Text(label="Rename regex - from:")
                    self.textFieldFrom = pm.textField()
                self.row2 = pm.RowLayout(numberOfColumns=2)
                with self.row2:
                    self.textTo = pm.Text(label="Rename regex - to:")
                    self.textFieldTo = pm.textField()
                self.row3 = pm.RowLayout(numberOfColumns=2)
                with self.row3:
                    self.textCount = pm.Text(label="Count:")
                    self.intFieldCount = pm.IntField()
                #self.row4 = pm.RowLayout( numberOfColumns=2 )
                #with self.row4:
                #self.textCount = pm.Text( label = "Padding (Not Yet Implemented):" )
                #self.intFieldCount = pm.IntField( )
                self.row5 = pm.RowLayout(numberOfColumns=2)
                with self.row5:
                    self.textRename = pm.Text(label="     ")
                    self.buttonRename = pm.Button(
                        label="Rename Selected",
                        command=lambda x: self.parent.rename(
                            toName=self.textFieldTo.getText(),
                            fromName=self.textFieldFrom.getText(),
                            count=self.intFieldCount.getValue()))
                self.textHelp = pm.Text(label="""
                
                This is a regular expression based renaming tool.
                It is designed to be extremely powerful, not extremely easy.
                --------------------------------
                
                Count is the maximum number of occurances to replace.
                When count is zero, replacement will be unlimited.
                
                * matches 0 or more (greedy)
                + matches 1 or more (greedy)
                ? matches 0 or 1 (greedy)
                ?* matches 0 or more (non-greedy)
                ?+ matches 1 or more (non-greedy)
                ?? matches 0 or 1 (non-greedy)
                
                
                ^ start of line
                $ end of string
                
                .  any character other than newline
                
                \w any alphanumeric character
                \W any non-alphanumeric character
                \d  any numerical digit
                \D  any non decimal character
                \s  any whitespace
                \S  any non-whitespace
                
                
                |   OR operator:  A|B, will match either A or B.
                
                """)

        self.window.show()
Beispiel #23
0
    def create_control_ui(self):
        btns = self.read_shapes()
        WINDOW = "create_control"
        chk_win = pm.window(WINDOW, query=True, exists=True)
        if chk_win:
            pm.deleteUI(WINDOW)
        pm.window(WINDOW, title="Create_Control", iconName="CC")

        main_split_col = pm.rowColumnLayout(parent=WINDOW, numberOfColumns=3)

        left_main_col = pm.columnLayout(parent=main_split_col,
                                        adjustableColumn=True)
        hlp_btn_col = pm.columnLayout(parent=left_main_col,
                                      columnOffset=("left", 110))
        pm.button("?",
                  parent=hlp_btn_col,
                  width=50,
                  command=lambda x: self.open_help())

        pm.separator(parent=left_main_col, style="in", height=10)
        con_obj_col = pm.columnLayout(parent=left_main_col,
                                      columnOffset=("left", 70))
        self.connect_chk_bx = pm.checkBox("Skinning/Constraint",
                                          parent=con_obj_col,
                                          value=True)
        pm.separator(parent=left_main_col, style="none")
        ctrl_typ_col = pm.rowColumnLayout(parent=left_main_col,
                                          numberOfColumns=3,
                                          columnOffset=(1, "left", 20),
                                          columnSpacing=(2, 10))
        pm.text("Control type", parent=ctrl_typ_col)
        rad_col = pm.columnLayout(parent=ctrl_typ_col)
        self.ctr_typ_rad_collection = pm.radioCollection(parent=rad_col)
        self.skin_rad_btn = pm.radioButton(
            label='Skin',
            parent=rad_col,
            select=True,
            onCommand=lambda x: self.set_ui_edit_mode(flag="Skin"))
        self.con_rad_btn = pm.radioButton(
            label='Constraint',
            parent=rad_col,
            onCommand=lambda x: self.set_ui_edit_mode(flag="Constraint"))
        con_typ_col = pm.columnLayout(parent=ctrl_typ_col)
        self.pr_chk_bx = pm.checkBox("Parent",
                                     parent=con_typ_col,
                                     value=True,
                                     editable=False)
        self.sc_chk_bx = pm.checkBox("Scale",
                                     parent=con_typ_col,
                                     editable=False)
        jnt_opn_col = pm.columnLayout(parent=left_main_col,
                                      columnOffset=("left", 100))
        self.jnt_cr_chk_bx = pm.checkBox(
            label="Create Joint",
            value=True,
            parent=jnt_opn_col,
            offCommand=lambda x: self.set_ui_edit_mode(flag="no_joint"))

        pm.separator(parent=left_main_col, height=10, style="in")
        pm.text("Control name", parent=left_main_col)
        re_name_col = pm.gridLayout(parent=left_main_col,
                                    numberOfRowsColumns=(2, 2),
                                    cellWidthHeight=(138, 20),
                                    allowEmptyCells=False)
        self.msh_nm_lbl = pm.text("Text from Mesh Name", parent=re_name_col)
        self.ctrl_nm_lbl = pm.text("Rename to Control", parent=re_name_col)
        self.msh_nm = pm.textField(text="_MSH", parent=re_name_col)
        self.ctrl_nm = pm.textField(text="_CTRL", parent=re_name_col)
        pm.separator(parent=left_main_col, height=10, style="none")
        new_name_col = pm.rowColumnLayout(parent=left_main_col,
                                          numberOfColumns=2,
                                          columnOffset=(1, "left", 10))
        self.new_nm_chk_bx = pm.checkBox(
            label="Control Name:    ",
            parent=new_name_col,
            changeCommand=lambda x: self.set_ui_edit_mode(flag="rename_field"))
        self.ctr_new_nm = pm.textField(text="Control",
                                       parent=new_name_col,
                                       width=150,
                                       editable=False)
        suf_name_col = pm.rowColumnLayout(parent=left_main_col,
                                          numberOfColumns=2,
                                          columnOffset=(1, "left", 10))
        self.suf_lbl = pm.text("Control Suffix Text:  ", parent=suf_name_col)
        self.suf_nm = pm.textField(text="_CTRL",
                                   parent=suf_name_col,
                                   width=163,
                                   editable=False)
        pm.separator(parent=left_main_col, height=10, style="none")
        zero_gp_col = pm.rowColumnLayout(parent=left_main_col,
                                         numberOfColumns=2,
                                         columnOffset=(1, "left", 50))
        self.zero_gp_chk_bx = pm.checkBox(
            "Zero Node",
            parent=zero_gp_col,
            value=True,
            changeCommand=lambda x: self.set_ui_edit_mode(flag="zero_node"))
        self.zero_nd_txt = pm.textField(text="_CTRLT", parent=zero_gp_col)

        scl_lk_col = pm.columnLayout(parent=left_main_col,
                                     columnOffset=("left", 50))
        self.scl_lk_chk_bx = pm.checkBox("Lock Scale/Visibility/Radius(Joint)",
                                         parent=scl_lk_col,
                                         value=True)
        scl_chk_col = pm.columnLayout(parent=left_main_col,
                                      columnOffset=("left", 50))
        self.scl_ctr_chk_bx = pm.checkBox(
            "Scale Control to match object",
            value=True,
            parent=scl_chk_col,
            changeCommand=lambda x: self.set_ui_edit_mode(flag="no_scale"))
        scl_offset_col = pm.rowColumnLayout(parent=left_main_col,
                                            numberOfColumns=2,
                                            columnOffset=(1, "left", 30))
        self.ctrl_off_sz_lbl = pm.text("Control size offset value",
                                       parent=scl_offset_col)
        self.scl_offset_val_txt = pm.textField(text="1", parent=scl_offset_col)

        pm.separator(parent=left_main_col, height=10, style="in")
        ctrl_pvt_col = pm.rowColumnLayout(parent=left_main_col,
                                          numberOfColumns=2,
                                          columnOffset=(1, "left", 80))
        self.ctrl_pos_chk_bx = pm.checkBox(
            "Control at object pivot",
            parent=ctrl_pvt_col,
            value=True,
            changeCommand=lambda x: self.set_ui_edit_mode(flag="position"))

        pos_rad_col = pm.gridLayout(parent=left_main_col,
                                    numberOfRowsColumns=(3, 2),
                                    cellWidthHeight=(140, 20),
                                    allowEmptyCells=False)

        self.pos_rad_collection = pm.radioCollection(parent=pos_rad_col)
        self.top_rad_btn = pm.radioButton(label="Top(Y Axis)",
                                          parent=pos_rad_col,
                                          editable=False)
        self.bot_rad_btn = pm.radioButton(label="Bottom(Y Axis)",
                                          parent=pos_rad_col,
                                          select=True,
                                          editable=False)
        self.left_rad_btn = pm.radioButton(label="Left(X Axis)",
                                           parent=pos_rad_col,
                                           editable=False)
        self.right_rad_btn = pm.radioButton(label="Right(X Axis)",
                                            parent=pos_rad_col,
                                            editable=False)
        self.front_rad_btn = pm.radioButton(label="Front(Z Axis)",
                                            parent=pos_rad_col,
                                            editable=False)
        self.back_rad_btn = pm.radioButton(label="Back(Z Axis)",
                                           parent=pos_rad_col,
                                           editable=False)

        pm.separator(parent=main_split_col,
                     height=10,
                     style="in",
                     horizontal=False)
        scr_lay = pm.scrollLayout(parent=main_split_col)
        grid_col = pm.gridLayout(parent=scr_lay,
                                 numberOfRowsColumns=(1, 5),
                                 autoGrow=True,
                                 cellWidthHeight=(50, 50),
                                 allowEmptyCells=False)
        for btn in btns:
            btn = btn.replace("\r", "")
            btn = btn.replace("\n", "")
            img = self.icon_path + btn + ".png"
            if os.path.exists(img):
                pm.iconTextButton(parent=grid_col,
                                  label=btn,
                                  style='iconOnly',
                                  image=img,
                                  command=partial(self.create_shape, nm=btn))
            else:
                rgb = [
                    random.uniform(.5, 1),
                    random.uniform(.5, 1),
                    random.uniform(.5, 1)
                ]
                pm.iconTextButton(parent=grid_col,
                                  label=btn,
                                  style='iconAndTextVertical',
                                  backgroundColor=rgb,
                                  command=partial(self.create_shape, nm=btn))
        pm.checkBox(
            self.connect_chk_bx,
            edit=True,
            changeCommand=lambda x: self.set_ui_edit_mode(flag="connect"))
        pm.showWindow(WINDOW)
        pm.window(WINDOW, edit=True, widthHeight=(540, 420))
        return None
Beispiel #24
0
     if autorun:
         self.makeUi()
 def makeUi(self):
     self.window = pm.Window(title="Mmmm Renamer")
     with self.window:
         self.col = pm.ColumnLayout( )
         with self.col:
             self.row = pm.RowLayout( numberOfColumns=2  )
             with self.row:
                 self.textFrom = pm.Text( label="Rename regex - from:" )
                 self.textFieldFrom = pm.textField()
             self.row2 = pm.RowLayout( numberOfColumns=2 )
             with self.row2:
                 self.textTo = pm.Text( label="Rename regex - to:" )
                 self.textFieldTo = pm.textField()
             self.row3 = pm.RowLayout( numberOfColumns=2 )
             with self.row3:
                 self.textCount = pm.Text( label = "Count:" )
                 self.intFieldCount = pm.IntField( )
             self.row4 = pm.RowLayout( numberOfColumns=2 )
             with self.row4:
                 self.textRename = pm.Text( label="     " )
                 self.buttonRename = pm.Button(
                     label="Rename Selected",
                     command=lambda x: self.parent.rename(
                         toName=self.textFieldTo.getText(),
                         fromName=self.textFieldFrom.getText(),
                         count=self.intFieldCount.getValue()
                     )
                 )
             self.textHelp = pm.Text( label="""
             
             This is a regular expression based renaming tool.
             It is designed to be extremely powerful, not extremely easy.
             --------------------------------
             
             Count is the maximum number of occurances to replace.
             When count is zero, replacement will be unlimited.
             
             * matches 0 or more (greedy)
             + matches 1 or more (greedy)
             ? matches 0 or 1 (greedy)
             ?* matches 0 or more (non-greedy)
             ?+ matches 1 or more (non-greedy)
             ?? matches 0 or 1 (non-greedy)
             
             
             ^ start of line
             $ end of string
             
             .  any character other than newline
             
             \w any alphanumeric character
             \W any non-alphanumeric character
             \d  any numerical digit
             \D  any non decimal character
             \s  any whitespace
             \S  any non-whitespace
             
             
             |   OR operator:  A|B, will match either A or B.
             
             """)
Beispiel #25
0
    def main_ui(self):
        WIN = "nodes_rename"
        if pm.window(WIN, query=True, exists=True):
            pm.deleteUI(WIN)
        pm.window(WIN, title="Rename Nodes", iconName="RNMND")
        main_col = pm.columnLayout(parent=WIN, adjustableColumn=True)
        row_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=2)

        type_list_col = pm.columnLayout(parent=row_col)
        pm.text(label="Node Type List", parent=type_list_col)
        pm.separator(height=5, style="none")
        rename_col = pm.columnLayout(parent=row_col, adjustableColumn=True)
        self.node_lst = pm.textScrollList('Node_Type_List',
                                          numberOfRows=10,
                                          parent=type_list_col,
                                          height=235,
                                          width=150,
                                          allowMultiSelection=False)

        pm.separator(parent=rename_col, height=20, style="none")
        pm.text(label="Gets name from selected mesh", parent=rename_col)
        pm.separator(parent=rename_col, height=5, style="none")
        name_from_col = pm.rowColumnLayout(parent=rename_col,
                                           numberOfColumns=2,
                                           columnOffset=(2, "left", 11))
        pm.text(label="Replace Text", parent=name_from_col)
        self.replace_txt = pm.textField(parent=name_from_col, text="_MSH")

        name_to_col = pm.rowColumnLayout(parent=rename_col,
                                         numberOfColumns=2,
                                         columnOffset=(2, "left", 5))
        pm.text(label="Replace With", parent=name_to_col)
        self.replace_to_txt = pm.textField(parent=name_to_col)

        pm.button(label="Rename (Replace)",
                  parent=rename_col,
                  command=lambda x: self.rename_call(mode="replace"))

        pm.separator(parent=rename_col, height=20)

        pm.text(label="Rename nodes irrespective\n of mesh name",
                parent=rename_col)
        pm.separator(parent=rename_col, height=5, style="none")
        new_name_col = pm.rowColumnLayout(parent=rename_col,
                                          numberOfColumns=2,
                                          columnOffset=(2, "left", 5))
        pm.text(label="Rename", parent=new_name_col)
        self.rename_txt = pm.textField(parent=new_name_col)

        pm.button(label="Rename (New)",
                  parent=rename_col,
                  command=lambda x: self.rename_call(mode="rename"))

        pm.separator(parent=rename_col, height=20)

        pm.button(label="Refresh node List",
                  parent=rename_col,
                  command=lambda x: self.refresh_node_list())

        pm.separator(parent=rename_col, height=20)

        pm.showWindow(WIN)
        pm.window(WIN, edit=True, widthHeight=(330, 260))
        return None
Beispiel #26
0
    def UI(self):
        self.WINDOW = "Checker_Material"
        if pm.window(self.WINDOW, query=True, exists=True):
            pm.deleteUI(self.WINDOW)
        pm.window(self.WINDOW,
                  title="Checker Material",
                  iconName="CHM",
                  widthHeight=(290, 110))
        self.main_col = pm.columnLayout(adjustableColumn=True,
                                        height=100,
                                        parent=self.WINDOW)

        self.button_col = pm.rowColumnLayout(parent=self.main_col,
                                             numberOfColumns=9)
        pm.separator(parent=self.main_col, style="in")
        self.del_col = pm.rowColumnLayout(parent=self.main_col,
                                          numberOfColumns=9)
        pm.separator(parent=self.main_col, style="in")
        self.uv_ch_col = pm.rowColumnLayout(parent=self.main_col,
                                            numberOfColumns=9)
        pm.separator(parent=self.main_col, style="in")
        self.uv_ful_ch_col = pm.rowColumnLayout(parent=self.main_col,
                                                numberOfColumns=9)
        pm.separator(parent=self.main_col, style="in")
        self.copy_btn_col = pm.columnLayout(parent=self.main_col,
                                            adjustableColumn=True)

        self.tex1_but = pm.button(
            label="checker1",
            parent=self.button_col,
            height=50,
            command=lambda x: self.assign_shader("myChLambert1", self.ch1_U_tx,
                                                 self.ch1_V_tx))
        pm.separator(parent=self.button_col, horizontal=False, style="in")
        self.tex2_but = pm.button(
            label="checker2",
            parent=self.button_col,
            height=50,
            command=lambda x: self.assign_shader("myChLambert2", self.ch2_U_tx,
                                                 self.ch2_V_tx))
        pm.separator(parent=self.button_col, horizontal=False, style="in")
        self.tex3_but = pm.button(
            label="checker3",
            parent=self.button_col,
            height=50,
            command=lambda x: self.assign_shader("myChLambert3", self.ch3_U_tx,
                                                 self.ch3_V_tx))
        pm.separator(parent=self.button_col, horizontal=False, style="in")
        self.tex4_but = pm.button(
            label="checker4",
            parent=self.button_col,
            height=50,
            command=lambda x: self.assign_shader("myChLambert4", self.ch4_U_tx,
                                                 self.ch4_V_tx))
        pm.separator(parent=self.button_col, horizontal=False, style="in")
        self.tex5_but = pm.button(
            label="checker5",
            parent=self.button_col,
            height=50,
            command=lambda x: self.assign_shader("myChLambert5", self.ch5_U_tx,
                                                 self.ch5_V_tx))

        self.del1_but = pm.button(
            label="delete\nchecker1",
            parent=self.del_col,
            height=50,
            width=55,
            command=lambda x: self.delete_shader("myChLambert1", self.ch1_U_tx,
                                                 self.ch1_V_tx))
        pm.separator(parent=self.del_col, horizontal=False, style="in")

        self.del2_but = pm.button(
            label="delete\nchecker2",
            parent=self.del_col,
            height=50,
            width=55,
            command=lambda x: self.delete_shader("myChLambert2", self.ch2_U_tx,
                                                 self.ch2_V_tx))
        pm.separator(parent=self.del_col, horizontal=False, style="in")

        self.del3_but = pm.button(
            label="delete\nchecker3",
            parent=self.del_col,
            height=50,
            width=55,
            command=lambda x: self.delete_shader("myChLambert3", self.ch3_U_tx,
                                                 self.ch3_V_tx))
        pm.separator(parent=self.del_col, horizontal=False, style="in")

        self.del4_but = pm.button(
            label="delete\nchecker4",
            parent=self.del_col,
            height=50,
            width=55,
            command=lambda x: self.delete_shader("myChLambert4", self.ch4_U_tx,
                                                 self.ch4_V_tx))
        pm.separator(parent=self.del_col, horizontal=False, style="in")

        self.del5_but = pm.button(
            label="delete\nchecker5",
            parent=self.del_col,
            height=50,
            width=55,
            command=lambda x: self.delete_shader("myChLambert5", self.ch5_U_tx,
                                                 self.ch5_V_tx))
        pm.separator(parent=self.del_col, horizontal=False, style="in")

        grid_cell_width = 27
        sep_width = 4

        self.ch1_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col,
                                              numberOfRowsColumns=(4, 2),
                                              cellWidth=grid_cell_width)
        self.ch1_U_tx = pm.textField(parent=self.ch1_txt_grid_col)
        pm.button(label="U",
                  parent=self.ch1_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert1", True, False, self.ch1_U_tx, None,
                              False, None, None))
        self.ch1_V_tx = pm.textField(parent=self.ch1_txt_grid_col)
        pm.button(label="V",
                  parent=self.ch1_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert1", False, True, None, self.ch1_V_tx,
                              False, None, None))
        pm.button(label="U+",
                  parent=self.ch1_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert1", True, False, None, None, True,
                              self.ch1_U_tx, None))
        pm.button(label="V+",
                  parent=self.ch1_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert1", False, True, None, None, True,
                              None, self.ch1_V_tx))
        pm.button(label="U-",
                  parent=self.ch1_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert1", True, False, None, None, False,
                              self.ch1_U_tx, None))
        pm.button(label="V-",
                  parent=self.ch1_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert1", False, True, None, None, False,
                              None, self.ch1_V_tx))
        pm.separator(parent=self.uv_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        self.ch2_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col,
                                              numberOfRowsColumns=(4, 2),
                                              cellWidth=grid_cell_width)
        self.ch2_U_tx = pm.textField(parent=self.ch2_txt_grid_col)
        pm.button(label="U",
                  parent=self.ch2_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert2", True, False, self.ch2_U_tx, None,
                              False, None, None))
        self.ch2_V_tx = pm.textField(parent=self.ch2_txt_grid_col)
        pm.button(label="V",
                  parent=self.ch2_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert2", False, True, None, self.ch2_V_tx,
                              False, None, None))
        pm.button(label="U+",
                  parent=self.ch2_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert2", True, False, None, None, True,
                              self.ch2_U_tx, None))
        pm.button(label="V+",
                  parent=self.ch2_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert2", False, True, None, None, True,
                              None, self.ch2_V_tx))
        pm.button(label="U-",
                  parent=self.ch2_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert2", True, False, None, None, False,
                              self.ch2_U_tx, None))
        pm.button(label="V-",
                  parent=self.ch2_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert2", False, True, None, None, False,
                              None, self.ch2_V_tx))
        pm.separator(parent=self.uv_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        self.ch3_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col,
                                              numberOfRowsColumns=(4, 2),
                                              cellWidth=grid_cell_width)
        self.ch3_U_tx = pm.textField(parent=self.ch3_txt_grid_col)
        pm.button(label="U",
                  parent=self.ch3_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert3", True, False, self.ch3_U_tx, None,
                              False, None, None))
        self.ch3_V_tx = pm.textField(parent=self.ch3_txt_grid_col)
        pm.button(label="V",
                  parent=self.ch3_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert3", False, True, None, self.ch3_V_tx,
                              False, None, None))
        pm.button(label="U+",
                  parent=self.ch3_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert3", True, False, None, None, True,
                              self.ch3_U_tx, None))
        pm.button(label="V+",
                  parent=self.ch3_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert3", False, True, None, None, True,
                              None, self.ch3_V_tx))
        pm.button(label="U-",
                  parent=self.ch3_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert3", True, False, None, None, False,
                              self.ch3_U_tx, None))
        pm.button(label="V-",
                  parent=self.ch3_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert3", False, True, None, None, False,
                              None, self.ch3_V_tx))
        pm.separator(parent=self.uv_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        self.ch4_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col,
                                              numberOfRowsColumns=(4, 2),
                                              cellWidth=grid_cell_width)
        self.ch4_U_tx = pm.textField(parent=self.ch4_txt_grid_col)
        pm.button(label="U",
                  parent=self.ch4_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert4", True, False, self.ch4_U_tx, None,
                              False, None, None))
        self.ch4_V_tx = pm.textField(parent=self.ch4_txt_grid_col)
        pm.button(label="V",
                  parent=self.ch4_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert4", False, True, None, self.ch4_V_tx,
                              False, None, None))
        pm.button(label="U+",
                  parent=self.ch4_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert4", True, False, None, None, True,
                              self.ch4_U_tx, None))
        pm.button(label="V+",
                  parent=self.ch4_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert4", False, True, None, None, True,
                              None, self.ch4_V_tx))
        pm.button(label="U-",
                  parent=self.ch4_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert4", True, False, None, None, False,
                              self.ch4_U_tx, None))
        pm.button(label="V-",
                  parent=self.ch4_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert4", False, True, None, None, False,
                              None, self.ch4_V_tx))
        pm.separator(parent=self.uv_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        self.ch5_txt_grid_col = pm.gridLayout(parent=self.uv_ch_col,
                                              numberOfRowsColumns=(4, 2),
                                              cellWidth=grid_cell_width)
        self.ch5_U_tx = pm.textField(parent=self.ch5_txt_grid_col)
        pm.button(label="U",
                  parent=self.ch5_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert5", True, False, self.ch5_U_tx, None,
                              False, None, None))
        self.ch5_V_tx = pm.textField(parent=self.ch5_txt_grid_col)
        pm.button(label="V",
                  parent=self.ch5_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert5", False, True, None, self.ch5_V_tx,
                              False, None, None))
        pm.button(label="U+",
                  parent=self.ch5_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert5", True, False, None, None, True,
                              self.ch5_U_tx, None))
        pm.button(label="V+",
                  parent=self.ch5_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert5", False, True, None, None, True,
                              None, self.ch5_V_tx))
        pm.button(label="U-",
                  parent=self.ch5_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert5", True, False, None, None, False,
                              self.ch5_U_tx, None))
        pm.button(label="V-",
                  parent=self.ch5_txt_grid_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert5", False, True, None, None, False,
                              None, self.ch5_V_tx))

        self.ch1_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col,
                                        numberOfRowsColumns=(2, 1),
                                        cellWidth=grid_cell_width * 2)
        pm.button(label="UV+",
                  parent=self.ch1_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert1", True, True, None, None, True,
                              self.ch1_U_tx, self.ch1_V_tx))
        pm.button(label="UV-",
                  parent=self.ch1_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert1", True, True, None, None, False,
                              self.ch1_U_tx, self.ch1_V_tx))
        pm.separator(parent=self.uv_ful_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        self.ch2_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col,
                                        numberOfRowsColumns=(2, 1),
                                        cellWidth=grid_cell_width * 2)
        pm.button(label="UV+",
                  parent=self.ch2_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert2", True, True, None, None, True,
                              self.ch2_U_tx, self.ch2_V_tx))
        pm.button(label="UV-",
                  parent=self.ch2_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert2", True, True, None, None, False,
                              self.ch2_U_tx, self.ch2_V_tx))
        pm.separator(parent=self.uv_ful_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        self.ch3_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col,
                                        numberOfRowsColumns=(2, 1),
                                        cellWidth=grid_cell_width * 2)
        pm.button(label="UV+",
                  parent=self.ch3_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert3", True, True, None, None, True,
                              self.ch3_U_tx, self.ch3_V_tx))
        pm.button(label="UV-",
                  parent=self.ch3_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert3", True, True, None, None, False,
                              self.ch3_U_tx, self.ch3_V_tx))
        pm.separator(parent=self.uv_ful_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        self.ch4_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col,
                                        numberOfRowsColumns=(2, 1),
                                        cellWidth=grid_cell_width * 2)
        pm.button(label="UV+",
                  parent=self.ch4_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert4", True, True, None, None, True,
                              self.ch4_U_tx, self.ch4_V_tx))
        pm.button(label="UV-",
                  parent=self.ch4_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert4", True, True, None, None, False,
                              self.ch4_U_tx, self.ch4_V_tx))
        pm.separator(parent=self.uv_ful_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        self.ch5_UV_col = pm.gridLayout(parent=self.uv_ful_ch_col,
                                        numberOfRowsColumns=(2, 1),
                                        cellWidth=grid_cell_width * 2)
        pm.button(label="UV+",
                  parent=self.ch5_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert5", True, True, None, None, True,
                              self.ch5_U_tx, self.ch5_V_tx))
        pm.button(label="UV-",
                  parent=self.ch5_UV_col,
                  command=lambda x: self.
                  tile_uv_val("myChLambert5", True, True, None, None, False,
                              self.ch5_U_tx, self.ch5_V_tx))
        pm.separator(parent=self.uv_ful_ch_col,
                     horizontal=False,
                     style="in",
                     width=sep_width)

        pm.button(label="copy shader",
                  parent=self.copy_btn_col,
                  command=lambda x: self.copy_shader())

        pm.showWindow(self.WINDOW)
        pm.window(self.WINDOW, edit=True, widthHeight=(290, 340))