def initUi(self):
        win = self.win = pm.window("Mmmm Mel To Python Converter")
        with win:
            col = self.col = pm.columnLayout(adjustableColumn=True)
            with col:

                labelMel = self.labelMel = pm.text("Mel:")
                tf01 = self.tf01 = pm.scrollField(wordWrap=True)
                btnRunMel = self.btnRunMel = pm.button(
                    "Run Mel",
                    command=lambda x: pm.mel.eval(self.tf01.getText()))
                labelSpacer01 = self.labelSpacer01 = pm.text("\n")

                labelPython = self.labelPython = pm.text("Python:")
                tf02 = self.tf02 = pm.scrollField(editable=False,
                                                  wordWrap=True)
                btnRunPython = self.btnRunMel = pm.button(
                    "Run Python",
                    command=lambda x: self.execPython(codeStr=self.tf02.
                                                      getText()))
                labelSpacer02 = self.labelSpacer02 = pm.text("\n")

                btnConvert = self.btnConvert = pm.button(
                    "Convert Mel To Python",
                    command=lambda x: self.tf02.setText(
                        self.convertFunc(self.tf01.getText())))

        win.show()
        
    def initUi(self):
        win = self.win = pm.window("Mmmm Mel To Python Converter")
        with win:
          col = self.col = pm.columnLayout(adjustableColumn=True)
          with col:
          
            labelMel = self.labelMel = pm.text("Mel:")              
            tf01 = self.tf01 = pm.scrollField( wordWrap=True )
            btnRunMel = self.btnRunMel = pm.button("Run Mel",
              command= lambda x:  pm.mel.eval( self.tf01.getText()  )
            )            
            labelSpacer01 = self.labelSpacer01 = pm.text("\n")
            
            
            labelPython = self.labelPython = pm.text("Python:")
            tf02 = self.tf02 = pm.scrollField( editable=False,  wordWrap=True  )
            btnRunPython = self.btnRunMel = pm.button("Run Python",
              command= lambda x:  self.execPython( codeStr=self.tf02.getText() )
            )             
            labelSpacer02 = self.labelSpacer02 = pm.text("\n")
              

            btnConvert = self.btnConvert = pm.button("Convert Mel To Python",
              command= lambda x:
                  self.tf02.setText(
                      self.convertFunc( self.tf01.getText()  )
                  )
            )

            
예제 #3
0
 def initializePythonScript(self):
     if not pm.objExists('vraySettings.postTranslatePython'):
         return False
     pm.setAttr('vraySettings.postTranslatePython', lock=False)
     actualValue = pm.getAttr('vraySettings.postTranslatePython')
     toAdd = ''
     if 'import arsenalFunction;' not in actualValue:
         toAdd += 'import arsenalFunction;'
     if 'reload(arsenalFunction);' not in actualValue:
         toAdd += 'reload(arsenalFunction);'
     if 'arsenalFunction.arsenalFunction();' not in actualValue:
         toAdd += 'arsenalFunction.arsenalFunction();'
     pm.setAttr('vraySettings.postTranslatePython', toAdd + actualValue)
     if pm.control('vrayPostTranslatePythonCallbackControl', query=True, ex=True):
         pm.scrollField('vrayPostTranslatePythonCallbackControl', edit=True, text=toAdd)
     return True
예제 #4
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
예제 #5
0
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,                    
예제 #6
0
    def test_ui(self):
        test_win = "log"
        if pm.window(test_win, query=True, exists=True):
            pm.deleteUI(test_win)
        pm.window(test_win, title="Rearrange Deformers", iconName="ReArDf")
        log_col = pm.columnLayout(parent=test_win, adjustableColumn=True)
        self.log_txt = pm.scrollField('log_list',
                                      parent=log_col,
                                      height=235,
                                      width=150,
                                      wordWrap=True)

        #self.reord_lst.append(self.file_ord_list)
        pm.showWindow(test_win)
        pm.window(test_win, edit=True, widthHeight=(300, 260))
        return None
예제 #7
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 reorder_edit_ui(self):
        reorder_win = "Reorder_Deformer_List"
        if pm.window(reorder_win, query=True, exists=True):
            pm.deleteUI(reorder_win)
        pm.window(reorder_win, title="Rearrange Deformers", iconName="ReArDf")
        main_col = pm.columnLayout(parent=reorder_win, adjustableColumn=True)
        self.reord_lst = pm.scrollField('reorder_deformer_list',
                                        parent=main_col,
                                        height=235,
                                        width=150,
                                        text=self.populate_order_edit_list())

        pm.button("Save order list",
                  parent=main_col,
                  command=lambda x: self.save_deformer_list())

        pm.showWindow(reorder_win)
        pm.window(reorder_win, edit=True, widthHeight=(150, 260))
        return None
예제 #9
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,
                )