Blender V5.0
depsgraph_query.cc File Reference
#include <cstring>
#include "BLI_listbase.h"
#include "BKE_action.hh"
#include "BKE_idtype.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "RNA_access.hh"
#include "RNA_path.hh"
#include "RNA_prototypes.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "intern/depsgraph.hh"
#include "intern/eval/deg_eval_copy_on_write.h"
#include "intern/node/deg_node_component.hh"
#include "intern/node/deg_node_id.hh"

Go to the source code of this file.

Namespaces

namespace  blender
namespace  blender::deg

Functions

static const IDblender::deg::get_original_id (const ID *id)
static IDblender::deg::get_original_id (ID *id)
static const IDblender::deg::get_evaluated_id (const Depsgraph *deg_graph, const ID *id)
static IDblender::deg::get_evaluated_id (const Depsgraph *deg_graph, ID *id)
SceneDEG_get_input_scene (const Depsgraph *graph)
ViewLayerDEG_get_input_view_layer (const Depsgraph *graph)
MainDEG_get_bmain (const Depsgraph *graph)
eEvaluationMode DEG_get_mode (const Depsgraph *graph)
float DEG_get_ctime (const Depsgraph *graph)
bool DEG_id_type_updated (const Depsgraph *graph, short id_type)
bool DEG_id_type_any_updated (const Depsgraph *graph)
bool DEG_id_type_any_exists (const Depsgraph *depsgraph, short id_type)
uint32_t DEG_get_eval_flags_for_id (const Depsgraph *graph, const ID *id)
void DEG_get_customdata_mask_for_object (const Depsgraph *graph, Object *ob, CustomData_MeshMasks *r_mask)
SceneDEG_get_evaluated_scene (const Depsgraph *graph)
ViewLayerDEG_get_evaluated_view_layer (const Depsgraph *graph)
IDDEG_get_evaluated_id (const Depsgraph *depsgraph, ID *id)
const IDDEG_get_evaluated_id (const Depsgraph *depsgraph, const ID *id)
void DEG_get_evaluated_rna_pointer (const Depsgraph *depsgraph, PointerRNA *ptr, PointerRNA *r_ptr_eval)
IDDEG_get_original_id (ID *id)
const IDDEG_get_original_id (const ID *id)
Depsgraph * DEG_get_depsgraph_by_id (const ID &id)
bool DEG_is_original_id (const ID *id)
bool DEG_is_evaluated_id (const ID *id)
bool DEG_is_fully_evaluated (const Depsgraph *depsgraph)
bool DEG_id_is_fully_evaluated (const Depsgraph *depsgraph, const ID *id_eval)
static bool operation_needs_update (const ID &id, const deg::NodeType component_type, const deg::OperationCode opcode)
bool DEG_object_geometry_is_evaluated (const Object &object)
bool DEG_object_transform_is_evaluated (const Object &object)
bool DEG_collection_geometry_is_evaluated (const Collection &collection)

Detailed Description

Implementation of Querying API

Definition in file depsgraph_query.cc.

Function Documentation

◆ DEG_collection_geometry_is_evaluated()

bool DEG_collection_geometry_is_evaluated ( const Collection & collection)

◆ DEG_get_bmain()

◆ DEG_get_ctime()

float DEG_get_ctime ( const Depsgraph * graph)

Get time that depsgraph is being evaluated or was last evaluated at.

Definition at line 104 of file depsgraph_query.cc.

References blender::deg::Depsgraph::ctime.

Referenced by blender::ed::object::apply_grease_pencil_for_modifier(), blender::ed::object::apply_grease_pencil_for_modifier_all_keyframes(), blender::ed::greasepencil::bake_grease_pencil_animation_exec(), blender::draw::gpencil::Instance::begin_sync(), BKE_animsys_eval_animdata(), BKE_animsys_eval_driver(), BKE_grease_pencil_eval_geometry(), BKE_mask_eval_animation(), BKE_mask_eval_update(), BKE_object_eval_grease_pencil(), BKE_object_where_is_calc(), BKE_object_where_is_calc_ex(), BKE_rigidbody_eval_simulation(), BKE_rigidbody_object_sync_transforms(), BKE_rigidbody_rebuild_sim(), camerasolver_evaluate(), clothModifier_do(), deform_verts(), deform_verts(), deform_verts(), blender::io::alembic::ABCPointsWriter::do_write(), blender::draw::drw_particle_update_ptcache_edit(), followtrack_context_init(), get_effector_data(), blender::ed::geometry::get_original_geometry_eval_copy(), blender::ed::greasepencil::grease_pencil_reproject_exec(), image_user_id_eval_animation(), blender::draw::overlay::Instance::init(), make_duplis_particle_system(), MOD_init_texture(), modify_geometry_set(), modify_mesh(), blender::NodesModifierBakeParams::NodesModifierBakeParams(), blender::NodesModifierSimulationParams::NodesModifierSimulationParams(), blender::draw::overlay::Relations::object_sync(), objectsolver_evaluate(), blender::draw::particle_batch_cache_ensure_pos(), particle_system_update(), precalculate_effector(), psys_get_particle_state(), blender::ed::geometry::store_result_geometry(), transformcache_evaluate(), volume_sequence_frame(), and waveModifier_do().

