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_action/space_action.c | |
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_action/space_action.c')
-rw-r--r-- | source/blender/editors/space_action/space_action.c | 29 |
1 files changed, 29 insertions, 0 deletions
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"); |