For the functionality of my scripted tool I’ve written some pseudo-code (in python format) that will guide me in programming later on.
This handles functionality of creating control shapes as well as user interface elements.
- import maya commands
- define function name_check_select
- enable name_input textField
- define function name_check_deselect
- disable name_input textField
- define function create_control
- joint_name from selection
- joint_name_stub = replace “jnt” with “” in joint_name
- current_ctrl_shape = “ctrl” + joint_name_stub
- current_group = “grp” + joint_name_stub + “offset”
- radius = radius_input from textField
- if radio_general radioButton is selected
- create nurbsCircle with name current_ctrl_shape and radius of radius
- if radio_rotator radioButton is selected
- create nurbsCircle with name current_ctrl_shape and radius of radius
- delete history on current_ctrl_shape
- duplicate current_ctrl_shape with temporary name circle_1
- duplicate current_ctrl_shape with temporary name circle_2
- rotate circle_1 by 90 degrees in X axis
- rotate circle_2 by 90 degrees in Y axis
- freeze transformations on circle_1
- freeze transformations on circle_2
- parent the shape node of circle_1 to current_ctrl_shape
- parent the shape node of circle_2 to current_ctrl_shape
- delete circle_1 transform node
- delete circle_2 transform node
- create a group with name current_group for current_ctrl_shape
- parent current_group to joint_name
- set rotateX attribute on current_group to 0
- set rotateY attribute on current_group to 0
- set rotateZ attribute on current_group to 0
- set translateX attribute on current_group to 0
- set translateY attribute on current_group to 0
- set translateZ attribute on current_group to 0
- unparent current_group from joint_name
- if window wnd_control_maker exists
- delete wnd_control_maker
- create wnd_ctrl_maker
- create buttons, radioButtons, text and textFields
- position buttons, radioButtons, text and textFields on form
- show wnd_control_maker