Script on custom attribut controller problem
Hi, Before to start with my problem, thanks for your website, really usefull ! I'm working on a simple script to batch a controller with several options, it work perfectly on a classic controller like a position but not on a custom attribut and i can't find my error. Please find bellow a short version of my script ( this part bake controller )
Hi, Before to start with my problem, thanks for your website, really usefull ! I'm working on a simple script to batch a controller with several options, it work perfectly on a classic controller like a position but not on a custom attribut and i can't find my error. Please find bellow a short version of my script ( this part bake controller )
<code>
fn bakeMe ctrl fromRange:animationRange.start toRange:animationRange.end = (
fromRange = fromRange as time
toRange = toRange as time
if (superclassof ctrl.controller) != FloatController do -- ctrl doit-être un controler de type float
(
print "Only work on FloatController superClass"
return false
)
undo "BakeControler " on (
tmpVal=#()
try (
-- record value
for i = fromRange to toRange do (
at time i (
append tmpVal ctrl.controller.value
)
)
-- assign new controller
ctrl.controller=linear_float()
--applying value to the new controller
for i = fromRange to toRange do (
at time i (
numID =((i.frame)+1-(fromRange.frame as integer)) as integer
with animate on (
ctrl.controller.value = tmpVal[numID]
)
)
)
)catch(
format "*** BakingError: % ***\n" (getCurrentException())
)
)
)
bakeMe $.position.controller[1] -- Work perfeclty
bakeMe bakeMe $.baseObject.Custom_Attributes.param1 -- Crash with Unknown property: "controller" in 6.69115 ( value )
</code>
Thanks for your help
Comments
Got my solution on another
Got my solution on another forum watting to be approved here.
So if it's can help someone :
fn bakeFloatController c type:#linear range: step:1 = if iskindof c FloatController do
(
if range == unsupplied do range = getTimeRange c
_c = if type == #linear then linear_float() else bezier_float()
for t = range.start to range.end by step do at time t
(
k = addNewKey _c t
k.value = c.value
)
replaceinstances c _c
numkeys _c
)