blob: 0b4e566a99953e76b20326787b8e657efecb515d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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])
|