Blender V5.0
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
18struct ID;
19struct PointerRNA;
20struct PropertyRNA;
21
22namespace blender::deg {
23
24struct Depsgraph;
25struct Node;
28
29/* For queries which gives operation node or key defines whether we are
30 * interested in a result of the given property or whether we are linking some
31 * dependency to that property. */
32enum class RNAPointerSource {
33 /* Query will return pointer to an entry operation of component which is
34 * responsible for evaluation of the given property. */
36 /* Query will return pointer to an exit operation of component which is
37 * responsible for evaluation of the given property.
38 * More precisely, it will return operation at which the property is known
39 * to be evaluated. */
41};
42
43/* A helper structure which wraps all fields needed to find a node inside of
44 * the dependency graph. */
46 public:
48
49 /* Check whether this identifier is valid and usable. */
50 bool is_valid() const;
51
54 const char *component_name;
56 const char *operation_name;
58};
59
60/* Helper class which performs optimized lookups of a node within a given
61 * dependency graph which satisfies given RNA pointer or RAN path. */
63 public:
66
67 Node *find_node(const PointerRNA *ptr, const PropertyRNA *prop, RNAPointerSource source);
68
69 protected:
72
73 /* Indexed by an ID, returns RNANodeQueryIDData associated with that ID. */
75
76 /* Construct identifier of the node which corresponds given configuration
77 * of RNA property. */
79 const PropertyRNA *prop,
80 RNAPointerSource source);
81
82 /* Make sure ID data exists for the given ID, and returns it. */
84
85 /* Check whether prop_identifier contains rna_path_component.
86 *
87 * This checks more than a sub-string:
88 *
89 * prop_identifier contains(prop_identifier, "location")
90 * ------------------------ -------------------------------------
91 * location true
92 * ["test_location"] false
93 * pose["bone"].location true
94 * pose["bone"].location.x true
95 */
96 static bool contains(const char *prop_identifier, const char *rna_path_component);
97};
98
100
101} // namespace blender::deg
BPy_StructRNA * depsgraph
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)
Definition DNA_ID.h:414
PointerRNA * ptr
Definition wm_files.cc:4238