summaryrefslogtreecommitdiffstats
path: root/Scripts/remove_audio_sources.py
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/remove_audio_sources.py')
-rw-r--r--Scripts/remove_audio_sources.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Scripts/remove_audio_sources.py b/Scripts/remove_audio_sources.py
new file mode 100644
index 0000000..0b4e566
--- /dev/null
+++ b/Scripts/remove_audio_sources.py
@@ -0,0 +1,20 @@
+import libunity
+import sys
+
+def removeAudioSources(path: str):
+ parser = libunity.MulticoreUnityParser()
+ anim = parser.parseFile(path)
+ anchors = set()
+ node = anim.popNodeOfClass("82")
+ while node:
+ print("Killed audio source")
+ anchors.add(node.anchor)
+ node = anim.popNodeOfClass("82")
+ for node in anim.nodes:
+ anim.scrubReferencesByValue(node, values=anchors)
+ with open(path, "w", encoding="utf-8") as f:
+ f.write(libunity.unityYamlToString(anim.nodes))
+
+if __name__ == "__main__":
+ removeAudioSources(sys.argv[1])
+