◆ DEG_get_customdata_mask_for_object()

◆ DEG_get_depsgraph_by_id()

Depsgraph * DEG_get_depsgraph_by_id ( const ID & id)

Get the depsgraph that owns the given ID. This is efficient because the depsgraph is cached on the ID.

Only IDs that use the copy-on-eval mechanism of depsgraph evaluation have a corresponding depsgraph. Original IDs as well as temporary IDs e.g. generated by geometry nodes do not have a corresponding depsgraph, so null is returned here for these IDs.

Definition at line 285 of file depsgraph_query.cc.

Referenced by BPy_GeometrySet_static_from_evaluated_object(), and operation_needs_update().

◆ DEG_get_eval_flags_for_id()

uint32_t DEG_get_eval_flags_for_id ( const Depsgraph * graph,
const ID * id )

◆ DEG_get_evaluated_id() [1/2]

const ID * DEG_get_evaluated_id ( const Depsgraph * depsgraph,
const ID * id )

Definition at line 215 of file depsgraph_query.cc.

References DEG_get_evaluated_id(), and depsgraph.

◆ DEG_get_evaluated_id() [2/2]

ID * DEG_get_evaluated_id ( const Depsgraph * depsgraph,
ID * id )

◆ DEG_get_evaluated_rna_pointer()

void DEG_get_evaluated_rna_pointer ( const Depsgraph * depsgraph,
PointerRNA * ptr,
PointerRNA * r_ptr_eval )

◆ DEG_get_evaluated_scene()

Scene * DEG_get_evaluated_scene ( const Depsgraph * graph)

Get scene at its evaluated state.

Technically, this is a copied-on-written and fully evaluated version of the input scene. This function will check that the data-block has been expanded (and copied) from the original one. Assert will happen if it's not.

Definition at line 184 of file depsgraph_query.cc.

References BLI_assert, blender::deg::deg_eval_copy_is_expanded(), Scene::id, and blender::deg::Depsgraph::scene_cow.

Referenced by action_preview_render(), blender::ed::object::add_hook_object(), bake_strokes(), BKE_cachefile_filepath_get(), BKE_camera_view_frame_fit_to_coords(), BKE_constraint_apply_for_object(), BKE_constraint_apply_for_pose(), BKE_crazyspace_get_mapped_editverts(), BKE_effectors_create(), BKE_multires_create_deformed_base_mesh_vert_coords(), BKE_multires_create_mesh(), BKE_scene_update_sound(), bpy_bmesh_from_object(), C_BVHTree_FromObject(), blender::ed::space_node::compo_startjob(), blender::io::alembic::ABCCameraWriter::create_alembic_objects(), deform_verts(), deform_verts(), deform_verts(), deform_verts(), deform_verts(), DEG_get_evaluated_view_layer(), DEG_iterator_objects_begin(), displaceModifier_do(), blender::io::alembic::ABCPointsWriter::do_write(), blender::io::usd::USDCameraWriter::do_write(), driver_target_context_from_animation_context(), DRW_draw_select_loop(), DRW_draw_view(), DRW_render_gpencil(), DRW_render_set_time(), DRW_render_to_image(), dynamicpaint_bake_exec(), ED_view3d_depth_override(), ED_view3d_has_depth_buffer_updated(), blender::ed::object::force_evaluation_if_constraint_disabled(), FRS_do_stroke_rendering(), blender::render::hydra::gf_camera(), blender::ed::object::ignore_parent_tx(), blender::workbench::SceneState::init(), mesh_new_from_mesh_object_with_layers(), MOD_lineart_compute_feature_lines_v3(), blender::ed::object::modifier_apply_obdata(), blender::ed::object::modifier_apply_shape(), blender::ed::object::modifier_skin_armature_create(), blender::modify_geometry_set(), blender::modify_geometry_set(), modify_geometry_set(), modify_mesh(), modify_mesh(), modify_mesh(), modify_mesh(), modify_mesh(), modify_mesh(), modify_mesh(), modify_mesh(), multires_as_mesh(), multires_ccg_settings_init(), multires_reshape_context_create_from_base_mesh(), multires_reshape_context_create_from_object(), multires_reshape_create_subdiv(), blender::nodes::node_geo_input_active_camera_cc::node_exec(), blender::nodes::node_geo_camera_info_cc::node_geo_exec(), blender::ed::object::object_force_modifier_update_for_bind(), blender::bke::object_get_datamask(), object_preview_render(), render_init_depsgraph(), scene_preview_render(), screen_animation_step_invoke(), screen_opengl_render_anim_init(), blender::seq::seq_prefetch_init_depsgraph(), blender::seq::seq_render_scene_strip_ex(), set_plane_exec(), SIM_cloth_solve(), sound_jack_sync_callback(), sound_mixdown_exec(), start_playback(), stop_playback(), subdiv_levels_for_modifier_get(), blender::render::hydra::Engine::sync(), view3d_calc_minmax_selected(), view3d_calc_minmax_visible(), view3d_orbit_calc_center(), and blender::render::hydra::ViewSettings::ViewSettings().

