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.c108
1 files changed, 60 insertions, 48 deletions
diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c
index aec0f808f64..aa1005c663f 100644
--- a/source/blender/blenkernel/intern/light.c
+++ b/source/blender/blenkernel/intern/light.c
@@ -37,17 +37,19 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BKE_animsys.h"
#include "BKE_colortools.h"
#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"
#include "BLT_translation.h"
+#include "DEG_depsgraph.h"
+
static void light_init_data(ID *id)
{
Light *la = (Light *)id;
@@ -59,17 +61,6 @@ static void light_init_data(ID *id)
BKE_curvemapping_initialize(la->curfalloff);
}
-Light *BKE_light_add(Main *bmain, const char *name)
-{
- Light *la;
-
- la = BKE_libblock_alloc(bmain, ID_LA, name, 0);
-
- light_init_data(&la->id);
-
- return la;
-}
-
/**
* Only copy internal data of Light ID from source
* to already allocated/initialized destination.
@@ -101,6 +92,61 @@ static void light_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
}
}
+static void light_free_data(ID *id)
+{
+ Light *la = (Light *)id;
+
+ BKE_curvemapping_free(la->curfalloff);
+
+ /* is no lib link block, but light extension */
+ if (la->nodetree) {
+ ntreeFreeEmbeddedTree(la->nodetree);
+ MEM_freeN(la->nodetree);
+ la->nodetree = NULL;
+ }
+
+ BKE_previewimg_free(&la->preview);
+ BKE_icon_id_delete(&la->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,
+ .main_listbase_index = INDEX_ID_LA,
+ .struct_size = sizeof(Light),
+ .name = "Light",
+ .name_plural = "lights",
+ .translation_context = BLT_I18NCONTEXT_ID_LIGHT,
+ .flags = 0,
+
+ .init_data = light_init_data,
+ .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)
+{
+ Light *la;
+
+ la = BKE_libblock_alloc(bmain, ID_LA, name, 0);
+
+ light_init_data(&la->id);
+
+ return la;
+}
+
Light *BKE_light_copy(Main *bmain, const Light *la)
{
Light *la_copy;
@@ -135,41 +181,7 @@ Light *BKE_light_localize(Light *la)
return lan;
}
-static void light_make_local(Main *bmain, ID *id, const int flags)
+void BKE_light_eval(struct Depsgraph *depsgraph, Light *la)
{
- BKE_lib_id_make_local_generic(bmain, id, flags);
+ DEG_debug_print_eval(depsgraph, __func__, la->id.name, la);
}
-
-static void light_free_data(ID *id)
-{
- Light *la = (Light *)id;
-
- BKE_curvemapping_free(la->curfalloff);
-
- /* is no lib link block, but light extension */
- if (la->nodetree) {
- ntreeFreeNestedTree(la->nodetree);
- MEM_freeN(la->nodetree);
- la->nodetree = NULL;
- }
-
- BKE_previewimg_free(&la->preview);
- BKE_icon_id_delete(&la->id);
- la->id.icon_id = 0;
-}
-
-IDTypeInfo IDType_ID_LA = {
- .id_code = ID_LA,
- .id_filter = FILTER_ID_LA,
- .main_listbase_index = INDEX_ID_LA,
- .struct_size = sizeof(Light),
- .name = "Light",
- .name_plural = "lights",
- .translation_context = BLT_I18NCONTEXT_ID_LIGHT,
- .flags = 0,
-
- .init_data = light_init_data,
- .copy_data = light_copy_data,
- .free_data = light_free_data,
- .make_local = light_make_local,
-};