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
def createGUI(self): self.window = pm.window(menuBar=True) menu = pm.menu(label='File', tearOff=True) pm.rowColumnLayout( numberOfColumns=3 ) self.obj.createFormGUI() self.obj._createAttrGUI() self.obj._createScriptGUI() return self.window
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
def __init__(self, parentRef): self.parentRef = parentRef self.win = pm.window(title="Joint Orientation", width=250, height=180) self.col = pm.columnLayout() self.row1 = pm.rowColumnLayout(width=200, numberOfColumns=2) self.rotateXText = pm.text(label="X rotate:", parent=self.row1) self.rotateXField = pm.intField(parent=self.row1) self.rotateYText = pm.text(label="Y rotate:", parent=self.row1) self.rotateYField = pm.intField(parent=self.row1) self.rotateZText = pm.text(label="Z rotate:", parent=self.row1) self.rotateZField = pm.intField(parent=self.row1) self.button = pm.button( label="Rotate Joints", width=200, command=lambda x: parentRef.rotateJoint( self.rotateXField.getValue(), self.rotateYField.getValue(), self.rotateZField.getValue()), parent=self.col) self.button = pm.button(label="Rotate Joints Relative", width=200, command=lambda x: parentRef.rotateJoint( self.rotateXField.getValue(), self.rotateYField.getValue(), self.rotateZField.getValue(), rotateRelative=True), parent=self.col) self.win.show() self.win.setWidth(260) self.win.setHeight(210)
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 lyr_swtch_ui(self): self.MAIN_WINDOW = "Layered_texture_switch" if pm.window(self.MAIN_WINDOW, query=True, exists=True): pm.deleteUI(self.MAIN_WINDOW) pm.window(self.MAIN_WINDOW, title="Layered Tex Switch", iconName="LTS", widthHeight=(150, 200)) main_col = pm.columnLayout(adjustableColumn=True, height=100, parent=self.MAIN_WINDOW) but_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=2) self.create_attr_btn = pm.button( label="Create ENUM Attribute", parent=main_col, command=lambda x: self.create_atr_ui()) pm.separator(parent=main_col, style="in", height=10) pm.text(label="Enum Attribuite list", parent=main_col) pm.separator(parent=main_col, style="none", height=5) self.text_lst = pm.textScrollList(allowMultiSelection=False, parent=main_col, height=150) pm.separator(parent=main_col, style="none", height=5) but_col = pm.rowColumnLayout(parent=main_col, numberOfColumns=3) pm.button(label="Refresh List", parent=but_col, command=lambda x: self.populate_list()) pm.separator(parent=but_col, horizontal=False) pm.button(label="Create Switch", parent=but_col, command=lambda x: self.create_switching()) pm.showWindow(self.MAIN_WINDOW) pm.window(self.MAIN_WINDOW, edit=True, widthHeight=(150, 235)) return None
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
def __init__(self, parentRef): self.parentRef = parentRef self.win = pm.window( title="Joint Orientation", width=250, height=180) self.col = pm.columnLayout() self.row1 = pm.rowColumnLayout( width = 200, numberOfColumns=2 ) self.rotateXText = pm.text( label="X rotate:", parent=self.row1 ) self.rotateXField = pm.intField( parent=self.row1 ) self.rotateYText = pm.text( label="Y rotate:", parent=self.row1 ) self.rotateYField = pm.intField( parent=self.row1 ) self.rotateZText = pm.text( label="Z rotate:", parent=self.row1 ) self.rotateZField = pm.intField( parent=self.row1 ) self.button = pm.button( label="Rotate Joints", width=200, command = lambda x: parentRef.rotateJoint( self.rotateXField.getValue() ,self.rotateYField.getValue() ,self.rotateZField.getValue() ), parent=self.col ) self.button = pm.button( label="Rotate Joints Relative", width=200, command = lambda x: parentRef.rotateJoint( self.rotateXField.getValue() ,self.rotateYField.getValue() ,self.rotateZField.getValue(), rotateRelative=True ), parent=self.col ) self.win.show() self.win.setWidth(260) self.win.setHeight(210)
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
def uv_ratio_UI(self): UV_RATIO_WINDOW = "UVratio" if pm.window(UV_RATIO_WINDOW, query=True, exists=True): pm.deleteUI(UV_RATIO_WINDOW) pm.window(UV_RATIO_WINDOW, title="uv ratio", iconName="UVR") main_col = pm.columnLayout(adjustableColumn=True) self.ref_shell_btn = pm.button("set reference shell", height=40, parent=main_col, backgroundColor=(.863, 0.078, 0.235), command=lambda x: self.set_ref_shell()) pm.separator(parent=main_col, style="in", height=5) self.sel_shell_btn = pm.button("select assigned reference shell", parent=main_col, enable=False, command=lambda x: self.sel_ref_shell()) pm.separator(parent=main_col, style="in", height=10) self.assign_btn = pm.button("apply uv ratio on\n selected Shells", height=40, parent=main_col, enable=False, command=lambda x: self.rescale_uv()) #self.assign_btn.setEnable(False) pm.separator(parent=main_col, height=5, style="in") ch_bx_col = pm.rowColumnLayout(numberOfColumns=2, parent=main_col, columnOffset=(1, "left", 40)) pm.text("", parent=ch_bx_col) self.ch_bx = pm.checkBox(label="Object Selection", parent=ch_bx_col, enable=False) pm.text("Check above option to select mesh\ninstead of shell", parent=main_col) pm.showWindow(UV_RATIO_WINDOW) pm.window(UV_RATIO_WINDOW, edit=True, widthHeight=(200, 170)) return None
def tread_create_ui(self): self.WINDOW = 'Loop_Motion_Path' if pm.window(self.WINDOW, query=True, exists=True): pm.deleteUI(self.WINDOW) pm.window(self.WINDOW, title="Loop Motion Path", iconName='TR', widthHeight=(200, 220)) column_1 = pm.columnLayout(adjustableColumn=True) pm.separator(height=20, style='none', parent=column_1) self.tread_name = pm.TextField(text='Setup_Name', parent=column_1) pm.separator(height=20, style='none', parent=column_1) # get parent name row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 150), parent=column_1, columnOffset=(2, 'left', 10)) self.curve_name = pm.TextField(text='PathCurve', parent=row_col_1) pm.button(label='<<', parent=row_col_1, command=lambda x: self.set_path_name()) chk_bx_col = pm.rowColumnLayout(parent=column_1, numberOfColumns=2, columnWidth=(1, 20)) pm.text("", parent=chk_bx_col) self.dup_crv_chk_bx = pm.checkBox("Duplicate Curve", parent=chk_bx_col, value=True) pm.separator(height=20, style='in', parent=column_1) self.jnt_type_lbl = pm.text(label="object placement type", align="left", parent=column_1) pm.separator(height=5, style='none', parent=column_1) self.jnt_typ_radio = pm.radioCollection(parent=column_1) row_layout = pm.rowLayout(numberOfColumns=2, height=20, parent=column_1) sel_chk_bx_col = pm.rowColumnLayout(parent=column_1, numberOfColumns=2, columnWidth=(1, 20)) info_chk_bx_col = pm.ColumnLayout(parent=column_1) self.chk_bx_info = pm.text("", parent=info_chk_bx_col, enable=False) pm.text("", parent=sel_chk_bx_col) self.sel_obj_chk_bx = pm.checkBox("Use Selection On Curve", parent=sel_chk_bx_col, value=False, enable=False) self.divisions = pm.TextField(text='1', parent=column_1) pm.radioButton( label='uniform', parent=row_layout, select=True, onCommand=lambda x: self.ui_set_selection_enable(flag="uniform")) pm.radioButton( label='selection', parent=row_layout, onCommand=lambda x: self.ui_set_selection_enable(flag="selection")) pm.separator(height=20, style='none', parent=column_1) pm.text("Input sample object (default joint)", parent=column_1) sample_row_col = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 150), parent=column_1, columnOffset=(2, 'left', 10)) self.sample_name = pm.text(label="", parent=sample_row_col) pm.button(label='<<', parent=sample_row_col, command=lambda x: self.set_sample_object()) pm.separator(height=20, style='none', parent=column_1) pm.button(label='Create', parent=column_1, command=lambda x: self.setup_motion_path()) pm.showWindow(self.WINDOW) pm.window(self.WINDOW, edit=True, widthHeight=(200, 320)) return None
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
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))
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
def CustomScripts_UI(): WINDOW = 'CustomScripts' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Custom Scripts", iconName='CS', widthHeight=(200, 400)) column_1 = pm.columnLayout(adjustableColumn=True) pm.separator(height=20, style='in', parent=column_1) pm.button(label='Immediate Parent in Hierarchy', command=lambda x: CustomScripts.immediateParent()) pm.separator(height=20, style='in', parent=column_1) hide_jnt_col = pm.rowColumnLayout(parent=column_1, numberOfColumns=3, columnWidth=(1, 95)) pm.button(label='Hide Joint', command=lambda x: CustomScripts.jntHide(), parent=hide_jnt_col) pm.separator(parent=hide_jnt_col, horizontal=False, width=10) pm.button(label='Show Joint', command=lambda x: CustomScripts.jntShow(), parent=hide_jnt_col, width=95) pm.separator(height=20, style='in', parent=column_1) lod_col = pm.rowColumnLayout(parent=column_1, numberOfColumns=3, columnWidth=(1, 95)) pm.button(label='LOD off', command=lambda x: CustomScripts.lodOff(), parent=lod_col) pm.separator(parent=lod_col, horizontal=False, width=10) pm.button(label='LOD on', command=lambda x: CustomScripts.lodOn(), parent=lod_col, width=95) pm.separator(height=20, style='in', parent=column_1) pm.button(label='Parent( in selection order)', command=lambda x: CustomScripts.parentChain(), parent=column_1) # get object name pm.separator(height=20, style='in', parent=column_1) row_col_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 150), parent=column_1, columnOffset=(2, 'left', 10)) object_name = pm.TextField(parent=row_col_2) pm.button( label='<<', parent=row_col_2, command=lambda x: object_name.setText(str(pm.ls(selection=True)[0]))) row_col_3 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) prntChk = pm.checkBox("parent", parent=row_col_3) sclChk = pm.checkBox("scale", parent=row_col_3) pm.separator(height=5, style='none', parent=column_1) pm.button( label='Copy Object to selected positions', parent=column_1, command=lambda x: CustomScripts.copyObjects(obj=object_name.getText(), prFlg=prntChk.getValue(), scFlg=sclChk.getValue())) pm.separator(height=20, style='in', parent=column_1) pm.button(label="copy orientation", parent=column_1, command=lambda x: CustomScripts.CopyJntOri()) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(200, 320)) return None
def showUI(self): """ this is teh function that creates the ui: in the future it will likely change to a Qt GUI """ testWindow = 'HS_Normal_Tool' if pm.window(testWindow, exists=True): pm.deleteUI(testWindow) pm.window(testWindow, sizeable=False) pm.rowColumnLayout('normal_Column', numberOfColumns=1, columnWidth=(1, 300), columnAttach=(1, 'left', 5)) pm.rowLayout('flatRow', parent='normal_Column', numberOfColumns=2) pm.button(label='Flat Surface', parent='flatRow', width=100, command=self.btn_connected_flat) self.objCheck = pm.checkBox(label='Object Selection', parent='flatRow', value=True) self.float1 = pm.floatSliderGrp(label='min_tolerance', parent='normal_Column', columnAlign=(1, 'left'), columnWidth=(1, 80), field=True) self.float2 = pm.floatSliderGrp(label='max_tolerance', parent='normal_Column', columnAlign=(1, 'left'), columnWidth=(1, 80), field=True) pm.separator(parent='normal_Column', height=20) pm.rowLayout('curveRow', parent='normal_Column', numberOfColumns=2) pm.button(label='Curved Surface', parent='curveRow', width=100, command=self.btn_hs_tube) self.tubeCheck = pm.checkBox(label='Edge Ring', parent='curveRow', value=True) pm.separator(parent='normal_Column', height=20) pm.button(label='Unlock Selected vtx Normals', parent='normal_Column', command=self.unlockVtxN) pm.separator(parent='normal_Column', height=20) pm.checkBox(label='Toggle vtx Normals', parent='normal_Column', onCommand=self.btn_show_vtx_normals, offCommand=self.btn_hide_vts_normals) self.float3 = pm.floatSliderGrp( label='vtx Length', parent='normal_Column', columnWidth=(1, 55), field=True, dragCommand=self.vtx_normal_length, ) pm.floatSliderGrp( self.float3, label='vtx Length', edit=True, columnWidth=(2, 42), ) pm.separator(parent='normal_Column', height=20) pm.rowLayout('blinnRow', parent='normal_Column', numberOfColumns=2, columnWidth=(2, 200)) pm.button(label='Create Blinn', parent='blinnRow', width=100, command=self.btn_create_blinn) self.blinnCol = pm.colorSliderGrp(label='', parent='blinnRow', width=190, columnWidth=(1, 1), dragCommand=self.edit_blinn) pm.showWindow(testWindow) pm.window(testWindow, edit=True, widthHeight=(300, 265))
def copySDK_UI(): WINDOW = 'copySDK' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="copySDK", iconName='SDKcpy', widthHeight=(210, 370)) # Layout column_1 = pm.columnLayout(adjustableColumn=True) textlabel = pm.text(label="UI for script downloaded from\ highend3d.com\nContact Email : [email protected]", align="center", wordWrap=True) pm.separator(height=20, style='in', parent=column_1) col2 = pm.columnLayout(width=200, adjustableColumn=False, parent=column_1) row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) pm.separator(height=20, style='in', parent=column_1) col3 = pm.columnLayout(width=200, adjustableColumn=False, parent=column_1) row_col_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) row_col_3 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) pm.separator(height=20, style='in', parent=column_1) row_col_4 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=column_1, columnOffset=(2, 'left', 10)) row_col_5 = pm.rowColumnLayout(numberOfRows=2, parent=row_col_4) column_2 = pm.columnLayout(adjustableColumn=False, width=200, columnOffset=["both", 50], parent=column_1) # Widgets cr_attr_chk_bx = pm.checkBox('Create attribute', parent=column_2, editable=False) mode_lbl = pm.text(label="mode", align="center", parent=col2, width=200) mode_radio = pm.radioCollection(parent=column_1) rb1 = pm.radioButton(label='driven', parent=row_col_1, select=True, onCommand=lambda x: pm.checkBox( cr_attr_chk_bx, edit=True, editable=False)) rb1 = pm.radioButton(label='driver', parent=row_col_1, select=False, onCommand=lambda x: pm.checkBox( cr_attr_chk_bx, edit=True, editable=True)) ctr_replace_lbl = pm.text(label="controller", align="center", parent=col3, width=200) search_lbl = pm.text(label="search", align="center", parent=row_col_2, width=100) replace_lbl = pm.text(label="replace", align="center", parent=row_col_2, width=100) search_str = pm.TextField(text='', parent=row_col_3) replace_str = pm.TextField(text='', parent=row_col_3) refresh_button = pm.button( label='Refresh', parent=row_col_5, command=lambda x: populate_attr(field_obj=attr_list)) attr_list = pm.textScrollList('Attr', numberOfRows=10, parent=row_col_5, height=150, width=100, allowMultiSelection=True) populate_attr(field_obj=attr_list) mirror_chk_bx = pm.checkBox('mirror', parent=row_col_4) apply_button = pm.button( label='Apply', parent=column_2, width=100, command=lambda x: sdk_call(mode_radio, attr_list, search_str, replace_str, mirror_chk_bx, cr_attr_chk_bx)) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(210, 370)) return None
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
def constraints_ui(): WINDOW = 'Constraints' if pm.window(WINDOW, query=True, exists=True): pm.deleteUI(WINDOW) pm.window(WINDOW, title="Constraints", iconName='CON', widthHeight=(200, 275)) column_1 = pm.columnLayout(adjustableColumn=True) pm.separator(height=2, style='in', parent=column_1) mulChLbl = pm.Text(label="Multiple Children", parent=column_1) pm.separator(height=5, style='none', parent=column_1) rowCol1 = pm.rowColumnLayout(numberOfRows=3, parent=column_1) txt_row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 150), parent=rowCol1, columnSpacing=(1, 15)) mulCtrlNm = pm.TextField(parent=txt_row_col_1) mulCtrlBtn = pm.button( label='<<', parent=txt_row_col_1, command=lambda x: mulCtrlNm.setText(str(pm.ls(selection=True)[0]))) row_col_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=rowCol1, columnAlign=(2, 'center'), columnSpacing=(1, 25)) prChk = pm.checkBox("Parent", parent=row_col_1) scChk = pm.checkBox("Scale", parent=row_col_1) conBtn = pm.button(label="Constraint", parent=column_1, command=lambda x: mul_con_call(mulCtrlNm, prChk, scChk)) pm.separator(height=20, style='in', parent=column_1) setLbl = pm.Text(label="Selection Set", parent=column_1) pm.separator(height=5, style='none', parent=column_1) rowCol2 = pm.rowColumnLayout(numberOfRows=2, parent=column_1) row_col_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=rowCol2, columnAlign=(2, 'center'), columnSpacing=(1, 25)) prSetChk = pm.checkBox("Parent", parent=row_col_2) scSetChk = pm.checkBox("Scale", parent=row_col_2) conSetBtn = pm.button(label="Constraint", parent=column_1, command=lambda x: set_con_call(prSetChk, scSetChk)) pm.separator(height=20, style='in', parent=column_1) delConLbl = pm.Text(label="Delete Constraints", parent=column_1) pm.separator(height=5, style='none', parent=column_1) rowCol3 = pm.rowColumnLayout(numberOfRows=3, parent=column_1) row_col_3_1 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=rowCol3, columnAlign=(2, 'center'), columnSpacing=(1, 25)) row_col_3_2 = pm.rowColumnLayout(numberOfColumns=2, columnWidth=(1, 100), parent=rowCol3, columnAlign=(2, 'center'), columnSpacing=(1, 25)) prDelChk = pm.checkBox("Parent", parent=row_col_3_1) scDelChk = pm.checkBox("Scale", parent=row_col_3_1) ptDelChk = pm.checkBox("Point", parent=row_col_3_2) orDelChk = pm.checkBox("Orient", parent=row_col_3_2) conDelBtn = pm.button( label="Delete", parent=column_1, command=lambda x: del_cons(prDelChk, scDelChk, ptDelChk, orDelChk)) pm.showWindow(WINDOW) pm.window(WINDOW, edit=True, widthHeight=(200, 275)) return None