◆ DEG_get_evaluated_view_layer()

◆ DEG_get_input_scene()

Scene * DEG_get_input_scene ( const Depsgraph * graph)

Get scene that depsgraph was built for.

Definition at line 80 of file depsgraph_query.cc.

References blender::deg::Depsgraph::scene.

Referenced by action_preview_render(), BKE_collision_relations_create(), BKE_scene_graph_update_for_newframe_ex(), BKE_volume_simplify_factor(), BKE_volume_simplify_level(), BPy_GeometrySet_static_from_evaluated_object(), blender::ed::geometry::build_extra_depsgraph(), curve_from_curve_object(), DEG_editors_update(), DEG_evaluate_on_framechange(), DEG_evaluate_on_refresh(), blender::io::SubdivModifierDisabler::disable_modifiers(), drw_callbacks_post_scene(), dynamicPaint_bakeImageSequence(), ED_preview_icon_job(), ED_render_view3d_update(), ED_update_for_newframe(), ED_view3d_cursor_snap_data_update(), engine_depsgraph_init(), blender::io::alembic::export_startjob(), blender::io::usd::export_to_stage(), blender::io::obj::exporter_main(), blender::io::usd::get_enabled_modifier(), blender::io::alembic::ABCMetaballWriter::is_supported(), blender::io::usd::USDMetaballWriter::is_supported(), blender::ed::transform::iter_snap_objects(), blender::ed::object::modifier_skin_armature_create(), modify_mesh(), blender::nodes::node_geo_input_scene_time_cc::node_exec(), blender::NodesModifierSimulationParams::NodesModifierSimulationParams(), blender::io::hydra::HydraSceneDelegate::populate(), psys_in_edit_mode(), scene_graph_update_tagged(), sculpt_update_object(), v3d_cursor_snap_draw_fn(), view3d_calc_minmax_selected(), view3d_calc_minmax_visible(), view3d_calc_point_in_selected_bounds(), and view3d_ruler_item_mousemove().

◆ DEG_get_input_view_layer()

◆ DEG_get_mode()

eEvaluationMode DEG_get_mode ( const Depsgraph * graph)

Get evaluation mode that depsgraph was built for.

Definition at line 98 of file depsgraph_query.cc.

References blender::deg::Depsgraph::mode.

Referenced by BKE_collision_relations_create(), BKE_effector_relations_create(), BKE_mball_polygonize(), BKE_multires_create_deformed_base_mesh_vert_coords(), BKE_object_eval_eval_base_flags(), BKE_object_handle_data_update(), BKE_scene_update_sound(), BKE_volume_simplify_factor(), BKE_volume_simplify_level(), bpy_bmesh_from_object(), blender::ed::geometry::build_extra_depsgraph(), bvh_get_mesh(), curve_from_curve_object(), curves_evaluate_modifiers(), DEG_debug_graph_relations_validate(), DEG_iterator_objects_begin(), blender::io::SubdivModifierDisabler::disable_modifiers(), distribute_invalid(), blender::draw::drw_particle_update_ptcache_edit(), dynamicPaint_doStep(), blender::bke::editbmesh_calc_modifiers(), blender::draw::foreach_obref_in_scene(), get_dupli_generator(), blender::io::usd::get_enabled_modifier(), grease_pencil_evaluate_modifiers(), image_user_id_eval_animation(), blender::io::hydra::MaterialData::init(), init_meta(), blender::io::hydra::HairData::is_visible(), blender::io::hydra::ObjectData::is_visible(), lineart_main_load_geometries(), Freestyle::BlenderFileLoader::Load(), make_child_duplis(), make_duplis_collection(), make_duplis_geometry_set_impl(), make_duplis_particle_system(), blender::bke::mesh_calc_modifiers(), blender::nodes::node_geo_is_viewport_cc::node_geo_exec(), pointcloud_evaluate_modifiers(), blender::io::hydra::USDSceneDelegate::populate(), psys_in_edit_mode(), psys_sim_data_init(), psys_thread_context_init_distribute(), psys_update_path_cache(), and volume_evaluate_modifiers().

