Search code examples
mayamelfbx

Maya: Merging FBX animation on top of HIK rig with namespace


I have an HIK character rig that is referenced into the scene with the namespace "rig:". I have a bunch of animation files that are of the same skeleton, but without an HIK rig and a namespace.

I can import and merge the animation on to my reference rig via Maya's Import window. In the Namespace Options, I select the HIK rig's namespace, then "Use selected namespace...add new string". And I set my animation to "Update". This works great.

However, I can't get a command line in MEL to work. The command I get for the above via the Script Editor's echo all is:

file -import -type "FBX"  -ignoreVersion -ra true -mergeNamespacesOnClash false -namespace "testNs"  -pr  -importTimeRange "combine" "C:/myFile.fbx";

But for some reason this doesn't work. The command seems to omit the referencing info from the options window I mentioned above, namely, selecting the referencing parent. I didn't notice anything in the FBX MEL commands documentation either. Is Maya running another command that isn't getting output in the Script Editor's echo all?

Any help would e appreciated.


Solution

  • I needed to set the namespace to the HIK's character namespace from within the referencing system. I also needed to set the type of import option I wanted (in this case, merging only bones it can find names for). I guess this is effectively what the Maya file import options box is doing.

    namespace -set "hik_rig_namespace";
    FBXImportMode -v "exmerge";
    file -import -type "FBX"  -ignoreVersion -ra true -mergeNamespacesOnClash true -namespace "this_doesnt_matter"  -pr -importTimeRange "combine" "C:/myFile.fbx";
    namespace -set ":";
    

    The namespace in the Maya import option doesn't seem to actually matter. After the file is imported, I set the namespace back to the root.