PDA

View Full Version : attribute holder slider ui controller association


resh
10-05-2009, 08:08 AM
Im curious how to associate a controller with a slider element in a rollout thats being created. the help file suggests merely using the controller: parameter but if it hasnt been created yet?

code:

b = emptymodifier()
b.name = "Reset"
try addmodifier o b catch()
starttotimo = attributes startto
(
parameters main rollout:resetointi
(
skaala type:#float ui:blendi default:1.0 --controller: hasnotbeencreatedyet!
)
rollout resetointi "Reset" width:161 height:50
(
button resetb "Reset Both"
button resett "Reset Position"
button reset2 "Reset Rotation"
slider blendi "curve"
on resetb pressed do
(
lst = $.pos.controller.count
lstr = $.rotation.controller.count
$.pos.controller[lst].X_Position.controller.value = 0.0
$.pos.controller[lst].Y_Position.controller.value = 0.0
$.pos.controller[lst].Z_Position.controller.value = 0.0
$.rotation.controller[lstr].X_Rotation.controller.value = 0.0
$.rotation.controller[lstr].Y_Rotation.controller.value = 0.0
$.rotation.controller[lstr].Z_Rotation.controller.value = 0.0
)
on resett pressed do
(
lst = $.pos.controller.count
$.pos.controller[lst].X_Position.controller.value = 0.0
$.pos.controller[lst].Y_Position.controller.value = 0.0
$.pos.controller[lst].Z_Position.controller.value = 0.0
)
on reset2 pressed do
(
lstr = $.rotation.controller.count
$.rotation.controller[lstr].X_Rotation.controller.value = 0.0
$.rotation.controller[lstr].Y_Rotation.controller.value = 0.0
$.rotation.controller[lstr].Z_Rotation.controller.value = 0.0
)
)
)
custattributes.add o.modifiers["reset"] starttotimo
o.modifiers["Reset"].startto.skaala.controller = bezier_float()

so how do i associate the skaala parameter with the controller i create at the after the fact? do i have to redefine the attribute? Since otherwise the connection is lost when reloading the scene. This parameter controls vertex tangent length at a line vertex controlled by a spline ik control helper.

resh
10-05-2009, 10:23 AM
resetting max seems to be the problem...

PEN
10-05-2009, 01:11 PM
The solution you have come up with works but it is completely name dependent and not really a good idea.

What you need to do is list the UI elements in the parameter block so the params and HUI items are connected. Then wire the needed tracks or use other controllers to connect the needed parameters in the rig to the parameters in the CA def.

parameters test rollout:testR
(
someVal type:#float UI:someValSpinner
)
rollout testR "Test"
(
spinner someValSpinner "Some Val"
)

resh
10-06-2009, 11:42 AM
Thanks for the reply!
I solved this by first creating a CA+controller for the baseobject of the helper. Then i just created and associated the empty modifier CA to the aforementioned controller. Works like a charm! The thing is that this controller then drives the appropriate spline vertex InVec/OutVec Y_positions so that i can alter how round an elbow is for instance(though this one is not for a character rig)
I guess using $ to for the position/rotation reset buttons is an ugly hack nonetheless...
Is there a way to reference the node that im creating a CA for in the CA definition?

CGTalk Moderation
10-06-2009, 11:42 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.