Blender V4.3
BKE_light_linking.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
13#include "DNA_collection_types.h" /* eCollectionLightLinkingState */
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19struct ID;
20struct Main;
21struct Object;
22struct Collection;
23struct ReportList;
24struct Scene;
25struct ViewLayer;
26
31
32/* Free object's light_linking if it is not needed to hold any of collections. */
33void BKE_light_linking_free_if_empty(struct Object *object);
34
35/* Get a collection of the given light linking type of the given object. */
37 LightLinkingType link_type);
38
39/* Create new collection and assign it as a light or shadow linking collection (denoted by the
40 * link_type) of the given object.
41 *
42 * The collection is created outside of the view layer collections.
43 * If the object already has light linking collection set up it is unreferenced from the object.
44 *
45 * Returns the newly created collection. */
47 struct Object *object,
48 LightLinkingType link_type);
49
50/* Assign given light or shadow linking collection (denoted by the link_type) to the given object.
51 * Maintains user counters of the collection: old collection is decreased the user counter, the new
52 * one is increased after this call.
53 * The new_collection is allowed to be null pointer.
54 *
55 * The assign_only variant takes care of (re)assigning the collection and maintaining the user
56 * counter, but not the dependency graph tagging for update. */
58 struct Collection *new_collection,
59 LightLinkingType link_type);
61 struct Object *object,
62 struct Collection *new_collection,
63 LightLinkingType link_type);
64
65/* Add receiver to the given light linking collection.
66 * The ID is expected to either be collection or an object. Passing other types of IDs has no
67 * effect */
69 struct Collection *collection,
70 struct ID *receiver,
71 const eCollectionLightLinkingState link_state);
73 struct Main *bmain,
74 struct Collection *collection,
75 struct ID *receiver,
76 const struct ID *before,
77 const eCollectionLightLinkingState link_state);
79 struct Main *bmain,
80 struct Collection *collection,
81 struct ID *receiver,
82 const struct ID *after,
83 const eCollectionLightLinkingState link_state);
84
85/* Remove the given ID from the light or shadow linking collection of the given object.
86 *
87 * The collection is expected to be either receiver_collection or blocker_collection from an
88 * emitter object.
89 *
90 * The ID is expected to either be collection or an object. If other ID type is passed to the
91 * function an error is reported and false is returned.
92 *
93 * Returns true if the ID was unlinked from the receiver collection, false otherwise. The unlinking
94 * will be unsuccessful if, for example, the receiver collection is a linked data-block.
95 *
96 * The optional reports argument is used to provide human-readable details about why unlinking was
97 * not successful. If it is nullptr then the report is printed to the console. */
99 struct Collection *collection,
100 struct ID *id,
101 struct ReportList *reports);
102
103/* Link receiver object to the given emitter.
104 *
105 * If the emitter already has light linking collection specified the object is added to that
106 * collection. Otherwise, first a new collection is created and assigned, and the receiver is added
107 * to it. */
109 struct Object *emitter,
110 struct Object *receiver,
111 LightLinkingType link_type,
113
114/* Select all objects which are linked to the given emitter via the given light link type. */
116 struct ViewLayer *view_layer,
117 struct Object *emitter,
118 LightLinkingType link_type);
119
120#ifdef __cplusplus
121}
122#endif
void BKE_light_linking_collection_assign(struct Main *bmain, struct Object *object, struct Collection *new_collection, LightLinkingType link_type)
void BKE_light_linking_select_receivers_of_emitter(struct Scene *scene, struct ViewLayer *view_layer, struct Object *emitter, LightLinkingType link_type)
LightLinkingType
@ LIGHT_LINKING_BLOCKER
@ LIGHT_LINKING_RECEIVER
bool BKE_light_linking_unlink_id_from_collection(struct Main *bmain, struct Collection *collection, struct ID *id, struct ReportList *reports)
void BKE_light_linking_free_if_empty(struct Object *object)
void BKE_light_linking_collection_assign_only(struct Object *object, struct Collection *new_collection, LightLinkingType link_type)
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)
struct Collection * BKE_light_linking_collection_new(struct Main *bmain, struct Object *object, LightLinkingType link_type)
struct Collection * BKE_light_linking_collection_get(const struct Object *object, LightLinkingType link_type)
void BKE_light_linking_link_receiver_to_emitter(struct Main *bmain, struct Object *emitter, struct Object *receiver, LightLinkingType link_type, eCollectionLightLinkingState link_state)
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 BKE_light_linking_add_receiver_to_collection(struct Main *bmain, struct Collection *collection, struct ID *receiver, const eCollectionLightLinkingState link_state)
Object groups, one object can be in many groups at once.
eCollectionLightLinkingState
Definition DNA_ID.h:413