Improving entity serialization
This commit is contained in:
@@ -49,6 +49,11 @@ visitor :: (info : *File_Visit_Info, files: *[..] Entity_File_Info) {
|
|||||||
|
|
||||||
load_scene :: (name: string) -> *Scene {
|
load_scene :: (name: string) -> *Scene {
|
||||||
scene := create_scene(name, 1024);
|
scene := create_scene(name, 1024);
|
||||||
|
|
||||||
|
if engine.procs.on_scene_loaded != null {
|
||||||
|
engine.procs.on_pre_scene_loaded(scene, engine.mode);
|
||||||
|
}
|
||||||
|
|
||||||
path := tprint("../assets/scenes/%", name);
|
path := tprint("../assets/scenes/%", name);
|
||||||
|
|
||||||
files : [..] Entity_File_Info;
|
files : [..] Entity_File_Info;
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ editor_ui :: () {
|
|||||||
|
|
||||||
if engine.current_scene != null {
|
if engine.current_scene != null {
|
||||||
for engine.current_scene.entities {
|
for engine.current_scene.entities {
|
||||||
|
if it.flags & .DELETED continue;
|
||||||
|
|
||||||
ui_set_next_padding(20);
|
ui_set_next_padding(20);
|
||||||
clicked := false;
|
clicked := false;
|
||||||
selected := array_find(engine.editor.selected_entities, it);
|
selected := array_find(engine.editor.selected_entities, it);
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ generate_code :: (w: Workspace) {
|
|||||||
builder: String_Builder;
|
builder: String_Builder;
|
||||||
|
|
||||||
for entity_type_names {
|
for entity_type_names {
|
||||||
print_to_builder(*builder, "\tcase \"%1\"; p, locator := find_and_occupy_empty_slot(*scene.by_type._%1); p._locator = locator; e = p; register_entity(scene, p, id); init_entity(p); deserialize_entity(scene, lines, cast(*%1)e); update_matrix(*e.transform);\n", it);
|
print_to_builder(*builder, "\tcase \"%1\"; p, locator := find_and_occupy_empty_slot(*scene.by_type._%1); p._locator = locator; e = p; register_entity(scene, p, id); deserialize_entity(scene, lines, cast(*%1)e); init_entity(p); update_matrix(*e.transform);\n", it);
|
||||||
}
|
}
|
||||||
|
|
||||||
build_string := sprint(DESERIALIZE_ENTITY, builder_to_string(*builder));
|
build_string := sprint(DESERIALIZE_ENTITY, builder_to_string(*builder));
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ Engine_Core :: struct {
|
|||||||
|
|
||||||
procs: struct {
|
procs: struct {
|
||||||
on_scene_loaded: (*Scene, Engine_Mode);
|
on_scene_loaded: (*Scene, Engine_Mode);
|
||||||
|
on_pre_scene_loaded: (*Scene, Engine_Mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
paused: bool;
|
paused: bool;
|
||||||
|
|||||||
Reference in New Issue
Block a user