diff options
author | Bastien Montagne <bastien@blender.org> | 2020-05-13 20:01:20 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-05-13 20:01:20 +0300 |
commit | 9ac5413ac06d5f5213607e10de5401262e3462f2 (patch) | |
tree | 271f93e3354d803519774c09085497c1e0eaf707 /source/blender | |
parent | c9048441f53513e74ac81160de4a23de1cceea08 (diff) |
Refactor: Move camera foreach_id to new IDTypeInfo structure.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/camera.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 13 |
2 files changed, 18 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 7c60698e824..5ec4c84c013 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -42,6 +42,7 @@ #include "BKE_idtype.h" #include "BKE_layer.h" #include "BKE_lib_id.h" +#include "BKE_lib_query.h" #include "BKE_main.h" #include "BKE_object.h" #include "BKE_scene.h" @@ -95,6 +96,21 @@ static void camera_free_data(ID *id) BLI_freelistN(&cam->bg_images); } +static void camera_foreach_id(ID *id, LibraryForeachIDData *data) +{ + Camera *camera = (Camera *)id; + + BKE_LIB_FOREACHID_PROCESS(data, camera->dof.focus_object, IDWALK_CB_NOP); + LISTBASE_FOREACH (CameraBGImage *, bgpic, &camera->bg_images) { + if (bgpic->source == CAM_BGIMG_SOURCE_IMAGE) { + BKE_LIB_FOREACHID_PROCESS(data, bgpic->ima, IDWALK_CB_USER); + } + else if (bgpic->source == CAM_BGIMG_SOURCE_MOVIE) { + BKE_LIB_FOREACHID_PROCESS(data, bgpic->clip, IDWALK_CB_USER); + } + } +} + IDTypeInfo IDType_ID_CA = { .id_code = ID_CA, .id_filter = FILTER_ID_CA, @@ -109,6 +125,7 @@ IDTypeInfo IDType_ID_CA = { .copy_data = camera_copy_data, .free_data = camera_free_data, .make_local = camera_make_local, + .foreach_id = camera_foreach_id, }; /******************************** Camera Usage *******************************/ diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index 8c29209f29d..d0aebde33d6 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -925,22 +925,11 @@ static void library_foreach_ID_link(Main *bmain, } case ID_LA: { - BLI_assert(0); break; } case ID_CA: { - Camera *camera = (Camera *)id; - CALLBACK_INVOKE(camera->dof.focus_object, IDWALK_CB_NOP); - LISTBASE_FOREACH (CameraBGImage *, bgpic, &camera->bg_images) { - if (bgpic->source == CAM_BGIMG_SOURCE_IMAGE) { - CALLBACK_INVOKE(bgpic->ima, IDWALK_CB_USER); - } - else if (bgpic->source == CAM_BGIMG_SOURCE_MOVIE) { - CALLBACK_INVOKE(bgpic->clip, IDWALK_CB_USER); - } - } - + BLI_assert(0); break; } |