Page 1 of 1
Getting Bezier Handle Values from Keys
Posted: Fri May 15, 2015 12:30 pm
by GaryC
We have a script for nudging keys that was originally written by Rudiger (rt_). It was written before Anime Studio 10, and when it's used on keys with bezier curves it doesn't retain the position of the bezier handles, they revert to defaults. I assume this is because the command used for getting bezier information doesn't actually get all the information necessary when setting a new key.
This is currently what it uses:
Code: Select all
channel:GetKeyInterp(frame, interp_mode, val1, val2)
Is there a similar command available to get all the bezier data from a key in the newer versions?
Re: Getting Bezier Handle Values from Keys
Posted: Fri May 15, 2015 8:57 pm
by hayasidist
check the pkg_moho file that's in the "extra files/Lua Scripting" zip.. I think you'll need the InterpSetting class.
Re: Getting Bezier Handle Values from Keys
Posted: Mon May 18, 2015 10:15 am
by GaryC
Aha, I did indeed find it
Code: Select all
class InterpSetting {
...
real BezierOutAngle(int32 component);
void SetBezierOutAngle(int32 component, real angle);
real BezierInAngle(int32 component);
void SetBezierInAngle(int32 component, real angle);
real BezierOutPercentage(int32 component);
void SetBezierOutPercentage(int32 component, real percent);
real BezierInPercentage(int32 component);
void SetBezierInPercentage(int32 component, real percent);
But I'm a little unclear with how I'd get access to an instance of the class to actually use those methods? As far as I can see there isn't a method to use on the animation channel to get it to provide me with each InterpSetting object. The settings being accessed so far were with a method built into the animation channel itself.
Is this something I'd need to edit into the actual moho_pkg to make it work?
Re: Getting Bezier Handle Values from Keys
Posted: Mon May 18, 2015 9:27 pm
by hayasidist
I'm in the realms of guesswork here, but I think you'll need to
get the animation channel
then
local interp = MOHO.InterpSetting:new_local()
channel:GetKeyInterp(moho.frame, interp) will populate interp
and
angle = interp:BezierOutAngle()
etc should give you access to the data you need...
BUT, I am guessing, so please let me know how you get on!
Re: Getting Bezier Handle Values from Keys
Posted: Tue May 19, 2015 5:13 pm
by GaryC
Ah, you were right! That has given me access to the InterpSetting object. Now I just need to make sense of the BezierInAngle parameter and return value. Thanks!