Blender V5.3
deg_builder_rna.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
13
14#include "BLI_map.hh"
15
16#include <memory>
17
18namespace blender {
19
20struct ID;
21struct PointerRNA;
22struct PropertyRNA;
23
24namespace deg {
25
26struct Depsgraph;
27struct Node;
30
31/* For queries which gives operation node or key defines whether we are
32 * interested in a result of the given property or whether we are linking some
33 * dependency to that property. */
34enum class RNAPointerSource {
35 /* Query will return pointer to an entry operation of component which is
36 * responsible for evaluation of the given property. */
38 /* Query will return pointer to an exit operation of component which is
39 * responsible for evaluation of the given property.
40 * More precisely, it will return operation at which the property is known
41 * to be evaluated. */
43};
44
45/* A helper structure which wraps all fields needed to find a node inside of
46 * the dependency graph. */
48 public:
50
51 /* Check whether this identifier is valid and usable. */
52 bool is_valid() const;
53
56 const char *component_name;
58 const char *operation_name;
60};
61
62/* Helper class which performs optimized lookups of a node within a given
63 * dependency graph which satisfies given RNA pointer or RNA path. */
65 public:
66 RNANodeQuery(Depsgraph *depsgraph, DepsgraphBuilder *builder);
68
69 Node *find_node(const PointerRNA *ptr, const PropertyRNA *prop, RNAPointerSource source);
70
71 protected:
74
75 /* Indexed by an ID, returns RNANodeQueryIDData associated with that ID. */
77
78 /* Construct identifier of the node which corresponds given configuration
79 * of RNA property. */
81 const PropertyRNA *prop,
82 RNAPointerSource source);
83
84 /* Make sure ID data exists for the given ID, and returns it. */
86
87 /* Check whether prop_identifier contains rna_path_component.
88 *
89 * This checks more than a sub-string:
90 *
91 * prop_identifier contains(prop_identifier, "location")
92 * ------------------------ -------------------------------------
93 * location true
94 * ["test_location"] false
95 * pose["bone"].location true
96 * pose["bone"].location.x true
97 */
98 static bool contains(const char *prop_identifier, const char *rna_path_component);
99};
100
101bool rna_prop_affects_parameters_node(const PointerRNA *ptr, const PropertyRNA *prop);
102
103} // namespace deg
104} // namespace blender
Node * find_node(const PointerRNA *ptr, const PropertyRNA *prop, RNAPointerSource source)
Map< const ID *, std::unique_ptr< RNANodeQueryIDData > > id_data_map_
RNANodeIdentifier construct_node_identifier(const PointerRNA *ptr, const PropertyRNA *prop, RNAPointerSource source)
static bool contains(const char *prop_identifier, const char *rna_path_component)
DepsgraphBuilder * builder_
RNANodeQuery(Depsgraph *depsgraph, DepsgraphBuilder *builder)
RNANodeQueryIDData * ensure_id_data(const ID *id)
bool rna_prop_affects_parameters_node(const PointerRNA *ptr, const PropertyRNA *prop)
BMesh Iterators.