Hi
when i make a spinner/slider, it works well
but when i click another object then i come back to the object that have the spinner/slider custom attributes
the value change to zero
i want to keep the value when i click another object but i d'ont know what to do
here is the code:
------------------------------
CharacterName = "Joshua"
--TURN OFF INHERIT ROTATION
setInheritanceFlags (execute ("$"+CharacterName+"_Hlp_L_BallPointFoot")) #{1..3,5,6,7..9}
setInheritanceFlags (execute ("$"+CharacterName+"_Hlp_R_BallPointFoot")) #{1..3,5,6,7..9}
AttribHolderL = EmptyModifier()
AttribHolderR = EmptyModifier()
addmodifier (execute ("$"+CharacterName+"_Ctrl_L_Leg")) AttribHolderL
addmodifier (execute ("$"+CharacterName+"_Ctrl_R_Leg")) AttribHolderR
FootCtrlParL = attributes FootControllersL
(
parameters FootControllersPL rollout:FootControllersRollL
(
HeelPellL type:#float animatable:on ui:(ui_HeelPellL_sl,ui_HeelPellL_sp)
ToeTapL type:#float animatable:on ui:(ui_ToeTapL_sl,ui_ToeTapL_sp)
ToeTwistL type:#float animatable:on ui:(ui_ToeTwistL_sl,ui_ToeTwistL_sp)
ToeLiftL type:#float animatable:on ui:(ui_ToeLiftL_sl,ui_ToeLiftL_sp)
HeelTwistL type:#float animatable:on ui:(ui_HeelTwistL_sl,ui_HeelTwistL_sp)
HeelLiftL type:#float animatable:on ui:(ui_HeelLiftL_sl,ui_HeelLiftL_sp)
slideKneeScL type:#float ui:(ui_slideKneeSpL,ui_SlideKneeSlL)
)
rollout FootControllersRollL "Foot Control Parameters"
(
local range=[0,100,0]
Group "Foot Control"
(
spinner ui_HeelPellL_sp "" range:[0,50,0] controller:(bezier_float()) width:50
slider ui_HeelPellL_sl "Foot roll" range:[0,50,0] offset: [0,-20]
spinner ui_ToeLiftL_sp "" range:range controller:(bezier_float()) width:50
slider ui_ToeLiftL_sl "Toe lift" range:[0,100,0] offset: [0,-20]
spinner ui_ToeTapL_sp "" range:[-50,50,0] controller:(bezier_float()) width:50
slider ui_ToeTapL_sl "Toe tap" range:[-50,50,0] offset: [0,-20]
spinner ui_ToeTwistL_sp "" range:[-50,50,0] controller:(bezier_float()) width:50
slider ui_ToeTwistL_sl "Toe twist" range:[-50,50,0] offset: [0,-20]
spinner ui_HeelTwistL_sp "" range:[-50,50,0] controller:(bezier_float()) width:50
slider ui_HeelTwistL_sl "Heel twist" range:[-50,50,0] offset: [0,-20]
spinner ui_HeelLiftL_sp "" range:[-50,50,0] controller:(bezier_float()) width:50
slider ui_HeelLiftL_sl "Heel lift" range:[-50,50,0] offset: [0,-20]
)
Group "Delete Animation"
(
--button keyall "Key All"
--button resetall "Reset All"
button deleteall "Delete All keys"
)
Group "Scale Knee"
(
spinner ui_slideKneeSpL "" range:[0,100,0] controller:(bezier_float()) width:50
slider ui_SlideKneeSlL "Slide" range:[0,100,0] offset: [0,-20]
)
/*
on keyall pressed do
(
for con in #(ui_HeelPellL_sp) do
con.value = ui_HeelPellL_sp.value
for con in #( ui_ToeTapL_sp) do
con.value = ui_ToeTapL_sp.value
for con in #(ui_ToeTwistL_sp) do
con.value = ui_ToeTwistL_sp.value
for con in #(ui_ToeLiftL_sp) do
con.value = ui_ToeLiftL_sp.value
for con in #(ui_HeelTwistL_sp) do
con.value = ui_HeelTwistL_sp.value
for con in #( ui_HeelLiftL_sp) do
con.value = ui_HeelLiftL_sp.value
for con in #( ui_slideKneeSpL) do
con.value = ui_slideKneeSpL.value
)
*/
on ui_HeelPellL_sp changed val do
(
ui_HeelPellL_sl.value = val
)
on ui_HeelPellL_sl changed val do
(
ui_HeelPellL_sp.value = val
)
on deleteall pressed do
(
for con in #(ui_HeelPellL_sp, ui_ToeTapL_sp, ui_ToeTwistL_sp, ui_ToeLiftL_sp, ui_HeelTwistL_sp, ui_HeelLiftL_sp) do
con.value = 0
for con in #(ui_HeelPellL_sp, ui_ToeTapL_sp, ui_ToeTwistL_sp, ui_ToeLiftL_sp, ui_HeelTwistL_sp, ui_HeelLiftL_sp) do
-----key for controllers
deletekeys ui_HeelPellL_sp.controller
#allkeys deletekeys ui_ToeTapL_sp.controller
#allkeys deletekeys ui_ToeTwistL_sp.controller
#allkeys deletekeys ui_ToeLiftL_sp.controller
#allkeys deletekeys ui_HeelTwistL_sp.controller
#allkeys deletekeys ui_HeelLiftL_sp.controller
#allkeys --deletekeys ui_slideKneeSpL.controller
#allkeys ---- key in the timeline
deletekeys (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllers.HeelPellL.controller
#allkeys deletekeys (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllers.ToeTapL.controller
#allkeys deletekeys (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllers.ToeTwistL.controller
#allkeys deletekeys (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllers.ToeLiftL.controller #allkeys
deletekeys (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllers.HeelTwistL.controller
#allkeys deletekeys (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllers.HeelLiftL.controller
#allkeys --deletekeys (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllers.slideKneeScL.controller #allkeys
)
/*
on resetall pressed do
(
for con in #(ui_HeelPellL_sp, ui_ToeTapL_sp, ui_ToeTwistL_sp, ui_ToeLiftL_sp,ui_HeelTwistL_sp,ui_HeelLiftL_sp,ui_slideKneeSpL) do
con.value = 0
)
*/
)
)
FootCtrlParR = attributes FootControllersR
(
parameters FootControllersPR rollout:FootControllersRollR
(
HeelPellR type:#float animatable:on ui:(ui_HeelPellR_sl,ui_HeelPellR_sp)
ToeTapR type:#float animatable:on ui:(ui_ToeTapR_sl,ui_ToeTapR_sp)
ToeTwistR type:#float animatable:on ui:(ui_ToeTwistR_sl,ui_ToeTwistR_sp)
ToeLiftR type:#float animatable:on ui:(ui_ToeLiftR_sl,ui_ToeLiftR_sp)
HeelTwistR type:#float animatable:on ui:(ui_HeelTwistR_sl,ui_HeelTwistR_sp)
HeelLiftR type:#float animatable:on ui:(ui_HeelLiftR_sl,ui_HeelLiftR_sp)
slideKneeScR type:#float ui:(ui_slideKneeSpR,ui_SlideKneeSlR)
)
rollout FootControllersRollR "Foot Control Parameters"
(
local range=[0,100,0]
Group "Foot Control"
(
spinner ui_HeelPellR_sp "" range:[0,50,0] controller:(bezier_float()) width:50
slider ui_HeelPellR_sl "Foot roll" range:[0,50,0] offset: [0,-20]
spinner ui_ToeLiftR_sp "" range:range controller:(bezier_float()) width:50
slider ui_ToeLiftR_sl "Toe lift" range:[0,100,0] offset: [0,-20]
spinner ui_ToeTapR_sp "" range:[-50,50,0] controller:(bezier_float()) width:50
slider ui_ToeTapR_sl "Toe tap" range:[-50,50,0] offset: [0,-20]
spinner ui_ToeTwistR_sp "" range:[-50,50,0] controller:(bezier_float()) width:50
slider ui_ToeTwistR_sl "Toe twist" range:[-50,50,0] offset: [0,-20]
spinner ui_HeelTwistR_sp "" range:[-50,50,0] controller:(bezier_float()) width:50
slider ui_HeelTwistR_sl "Heel twist" range:[-50,50,0] offset: [0,-20]
spinner ui_HeelLiftR_sp "" range:[-50,50,0] controller:(bezier_float()) width:50
slider ui_HeelLiftR_sl "Heel lift" range:[-50,50,0] offset: [0,-20]
)
Group "Delete Animation"
(
--button keyall "Key All"
--button resetall "Reset All"
button deleteall "Delete All keys"
)
Group "Scale Knee"
(
spinner ui_slideKneeSpR "" range:[0,100,0] controller:(bezier_float()) width:50
slider ui_SlideKneeSlR "Slide" range:[0,100,0] offset: [0,-20]
)
/*
on keyall pressed do
(
for con in #(ui_HeelPellR_sp) do
con.value = ui_HeelPellR_sp.value
for con in #( ui_ToeTapR_sp) do
con.value = ui_ToeTapR_sp.value
for con in #(ui_ToeTwistR_sp) do
con.value = ui_ToeTwistR_sp.value
for con in #(ui_ToeLiftR_sp) do
con.value = ui_ToeLiftR_sp.value
for con in #(ui_HeelTwistR_sp) do
con.value = ui_HeelTwistR_sp.value
for con in #( ui_HeelLiftR_sp) do
con.value = ui_HeelLiftR_sp.value
for con in #( ui_slideKneeSpR) do
con.value = ui_slideKneeSpR.value
)
*/
on deleteall pressed do
(
for con in #(ui_HeelPellR_sp, ui_ToeTapR_sp, ui_ToeTwistR_sp, ui_ToeLiftR_sp, ui_HeelTwistR_sp, ui_HeelLiftR_sp) do
con.value = 0
for con in #(ui_HeelPellR_sp, ui_ToeTapR_sp, ui_ToeTwistR_sp, ui_ToeLiftR_sp, ui_HeelTwistR_sp, ui_HeelLiftR_sp) do
-----key for controllers
deletekeys ui_HeelPellR_sp.controller
#allkeys deletekeys ui_ToeTapR_sp.controller
#allkeys deletekeys ui_ToeTwistR_sp.controller
#allkeys deletekeys ui_ToeLiftR_sp.controller
#allkeys deletekeys ui_HeelTwistR_sp.controller
#allkeys deletekeys ui_HeelLiftR_sp.controller
#allkeys --deletekeys ui_slideKneeSpR.controller
#allkeys ---- key in the timeline
deletekeys (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR.HeelPellR.controller
#allkeys deletekeys (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR.ToeTapR.controller
#allkeys deletekeys (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR.ToeTwistR.controller
#allkeys deletekeys (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR.ToeLiftR.controller #allkeys
deletekeys (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR.HeelTwistR.controller
#allkeys deletekeys (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR.HeelLiftR.controller
#allkeys --deletekeys (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR.slideKneeScR.controller #allkeys
)
/*
on resetall pressed do
(
for con in #(ui_HeelPellR_sp, ui_ToeTapR_sp, ui_ToeTwistR_sp, ui_ToeLiftR_sp,ui_HeelTwistR_sp,ui_HeelLiftR_sp,ui_slideKneeSpR) do
con.value = 0
)
*/
)
)
custAttributes.add (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[1] FootCtrlParR
custAttributes.add (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[1] FootCtrlParL
---
---
--HEEL PEEL
---
---
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllersL[#HeelPellL] (execute ("$"+CharacterName+"_Bn_Rev_L_Ankle")).rotation.controller.Zero_Euler_XYZ.controller[#Z_Rotation] "-HeelPellL/100"
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR[#HeelPellR] (execute ("$"+CharacterName+"_Bn_Rev_R_Ankle")).rotation.controller.Zero_Euler_XYZ.controller[#Z_Rotation] "-HeelPellR/100"
---
---
--TOE TAP
---
---
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllersL[#ToeTapL] (execute ("$"+CharacterName+"_Hlp_L_RotPointFoot")).rotation.controller.Zero_Euler_XYZ.controller[#X_Rotation] "-ToeTapL/50"
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR[#ToeTapR] (execute ("$"+CharacterName+"_Hlp_R_RotPointFoot")).rotation.controller.Zero_Euler_XYZ.controller[#X_Rotation] "-ToeTapR/50"
---
---
--TOE TWIST
---
---
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllersL[#ToeTwistL] (execute ("$"+CharacterName+"_Bn_Rev_L_Toe")).rotation.controller.Zero_Euler_XYZ.controller[#Y_Rotation] "-ToeTwistL/50"
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR[#ToeTwistR] (execute ("$"+CharacterName+"_Bn_Rev_R_Toe")).rotation.controller.Zero_Euler_XYZ.controller[#Y_Rotation] "ToeTwistR/50"
---
---
--TOE LIFT
---
---
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllersL[#ToeLiftL] (execute ("$"+CharacterName+"_Bn_Rev_L_Toe")).rotation.controller.Zero_Euler_XYZ.controller[#Z_Rotation] "-ToeLiftL/100"
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR[#ToeLiftR] (execute ("$"+CharacterName+"_Bn_Rev_R_Toe")).rotation.controller.Zero_Euler_XYZ.controller[#Z_Rotation] "-ToeLiftR/100"
---
---
--HEEL TWIST
---
---
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllersL[#HeelTwistL] (execute ("$"+CharacterName+"_Bn_Rev_L_Heel")).rotation.controller.Zero_Euler_XYZ.controller[#Y_Rotation] "-HeelTwistL/100"
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR[#HeelTwistR] (execute ("$"+CharacterName+"_Bn_Rev_R_Heel")).rotation.controller.Zero_Euler_XYZ.controller[#Y_Rotation] "HeelTwistR/100"
---
---
--HEEL LIFT
---
---
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_L_Leg")).modifiers[#Attribute_Holder].FootControllersL[#HeelLiftL] (execute ("$"+CharacterName+"_Bn_Rev_L_Heel")).rotation.controller.Zero_Euler_XYZ.controller[#Z_Rotation] "-HeelLiftL/100"
paramWire.connect (execute ("$"+CharacterName+"_Ctrl_R_Leg")).modifiers[#Attribute_Holder].FootControllersR[#HeelLiftR] (execute ("$"+CharacterName+"_Bn_Rev_R_Heel")).rotation.controller.Zero_Euler_XYZ.controller[#Z_Rotation] "-HeelLiftR/100"
----------------------------
thank you very much for you attention
Marcos
Replies
So anyone can help me?
Thank you very much
Marcos
It is Maxscript
This is difficult to debug, because you are using several hard coded object names. Basically I can't run the script without your max file.
But I can give a few suggestions.
- Since the modifier is already a variable, there's no need to execute a string to get the object and then it's modifier.
As for as the sliders not updating. I peeled back the code, and it works for me.Try posting the smallest amount of code that doesn't work for you. Then we can help you better.
Thank you very much for your answer. Yes it is so big code and I will reduce next time. I found code format. Great tip.
Marcos