Example #1
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
Example #2
0
    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 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
Example #4
0
def sdk_call(mode_obj, attributes_obj, search_obj, replace_obj, mirror_obj,
             att_chk):
    sel_mode = mode_obj.getSelect()
    mode_opn = str(pm.radioButton(sel_mode, query=True, label=True))
    srch_txt = search_obj.getText()
    rplc_txt = replace_obj.getText()
    attrs_sel = pm.textScrollList(attributes_obj, query=True, selectItem=True)
    mirror_val = pm.checkBox(mirror_obj, query=True, value=True)
    att_val = False
    if str(mode_opn) == "driver":
        att_val = pm.checkBox(att_chk, query=True, value=True)
    if not mirror_val:
        if srch_txt == "" or rplc_txt == "":
            copy_SDK.copySDK(curAttrs=attrs_sel,
                             mode=mode_opn,
                             createDriverAttr=att_val)
        else:
            copy_SDK.copySDK(curAttrs=attrs_sel,
                             mode=mode_opn,
                             search=srch_txt,
                             replace=rplc_txt,
                             createDriverAttr=att_val)
    else:
        if srch_txt == "" or rplc_txt == "":
            copy_SDK.copySDK(curAttrs=attrs_sel,
                             mode=mode_opn,
                             mirrorAttrs=attrs_sel,
                             createDriverAttr=att_val)
        else:
            copy_SDK.copySDK(curAttrs=attrs_sel,
                             mode=mode_opn,
                             search=srch_txt,
                             mirrorAttrs=attrs_sel,
                             replace=rplc_txt,
                             createDriverAttr=att_val)
    return None
Example #5
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
Example #6
0
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