From 833ef96f677a60197abb417651ac306820e225f0 Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 1 Sep 2023 00:48:20 -0700 Subject: Add `Enable phonemes` toggle to radial menu Also: * Fully scrub AudioSource references from prefab when not using phonemes. * Disable net sync on phoneme params when not using them. When not synced, they don't count against the total memory limit. * Use config file in generate_params.py --- Scripts/libunity.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Scripts/libunity.py') diff --git a/Scripts/libunity.py b/Scripts/libunity.py index f79cd6f..39348d4 100644 --- a/Scripts/libunity.py +++ b/Scripts/libunity.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +from functools import partial + import argparse import copy import enum @@ -8,6 +10,7 @@ import os import pickle import random import sys +import typing # python3 -m pip install pyyaml # License: MIT. import yaml @@ -485,6 +488,13 @@ class UnityAnimator(): if hasattr(node, "forEach"): node.forEach(self.mergeIterator) + # Delete any key-value pairs where the value == the value. + def scrubReferencesByValue(self, node, values: typing.Set[str]): + if hasattr(node, "mapping"): + node.mapping = {k: v for k, v in node.mapping.items() if v not in values} + if hasattr(node, "forEach"): + node.forEach(partial(self.scrubReferencesByValue, values=values)) + def peekNodeOfClass(self, classId): for node in self.nodes: if node.class_id == classId: -- cgit v1.2.3