38 if (
object->light_linking ==
nullptr) {
39 object->light_linking = MEM_new<LightLinking>(__func__);
83 if (
object->light_linking) {
88 MEM_SAFE_DELETE(
object->light_linking);
94 if (
object->light_linking->receiver_collection ==
nullptr &&
95 object->light_linking->blocker_collection ==
nullptr)
104 if (!
object->light_linking) {
110 return object->light_linking->receiver_collection;
112 return object->light_linking->blocker_collection;
125 format =
DATA_(
"Light Linking for %s");
128 format =
DATA_(
"Shadow Linking for %s");
148 return new_collection;
157 if (old_collection) {
162 if (new_collection) {
166 if (
object->light_linking) {
170 object->light_linking->receiver_collection = new_collection;
173 object->light_linking->blocker_collection = new_collection;
180 if (new_collection) {
202 if (collection_object.
ob ==
object) {
203 return &collection_object;
215 return &collection_child;
235 if (!collection_object) {
236 BLI_assert_msg(0,
"Object was not found after added to the light linking collection");
256 if (!collection_child) {
257 BLI_assert_msg(0,
"Collection was not found after added to the light linking collection");
268 const bool allow_all_objects)
274 if (id_type ==
ID_OB) {
277 if (!allow_all_objects) {
292 else if (id_type ==
ID_GR) {
294 bmain, collection,
reinterpret_cast<Collection *
>(receiver));
300 if (!collection_light_linking) {
304 collection_light_linking->
link_state = link_state;
325 if (!receiver_collection_child) {
326 BLI_assert_msg(0,
"Receiver child was not found after adding collection to light linking");
332 if (before_id_type !=
ID_GR) {
342 collection,
reinterpret_cast<const Collection *
>(before));
343 if (!before_collection_child) {
357 if (!receiver_collection_child) {
358 BLI_assert_msg(0,
"Receiver child was not found after adding collection to light linking");
364 if (after_id_type !=
ID_GR) {
374 collection,
reinterpret_cast<const Collection *
>(after));
375 if (!after_collection_child) {
389 if (!receiver_collection_object) {
391 0,
"Receiver collection object was not found after adding collection to light linking");
397 if (before_id_type !=
ID_OB) {
407 collection,
reinterpret_cast<const Object *
>(before));
408 if (!before_collection_object) {
420 if (!receiver_collection_object) {
422 0,
"Receiver collection object was not found after adding collection to light linking");
428 if (after_id_type !=
ID_OB) {
438 collection,
reinterpret_cast<const Object *
>(after));
439 if (!after_collection_object) {
464 if (id_type ==
ID_OB) {
467 else if (id_type ==
ID_GR) {
488 if (id_type ==
ID_OB) {
491 else if (id_type ==
ID_GR) {
503 if (id_type ==
ID_OB) {
506 else if (id_type ==
ID_GR) {
512 "Cannot unlink unsupported '%s' from light linking collection '%s'",
519 if (id_type ==
ID_OB) {
571 if (base.object == emitter) {
#define SNPRINTF_UTF8(dst, format,...)
ID and Library types, which are fundamental for SDNA.
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
struct Collection * BKE_light_linking_collection_new(struct Main *bmain, struct Object *object, LightLinkingType link_type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BKE_light_linking_copy(struct Object *object_dst, const struct Object *object_src, const int copy_flags)
static CollectionLightLinking * light_linking_collection_add_collection(Main *bmain, Collection *collection, Collection *child)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BKE_light_linking_add_receiver_to_collection_after(struct Main *bmain, struct Collection *collection, struct ID *receiver, const struct ID *after, const eCollectionLightLinkingState link_state)
void BKE_light_linking_copy_collection(Main *bmain, Object &object_dst, const Object &object_src, LightLinkingType link_type)
bool BKE_collection_child_add(Main *bmain, Collection *parent, Collection *child)
void BKE_light_linking_free_if_empty(struct Object *object)
void BKE_light_linking_delete(struct Object *object, const int delete_flags)
static CollectionLightLinking * light_linking_collection_add_object(Main *bmain, Collection *collection, Object *object)
static void order_collection_receiver_before(Collection *collection, Collection *receiver, const ID *before)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void BKE_light_linking_copy_receiver_collection(Main *bmain, Object &object_dst, const Object &object_src)
eCollectionLightLinkingState
void BKE_light_linking_collection_assign_only(struct Object *object, struct Collection *new_collection, LightLinkingType link_type)
void BKE_light_linking_copy_blocker_collection(Main *bmain, Object &object_dst, const Object &object_src)
static CollectionObject * find_collection_object(const Collection *collection, const Object *object)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
struct Collection * BKE_light_linking_collection_get(const struct Object *object, LightLinkingType link_type)
bool BKE_collection_contains_geometry_recursive(const Collection *collection)
void BKE_light_linking_select_receivers_of_emitter(const Main &bmain, struct Scene *scene, struct ViewLayer *view_layer, struct Object *emitter, LightLinkingType link_type)
static void light_linking_add_receiver_to_collection(Main *bmain, Collection *collection, ID *receiver, const eCollectionLightLinkingState link_state, const bool allow_all_objects)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
bool BKE_collection_child_remove(Main *bmain, Collection *parent, Collection *child)
static void order_object_receiver_after(Collection *collection, Object *receiver, const ID *after)
bool BKE_collection_object_add(Main *bmain, Collection *collection, Object *ob)
static void order_collection_receiver_after(Collection *collection, Collection *receiver, const ID *after)
static std::string get_default_collection_name(const Object *object, const LightLinkingType link_type)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void BKE_light_linking_ensure(struct Object *object)
bool BKE_light_linking_unlink_id_from_collection(struct Main *bmain, struct Collection *collection, struct ID *id, struct ReportList *reports)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
bool BKE_collection_object_remove(Main *bmain, Collection *collection, Object *ob, bool free_us)
void BKE_light_linking_add_receiver_to_collection_before(struct Main *bmain, struct Collection *collection, struct ID *receiver, const struct ID *before, const eCollectionLightLinkingState link_state)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BKE_light_linking_link_receiver_to_emitter(struct Main *bmain, struct Object *emitter, struct Object *receiver, LightLinkingType link_type, eCollectionLightLinkingState link_state)
ID_Type GS(const char *name)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
void BKE_light_linking_add_receiver_to_collection(struct Main *bmain, struct Collection *collection, struct ID *receiver, const eCollectionLightLinkingState link_state)
bool DEG_object_has_geometry_component(Object *object)
void DEG_relations_tag_update(Main *bmain)
void BKE_light_linking_collection_assign(struct Main *bmain, struct Object *object, struct Collection *new_collection, LightLinkingType link_type)
ListBaseT< Base > * BKE_view_layer_object_bases_get(ViewLayer *view_layer)
static void order_object_receiver_before(Collection *collection, Object *receiver, const ID *before)
static CollectionChild * find_collection_child(const Collection *collection, const Collection *child)
Collection * BKE_collection_add(Main *bmain, Collection *collection_parent, const char *name_custom)
struct Collection * collection
CollectionLightLinking light_linking
eCollectionLightLinkingState link_state
CollectionLightLinking light_linking
ListBaseT< CollectionChild > children
ListBaseT< CollectionObject > gobject
struct Collection * blocker_collection
struct Collection * receiver_collection
LightLinking * light_linking
struct Collection * instance_collection