From 00695a18d835099ea3083f38d7de5088079613b9 Mon Sep 17 00:00:00 2001 From: "kaosat.dev" Date: Wed, 6 Mar 2024 14:36:08 +0100 Subject: [PATCH] feat(bevy_components): added handling of wrong string for unit structs * allows detection of more wrong values for components --- tools/bevy_components/components/operators.py | 2 +- .../bevy_components/propGroups/conversions_to_prop_group.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/bevy_components/components/operators.py b/tools/bevy_components/components/operators.py index 9d308ef..ae7044c 100644 --- a/tools/bevy_components/components/operators.py +++ b/tools/bevy_components/components/operators.py @@ -227,7 +227,7 @@ class OT_rename_component(Operator): else: self.report({'INFO'}, "Sucessfully renamed component") - # TODO: clear data after we are done + #clear data after we are done self.original_name = "" context.window_manager.bevy_component_rename_helper.original_name = "" diff --git a/tools/bevy_components/propGroups/conversions_to_prop_group.py b/tools/bevy_components/propGroups/conversions_to_prop_group.py index 6eec325..84d10e2 100644 --- a/tools/bevy_components/propGroups/conversions_to_prop_group.py +++ b/tools/bevy_components/propGroups/conversions_to_prop_group.py @@ -224,8 +224,9 @@ def property_group_value_from_custom_property_value(property_group, definition, else: - pass - #print("struct with zero fields") + if len(value) > 2: #a unit struct should be two chars long :() + #print("struct with zero fields") + raise Exception("input string too big for a unit struct") elif type_info == "Tuple": custom_property_values = parse_tuplestruct_string(value, start_nesting=1 if len(nesting) == 1 else 1)