def __init__(self, parentRef, selection=False, multiplier=1.0):
     self.parentRef = parentRef
     self.buttons = []
     self.window = pm.window(sizeable=False,
                             title="Light Multiplier",
                             titleBar=True)
     with self.window:
         self.layout = pm.columnLayout()
         with self.layout:  ## Using Ui on the end of Widget names
             self.multiplierText = pm.text(label='Multiplier:',
                                           align='left')
             self.multiplierUi = pm.floatField(value=1.0)
             self.checkBoxUi = pm.checkBox(
                 label='Affect Selected Lights Only')
             self.okUi = pm.button(
                 label='Apply',
                 parent=self.layout,
                 command=lambda xc: self.parentRef.applyMultiplier(
                     multiplier=self.multiplierUi.getValue(),
                     selection=self.checkBoxUi.getValue(),
                 ),
                 width=300)
     pm.showWindow(self.window)
     self.window.setWidth(600)
     self.window.setHeight(400)
Beispiel #2
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
Beispiel #3
0
class MmmmShellThickenUi(object):
    def __init__(self, autorun=True ):
        self.shellThicken = MmmmShellThicken( )
        if autorun==True:
            self.createUi()
        
    def createUi(self):
        self.win = pm.window(title="Mmmm Shell Thicken")
        with self.win:
            self.col = pm.columnLayout()
            with self.col:
                self.thicknessLabel = pm.text( "Thickness:             " )
                self.thicknessFloatField = pm.floatField( value=1.0, precision=9, width=200 )
                self.divisionsLabel = pm.text( "Divisions:             " )
                self.divisionsIntField = pm.intField( value=1, width=200 )
                self.mergeLabel = pm.text( "Distance (tolerance) for verts merge:" )
 def __init__(self, parentRef, selection=False, multiplier=1.0):
   self.parentRef = parentRef
   self.buttons = []
   self.window = pm.window( sizeable = False, title = "Light Multiplier", titleBar=True)
   with self.window:
       self.layout = pm.columnLayout()
       with self.layout:  ## Using Ui on the end of Widget names
           self.multiplierText = pm.text( label='Multiplier:', align='left' )
           self.multiplierUi = pm.floatField( value=1.0 )
           self.checkBoxUi = pm.checkBox( label='Affect Selected Lights Only')
           self.okUi = pm.button ( label = 'Apply',parent = self.layout,
                       command = lambda xc: self.parentRef.applyMultiplier( multiplier=self.multiplierUi.getValue(),
                                   selection=self.checkBoxUi.getValue(),
                               ),
                       width = 300  )
   pm.showWindow(self.window)
   self.window.setWidth(600)
   self.window.setHeight(400)
Beispiel #5
0
    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 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 #7
0
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
Beispiel #8
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
Beispiel #9
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 #10
0
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
Beispiel #11
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
    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
Beispiel #13
0
    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))
Beispiel #14
0
 def btn_hs_tube(self, *args):
     edgeCheck = pm.checkBox(self.tubeCheck, q=True, value=True)
     print edgeCheck
     self.hs_tube(edgeCheck)
Beispiel #15
0
 def btn_connected_flat(self, *args):
     objSel = pm.checkBox(self.objCheck, q=True, value=True)
     minTol = pm.floatSliderGrp(self.float1, q=True, value=True)
     maxTol = pm.floatSliderGrp(self.float2, q=True, value=True)
     self.connected_flat(objSel, minTol, maxTol)