Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from maya import cmds
- win_name = 'rig_blendShapeManager'
- text_scoll_list_name = 'bsm_tsl'
- slider_name = 'bsm_slider'
- def blend_shape_manager_UI():
- if cmds.window(win_name, q=True, ex=True):
- cmds.deleteUI(win_name)
- cmds.window(win_name, t="Blend Shape Manager")
- cmds.columnLayout()
- cmds.textScrollList(
- text_scoll_list_name,
- sc=blend_shape_manager_connect,
- dcc=blend_shape_manager_activate,
- ams=True)
- cmds.floatSliderGrp(slider_name, field=True, minValue=0.0, maxValue=1.0, value=0)
- cmds.button(l="Refresh", c=blend_shape_manager_update)
- cmds.button(l="Reset", c=blend_shape_manager_reset)
- cmds.setParent("..")
- cmds.showWindow(win_name)
- def blend_shape_manager_update(*args):
- blend_shape_node = get_blend_shape_node()
- attributes = cmds.listAttr(blend_shape_node + ".weight", m=True)
- cmds.textScrollList(text_scoll_list_name, e=True, removeAll=True)
- cmds.textScrollList(text_scoll_list_name, e=True, append=attributes)
- def blend_shape_mappnager_reset(*args):
- blend_shape_node = get_blend_shape_node()
- attributes = cmds.listAttr(blend_shape_node + ".weight", m=True)
- for attr in attributes:
- cmds.setAttr(blend_shape_node + '.' + attr, 0)
- def get_blend_shape_node():
- selection = cmds.ls(sl=True)
- history_list = cmds.listHistory(selection[0])
- for node in history_list:
- if cmds.nodeType(node) == "blendShape":
- return node
- def blend_shape_manager_activate():
- blend_shape_node = get_blend_shape_node()
- selected = cmds.textScrollList(text_scoll_list_name, q=True, si=True)
- cmds.setAttr(blend_shape_node + '.' + selected[0], 1)
- def blend_shape_manager_connect():
- blend_shape_node = get_blend_shape_node()
- selected = cmds.textScrollList(text_scoll_list_name, q=True, si=True)
- attributes = [blend_shape_node + '.' + attr for attr in selected]
- cmds.connectControl(slider_name, *attributes)
- blend_shape_manager_UI()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement