diff options
author | Bastien Montagne <bastien@blender.org> | 2020-05-20 17:31:47 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-05-20 19:43:46 +0300 |
commit | 140935ee7e4404d037edecfd35ea8b1b9d27881c (patch) | |
tree | 0d8edcbcaa661ddfe48aaf0ed0c501cd23b9996e /source | |
parent | 796412dca0a54a0f35400ea8ebf7a99ce891080d (diff) |
Refactor: Move grease pencil foreach_id to new IDTypeInfo structure.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 11 |
2 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 04d3c32f599..4311e425abf 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -55,6 +55,7 @@ #include "BKE_idtype.h" #include "BKE_image.h" #include "BKE_lib_id.h" +#include "BKE_lib_query.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_paint.h" @@ -97,6 +98,19 @@ static void greasepencil_free_data(ID *id) BKE_gpencil_free((bGPdata *)id, true); } +static void greasepencil_foreach_id(ID *id, LibraryForeachIDData *data) +{ + bGPdata *gpencil = (bGPdata *)id; + /* materials */ + for (int i = 0; i < gpencil->totcol; i++) { + BKE_LIB_FOREACHID_PROCESS(data, gpencil->mat[i], IDWALK_CB_USER); + } + + LISTBASE_FOREACH (bGPDlayer *, gplayer, &gpencil->layers) { + BKE_LIB_FOREACHID_PROCESS(data, gplayer->parent, IDWALK_CB_NOP); + } +} + IDTypeInfo IDType_ID_GD = { .id_code = ID_GD, .id_filter = FILTER_ID_GD, @@ -111,6 +125,7 @@ IDTypeInfo IDType_ID_GD = { .copy_data = greasepencil_copy_data, .free_data = greasepencil_free_data, .make_local = NULL, + .foreach_id = greasepencil_foreach_id, }; /* ************************************************** */ diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index 1fcae6a3072..bcb1c82cad1 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -861,16 +861,7 @@ static void library_foreach_ID_link(Main *bmain, } case ID_GD: { - bGPdata *gpencil = (bGPdata *)id; - /* materials */ - for (i = 0; i < gpencil->totcol; i++) { - CALLBACK_INVOKE(gpencil->mat[i], IDWALK_CB_USER); - } - - LISTBASE_FOREACH (bGPDlayer *, gplayer, &gpencil->layers) { - CALLBACK_INVOKE(gplayer->parent, IDWALK_CB_NOP); - } - + BLI_assert(0); break; } case ID_HA: { |