diff options
author | Jacques Lucke <jacques@blender.org> | 2022-05-30 13:54:07 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-05-30 13:54:07 +0300 |
commit | bb0fc675822f313c5546a2498a162472c2571ecb (patch) | |
tree | 2f4a7941a1a32d24260d3add53e92103506a8593 /source/blender/blenkernel/BKE_node_runtime.hh | |
parent | 2f77b2daaccfa00866f049e4c2fc1cdee41e8ae1 (diff) |
Nodes: add separately allocated run-time data for bNodeTree
`bNodeTree` has a lot of run-time embedded in it currently. Having a separately
allocated run-time struct has some benefits:
* Run-time data is not stored in files.
* Makes it easy to use c++ types as run-time data.
* More clear distinction between what data only exists at run-time and which doesn't.
This commit doesn't move all run-time data to the new struct yet, only the data where
I know for sure how it is used. The remaining data can be moved separately.
Differential Revision: https://developer.blender.org/D15033
Diffstat (limited to 'source/blender/blenkernel/BKE_node_runtime.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_node_runtime.hh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh new file mode 100644 index 00000000000..c9c4577a2d4 --- /dev/null +++ b/source/blender/blenkernel/BKE_node_runtime.hh @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#include <memory> + +#include "BLI_sys_types.h" +#include "BLI_utility_mixins.hh" + +namespace blender::nodes { +struct FieldInferencingInterface; +} + +namespace blender::bke { + +class bNodeTreeRuntime : NonCopyable, NonMovable { + public: + /** + * Keeps track of what changed in the node tree until the next update. + * Should not be changed directly, instead use the functions in `BKE_node_tree_update.h`. + * #eNodeTreeChangedFlag. + */ + uint32_t changed_flag = 0; + /** + * A hash of the topology of the node tree leading up to the outputs. This is used to determine + * of the node tree changed in a way that requires updating geometry nodes or shaders. + */ + uint32_t output_topology_hash = 0; + + /** + * Used to cache run-time information of the node tree. + * #eNodeTreeRuntimeFlag. + */ + uint8_t runtime_flag = 0; + + /** Information about how inputs and outputs of the node group interact with fields. */ + std::unique_ptr<nodes::FieldInferencingInterface> field_inferencing_interface; +}; + +} // namespace blender::bke |