From 857c9be957fa14a40a75371a2aa5b64aecedc21f Mon Sep 17 00:00:00 2001 From: Alexander Raistrick Date: Sat, 25 May 2024 19:01:59 -0400 Subject: [PATCH] Fix unit-test failures for empty materials --- infinigen/assets/fruits/general_fruit.py | 3 +++ infinigen/assets/leaves/leaf_pine.py | 1 + tests/utils.py | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/infinigen/assets/fruits/general_fruit.py b/infinigen/assets/fruits/general_fruit.py index a28ca0b49..eac821080 100644 --- a/infinigen/assets/fruits/general_fruit.py +++ b/infinigen/assets/fruits/general_fruit.py @@ -169,6 +169,9 @@ def create_asset(self, **params): obj.scale *= normal(1, 0.1) * self.scale * scale_multiplier butil.apply_transform(obj) + # TODO remove when empty materials from geonodes is debugged + butil.purge_empty_materials(obj) + tag_object(obj, 'fruit_'+self.name) return obj diff --git a/infinigen/assets/leaves/leaf_pine.py b/infinigen/assets/leaves/leaf_pine.py index 4acce1125..3ef01abd8 100644 --- a/infinigen/assets/leaves/leaf_pine.py +++ b/infinigen/assets/leaves/leaf_pine.py @@ -366,6 +366,7 @@ def create_asset(self, **params): obj = bpy.context.object obj.scale *= normal(1, 0.05) * self.scale butil.apply_transform(obj) + butil.purge_empty_materials(obj) # TODO remove when geonodes emptymats solved tag_object(obj, 'leaf_pine') return obj diff --git a/tests/utils.py b/tests/utils.py index 9f01cfd42..593fce048 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -33,8 +33,9 @@ def import_item(name): def load_txt_list(path): res = (Path(__file__).parent/path).read_text().splitlines() - res = [f for f in res if not f.startswith('#')] - return res + res = [f.strip() for f in res if not f.startswith('#')] + res = [f for f in res if len(f) > 0] + return sorted(res) def check_factory_runs(fac_class, seed1=0, seed2=0, distance_m=50): butil.clear_scene()