mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 03:50:52 +00:00
save and load?
This commit is contained in:
parent
2ffadc19eb
commit
ec42c6d2bd
@ -25,6 +25,8 @@ conversion_tables = {
|
||||
"bevy_color::srgba::Srgba": lambda value: "Srgba(red:"+str(value[0])+ ", green:"+str(value[1])+ ", blue:"+str(value[2])+ ", alpha:"+str(value[3])+ ")",
|
||||
"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) + ")"
|
||||
}
|
||||
|
||||
#converts the value of a property group(no matter its complexity) into a single custom property value
|
||||
|
@ -1,3 +1,4 @@
|
||||
import bpy
|
||||
from bpy_types import PropertyGroup
|
||||
import re
|
||||
|
||||
@ -126,6 +127,10 @@ def parse_color_hsva(value, caster, typeName):
|
||||
parsed = parse_struct_string(value.replace(typeName,"").replace("(", "").replace(")","") )
|
||||
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(")","") )
|
||||
bpy.context.scene.objects[parsed["name"]]
|
||||
|
||||
def to_int(input):
|
||||
return int(float(input))
|
||||
|
||||
@ -171,7 +176,7 @@ type_mappings = {
|
||||
"bevy_color::linear_rgba::LinearRgba": lambda value: parse_color_rgba(value, float, "LinearRgba"),
|
||||
"bevy_color::hsva::Hsva": lambda value: parse_color_hsva(value, float, "Hsva"),
|
||||
|
||||
'bevy_ecs::entity::Entity': lambda value: int(value), # TODO: whatdafuq do we do here?
|
||||
"bevy_ecs::entity::Entity": parse_entity,
|
||||
}
|
||||
|
||||
def is_def_value_type(definition, registry):
|
||||
|
Loading…
Reference in New Issue
Block a user