[Closed] Help with Curve Control
Hi!, I did this script to add a curve control on a custom attribute definition, and then add this definition to any object.
Basically what the scrip do, is take a cuve profile, a cycle and a multiplier, and applies a procedural cycle animation, using the curve profile as a guide.
everything seems to work fine, but when I leave modify mode, and enter again, the curve is resetted. I have tried almost everything to solve the problem, without good results.
if someone please could try the script and try to figure out the problem, I would greatly appreciate it.
Here is the code:
curvesCA = attributes CustomCurves
(
Parameters main rollout:CustomCV
(
cycle Type:#float UI:cycle Default:10
mult Type:#float UI:mult Default:30
)
Rollout customCV "Custom Curve"
(
CurveControl cc_test "Curve Control:" numcurves:1
spinner cycle "cycle:" Type:#float Range:[-1000,1000,10]
spinner mult "multiplier:" Type:#float Range:[-1000,1000,0]
)
)
max modify mode
CustAttributes.add $ curvesCA
$.cycle.controller = bezier_float()
$.mult.controller = bezier_float()
$.position.controller.z_position.controller = float_script()
$.position.controller.z_position.controller.addtarget "cycle" $.cycle.controller
$.position.controller.z_position.controller.addtarget "mult" $.mult.controller
$.position.controller.z_position.controller.addnode "obj" $
$.position.controller.z_position.controller.script = "c = obj.customcv.cc_test.curves[1]
phase = (mod currenttime cycle)/ cycle
(getvalue c currenttime phase) * mult"
Usage:
-select an object
-run the script
-change the profile
-modify the cycle or multiply parameters if you like
-hit play
thanks in advance
curve control is reset if the rollout is closed, and you cannot read from it if the curve control UI is not displayed – there are ways to store the information – i looked at this myself a few months ago – what the script did was to store all the points on the curve and the tangets storing them in custom attributes [floattabs], when the rollout was closed you use interlopation of the points made up from the data in the CA’s, when you re-open the curve control you set the curve using the points
mark