Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2022-09-28 12:52:22 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2022-09-28 12:52:22 +0300
commit808b03da437043d7bb809a4d0e9e523bbfad95f9 (patch)
tree4a3ef1f74b09328b2e97bf827fa1fc700a9e2e41 /source/blender/editors/space_action
parent5270ac5ed87fb5f9b5605fdc332f16ea0f7ee59d (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_action')
-rw-r--r--source/blender/editors/space_action/CMakeLists.txt6
-rw-r--r--source/blender/editors/space_action/space_action.c29
2 files changed, 34 insertions, 1 deletions
diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt
index b9e27c4de49..3ec814ada48 100644
--- a/source/blender/editors/space_action/CMakeLists.txt
+++ b/source/blender/editors/space_action/CMakeLists.txt
@@ -4,6 +4,7 @@ set(INC
../include
../../blenkernel
../../blenlib
+ ../../blenloader
../../blentranslation
../../depsgraph
../../gpu
@@ -11,6 +12,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
)
@@ -35,5 +39,5 @@ set(LIB
blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
-# RNA_prototypes.h
+# RNA_prototypes.h dna_type_offsets.h
add_dependencies(bf_editor_space_action bf_rna)
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index b54750accb0..2f22121f7de 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -42,6 +42,8 @@
#include "ED_space_api.h"
#include "ED_time_scrub_ui.h"
+#include "BLO_read_write.h"
+
#include "action_intern.h" /* own include */
/* ******************** default callbacks for action space ***************** */
@@ -834,6 +836,30 @@ static void action_space_subtype_item_extend(bContext *UNUSED(C),
RNA_enum_items_add(item, totitem, rna_enum_space_action_mode_items);
}
+static void action_blend_read_data(BlendDataReader *UNUSED(reader), SpaceLink *sl)
+{
+ SpaceAction *saction = (SpaceAction *)sl;
+ memset(&saction->runtime, 0x0, sizeof(saction->runtime));
+}
+
+static void action_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl)
+{
+ SpaceAction *saction = (SpaceAction *)sl;
+ bDopeSheet *ads = &saction->ads;
+
+ if (ads) {
+ BLO_read_id_address(reader, parent_id->lib, &ads->source);
+ BLO_read_id_address(reader, parent_id->lib, &ads->filter_grp);
+ }
+
+ BLO_read_id_address(reader, parent_id->lib, &saction->action);
+}
+
+static void action_blend_write(BlendWriter *writer, SpaceLink *sl)
+{
+ BLO_write_struct(writer, SpaceAction, sl);
+}
+
void ED_spacetype_action(void)
{
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype action");
@@ -854,6 +880,9 @@ void ED_spacetype_action(void)
st->space_subtype_item_extend = action_space_subtype_item_extend;
st->space_subtype_get = action_space_subtype_get;
st->space_subtype_set = action_space_subtype_set;
+ st->blend_read_data = action_blend_read_data;
+ st->blend_read_lib = action_blend_read_lib;
+ st->blend_write = action_blend_write;
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype action region");