diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_compute_contexts.hh (renamed from source/blender/blenkernel/BKE_context_stack.hh) | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/compute_contexts.cc | 38 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/context_stack.cc | 40 |
4 files changed, 49 insertions, 50 deletions
diff --git a/source/blender/blenkernel/BKE_context_stack.hh b/source/blender/blenkernel/BKE_compute_contexts.hh index 1415a5e21b7..bb01aee788e 100644 --- a/source/blender/blenkernel/BKE_context_stack.hh +++ b/source/blender/blenkernel/BKE_compute_contexts.hh @@ -2,34 +2,35 @@ #pragma once -#include "BLI_context_stack.hh" +/** + * This file implements some specific compute contexts for concepts in Blender. + */ + +#include "BLI_compute_context.hh" namespace blender::bke { -class ModifierContextStack : public ContextStack { +class ModifierComputeContext : public ComputeContext { private: static constexpr const char *s_static_type = "MODIFIER"; std::string modifier_name_; public: - ModifierContextStack(const ContextStack *parent, std::string modifier_name); + ModifierComputeContext(const ComputeContext *parent, std::string modifier_name); private: void print_current_in_line(std::ostream &stream) const override; }; -class NodeGroupContextStack : public ContextStack { +class NodeGroupComputeContext : public ComputeContext { private: static constexpr const char *s_static_type = "NODE_GROUP"; std::string node_name_; - std::string debug_group_name_; public: - NodeGroupContextStack(const ContextStack *parent, - std::string node_name, - std::string debug_group_name = "<unknown>"); + NodeGroupComputeContext(const ComputeContext *parent, std::string node_name); StringRefNull node_name() const; diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 228902f5d02..f8fb609f1c3 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -98,9 +98,9 @@ set(SRC intern/collision.c intern/colorband.c intern/colortools.c + intern/compute_contexts.cc intern/constraint.c intern/context.c - intern/context_stack.cc intern/crazyspace.cc intern/cryptomatte.cc intern/curve.cc @@ -353,9 +353,9 @@ set(SRC BKE_collision.h BKE_colorband.h BKE_colortools.h + BKE_compute_contexts.hh BKE_constraint.h BKE_context.h - BKE_context_stack.hh BKE_crazyspace.h BKE_crazyspace.hh BKE_cryptomatte.h diff --git a/source/blender/blenkernel/intern/compute_contexts.cc b/source/blender/blenkernel/intern/compute_contexts.cc new file mode 100644 index 00000000000..026706d363e --- /dev/null +++ b/source/blender/blenkernel/intern/compute_contexts.cc @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "BKE_compute_contexts.hh" + +namespace blender::bke { + +ModifierComputeContext::ModifierComputeContext(const ComputeContext *parent, + std::string modifier_name) + : ComputeContext(s_static_type, parent), modifier_name_(std::move(modifier_name)) +{ + hash_.mix_in(s_static_type, strlen(s_static_type)); + hash_.mix_in(modifier_name_.data(), modifier_name_.size()); +} + +void ModifierComputeContext::print_current_in_line(std::ostream &stream) const +{ + stream << "Modifier: " << modifier_name_; +} + +NodeGroupComputeContext::NodeGroupComputeContext(const ComputeContext *parent, + std::string node_name) + : ComputeContext(s_static_type, parent), node_name_(std::move(node_name)) +{ + hash_.mix_in(s_static_type, strlen(s_static_type)); + hash_.mix_in(node_name_.data(), node_name_.size()); +} + +StringRefNull NodeGroupComputeContext::node_name() const +{ + return node_name_; +} + +void NodeGroupComputeContext::print_current_in_line(std::ostream &stream) const +{ + stream << "Node: " << node_name_; +} + +} // namespace blender::bke diff --git a/source/blender/blenkernel/intern/context_stack.cc b/source/blender/blenkernel/intern/context_stack.cc deleted file mode 100644 index 3e45bebb52a..00000000000 --- a/source/blender/blenkernel/intern/context_stack.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -#include "BKE_context_stack.hh" - -namespace blender::bke { - -ModifierContextStack::ModifierContextStack(const ContextStack *parent, std::string modifier_name) - : ContextStack(s_static_type, parent), modifier_name_(std::move(modifier_name)) -{ - hash_.mix_in(s_static_type, strlen(s_static_type)); - hash_.mix_in(modifier_name_.data(), modifier_name_.size()); -} - -void ModifierContextStack::print_current_in_line(std::ostream &stream) const -{ - stream << "Modifier: " << modifier_name_; -} - -NodeGroupContextStack::NodeGroupContextStack(const ContextStack *parent, - std::string node_name, - std::string debug_group_name) - : ContextStack(s_static_type, parent), - node_name_(std::move(node_name)), - debug_group_name_(std::move(debug_group_name)) -{ - hash_.mix_in(s_static_type, strlen(s_static_type)); - hash_.mix_in(node_name_.data(), node_name_.size()); -} - -StringRefNull NodeGroupContextStack::node_name() const -{ - return node_name_; -} - -void NodeGroupContextStack::print_current_in_line(std::ostream &stream) const -{ - stream << "Node Group: " << debug_group_name_ << " \t Node Name: " << node_name_; -} - -} // namespace blender::bke |