How to set keyframes from a C++ command

Hello,
I’m trying to set some keyframes from C++ by calling the SetAnimCurveKeys commands, but I can’t pass the “paths” argument correctly.
At the moment, I’m doing this:

auto commandBridge = carb::getCachedInterface<omni::kit::commands::ICommandBridge>();
auto iDictionary = carb::getCachedInterface<carb::dictionary::IDictionary>();
carb::dictionary::Item* kwargs = iDictionary->createItem(nullptr, "", carb::dictionary::ItemType::eDictionary);
auto pathsItem = iDictionary->createItem(kwargs, "paths", carb::dictionary::ItemType::eDictionary);
iDictionary->setStringAt(pathsItem, 0, footAttr.GetPath().GetString().c_str());
commandBridge->executeCommand("SetAnimCurveKeys", kwargs);

But I get this error:
[omni.anim.curve.core.scripts.commands] SetAnimCurveKeys: paths TypeError: Expected None or list, got <class ‘tuple’>.

I checked the Python source code of the SetAnimCurveKeys command, and it expects a list or None. Is there a way to pass the pats argument as a list instead of a tuple?

Thanks
Alan

I will see if I can get someone to help you. What exactly are you building? You are making an app in C++ that talks to Omniverse? Some context would help. You are using C++ and not python?

Hello @Richard3D,
I’m bringing our crowd simulation framework to Omniverse. In this case, I need to set keyframes when we import some assets, since importing from Python will be too slow. Anyway, it is not a big problem. At the moment, I created a Python command that converts the tuple to a list, but it would be good if I could call it directly from C++ in the future, so I can remove one of the Python extensions I created.
Thanks
Alan

Here is our full code for “SetAnimCurveKeys” for your full reference

SetAnimCurveKeys.txt (20.1 KB)