diff --git a/tools/blenvy/add_ons/bevy_components/propGroups/conversions_from_prop_group.py b/tools/blenvy/add_ons/bevy_components/propGroups/conversions_from_prop_group.py index 48b0d8b..2541cc4 100644 --- a/tools/blenvy/add_ons/bevy_components/propGroups/conversions_from_prop_group.py +++ b/tools/blenvy/add_ons/bevy_components/propGroups/conversions_from_prop_group.py @@ -26,7 +26,7 @@ conversion_tables = { "bevy_color::linear_rgba::LinearRgba": lambda value: "LinearRgba(red:"+str(value[0])+ ", green:"+str(value[1])+ ", blue:"+str(value[2])+ ", alpha:"+str(value[3])+ ")", "bevy_color::hsva::Hsva": lambda value: "Hsva(hue:"+str(value[0])+ ", saturation:"+str(value[1])+ ", value:"+str(value[2])+ ", alpha:"+str(value[3])+ ")", - "bevy_ecs::entity::Entity": lambda value: 'Entity(name: "' + str(value.name) + '")' + "bevy_ecs::entity::Entity": lambda value: 'Entity(name: ' + ('Some("' + str(value.name) + '")') if value is not None else "None" + ')' } #converts the value of a property group(no matter its complexity) into a single custom property value diff --git a/tools/blenvy/add_ons/bevy_components/propGroups/conversions_to_prop_group.py b/tools/blenvy/add_ons/bevy_components/propGroups/conversions_to_prop_group.py index 6bf77a8..3cac940 100644 --- a/tools/blenvy/add_ons/bevy_components/propGroups/conversions_to_prop_group.py +++ b/tools/blenvy/add_ons/bevy_components/propGroups/conversions_to_prop_group.py @@ -128,8 +128,14 @@ def parse_color_hsva(value, caster, typeName): return [caster(parsed['hue']), caster(parsed['saturation']), caster(parsed['value']), caster(parsed['alpha'])] def parse_entity(value): - parsed = parse_struct_string(value.replace("Entity","").replace("(", "").replace(")","").replace('"', "")) - bpy.context.scene.objects[parsed["name"]] + # strip 'Entity(name: )' to just '' + value = value[13:-1] + if value.startswith("Some"): + # strip 'Some("")' to just '' + value = value[6:-2] + return bpy.context.scene.objects[value] + else: + return None def to_int(input): return int(float(input))