diff options
author | Bastien Montagne <bastien@blender.org> | 2020-05-20 17:40:58 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-05-20 19:43:46 +0300 |
commit | 4d613018eeb5ec7032135c2f72a9ef635616543d (patch) | |
tree | f26c2c34f6282a536cc84c71202a88ea58671e98 | |
parent | e2d961809b20a98b155c4492f705c3ea691e4f2c (diff) |
Refactor: Move hair foreach_id to new IDTypeInfo structure.
-rw-r--r-- | source/blender/blenkernel/intern/hair.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/hair.c b/source/blender/blenkernel/intern/hair.c index 4e15067288b..90761d24b73 100644 --- a/source/blender/blenkernel/intern/hair.c +++ b/source/blender/blenkernel/intern/hair.c @@ -22,6 +22,7 @@ #include "DNA_defaults.h" #include "DNA_hair_types.h" +#include "DNA_material_types.h" #include "DNA_object_types.h" #include "BLI_listbase.h" @@ -95,6 +96,14 @@ static void hair_free_data(ID *id) MEM_SAFE_FREE(hair->mat); } +static void hair_foreach_id(ID *id, LibraryForeachIDData *data) +{ + Hair *hair = (Hair *)id; + for (int i = 0; i < hair->totcol; i++) { + BKE_LIB_FOREACHID_PROCESS(data, hair->mat[i], IDWALK_CB_USER); + } +} + IDTypeInfo IDType_ID_HA = { .id_code = ID_HA, .id_filter = FILTER_ID_HA, @@ -109,6 +118,7 @@ IDTypeInfo IDType_ID_HA = { .copy_data = hair_copy_data, .free_data = hair_free_data, .make_local = NULL, + .foreach_id = hair_foreach_id, }; static void hair_random(Hair *hair) diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index bcb1c82cad1..713eef6d0a1 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -865,10 +865,7 @@ static void library_foreach_ID_link(Main *bmain, break; } case ID_HA: { - Hair *hair = (Hair *)id; - for (i = 0; i < hair->totcol; i++) { - CALLBACK_INVOKE(hair->mat[i], IDWALK_CB_USER); - } + BLI_assert(0); break; } case ID_PT: { |