Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/light.c')
-rw-r--r--source/blender/blenkernel/intern/light.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c
index 3d0503b2e70..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"
@@ -97,7 +98,7 @@ static void light_free_data(ID *id)
/* is no lib link block, but light extension */
if (la->nodetree) {
- ntreeFreeNestedTree(la->nodetree);
+ ntreeFreeEmbeddedTree(la->nodetree);
MEM_freeN(la->nodetree);
la->nodetree = NULL;
}
@@ -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)