Código:
macroScript SquashyBiped.
Category:lm_Rigging.
Toltip:SquashyBiped.
Buttontext:SquashyBiped.
(.
-------------------------------------------------------------------
-- Globals.
--***dialog settings***.
Global squashyBiped_dialog, squashyBiped_rollout.
Try(cui. FloatDialogBar squashyBiped_rollout)catch().
Try(cui, unRegisterDialogBar squashyBiped_rollout)catch().
Try (destroydialog squashyBiped_rollout) catch().
Global objs, parents.
Objs = #().
Parents = #().
-- Functions.
Fn biped_filt obj = classof obj == Biped_object.
Fn detect_bipeds =.
(.
Arr_bipeds = #().
For bips in geometry where (classof bips, controller == Vertical_Horizontal_Turn) do.
(.
Append arr_bipeds bips, name.
).
Return arr_bipeds.
).
Rollout squashyBiped_rollout StretchyBiped.
(.
Button btn_Stretch Make Stretchy toltip:select all Biped bones which you want to Stretch with one parameter across:2.
Checkbox ch_cntInclude Skip 1st toltip:will force action to take first obj as controller only offset:[20,5].
Button btn_remStretch remove Stretch toltip:select controller, width:170.
-- local functions.
Fn quick_react_setup react react2 = (.
Print react.
Print react2.
Print dir.
Print axis.
-- animate react2 (cos new state neds value).
Anim_val = 100.
Animate on at time 10 react2.value = anim_val.
Anim_val = -100.
Animate on at time 20 react2.value = anim_val.
-- create reaction controller on morph channel.
R_cnt = float_reactor().
React[1].controller = r_cnt.
-- creating state 1.
Reactto r_cnt react2.
-- creating state 2.
Slidertime = 10.
Createreaction r_cnt.
-- creating state 3.
Slidertime = 20.
Createreaction r_cnt.
-- setting reaction values.
SetReactionState r_cnt 1 0.5.
SetReactionState r_cnt 2 1.0.
SetReactionState r_cnt 3 6.0.
-- naming reactions.
SetReactionName r_cnt 1 min.
SetReactionName r_cnt 2 default.
SetReactionName r_cnt 3 max.
Slidertime = 0.
-- deleete animation keys.
DeleteKeys react2 #allKeys.
).
Fn setupExprCnt react react2 = (.
-- dealing with X AXIS for Stretch.
Cnt = float_expression().
React[1].controller = cnt.
Iface = cnt, iexprctrl.
Iface, addscalartarget stretch react2 offset:0.
Iface, setexpression stretch.
-- dealing with Y&Z axis for squash expression.
For i = 2 to 3 do (.
Cnt = float_expression().
React[i].controller = cnt.
Iface = cnt, iexprctrl.
Iface, addscalartarget stretch react2 offset:0.
Iface, setexpression (sqrt(stretch))/stretch.
).
).
Fn check_rig node = (.
If (node, modifiers[#attribute_holder].= undefined) then return true else return false.
).
On btn_remStretch pressed do.
(.
If (check_rig selection[1] == true) then (node = selection[1]).
If node.= undefined then.
(.
-- getting dependent nodes into array.
Nodes_arr = #().
Cnt_arr = #().
Cnt = node, modifiers[#Attribute_Holder].stretch, controller.
Nodes_arr = refs, dependentnodes cnt.
Try (deleteModifier node 1) catch().
For i in 1 to nodes_arr, count do.
(.
Cnt = nodes_arr[i].transform, controller, biped_subanim, controller, bipscalelist, controller.
Append cnt_arr cnt.
).
For i in 1 to cnt_arr, count do.
(.
Cnt_arr[i].deleete 1.
).
).
).
On btn_Stretch pressed do.
(.
Nodes_arr = #().
Cnt_arr = #().
Nodes_arr = selection as array.
If ch_cntInclude, state == true then deleteItem nodes_arr 1.
Node = selection[1].
If node.= undefined then.
(.
add modifier node (EmptyModifier ()).
New_def = attributes str_attributes).
(.
Parameters main ut:params.
(.
STRETCHType:#float UI:STRETCHDefault:1.0.
).
Rollout Params stretching Attributes.
(.
Spinner STRETCHSTRETCH: Width:100 Height:16 Align:#Left Offset:[0,0] Type:#float Range:[0.05,5,1.0].
).
).
CustAttributes, add node, modifiers[#attribute_holder] new_def.
For i in 1 to nodes_arr, count do.
(.
Cnt = nodes_arr[i].transform, controller, biped_subanim, controller, bipscalelist, controller.
Append cnt_arr cnt.
).
For i in 1 to cnt_arr, count do.
(.
New_cnt = scaleXYZ().
Cnt_arr[i]. Available, controller = new_cnt.
).
Cnt = Bézier_float() -- neded once.
React2_cnt = node, modifiers[#attribute_holder].stretch, controller = cnt.
For i in cnt_arr do.
(.
--react_cnt = i[1].controller.
-- setting Stretchy at x.
--quick_react_setup react_cnt react2_cnt -- setting Stretch at x axis.
-- setting squash at yz.
-- setup expression controllers.
React_cnt = i[1].controller -- sending xyz controller for scalelist first controller to setup expressions on this.
--print react_cnt.
SetupExprCnt react_cnt react2_cnt.
).
).
).
On squashyBiped_rollout open do.
(.
).
) -- end of ut.
On execute do (.
SquashyBiped_dialog = createDialog SquashyBiped_rollout 200 60 pos:[5,70]style:#(#style_titlebar, #style_border,#style_sysmenu).
SquashyBiped_rollout, title = (SquashyBiped + _v_0.2).
).
)
.