Blender  V2.93
deg_builder_relations_drivers.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2013 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "BLI_string_ref.hh"
27 
28 #include "RNA_types.h"
29 
31 
32 struct FCurve;
33 
34 namespace blender {
35 namespace deg {
36 
37 /* Helper class for determining which relations are needed between driver evaluation nodes. */
39  public:
40  /* Drivers are grouped by their RNA prefix. The prefix is the part of the RNA
41  * path up to the last dot, the suffix is the remainder of the RNA path:
42  *
43  * fcu->rna_path rna_prefix rna_suffix
44  * ------------------------------- ---------------------- ----------
45  * 'color' '' 'color'
46  * 'rigidbody_world.time_scale' 'rigidbody_world' 'time_scale'
47  * 'pose.bones["master"].location' 'pose.bones["master"]' 'location'
48  */
51 
52  public:
53  DriverDescriptor(PointerRNA *id_ptr, FCurve *fcu);
54 
55  bool driver_relations_needed() const;
56  bool is_array() const;
57  /* Assumes that 'other' comes from the same RNA group, that is, has the same RNA path prefix. */
58  bool is_same_array_as(const DriverDescriptor &other) const;
60 
61  private:
62  PointerRNA *id_ptr_;
63  FCurve *fcu_;
64  bool driver_relations_needed_;
65 
66  PointerRNA pointer_rna_;
67  PropertyRNA *property_rna_;
68  bool is_array_;
69 
70  bool determine_relations_needed();
71  void split_rna_path();
72  bool resolve_rna();
73 };
74 
75 } // namespace deg
76 } // namespace blender
DriverDescriptor(PointerRNA *id_ptr, FCurve *fcu)
bool is_same_array_as(const DriverDescriptor &other) const