Page 1 of 1

Spliting keyframe dimensions

Posted: Mon Jul 18, 2022 7:05 pm
by ggoblin
If you want to split keyframe dimensions, what is the correct procedure to do it from script?

For example if you want noisy interpretation in the y dimension and linear interpretation in the other channels I used

Code: Select all

mylayer.fTranslation:SetKeyInterp(myframe,MOHO.INTERP_LINEAR)

mylayer.fTranslation:DimensionChannel(1):SetKeyInterp(myframe,MOHO.INTERP_NOISY,myamp,myscale)
I think it resulted in some wierd side effects like keyframes defined BEFORE the split loosing some of their dimensions, so I changed it to:

Code: Select all

mylayer.fTranslation:SetKeyInterp(myframe,MOHO.INTERP_LINEAR)

my layer.fTranslation:SplitDimensions(true)
mylayer.fTranslation:DimensionChannel(1):SetKeyInterp(myframe,MOHO.INTERP_NOISY,myamp,myscale)
Now I am wondering do i need to add

Code: Select all

my layer.fTranslation:SplitDimensions(false)
at the end to join the dimensions again?

I don't really understand what SplitDimensions does, is it required before DimensionChannel is called?

I couldn't find any examples of SplitDimensions being used with a true value, and the documentation is empty other that saying it takes an argument b of type boolean and returns nothing.

Any insights would be greatly appreciated. Thank you.

Re: Spliting keyframe dimensions

Posted: Mon Jul 18, 2022 7:25 pm
by synthsin75
Just like using split dimensions in the UI, you have to split the dimensions and leave them split for different axes to retain different interpolations.

So your second code block should be all you need.

Re: Spliting keyframe dimensions

Posted: Tue Jul 19, 2022 1:46 am
by ggoblin
synthsin75 wrote: Mon Jul 18, 2022 7:25 pm Just like using split dimensions in the UI, you have to split the dimensions and leave them split for different axes to retain different interpolations.

So your second code block should be all you need.
Thank you for confirming this.

What happens is we call DimensionChannel without first calling SplitDimensions? Shouldn't DimensionChannel implicitly call SplitDimensions?

Re: Spliting keyframe dimensions

Posted: Tue Jul 19, 2022 2:48 am
by synthsin75
ggoblin wrote: Tue Jul 19, 2022 1:46 am What happens is we call DimensionChannel without first calling SplitDimensions? Shouldn't DimensionChannel implicitly call SplitDimensions?
I assume DimensionChannel just fails. I can't think of any API that automatically invoke another. Kind of like how you have to cast layer type, even after explicitly creating a specific layer type.

Re: Spliting keyframe dimensions

Posted: Tue Jul 19, 2022 5:36 am
by ggoblin
synthsin75 wrote: Tue Jul 19, 2022 2:48 am
ggoblin wrote: Tue Jul 19, 2022 1:46 am What happens is we call DimensionChannel without first calling SplitDimensions? Shouldn't DimensionChannel implicitly call SplitDimensions?
I assume DimensionChannel just fails. I can't think of any API that automatically invoke another. Kind of like how you have to cast layer type, even after explicitly creating a specific layer type.
Good point.

In that case perhaps it might be worth documenting this in the description of DimensionChannel that you must first call SplitDimensions(true) otherwise it will fail without error message, and as a result you may see unexpected behaviour in other parts of your script.

https://mohoscripting.com/methods/1170