15#define DNA_DEPRECATED_ALLOW
48 Light *la = id_cast<Light *>(
id);
63 std::optional<Library *> owner_library,
68 Light *la_dst = id_cast<Light *>(id_dst);
69 const Light *la_src = id_cast<const Light *>(id_src);
78 if (la_src->nodetree) {
85 &la_src->nodetree->id,
87 reinterpret_cast<ID **
>(&la_dst->nodetree),
88 flag_embedded_id_data);
96 la_dst->preview =
nullptr;
102 Light *la = id_cast<Light *>(
id);
107 MEM_delete(la->nodetree);
108 la->nodetree =
nullptr;
120 if (lamp->nodetree) {
129 Light *la = id_cast<Light *>(
id);
136 Light *la = id_cast<Light *>(
id);
139 la->energy_deprecated = la->energy * exp2f(la->exposure);
141 la->energy_deprecated /=
M_PI_4;
145 la->use_nodes =
true;
164 Light *la = id_cast<Light *>(
id);
171 .id_code = Light::id_type,
175 .struct_size =
sizeof(
Light),
177 .name_plural =
N_(
"lights"),
180 .asset_type_info =
nullptr,
185 .make_local =
nullptr,
187 .foreach_cache =
nullptr,
188 .foreach_path =
nullptr,
190 .foreach_asset_weak_reference =
nullptr,
191 .owner_pointer_get =
nullptr,
195 .blend_read_after_liblink =
nullptr,
197 .blend_read_undo_preserve =
nullptr,
199 .lib_override_apply_post =
nullptr,
220 return light.energy * exp2f(light.exposure);
228 float temperature_color[4];
239 switch (light.
type) {
242 const float3x3 scalemat = object_to_world.view<3, 3>();
245 const float size_x = light.area_size *
scale.x;
251 float area = size_x * size_y;
262 const float radius = light.radius;
267 const float angle = light.sun_angle / 2.0f;
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_)
General operations, lookup, etc. for blender lights.
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_LIGHT
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
float3x3 scale(float3x3 mat, float2 scale)
void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
bNodeTree * node_tree_localize(bNodeTree *ntree, std::optional< ID * > new_owner_id)
void node_tree_free_embedded_tree(bNodeTree *ntree)
VecBase< T, 3 > to_scale(const MatBase< T, NumCol, NumRow > &mat)
void node_tree_shader_default(const bContext *C, Main *bmain, ID *id)
static void light_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void BKE_icon_id_delete(ID *id)
void BKE_previewimg_id_free(ID *id)
void BKE_previewimg_blend_read(BlendDataReader *reader, PreviewImage *prv)
static void light_copy_data(Main *bmain, std::optional< Library * > owner_library, ID *id_dst, const ID *id_src, const int flag)
void BKE_previewimg_blend_write(BlendWriter *writer, const PreviewImage *prv)
void DEG_debug_print_eval(Depsgraph *depsgraph, const char *function_name, const char *object_name, const void *object_address)
float BKE_light_power(const Light &light)
MatBase< float, 4, 4 > float4x4
void BKE_id_blend_write(BlendWriter *writer, ID *id)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
@ LIB_ID_CREATE_NO_ALLOCATE
BMesh const char void * data
void BKE_library_foreach_ID_embedded(LibraryForeachIDData *data, ID **id_pp)
void IMB_colormanagement_blackbody_temperature_to_rgb(float r_dest[4], float value)
MatBase< float, 3, 3 > float3x3
static void light_init_data(ID *id)
static void light_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
static void light_free_data(ID *id)
void BKE_previewimg_id_copy(ID *new_id, const ID *old_id)
static void light_foreach_id(ID *id, LibraryForeachIDData *data)
float3 BKE_light_color(const Light &light)
Light * BKE_light_add(Main *bmain, const char *name) ATTR_WARN_UNUSED_RESULT
static void light_blend_read_data(BlendDataReader *reader, ID *id)
float BKE_light_area(const Light &light, const float4x4 &object_to_world)
VecBase< float, 3 > float3
void BKE_light_eval(Depsgraph *depsgraph, Light *la)
void * BKE_id_new(Main *bmain, short type, const char *name)
struct ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, std::optional< const ID * > new_owner_id, ID **new_id_p, int flag)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void write_embedded_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)