Fixed bool serialization

This commit is contained in:
2025-03-18 22:38:30 +01:00
parent 916e929c8b
commit dfa5d1245f
2 changed files with 17 additions and 13 deletions

View File

@@ -43,11 +43,11 @@ Node_Render_Data :: struct {
Renderable :: struct {
visible: bool = true;
type : Renderable_Type;
type : Renderable_Type; @DontSerialize
model: *Model;
nodes: [MAX_NODES] Node_Render_Data;
num_nodes: s64;
model: *Model; @DontSerialize
nodes: [MAX_NODES] Node_Render_Data; @DontSerialize
num_nodes: s64; @DontSerialize
}
MAX_CHILDREN :: 16;
@@ -75,7 +75,7 @@ Entity :: struct {
snap_offset: Vector3;
snap_intervals: Vector3 = .{1,1,1};
renderable: Renderable; @DontSerialize
renderable: Renderable;
animator: Animator; @DontSerialize
// Physics

View File

@@ -44,7 +44,7 @@ build :: (build_release: bool, main_path: string, game_name: string, working_dir
entity_serialize_proc_string: [..] string;
should_serialize :: (type: *Type_Info_Struct, member: Type_Info_Struct_Member) -> bool {
if type!= null {
if type != null {
if type.name == {
case "Vector2"; {
if member.name == {
@@ -205,9 +205,9 @@ if updated {
}
DONE
generate_member_serialization :: (type: *Type_Info_Struct, builder: *String_Builder, path: string = "") {
for type.members {
if should_serialize(type, it) {
generate_member_serialization :: (struct_type: *Type_Info_Struct, builder: *String_Builder, path: string = "") {
for struct_type.members {
if should_serialize(struct_type, it) {
new_path : string;
if path.count == 0 {
new_path = it.name;
@@ -242,9 +242,10 @@ generate_member_serialization :: (type: *Type_Info_Struct, builder: *String_Buil
}
}
generate_member_deserialization :: (type: *Type_Info_Struct, builder: *String_Builder, path: string = "") {
for type.members {
if should_serialize(type, it) {
generate_member_deserialization :: (struct_type: *Type_Info_Struct, builder: *String_Builder, path: string = "") {
for struct_type.members {
if should_serialize(struct_type, it) {
print("DESER %\n", struct_type.name);
new_path : string;
if path.count == 0 {
new_path = it.name;
@@ -269,7 +270,10 @@ generate_member_deserialization :: (type: *Type_Info_Struct, builder: *String_Bu
print_to_builder(builder, "\t\t\t\tcase \"%\";\n", new_path);
print_to_builder(builder, "\t\t\t\tif values[1].count > 0 { e.%1 = copy_string(trim(values[1])); }\n", new_path);
}
case .BOOL; #through;
case .BOOL; {
print_to_builder(builder, "\t\t\t\tcase \"%\";\n", new_path);
print_to_builder(builder, "\t\t\t\t\tscan2(trim(values[1]), \"\%\", *e.%);\n", new_path);
}
case .FLOAT; #through;
case .ENUM; {
print_to_builder(builder, "\t\t\t\tcase \"%\";\n", new_path);