diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-09-28 12:52:22 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-09-28 12:52:22 +0300 |
commit | 808b03da437043d7bb809a4d0e9e523bbfad95f9 (patch) | |
tree | 4a3ef1f74b09328b2e97bf827fa1fc700a9e2e41 /source/blender/editors/space_topbar | |
parent | 5270ac5ed87fb5f9b5605fdc332f16ea0f7ee59d (diff) |
Cleanup: decentralize .blend I/O for space types
This adds callbacks to `SpaceType` to make each editor responsible to
manage their own .blend I/O, and moves relevant code from `screen.c`
to the editors files.
Differential Revision: D11069
Diffstat (limited to 'source/blender/editors/space_topbar')
-rw-r--r-- | source/blender/editors/space_topbar/CMakeLists.txt | 5 | ||||
-rw-r--r-- | source/blender/editors/space_topbar/space_topbar.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/space_topbar/CMakeLists.txt b/source/blender/editors/space_topbar/CMakeLists.txt index f529c855e6d..a0854bd688c 100644 --- a/source/blender/editors/space_topbar/CMakeLists.txt +++ b/source/blender/editors/space_topbar/CMakeLists.txt @@ -11,6 +11,9 @@ set(INC ../../makesrna ../../windowmanager ../../../../intern/guardedalloc + + # dna_type_offsets.h + ${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern # RNA_prototypes.h ${CMAKE_BINARY_DIR}/source/blender/makesrna ) @@ -27,5 +30,5 @@ set(LIB blender_add_lib(bf_editor_space_topbar "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") -# RNA_prototypes.h +# RNA_prototypes.h dna_type_offsets.h add_dependencies(bf_editor_space_topbar bf_rna) diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c index e4826ed5964..aa5689bd047 100644 --- a/source/blender/editors/space_topbar/space_topbar.c +++ b/source/blender/editors/space_topbar/space_topbar.c @@ -28,6 +28,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "WM_api.h" @@ -282,6 +284,11 @@ static void undo_history_menu_register(void) WM_menutype_add(mt); } +static void topbar_blend_write(BlendWriter *writer, SpaceLink *sl) +{ + BLO_write_struct(writer, SpaceTopBar, sl); +} + void ED_spacetype_topbar(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype topbar"); @@ -296,6 +303,7 @@ void ED_spacetype_topbar(void) st->duplicate = topbar_duplicate; st->operatortypes = topbar_operatortypes; st->keymap = topbar_keymap; + st->blend_write = topbar_blend_write; /* regions: main window */ art = MEM_callocN(sizeof(ARegionType), "spacetype topbar main region"); |