◆ DEG_get_original_id() [1/2]

const ID * DEG_get_original_id ( const ID * id)

Definition at line 280 of file depsgraph_query.cc.

References blender::deg::get_original_id().

◆ DEG_get_original_id() [2/2]

◆ DEG_id_is_fully_evaluated()

bool DEG_id_is_fully_evaluated ( const Depsgraph * depsgraph,
const ID * id_eval )

Check every component of the data-block is evaluated. For example, an object disabled in the viewport is not fully evaluated, even though the copy-on-eval data-block is created.

Definition at line 333 of file depsgraph_query.cc.

References blender::deg::IDNode::components, depsgraph, blender::deg::DEPSOP_FLAG_NEEDS_UPDATE, blender::deg::Depsgraph::find_id_node(), blender::deg::OperationNode::flag, and blender::deg::get_original_id().

Referenced by blender::ed::geometry::run_node_group_exec().

◆ DEG_id_type_any_exists()

bool DEG_id_type_any_exists ( const Depsgraph * depsgraph,
short id_type )

◆ DEG_id_type_any_updated()

bool DEG_id_type_any_updated ( const Depsgraph * graph)

◆ DEG_id_type_updated()

bool DEG_id_type_updated ( const Depsgraph * depsgraph,
short id_type )

Check if given ID type was tagged for update.

Definition at line 110 of file depsgraph_query.cc.

References BKE_idtype_idcode_to_index(), and blender::deg::Depsgraph::id_type_updated.

◆ DEG_is_evaluated_id()

bool DEG_is_evaluated_id ( const ID * id)

Definition at line 314 of file depsgraph_query.cc.

References DEG_is_original_id().

Referenced by DEG_is_evaluated().

◆ DEG_is_fully_evaluated()

bool DEG_is_fully_evaluated ( const Depsgraph * depsgraph)

Check whether depsgraph is fully evaluated. This includes the following checks:

  • Relations are up-to-date.
  • Nothing is tagged for update.

Definition at line 319 of file depsgraph_query.cc.

References depsgraph, blender::deg::Depsgraph::entry_tags, and blender::deg::Depsgraph::need_update_relations.

Referenced by BKE_scene_graph_update_for_newframe_ex(), and scene_graph_update_tagged().

◆ DEG_is_original_id()

bool DEG_is_original_id ( const ID * id)

Check whether given ID is an original.

Original IDs are considered all the IDs which are not covered by copy-on-evaluation system and are not out-of-main localized data-blocks.

Definition at line 290 of file depsgraph_query.cc.

References ID_TAG_COPIED_ON_EVAL, ID_TAG_COPIED_ON_EVAL_FINAL_RESULT, ID_TAG_LOCALIZED, and ID::tag.

Referenced by DEG_is_evaluated_id(), and DEG_is_original().

◆ DEG_object_geometry_is_evaluated()

bool DEG_object_geometry_is_evaluated ( const Object & object)

Returns false when the objects geometry is not fully evaluated in its depsgraph yet. In this case, the geometry must not be accessed. Otherwise returns true when geometry is fully evaluated or the object does not belong to any specific depsgraph.

The result of this function is non deterministic when multi-threading is used because the depsgraph nodes are not totally ordered. When the depsgraph contains all correct relations and there are no cycles, the result should always be true here though. So it does not break determinism when there are no dependency graph cycles.

Definition at line 385 of file depsgraph_query.cc.

References blender::deg::GEOMETRY, blender::deg::GEOMETRY_EVAL, and operation_needs_update().

Referenced by BKE_modifier_get_evaluated_mesh_from_evaluated_object(), BKE_object_get_evaluated_mesh(), BKE_object_get_evaluated_mesh_no_subsurf(), BPy_GeometrySet_static_from_evaluated_object(), blender::nodes::node_geo_object_info_cc::node_geo_exec(), and blender::bke::object_get_evaluated_geometry_set().

◆ DEG_object_transform_is_evaluated()

bool DEG_object_transform_is_evaluated ( const Object & object)

◆ operation_needs_update()