Notifications
Clear all

[Closed] Always Step Bezier Float Controller

Great stuff, much better than what I was using. cheers all.

Great idea to use CAs and the when constructor together! Thanks for sharing your code.

Today I had some free time, so I’m getting back to this.
What do you think about this?


fn alwaysStep obj ctrl ctrlStg = (
 alwaysCA = attributes alwaysStep ( parameters changeKeys ( changer type:#float ) )
 if iskindof ctrl Bezier_Float do (
  --Cleanup oldDefs
  for d in custAttributes.getDefs ctrl where d.name == #alwaysStep do ( custAttributes.delete ctrl d )
  --Add a fresh CA
  custAttributes.add ctrl alwaysCA
  s = ctrl.alwaysStep.changer.controller = float_script()
  s.addNode "self" obj
  s.setexpression ("self"+ctrlStg+".keys.intangenttype = self"+ctrlStg+".keys.outtangenttype = #step
0")
 )
)
alwaysStep $Sphere001 $Sphere001.position.Z_position.controller ".position.Z_position.controller"

Personally I think that it combines best from both worlds (especially after the optimisation that Denis will probably do hahaha ).
The thing I like the most, is that you can also easily track and delete all this CAs from all your scene Bezier_floats and you can easily add extra params (eg, you can have a param to enable/disable the float script etc).

P.S.: At the beginning I had a AttribID and a global CA but I have a habit not to you global vars so I decided to make it local.

the way how you do it by using CA doesn’t update the controlled ‘step’ float controller on every change event…

so my favorite is still yours ‘list controller’ + ‘expression’ solution.

Sorry for digging up and old thread… but I’m having some issue with this using this with a slider stored inside a CA

I tried both denis and nick variation but I can’t get it to work on my CA.
I can run the script, it create the float_list add the script and all but as soon as I test it I get an illegal self reference

All I changed was the path to my CA pointing to a slider. I converted the slider track to controller so I can retrieve/access it in script


$.modifiers[#test].testAttributes[#TestSwitch].controller = bezier_float()
alwaysStep $.modifiers[#test].testAttributes[#TestSwitch]  --

I run the script with the box and it run just fines… Am I assigning it to the right track!?

fixed, stored the script inside another object rather than in the CA’s controllers and it worked perfectly

Page 2 / 2