diff options
| author | yum <yum.food.vr@gmail.com> | 2023-05-09 00:06:46 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-05-09 00:06:46 -0700 |
| commit | aec43ecd11e8ef84fe4f5f5fcca9578dbde59469 (patch) | |
| tree | a3f4d07fe96195fbc1b391148b8fa90375378b36 /Scripts | |
| parent | 1f2e5c6cf16e7e7a8d7d737ff86fdd7d89c2d9d9 (diff) | |
Fix noop animations on current creator companion buildv0.11.3
See comment for details.
* Update README
Diffstat (limited to 'Scripts')
| -rw-r--r-- | Scripts/libunity.py | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/Scripts/libunity.py b/Scripts/libunity.py index 9ab0f19..e94765d 100644 --- a/Scripts/libunity.py +++ b/Scripts/libunity.py @@ -962,17 +962,32 @@ class UnityAnimator(): motion = node.mapping['AnimatorState'].mapping['m_Motion'] replace = False - if "fileID" in motion.mapping.keys() and \ - motion.mapping["fileID"] != "0": - continue - - if "guid" in motion.mapping.keys() and \ - motion.mapping["guid"] in guid_map: - continue + name = node.mapping['AnimatorState'].mapping['m_Name'] + anchor = node.anchor - motion.mapping["fileID"] = "7400000" - motion.mapping["guid"] = noop_anim_meta.guid - motion.mapping["type"] = "2" + # As of 8 May 2023, idle states look like this: + # m_Motion: {fileID: 7400000, guid: e5881c5b0c09be854b0fd6fd8144333f, type: 2} + # Before that, they looked like this: + # m_Motion: {fileID: 0} + # The first predicate looks for the new pattern. + # The second predicate looks for the second pattern. + if "fileID" in motion.mapping.keys() and \ + "guid" in motion.mapping.keys() and \ + not motion.mapping["guid"] in guid_map: + motion.mapping["fileID"] = "7400000" + print(f"Set noop animation to guid {noop_anim_meta.guid} in state {node.anchor}") + motion.mapping["guid"] = noop_anim_meta.guid + motion.mapping["type"] = "2" + elif not ("fileID" in motion.mapping.keys() and + motion.mapping["fileID"] != "0") and not ("guid" in + motion.mapping.keys() and motion.mapping["guid"] in + guid_map): + motion.mapping["fileID"] = "7400000" + print(f"Set noop animation to guid {noop_anim_meta.guid} in state {node.anchor}") + motion.mapping["guid"] = noop_anim_meta.guid + motion.mapping["type"] = "2" + else: + print(f"Skipping state {anchor} / {name}") def unityYamlToString(nodes): lines = [] |
