Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- _________________Modeling_Tool_Kit_________________
- Built by:
- Alexander Torres
- How to Run:
- import modeling_toolkit
- reload (modeling_toolkit)
- modeling_toolkit.gui()
- What this Script does:
- This Script creates a toolkit that can be used to for modeling.
- Meant to speed up your workflow and proved useful tools as well as frequently used buttons.
- Make sure to put script in your maya script folder:
- (These are the default paths, Any custom paths you would need to know)
- OSX:Users/insertYourComputersNameHere/Library/Preferences/Autodesk/maya/scripts
- WIN:
- Just copy the code above in the "How to Run:" section and paste into a python tab in your version of maya, works with 2016,/17,/18. Other version maybe not.
- Have Fun!
- '''
- # Color Index
- red = [1.0, 0.0, 0.0]
- blue = [0.0, 0.0, 1.0]
- drk_blue = [.0, .016, .373]
- green = [0.0, 1.0, 0.0]
- yellow = [1.0, 1.0, 0.0]
- black = [0.0, 0.0, 0.0]
- white = [1.0, 1.0, 1.0]
- grey = [0.5, 0.5, 0.5]
- import pymel.core as pm
- win_name = 'Modelers_Toolkit'
- script_name = __name__
- def gui():
- if pm.window(win_name, query=True, exists=True):
- pm.deleteUI(win_name)
- if pm.windowPref(win_name, q=True, exists=True):
- pm.windowPref(win_name, r=True)
- if pm.dockControl('dock_windows', q=True, exists=True):
- pm.deleteUI('dock_windows')
- win_h = 850
- win_w = 200
- win_w7 = win_w / 7
- button_h = 40
- tab_h = (win_w / 10) * 9
- scroll_w = win_w - 24
- scroll_w2 = scroll_w / 2
- column_w = win_w / 2
- column_w2 = column_w / 2
- column_w3 = scroll_w / 3
- column_w4 = scroll_w / 4
- win_w4 = win_w / 4
- global win
- win = pm.window(win_name, t='Modelers Toolkit', w=win_w, h=win_h, backgroundColor=grey, nde=True, tlb=True, s=False)
- header_layout(win_w7, button_h, win_w7, win_w4)
- main_win_layout = pm.scrollLayout(w=win_w, h=win_h)
- test_layout = pm.columnLayout()
- what = renamer_layout(test_layout, scroll_w, tab_h, scroll_w2)
- # what.setLabel('something new')
- create_primitives_layout(scroll_w, tab_h, column_w3, column_w4)
- pm.setParent(main_win_layout)
- topology_tools_layout(scroll_w, tab_h)
- pm.setParent(main_win_layout)
- positioning_tools_layout(scroll_w, tab_h)
- pm.setParent(main_win_layout)
- uv_tools_layout(scroll_w, tab_h)
- pm.setParent(main_win_layout)
- mesh_tools_layout(scroll_w, tab_h)
- pm.setParent(main_win_layout)
- win.show()
- def do_dock_win():
- dock_window(win)
- def dock_window(win):
- allowedAreas = ['right', 'left']
- if pm.dockControl('dock_windows', q=True, exists=True):
- return
- left_right_chk_var = pm.optionMenu(left_right_chk, query=True, sl=True)
- area_var = ''
- if left_right_chk_var == 1:
- area_var = 'right'
- if left_right_chk_var == 2:
- area_var = 'left'
- pm.dockControl('dock_windows', area=area_var, content=win, allowedArea=allowedAreas)
- def dock_win_chng_side():
- left_right_chk_var = pm.optionMenu(left_right_chk, query=True, sl=True)
- area_var = ''
- if left_right_chk_var == 1:
- area_var = 'right'
- if left_right_chk_var == 2:
- area_var = 'left'
- dock_window = pm.dockControl('dock_windows', e=True, area=area_var)
- def header_layout(w, h, w7, w4):
- header_layout = pm.rowColumnLayout()
- pm.text(l='Modelers Tools', w=w)
- pm.separator(h=5, w=w)
- global left_right_chk
- row_col_layout = pm.rowColumnLayout(nc=2, cw=[[1, (w7 * 2)], [2, (w7 * 5)]])
- left_right_chk = pm.optionMenu(bgc=black, w=(w7 * 2), cc=script_name + '.dock_win_chng_side()')
- pm.menuItem(l='Right')
- pm.menuItem(l='Left')
- pm.setParent(row_col_layout)
- dock_button = pm.button(bgc=black, l="dock UI", c=script_name + '.do_dock_win()', w=(w7 * 5))
- pm.setParent(header_layout)
- pm.separator(h=5, w=w)
- row_layout = pm.rowColumnLayout(nc=7, h=h)
- pm.rowColumnLayout(row_layout, edit=True,
- cw=[[1, w], [2, w], [3, w], [4, w], [5, w], [6, w], [7, w]])
- pm.text(label='')
- pm.iconTextButton(label='FT', width=w, height=h, style='iconAndTextVertical',
- image1='menuIconModify.png', c=script_name + '.freeze_transform()')
- pm.text(label='')
- pm.iconTextButton(label='DH', width=w, height=h, style='iconAndTextVertical', image1='menuIconEdit.png',
- c=script_name + '.delete_history()')
- pm.text(label='')
- pm.iconTextButton(label='CP', width=w, height=h, style='iconAndTextVertical',
- image1='menuIconModify.png', c=script_name + '.center_pivot()')
- pm.text(label='')
- pm.setParent(header_layout)
- pm.separator(h=5, w=w)
- # row2_layout = pm.rowColumnLayout(nc=4, h=h)
- # pm.rowColumnLayout(row2_layout, edit=True, cw=[[1, w4], [2, w4], [3, w4], [4, w4]])
- # pm.iconTextButton(label='Object', width=w4, height=h, style='iconAndTextVertical',
- # image1='menuIconModify.png')
- # pm.iconTextButton(label='Edges', width=w4, height=h, style='iconAndTextVertical',
- # image1='menuIconModify.png')
- # pm.iconTextButton(label='Verts', width=w4, height=h, style='iconAndTextVertical',
- # image1='menuIconModify.png')
- # pm.iconTextButton(label='Faces', width=w4, height=h, style='iconAndTextVertical',
- # image1='menuIconModify.png')
- #
- # pm.setParent(header_layout)
- # pm.separator(h=5, w=w)
- def renamer_layout(parent_layout, w, h, cw):
- # main_layout = pm.columnLayout()
- header_layout = pm.frameLayout(label='Renamer', w=w, cll=True, cl=False, bgc=black, parent=parent_layout)
- org_layout = pm.columnLayout()
- renamer_layout = pm.rowColumnLayout(nc=2, cw=[[1, cw], [2, cw]], h=80)
- txt_column = pm.columnLayout(w=cw)
- pm.text(l='Prefix:')
- pref_txt = pm.textFieldGrp(text='ct')
- pm.text(l='Name:')
- name_txt = pm.textFieldGrp(text='back')
- pm.setParent(renamer_layout)
- button_column = pm.columnLayout()
- pm.text(l='Type:')
- global suf_title, suf_txt, type_opt
- type_opt = pm.optionMenu(bgc=black, w=cw, cc=script_name + '.namer_visSwp()')
- pm.menuItem(l='Count')
- pm.menuItem(l='Cntrls')
- pm.menuItem(l='Geo')
- pm.menuItem(l='Custom')
- pm.setParent(button_column)
- suf_title = pm.text(l='Suffix', vis=False)
- suf_txt = pm.textFieldGrp(text='bind', vis=False)
- pm.setParent(org_layout)
- pm.button(l='Rename!', w=w, h=20, backgroundColor=black)
- pm.setParent(parent_layout)
- return header_layout
- def namer_visSwp():
- type = pm.optionMenu(type_opt, query=True, sl=True)
- # global pref_txt, name_txt, suf_txt, type_opt, suf_title
- if type == 1 or 2 or 3:
- suf_title.setVisible(0)
- suf_txt.setVisible(0)
- if type == 4:
- suf_title.setVisible(1)
- suf_txt.setVisible(1)
- def create_primitives_layout(w, h, w3, w4):
- main_layout = pm.columnLayout()
- header_layout = pm.frameLayout(label='Create Primitives', w=w, cll=True, cl=False, bgc=black)
- org_layout = pm.shelfTabLayout(scr=True, h=(2 * h),)
- polygons_tab = pm.columnLayout('Polygons')
- # pm.iconTextButton(label='Cube', w=(w4 - 5), h=(w4 + 5), style='iconAndTextVertical', image1='polyCube.png')
- # pm.setParent(polygons_tab)
- # pm.iconTextButton(label='Circle', w=(w4 - 5), h=(w4 + 5), style='iconAndTextVertical', image1='polySphere.png')
- # pm.setParent(polygons_tab)
- # pm.iconTextButton(label='Cylinder', w=(w4 - 5), h=(w4 + 5), style='iconAndTextVertical', image1='polyCylinder.png')
- # pm.setParent(polygons_tab)
- # pm.iconTextButton(label='Create', w=(w4 - 5), h=(w4 + 5), style='iconAndTextVertical', image1='polyCreateFacet.png')
- # pm.setParent(polygons_tab)
- # pm.iconTextButton(label='Platonic Solid', w=(w4 - 5), h=(w4 + 5), style='iconAndTextVertical', image1='polyPlatonicSolid.png')
- # pm.setParent(polygons_tab)
- # pm.iconTextButton(label='Disc', w=(w4 - 5), h=(w4 + 5), style='iconAndTextVertical', image1='polyDisc.png')
- # pm.setParent(polygons_tab)
- pm.text(l='X', h=15)
- pm.intSliderGrp(w=(w - 10), field=True, minValue=0, maxValue=20, fieldMinValue=-100, fieldMaxValue=100, value=0, h=18)
- pm.text(l='Y', h=15)
- pm.intSliderGrp(w=(w - 10), field=True, minValue=0, maxValue=20, fieldMinValue=-100, fieldMaxValue=100, value=0, h=18)
- pm.text(l='Z', h=15)
- pm.intSliderGrp(w=(w - 10), field=True, minValue=0, maxValue=20, fieldMinValue=-100, fieldMaxValue=100, value=0, h=18)
- pm.setParent(polygons_tab)
- pm.setParent(org_layout)
- nurbs_tab = pm.shelfLayout('Nurbs')
- pm.setParent(org_layout)
- curve_tab = pm.shelfLayout('Curves')
- pm.setParent(org_layout)
- pm.setParent(header_layout)
- pm.separator(w=w, h=5)
- def topology_tools_layout(w, h):
- main_layout = pm.columnLayout()
- header_layout = pm.frameLayout(label='Topology Tools', w=w, cll=True, cl=False, bgc=black)
- org_layout = pm.columnLayout()
- pm.separator(w=w, h=5)
- pm.text(w=w, label='These Tools are meant to make\nre-topologizing a model easier!')
- pm.separator(w=w, h=5)
- pm.button(l='Quad Draw')
- pm.button(l='')
- pm.separator(w=w, h=5)
- def positioning_tools_layout(w, h):
- main_layout = pm.columnLayout()
- header_layout = pm.frameLayout(label='Positioning Tools', w=w, cll=True, cl=False, bgc=black)
- org_layout = pm.columnLayout()
- pm.separator(w=w, h=5)
- pm.text(w=w, h=60,
- label='HI!')
- pm.separator(w=w, h=5)
- pm.separator(w=w, h=5)
- def uv_tools_layout(w, h):
- main_layout = pm.columnLayout()
- header_layout = pm.frameLayout(label='UV Tools', w=w, cll=True, cl=False, bgc=black)
- org_layout = pm.columnLayout()
- pm.separator(w=w, h=5)
- pm.text(w=w, h=60,
- label='HI!')
- pm.separator(w=w, h=5)
- pm.separator(w=w, h=5)
- def mesh_tools_layout(w, h):
- main_layout = pm.columnLayout()
- header_layout = pm.frameLayout(label='Mesh Tools', w=w, cll=True, cl=False, bgc=black)
- org_layout = pm.columnLayout()
- pm.separator(w=w, h=5)
- pm.text(w=w, h=60,
- label='HI!')
- pm.separator(w=w, h=5)
- pm.separator(w=w, h=5)
Add Comment
Please, Sign In to add comment