Hi,
I have a workflow involving exporting FBX animations to Unreal Engine with custom attributes (animation curves).
Unreal Engine imports these curves in the order they are listed on the fbx_custom_attributes point attribute, and the order is important for my workflow.
The problem is that the fbx_custom_attributes attribute is a dict type and even though I am adding the keys/values in the order I need, they always get scrambled.
In the image below, the list on the left is the order I need to keys to be in and on the right is the order they end up in.
Is there really no way to preserve the order of the keys in a dict attribute?
Thanks
Peter
Is there really no way to preserve dict key order?
99 1 1- mrpdean
- Member
- 68 posts
- Joined: April 2019
- Offline
- alexwheezy
- Member
- 298 posts
- Joined: Jan. 2013
- Online
A dictionary is an associative data structure meaning that the keys will always be sorted in alphabetical order. You can export together with the dictionary a list of keys ordered in a certain way and use them as keys in UE.
Another ugly way to order the keys in an array is simply by giving them a prefixed increasing value, but in UE you have to remove or skip this prefix.
s[]@keys = {"DMH_jawOpen", "DMH_jawOpenFull", "DMH_jawLeft", "DMH_jawRight", "DMH_jawFwd", "DMH_jawBack"}; d@map = set("DMH_jawOpen", 0, "DMH_jawOpenFull", 0, "DMH_jawLeft", 0, "DMH_jawRight", 0, "DMH_jawFwd", 0, "DMH_jawBack", 0); i@value = @map[@keys[0]];
Another ugly way to order the keys in an array is simply by giving them a prefixed increasing value, but in UE you have to remove or skip this prefix.
d@map = set("1_DMH_jawOpen", 0, "2_DMH_jawOpenFull", 0, "3_DMH_jawLeft", 0, "4_DMH_jawRight", 0, "5_DMH_jawFwd", 0, "6_DMH_jawBack", 0);
-
- Quick Links