Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/depsgraph_query.cc
| Show All 27 Lines | |||||
| #include <cstring> /* XXX: memcpy */ | #include <cstring> /* XXX: memcpy */ | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_action.h" /* XXX: BKE_pose_channel_find_name */ | #include "BKE_action.h" /* XXX: BKE_pose_channel_find_name */ | ||||
| #include "BKE_customdata.h" | #include "BKE_customdata.h" | ||||
| #include "BKE_idtype.h" | #include "BKE_idtype.h" | ||||
| #include "BKE_layer.h" | |||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| ▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | ViewLayer *DEG_get_evaluated_view_layer(const Depsgraph *graph) | ||||
| /* TODO(sergey): Can this be optimized? */ | /* TODO(sergey): Can this be optimized? */ | ||||
| ViewLayer *view_layer_orig = deg_graph->view_layer; | ViewLayer *view_layer_orig = deg_graph->view_layer; | ||||
| ViewLayer *view_layer_cow = (ViewLayer *)BLI_findstring( | ViewLayer *view_layer_cow = (ViewLayer *)BLI_findstring( | ||||
| &scene_cow->view_layers, view_layer_orig->name, offsetof(ViewLayer, name)); | &scene_cow->view_layers, view_layer_orig->name, offsetof(ViewLayer, name)); | ||||
| BLI_assert(view_layer_cow != nullptr); | BLI_assert(view_layer_cow != nullptr); | ||||
| return view_layer_cow; | return view_layer_cow; | ||||
| } | } | ||||
| ViewLayer *DEG_get_evaluated_view_layer_of_object(const Depsgraph *graph, const Object *object) | |||||
| { | |||||
| if (object == nullptr) { | |||||
| return DEG_get_evaluated_view_layer(graph); | |||||
| } | |||||
| const deg::Depsgraph *deg_graph = reinterpret_cast<const deg::Depsgraph *>(graph); | |||||
| const ID *orig_id = object->id.orig_id != nullptr ? object->id.orig_id : &object->id; | |||||
| const deg::IDNode *id_node = deg_graph->find_id_node(orig_id); | |||||
| if (id_node == nullptr) { | |||||
| return nullptr; | |||||
| } | |||||
| switch (id_node->linked_state) { | |||||
| case deg::DEG_ID_LINKED_VIA_SET: { | |||||
| Scene *set_scene_orig = deg_graph->scene->set; | |||||
| const deg::IDNode *set_scene_id_node = deg_graph->find_id_node(&set_scene_orig->id); | |||||
| BLI_assert(set_scene_id_node != nullptr); | |||||
| const Scene *set_scene_cow = reinterpret_cast<const Scene *>(set_scene_id_node->id_cow); | |||||
| ViewLayer *set_view_layer_cow = BKE_view_layer_default_render(set_scene_cow); | |||||
| return set_view_layer_cow; | |||||
| } | |||||
| default: | |||||
| return DEG_get_evaluated_view_layer(graph); | |||||
| } | |||||
| } | |||||
| Object *DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object) | Object *DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object) | ||||
| { | { | ||||
| return (Object *)DEG_get_evaluated_id(depsgraph, &object->id); | return (Object *)DEG_get_evaluated_id(depsgraph, &object->id); | ||||
| } | } | ||||
| ID *DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id) | ID *DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id) | ||||
| { | { | ||||
| if (id == nullptr) { | if (id == nullptr) { | ||||
| ▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines | |||||