How to add an extension to Animation.Channel.Target (KHR_animation_pointer) #613
-
Hello, I'm looking at how to pass through KHR_animation data written to I'm not sure how to correctly set an extension on a channel target. It looks like there is currently no support for that? (docs) Something like: function read(context){
context.jsonDoc.json.animations?.forEach((animDef, index) => {
animDef.channels.forEach((channel, channelIndex) => {
const animation = context.animations[index];
const animationChannel = animation.channels[channelIndex];
const target = channel.target;
const extensionDef = target.extensions && target.extensions[EXTENSION_NAME];
const extension = this.document.createExtension(OpaqueExtension);
const ext = extension.create(extensionDef, context);
animationChannel.target.setExtension(EXTENSION_NAME, ext); // < setting the extension on the target
});
});
} Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
donmccurdy
Jul 9, 2022
Replies: 1 comment
-
The AnimationChannel class inlines "target.path" and "target.node" into the class as "targetPath" and "targetNode", so I think it'd make sense to attach this extension to the channel. It can still write to the target object when serialized to JSON. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
marwie
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The AnimationChannel class inlines "target.path" and "target.node" into the class as "targetPath" and "targetNode", so I think it'd make sense to attach this extension to the channel. It can still write to the target object when serialized to JSON.