Create animation curve on specific animation layer c++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am working on a C++ plugin that creates animation curves for a list of attributes. It works well when there is only the BaseAnimation anim layer, but when there are multiple animation layers for my attributes, the plugin fails to create the curves. I am able to get the plug I am looking for, then :
When there are no keys on the attribute I am using MFnAnimCurve::create(const MPlug &plug, AnimCurveType animCurveType, MDGModifier *modifier=NULL, MStatus *ReturnStatus=NULL) and it fails with error "(kInvalidParameter): Dependency graph plug already has connection".
And when there are keys, I am trying to get the existing curve with MFnAnimCurve(const MPlug &plug, MStatus *ReturnStatus=NULL) and it fails with "(kNotImplemented): Unexpected Internal Failure".
I don't think I really understand the relationship between attributes and animation layers, but I did not see any function specifying an animation layer in the C++ API. However, I see a lot of people working with Python/MEL asking how to specify an animation layer when adding keyframes and it seems possible for them. The command setKeyFrame can specify the animation layer name, but in C++ MFnAnimCurve::addKeys cannot...
I also looked at the Maya devkit example "atomImportExport" but they don't seem to create anim curves from scratch and this is really what I need to do.
So my question is : is there a way to specify the animation layer with C++ to create an animation curve and set keys on this layer only ?
Thanks,