1
$\begingroup$

Most engines that support skeletal animation have some concept of keyframe events. Essentially, a keyframe can have arbitrary metadata associated with it that is inspected by the code that is driving the animation in the engine. This data is then used to perform actions at the appropriate times when the animation is rendered.

As a simple contrived example: An artist might create a walk cycle animation and on each keyframe where the walking character's foot touches the floor, the keyframes are annotated with a FootStepEvent string. When the walk cycle is rendered in the receiving engine, the engine sees the FootStepEvent string on a given keyframe and knows that it should play a footstep sound each time that particular frame is reached.

The engine I'm developing has support for this, and I have written various addons to get animation and bone data out of Blender. Specifically, for each action, I'm recording all of the action's FCurves and taking a snapshot of the skeleton at each keyframe along with data such as the curve's easing and interpolation settings.

The problem: How do I actually author per-keyframe metadata in Blender? What I would like to be able to do is associate simple strings with particular keyframes inside actions. I can't see anything in Blender's data model that would allow me to do this.

$\endgroup$
1
$\begingroup$

Blender provides property definitions that we can use to add custom properties to objects and bones. You will then want to define a panel that displays the property so that you can easily edit it.

As we can't animate strings I expect you will need to use a collection to define a string and frame number or range of frames that it will be applied to. Another option may be to assign a number to each sound and animate a custom integer. You can use an EnumProperty to create a menu that lists available sounds but stores a numeric value instead of a string.

$\endgroup$
  • $\begingroup$ Can I apply properties to actions? The event data is action-specific, not object or bone specific. $\endgroup$ – oceanic Nov 28 '16 at 12:18
  • $\begingroup$ To answer my own question: "Custom properties can be added to any subclass of an ID, Bone and PoseBone." and Action is a subclass of ID. So... Yes! $\endgroup$ – oceanic Nov 28 '16 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.