diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-09-15 16:40:06 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-09-21 17:48:48 +0300 |
commit | f948ffaa9f6676839e5ec3c3da3570f9bb0cb33e (patch) | |
tree | 84a5ec9d757da67b78e15ca869b670853686c3b2 /source | |
parent | 78b7a1c3a8b982d0081c9071e5b1d90444f902b8 (diff) |
Refactor: Move depsgraph node keys to own file
They are not specific to the relations builder and could be
used outside of it.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/CMakeLists.txt | 3 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_key.cc (renamed from source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc) | 32 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_key.h | 145 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.h | 127 |
4 files changed, 171 insertions, 136 deletions
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index e799c5ce32a..a394ea4a54a 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -26,6 +26,8 @@ set(SRC intern/builder/deg_builder.cc intern/builder/deg_builder_cache.cc intern/builder/deg_builder_cycle.cc + intern/builder/deg_builder_key.cc + intern/builder/deg_builder_key.h intern/builder/deg_builder_map.cc intern/builder/deg_builder_nodes.cc intern/builder/deg_builder_nodes_rig.cc @@ -34,7 +36,6 @@ set(SRC intern/builder/deg_builder_pchanmap.cc intern/builder/deg_builder_relations.cc intern/builder/deg_builder_relations_drivers.cc - intern/builder/deg_builder_relations_keys.cc intern/builder/deg_builder_relations_rig.cc intern/builder/deg_builder_relations_scene.cc intern/builder/deg_builder_relations_view_layer.cc diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc b/source/blender/depsgraph/intern/builder/deg_builder_key.cc index 8506a97c408..741c415b5cd 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_key.cc @@ -7,20 +7,26 @@ * Methods for constructing depsgraph */ -#include "intern/builder/deg_builder_relations.h" +#include "intern/builder/deg_builder_key.h" + +#include "RNA_path.h" namespace blender::deg { -//////////////////////////////////////////////////////////////////////////////// -/* Time source. */ +/* -------------------------------------------------------------------- */ +/** \name Time source + * \{ */ string TimeSourceKey::identifier() const { return string("TimeSourceKey"); } -//////////////////////////////////////////////////////////////////////////////// -// Component. +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Component + * \{ */ string ComponentKey::identifier() const { @@ -35,8 +41,11 @@ string ComponentKey::identifier() const return result; } -//////////////////////////////////////////////////////////////////////////////// -// Operation. +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Operation + * \{ */ string OperationKey::identifier() const { @@ -51,8 +60,11 @@ string OperationKey::identifier() const return result; } -//////////////////////////////////////////////////////////////////////////////// -// RNA path. +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name RNA path + * \{ */ RNAPathKey::RNAPathKey(ID *id, const char *path, RNAPointerSource source) : id(id), source(source) { @@ -79,4 +91,6 @@ string RNAPathKey::identifier() const return string("RnaPathKey(") + "id: " + id_name + ", prop: '" + prop_name + "')"; } +/** \} */ + } // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_key.h b/source/blender/depsgraph/intern/builder/deg_builder_key.h new file mode 100644 index 00000000000..cbb0daa4fc9 --- /dev/null +++ b/source/blender/depsgraph/intern/builder/deg_builder_key.h @@ -0,0 +1,145 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2013 Blender Foundation. All rights reserved. */ + +/** \file + * \ingroup depsgraph + */ + +#pragma once + +#include "intern/builder/deg_builder_rna.h" +#include "intern/depsgraph_type.h" + +#include "DNA_ID.h" + +#include "RNA_access.h" +#include "RNA_types.h" + +struct ID; +struct PropertyRNA; + +namespace blender::deg { + +struct TimeSourceKey { + TimeSourceKey() = default; + + string identifier() const; +}; + +struct ComponentKey { + ComponentKey() = default; + + inline ComponentKey(const ID *id, NodeType type, const char *name = "") + : id(id), type(type), name(name) + { + } + + string identifier() const; + + const ID *id = nullptr; + NodeType type = NodeType::UNDEFINED; + const char *name = ""; +}; + +struct OperationKey { + OperationKey() = default; + + inline OperationKey(const ID *id, NodeType component_type, const char *name, int name_tag = -1) + : id(id), + component_type(component_type), + component_name(""), + opcode(OperationCode::OPERATION), + name(name), + name_tag(name_tag) + { + } + + OperationKey(const ID *id, + NodeType component_type, + const char *component_name, + const char *name, + int name_tag) + : id(id), + component_type(component_type), + component_name(component_name), + opcode(OperationCode::OPERATION), + name(name), + name_tag(name_tag) + { + } + + OperationKey(const ID *id, NodeType component_type, OperationCode opcode) + : id(id), + component_type(component_type), + component_name(""), + opcode(opcode), + name(""), + name_tag(-1) + { + } + + OperationKey(const ID *id, + NodeType component_type, + const char *component_name, + OperationCode opcode) + : id(id), + component_type(component_type), + component_name(component_name), + opcode(opcode), + name(""), + name_tag(-1) + { + } + + OperationKey(const ID *id, + NodeType component_type, + OperationCode opcode, + const char *name, + int name_tag = -1) + : id(id), + component_type(component_type), + component_name(""), + opcode(opcode), + name(name), + name_tag(name_tag) + { + } + + OperationKey(const ID *id, + NodeType component_type, + const char *component_name, + OperationCode opcode, + const char *name, + int name_tag = -1) + : id(id), + component_type(component_type), + component_name(component_name), + opcode(opcode), + name(name), + name_tag(name_tag) + { + } + + string identifier() const; + + const ID *id = nullptr; + NodeType component_type = NodeType::UNDEFINED; + const char *component_name = ""; + OperationCode opcode = OperationCode::OPERATION; + const char *name = ""; + int name_tag = -1; +}; + +struct RNAPathKey { + RNAPathKey(ID *id, const char *path, RNAPointerSource source); + RNAPathKey(ID *id, const PointerRNA &ptr, PropertyRNA *prop, RNAPointerSource source); + + string identifier() const; + + ID *id; + PointerRNA ptr; + PropertyRNA *prop; + RNAPointerSource source; +}; + +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 7d3a0fd9217..901e4a1acbb 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -14,14 +14,13 @@ #include "DNA_ID.h" -#include "RNA_access.h" #include "RNA_path.h" -#include "RNA_types.h" #include "BLI_string.h" #include "BLI_utildefines.h" #include "intern/builder/deg_builder.h" +#include "intern/builder/deg_builder_key.h" #include "intern/builder/deg_builder_map.h" #include "intern/builder/deg_builder_rna.h" #include "intern/builder/deg_builder_stack.h" @@ -69,8 +68,6 @@ struct bNodeTree; struct bPoseChannel; struct bSound; -struct PropertyRNA; - namespace blender::deg { struct ComponentNode; @@ -84,128 +81,6 @@ struct Relation; struct RootPChanMap; struct TimeSourceNode; -struct TimeSourceKey { - TimeSourceKey() = default; - - string identifier() const; -}; - -struct ComponentKey { - ComponentKey() = default; - - inline ComponentKey(const ID *id, NodeType type, const char *name = "") - : id(id), type(type), name(name) - { - } - - string identifier() const; - - const ID *id = nullptr; - NodeType type = NodeType::UNDEFINED; - const char *name = ""; -}; - -struct OperationKey { - OperationKey() = default; - - inline OperationKey(const ID *id, NodeType component_type, const char *name, int name_tag = -1) - : id(id), - component_type(component_type), - component_name(""), - opcode(OperationCode::OPERATION), - name(name), - name_tag(name_tag) - { - } - - OperationKey(const ID *id, - NodeType component_type, - const char *component_name, - const char *name, - int name_tag) - : id(id), - component_type(component_type), - component_name(component_name), - opcode(OperationCode::OPERATION), - name(name), - name_tag(name_tag) - { - } - - OperationKey(const ID *id, NodeType component_type, OperationCode opcode) - : id(id), - component_type(component_type), - component_name(""), - opcode(opcode), - name(""), - name_tag(-1) - { - } - - OperationKey(const ID *id, - NodeType component_type, - const char *component_name, - OperationCode opcode) - : id(id), - component_type(component_type), - component_name(component_name), - opcode(opcode), - name(""), - name_tag(-1) - { - } - - OperationKey(const ID *id, - NodeType component_type, - OperationCode opcode, - const char *name, - int name_tag = -1) - : id(id), - component_type(component_type), - component_name(""), - opcode(opcode), - name(name), - name_tag(name_tag) - { - } - - OperationKey(const ID *id, - NodeType component_type, - const char *component_name, - OperationCode opcode, - const char *name, - int name_tag = -1) - : id(id), - component_type(component_type), - component_name(component_name), - opcode(opcode), - name(name), - name_tag(name_tag) - { - } - - string identifier() const; - - const ID *id = nullptr; - NodeType component_type = NodeType::UNDEFINED; - const char *component_name = ""; - OperationCode opcode = OperationCode::OPERATION; - const char *name = ""; - int name_tag = -1; -}; - -struct RNAPathKey { - RNAPathKey(ID *id, const char *path, RNAPointerSource source); - RNAPathKey(ID *id, const PointerRNA &ptr, PropertyRNA *prop, RNAPointerSource source); - - string identifier() const; - - ID *id; - PointerRNA ptr; - PropertyRNA *prop; - RNAPointerSource source; -}; - class DepsgraphRelationBuilder : public DepsgraphBuilder { public: DepsgraphRelationBuilder(Main *bmain, Depsgraph *graph, DepsgraphBuilderCache *cache); |