Blender  V3.3
deg_builder_rna.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2019 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "intern/node/deg_node.h"
12 
13 struct ID;
14 struct PointerRNA;
15 struct PropertyRNA;
16 
17 namespace blender::deg {
18 
19 struct Depsgraph;
20 struct Node;
21 class RNANodeQueryIDData;
22 class DepsgraphBuilder;
23 
24 /* For queries which gives operation node or key defines whether we are
25  * interested in a result of the given property or whether we are linking some
26  * dependency to that property. */
27 enum class RNAPointerSource {
28  /* Query will return pointer to an entry operation of component which is
29  * responsible for evaluation of the given property. */
30  ENTRY,
31  /* Query will return pointer to an exit operation of component which is
32  * responsible for evaluation of the given property.
33  * More precisely, it will return operation at which the property is known
34  * to be evaluated. */
35  EXIT,
36 };
37 
38 /* A helper structure which wraps all fields needed to find a node inside of
39  * the dependency graph. */
41  public:
43 
44  /* Check whether this identifier is valid and usable. */
45  bool is_valid() const;
46 
47  ID *id;
49  const char *component_name;
51  const char *operation_name;
53 };
54 
55 /* Helper class which performs optimized lookups of a node within a given
56  * dependency graph which satisfies given RNA pointer or RAN path. */
57 class RNANodeQuery {
58  public:
61 
62  Node *find_node(const PointerRNA *ptr, const PropertyRNA *prop, RNAPointerSource source);
63 
64  protected:
67 
68  /* Indexed by an ID, returns RNANodeQueryIDData associated with that ID. */
70 
71  /* Construct identifier of the node which corresponds given configuration
72  * of RNA property. */
74  const PropertyRNA *prop,
75  RNAPointerSource source);
76 
77  /* Make sure ID data exists for the given ID, and returns it. */
79 
80  /* Check whether prop_identifier contains rna_path_component.
81  *
82  * This checks more than a sub-string:
83  *
84  * prop_identifier contains(prop_identifier, "location")
85  * ------------------------ -------------------------------------
86  * location true
87  * ["test_location"] false
88  * pose["bone"].location true
89  * pose["bone"].location.x true
90  */
91  static bool contains(const char *prop_identifier, const char *rna_path_component);
92 };
93 
95 
96 } // namespace blender::deg
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
Node * find_node(const PointerRNA *ptr, const PropertyRNA *prop, RNAPointerSource source)
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)
Map< const ID *, unique_ptr< RNANodeQueryIDData > > id_data_map_
const Depsgraph * depsgraph
bool rna_prop_affects_parameters_node(const PointerRNA *ptr, const PropertyRNA *prop)
Definition: DNA_ID.h:368
PointerRNA * ptr
Definition: wm_files.c:3480