|
Blender V5.0
|
#include "BKE_light_linking.h"#include <string>#include "MEM_guardedalloc.h"#include "DNA_ID.h"#include "DNA_collection_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BLI_assert.h"#include "BLI_listbase.h"#include "BLI_string_utf8.h"#include "BKE_collection.hh"#include "BKE_layer.hh"#include "BKE_lib_id.hh"#include "BKE_report.hh"#include "BLT_translation.hh"#include "DEG_depsgraph.hh"#include "DEG_depsgraph_build.hh"Go to the source code of this file.
| void BKE_light_linking_add_receiver_to_collection | ( | struct Main * | bmain, |
| struct Collection * | collection, | ||
| struct ID * | receiver, | ||
| const eCollectionLightLinkingState | link_state ) |
Add receiver to the given light linking collection. The ID is expected to either be collection or an object. Passing other types of IDs has no effect.
Definition at line 233 of file light_linking.cc.
References BKE_collection_contains_geometry_recursive(), DEG_id_tag_update(), DEG_relations_tag_update(), GS, Collection::id, ID_GR, ID_OB, ID_RECALC_HIERARCHY, ID_RECALC_SHADING, Object::instance_collection, light_linking_collection_add_collection(), light_linking_collection_add_object(), CollectionLightLinking::link_state, ID::name, OB_EMPTY, OB_TYPE_IS_GEOMETRY, and Object::type.
Referenced by BKE_light_linking_add_receiver_to_collection_after(), BKE_light_linking_add_receiver_to_collection_before(), and BKE_light_linking_link_receiver_to_emitter().
| void BKE_light_linking_add_receiver_to_collection_after | ( | Main * | bmain, |
| Collection * | collection, | ||
| ID * | receiver, | ||
| const ID * | after, | ||
| const eCollectionLightLinkingState | link_state ) |
Definition at line 427 of file light_linking.cc.
References BKE_light_linking_add_receiver_to_collection(), BLI_assert, GS, ID_GR, ID_OB, ID::name, order_collection_receiver_after(), and order_object_receiver_after().
| void BKE_light_linking_add_receiver_to_collection_before | ( | Main * | bmain, |
| Collection * | collection, | ||
| ID * | receiver, | ||
| const ID * | before, | ||
| const eCollectionLightLinkingState | link_state ) |
Definition at line 403 of file light_linking.cc.
References BKE_light_linking_add_receiver_to_collection(), BLI_assert, GS, ID_GR, ID_OB, ID::name, order_collection_receiver_before(), and order_object_receiver_before().
| void BKE_light_linking_collection_assign | ( | Main * | bmain, |
| Object * | object, | ||
| Collection * | new_collection, | ||
| const LightLinkingType | link_type ) |
Definition at line 157 of file light_linking.cc.
References BKE_light_linking_collection_assign_only(), DEG_id_tag_update(), DEG_relations_tag_update(), Object::id, ID_RECALC_SHADING, and ID_RECALC_SYNC_TO_EVAL.
Referenced by BKE_light_linking_collection_new().
| void BKE_light_linking_collection_assign_only | ( | struct Object * | object, |
| struct Collection * | new_collection, | ||
| LightLinkingType | link_type ) |
Assign given light or shadow linking collection (denoted by the link_type) to the given object. Maintains user counters of the collection: old collection is decreased the user counter, the new one is increased after this call. The new_collection is allowed to be null pointer.
The assign_only variant takes care of (re)assigning the collection and maintaining the user counter, but not the dependency graph tagging for update.
Definition at line 120 of file light_linking.cc.
References BKE_light_linking_collection_get(), BKE_light_linking_ensure(), BKE_light_linking_free_if_empty(), BLI_assert_unreachable, Collection::id, id_us_min(), id_us_plus(), Object::light_linking, LIGHT_LINKING_BLOCKER, and LIGHT_LINKING_RECEIVER.
Referenced by BKE_light_linking_collection_assign().
| Collection * BKE_light_linking_collection_get | ( | const Object * | object, |
| const LightLinkingType | link_type ) |
Definition at line 70 of file light_linking.cc.
References Object::light_linking, LIGHT_LINKING_BLOCKER, and LIGHT_LINKING_RECEIVER.
Referenced by BKE_light_linking_collection_assign_only(), BKE_light_linking_link_receiver_to_emitter(), and BKE_light_linking_select_receivers_of_emitter().
| Collection * BKE_light_linking_collection_new | ( | struct Main * | bmain, |
| struct Object * | object, | ||
| LightLinkingType | link_type ) |
Create new collection and assign it as a light or shadow linking collection (denoted by the link_type) of the given object.
The collection is created outside of the view layer collections. If the object already has light linking collection set up it is unreferenced from the object.
Definition at line 107 of file light_linking.cc.
References BKE_collection_add(), BKE_light_linking_collection_assign(), and get_default_collection_name().
Referenced by BKE_light_linking_link_receiver_to_emitter(), and blender::ed::object::light_linking_collection_new_exec().
| void BKE_light_linking_copy | ( | Object * | object_dst, |
| const Object * | object_src, | ||
| const int | copy_flags ) |
Definition at line 37 of file light_linking.cc.
References BLI_assert, LightLinking::blocker_collection, ELEM, id_us_plus(), LIB_ID_CREATE_NO_USER_REFCOUNT, Object::light_linking, MEM_dupallocN(), and LightLinking::receiver_collection.
| void BKE_light_linking_delete | ( | struct Object * | object, |
| const int | delete_flags ) |
Free the LightLinking data from the object.
| copy_flags | Flags controlling the copy process, see e.g. LIB_ID_CREATE_NO_USER_REFCOUNT and related flags in the same enum. |
Definition at line 50 of file light_linking.cc.
References LightLinking::blocker_collection, id_us_min(), LIB_ID_CREATE_NO_USER_REFCOUNT, Object::light_linking, MEM_SAFE_FREE, and LightLinking::receiver_collection.
Referenced by BKE_light_linking_free_if_empty(), and object_free_data().
| void BKE_light_linking_ensure | ( | struct Object * | object | ) |
Add an empty LightLinking data to an Object.
Definition at line 30 of file light_linking.cc.
References Object::light_linking, and MEM_callocN().
Referenced by BKE_light_linking_collection_assign_only(), blender::deg::light_linking::Cache::eval_runtime_data(), and blender::deg::ObjectRuntimeBackup::restore_to_object().
| void BKE_light_linking_free_if_empty | ( | struct Object * | object | ) |
Free object's light_linking if it is not needed to hold any of collections.
Definition at line 61 of file light_linking.cc.
References BKE_light_linking_delete(), LightLinking::blocker_collection, LIB_ID_CREATE_NO_USER_REFCOUNT, Object::light_linking, and LightLinking::receiver_collection.
Referenced by BKE_light_linking_collection_assign_only(), and blender::deg::light_linking::Cache::eval_runtime_data().
| void BKE_light_linking_link_receiver_to_emitter | ( | struct Main * | bmain, |
| struct Object * | emitter, | ||
| struct Object * | receiver, | ||
| LightLinkingType | link_type, | ||
| eCollectionLightLinkingState | link_state ) |
Link receiver object to the given emitter.
If the emitter already has light linking collection specified the object is added to that collection. Otherwise, first a new collection is created and assigned, and the receiver is added to it.
Definition at line 483 of file light_linking.cc.
References BKE_collection_contains_geometry_recursive(), BKE_light_linking_add_receiver_to_collection(), BKE_light_linking_collection_get(), BKE_light_linking_collection_new(), Object::id, Object::instance_collection, OB_EMPTY, OB_TYPE_IS_GEOMETRY, and Object::type.
Referenced by blender::ed::object::light_linking_link_exec().
| void BKE_light_linking_select_receivers_of_emitter | ( | struct Scene * | scene, |
| struct ViewLayer * | view_layer, | ||
| struct Object * | emitter, | ||
| LightLinkingType | link_type ) |
Select all objects which are linked to the given emitter via the given light link type.
Definition at line 507 of file light_linking.cc.
References BASE_SELECTED, BKE_light_linking_collection_get(), BKE_view_layer_base_find(), BKE_view_layer_object_bases_get(), BKE_view_layer_synced_ensure(), DEG_id_tag_update(), Base::flag, Collection::gobject, Scene::id, ID_RECALC_SELECT, and LISTBASE_FOREACH.
Referenced by blender::ed::object::light_linking_select_exec().
| bool BKE_light_linking_unlink_id_from_collection | ( | struct Main * | bmain, |
| struct Collection * | collection, | ||
| struct ID * | id, | ||
| struct ReportList * | reports ) |
Remove the given ID from the light or shadow linking collection of the given object.
The collection is expected to be either receiver_collection or blocker_collection from an emitter object.
The ID is expected to either be collection or an object. If other ID type is passed to the function an error is reported and false is returned.
The optional reports argument is used to provide human-readable details about why unlinking was not successful. If it is nullptr then the report is printed to the console.
Definition at line 451 of file light_linking.cc.
References BKE_collection_child_remove(), BKE_collection_object_remove(), BKE_reportf(), DEG_id_tag_update(), DEG_relations_tag_update(), GS, Collection::id, ID_GR, ID_OB, ID_RECALC_HIERARCHY, ID_RECALC_SYNC_TO_EVAL, ID::name, and RPT_ERROR.
Referenced by blender::ed::object::light_linking_unlink_from_collection_exec().
|
static |
Definition at line 179 of file light_linking.cc.
References Collection::children, and LISTBASE_FOREACH.
Referenced by light_linking_collection_add_collection(), order_collection_receiver_after(), and order_collection_receiver_before().
|
static |
Definition at line 168 of file light_linking.cc.
References Collection::gobject, and LISTBASE_FOREACH.
Referenced by light_linking_collection_add_object(), order_object_receiver_after(), and order_object_receiver_before().
|
static |
Definition at line 87 of file light_linking.cc.
References DATA_, Object::id, LIGHT_LINKING_BLOCKER, LIGHT_LINKING_RECEIVER, MAX_ID_NAME, ID::name, name, and SNPRINTF_UTF8.
Referenced by BKE_light_linking_collection_new().
|
static |
Definition at line 217 of file light_linking.cc.
References BKE_collection_child_add(), BLI_assert_msg, find_collection_child(), and CollectionChild::light_linking.
Referenced by BKE_light_linking_add_receiver_to_collection().
|
static |
Definition at line 196 of file light_linking.cc.
References BKE_collection_object_add(), BLI_assert_msg, find_collection_object(), and CollectionObject::light_linking.
Referenced by BKE_light_linking_add_receiver_to_collection().
|
static |
Definition at line 307 of file light_linking.cc.
References BLI_addtail(), BLI_assert_msg, BLI_insertlinkafter(), BLI_remlink(), Collection::children, find_collection_child(), GS, ID_GR, and ID::name.
Referenced by BKE_light_linking_add_receiver_to_collection_after().
|
static |
Definition at line 275 of file light_linking.cc.
References BLI_addtail(), BLI_assert_msg, BLI_insertlinkbefore(), BLI_remlink(), Collection::children, find_collection_child(), GS, ID_GR, and ID::name.
Referenced by BKE_light_linking_add_receiver_to_collection_before().
|
static |
Definition at line 372 of file light_linking.cc.
References BLI_addhead(), BLI_assert_msg, BLI_insertlinkafter(), BLI_remlink(), find_collection_object(), Collection::gobject, GS, ID_OB, and ID::name.
Referenced by BKE_light_linking_add_receiver_to_collection_after().
|
static |
Definition at line 339 of file light_linking.cc.
References BLI_addhead(), BLI_assert_msg, BLI_insertlinkbefore(), BLI_remlink(), find_collection_object(), Collection::gobject, GS, ID_OB, and ID::name.
Referenced by BKE_light_linking_add_receiver_to_collection_before().