CH_Channel what is the best way to get list of keys

   1511   2   1
User Avatar
Member
11 posts
Joined: June 2008
Offline
I am learng HDK. Trying to write plugin that will export animation to my game engine.
I would appreciate a lot if someone could show me right way to get a list of animation keys and slobs data.
Right now I have CH_Channel and I Am trying to understand how I need to go from there.
Is CH_Segment what I need to do next? Is Segment part from key to key or it is complete animation curve from start to end?

Thanks.
User Avatar
Staff
476 posts
Joined: April 2014
Offline
Houdini stores animation as a list of segments with in/out values/slopes/accelerations.
The in/out values/slopes/accelerations can be individually tied to share the same values from segment to segment. Each segment also has an expression, which controls how to interpret all the in/out values. The built-in expressions such as bezier(), cubic(), linear(), constant() use the values internally. You can set a user expression such as ‘sin($FF)’ or even mix builtin and user expressions: ‘bezier() + sin($FF)’

Since you are exporting to a game engine, it might more convenient to resample the channels manually to support all the expressions types.

Houdini parameters can also be overridden by CHOP exports, so querying the CH_Channel directly won't give you the value of the overrides.

So I suggest you to use PRM_Parm::getValue() first instead of CH_Channel::sampleValueSlope().

Then if you want to improve your exporter to detect and support linear() or bezier() curves natively without resampling you could iterate on all the CH_Segments from a CH_Channel using getNSegments() and getSegment(idx).

On each CH_Segment, you then use getInValue(), getOutValue() and isInValueTied() isOutValueTied().
Make sure you detect that all the segments share the same built-in expression and that everything is tied.

OK, please tell me if this is helping you.
User Avatar
Member
11 posts
Joined: June 2008
Offline
Thank you. This helped me a lot.
I have in my game engine step, linear, bazier interpolation. I was using FBX before. 3D app -> fbx -> fbxTogame app -> game app . Naw I am doing 3D app -> game app. Basically fbxTogame app is naw new plugin (lib) in 3D App. In tis case Houdini that makes files that will be load to game.
  • Quick Links