diff options
| author | yum <yum.food.vr@gmail.com> | 2023-09-01 00:48:20 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-09-01 00:48:20 -0700 |
| commit | 833ef96f677a60197abb417651ac306820e225f0 (patch) | |
| tree | 40fe147399558d6452caba158b662902e37ea7c0 /Scripts/libunity.py | |
| parent | cb44e4744ac82d1d35547d12254cfea09dc63fae (diff) | |
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
Diffstat (limited to 'Scripts/libunity.py')
| -rw-r--r-- | Scripts/libunity.py | 10 |
1 files changed, 10 insertions, 0 deletions
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: |
