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_clip/space_clip.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_clip/space_clip.c')
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index ab952470757..3631a1740f7 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -49,6 +49,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "clip_intern.h" /* own include */ @@ -1245,6 +1247,27 @@ static void clip_id_remap(ScrArea *UNUSED(area), BKE_id_remapper_apply(mappings, (ID **)&sclip->mask_info.mask, ID_REMAP_APPLY_ENSURE_REAL); } +static void clip_blend_read_data(BlendDataReader *UNUSED(reader), SpaceLink *sl) +{ + SpaceClip *sclip = (SpaceClip *)sl; + + sclip->scopes.track_search = NULL; + sclip->scopes.track_preview = NULL; + sclip->scopes.ok = 0; +} + +static void clip_blend_read_lib(BlendLibReader *reader, ID *parent_id, SpaceLink *sl) +{ + SpaceClip *sclip = (SpaceClip *)sl; + BLO_read_id_address(reader, parent_id->lib, &sclip->clip); + BLO_read_id_address(reader, parent_id->lib, &sclip->mask_info.mask); +} + +static void clip_blend_write(BlendWriter *writer, SpaceLink *sl) +{ + BLO_write_struct(writer, SpaceClip, sl); +} + void ED_spacetype_clip(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype clip"); @@ -1265,6 +1288,9 @@ void ED_spacetype_clip(void) st->dropboxes = clip_dropboxes; st->refresh = clip_refresh; st->id_remap = clip_id_remap; + st->blend_read_data = clip_blend_read_data; + st->blend_read_lib = clip_blend_read_lib; + st->blend_write = clip_blend_write; /* regions: main window */ art = MEM_callocN(sizeof(ARegionType), "spacetype clip region"); |