summaryrefslogtreecommitdiffstats
path: root/Scripts/libunity.py
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/libunity.py')
-rw-r--r--Scripts/libunity.py35
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 = []