diff options
author | Bastien Montagne <bastien@blender.org> | 2020-05-12 19:54:38 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-05-12 19:54:57 +0300 |
commit | 13d0f74b8076a77dc1ea5725739f167128932312 (patch) | |
tree | 58e7320a37c346b2223da21da09c3a49246d80cc /source/blender/blenkernel/intern/light.c | |
parent | 8ce0c9111db489854ba7c7b9110ea55f39f16c16 (diff) |
Refactor: Move lamp foreach_id to new IDTypeInfo structure.
Diffstat (limited to 'source/blender/blenkernel/intern/light.c')
-rw-r--r-- | source/blender/blenkernel/intern/light.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c index 13f4815124b..9dc338ce580 100644 --- a/source/blender/blenkernel/intern/light.c +++ b/source/blender/blenkernel/intern/light.c @@ -41,6 +41,7 @@ #include "BKE_icons.h" #include "BKE_idtype.h" #include "BKE_lib_id.h" +#include "BKE_lib_query.h" #include "BKE_light.h" #include "BKE_main.h" #include "BKE_node.h" @@ -107,6 +108,15 @@ static void light_free_data(ID *id) la->id.icon_id = 0; } +static void light_foreach_id(ID *id, LibraryForeachIDData *data) +{ + Light *lamp = (Light *)id; + if (lamp->nodetree) { + /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */ + BKE_library_foreach_ID_embedded(data, (ID **)&lamp->nodetree); + } +} + IDTypeInfo IDType_ID_LA = { .id_code = ID_LA, .id_filter = FILTER_ID_LA, @@ -121,6 +131,7 @@ IDTypeInfo IDType_ID_LA = { .copy_data = light_copy_data, .free_data = light_free_data, .make_local = NULL, + .foreach_id = light_foreach_id, }; Light *BKE_light_add(Main *bmain, const char *name) |