Blender V4.5
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
12
13#include "DNA_collection_types.h" /* eCollectionLightLinkingState */
14
15struct ID;
16struct Main;
17struct Object;
18struct Collection;
19struct ReportList;
20struct Scene;
21struct ViewLayer;
22
27
28/* Free object's light_linking if it is not needed to hold any of collections. */
29void BKE_light_linking_free_if_empty(struct Object *object);
30
31/* Get a collection of the given light linking type of the given object. */
33 LightLinkingType link_type);
34
35/* Create new collection and assign it as a light or shadow linking collection (denoted by the
36 * link_type) of the given object.
37 *
38 * The collection is created outside of the view layer collections.
39 * If the object already has light linking collection set up it is unreferenced from the object.
40 *
41 * Returns the newly created collection. */
43 struct Object *object,
44 LightLinkingType link_type);
45
46/* Assign given light or shadow linking collection (denoted by the link_type) to the given object.
47 * Maintains user counters of the collection: old collection is decreased the user counter, the new
48 * one is increased after this call.
49 * The new_collection is allowed to be null pointer.
50 *
51 * The assign_only variant takes care of (re)assigning the collection and maintaining the user
52 * counter, but not the dependency graph tagging for update. */
54 struct Collection *new_collection,
55 LightLinkingType link_type);
57 struct Object *object,
58 struct Collection *new_collection,
59 LightLinkingType link_type);
60
61/* Add receiver to the given light linking collection.
62 * The ID is expected to either be collection or an object. Passing other types of IDs has no
63 * effect */
65 struct Collection *collection,
66 struct ID *receiver,
67 const eCollectionLightLinkingState link_state);
69 struct Main *bmain,
70 struct Collection *collection,
71 struct ID *receiver,
72 const struct ID *before,
73 const eCollectionLightLinkingState link_state);
75 struct Main *bmain,
76 struct Collection *collection,
77 struct ID *receiver,
78 const struct ID *after,
79 const eCollectionLightLinkingState link_state);
80
81/* Remove the given ID from the light or shadow linking collection of the given object.
82 *
83 * The collection is expected to be either receiver_collection or blocker_collection from an
84 * emitter object.
85 *
86 * The ID is expected to either be collection or an object. If other ID type is passed to the
87 * function an error is reported and false is returned.
88 *
89 * Returns true if the ID was unlinked from the receiver collection, false otherwise. The unlinking
90 * will be unsuccessful if, for example, the receiver collection is a linked data-block.
91 *
92 * The optional reports argument is used to provide human-readable details about why unlinking was
93 * not successful. If it is nullptr then the report is printed to the console. */
95 struct Collection *collection,
96 struct ID *id,
97 struct ReportList *reports);
98
99/* Link receiver object to the given emitter.
100 *
101 * If the emitter already has light linking collection specified the object is added to that
102 * collection. Otherwise, first a new collection is created and assigned, and the receiver is added
103 * to it. */
105 struct Object *emitter,
106 struct Object *receiver,
107 LightLinkingType link_type,
109
110/* Select all objects which are linked to the given emitter via the given light link type. */
112 struct ViewLayer *view_layer,
113 struct Object *emitter,
114 LightLinkingType link_type);
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
ReportList * reports
Definition WM_types.hh:1025
Definition DNA_ID.h:404