Refactor: Move node tools OperatorComputeContext to blenkernel
For socket value logging this needs to be used in a couple other places. Also remove the operator name argument. For the forseable future this will only be used with the existing node tools operator anyway.
This commit is contained in:
@@ -123,4 +123,16 @@ class RepeatZoneComputeContext : public ComputeContext {
|
||||
void print_current_in_line(std::ostream &stream) const override;
|
||||
};
|
||||
|
||||
class OperatorComputeContext : public ComputeContext {
|
||||
private:
|
||||
static constexpr const char *s_static_type = "OPERATOR";
|
||||
|
||||
public:
|
||||
OperatorComputeContext();
|
||||
OperatorComputeContext(const ComputeContext *parent);
|
||||
|
||||
private:
|
||||
void print_current_in_line(std::ostream &stream) const override;
|
||||
};
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
@@ -117,4 +117,17 @@ void RepeatZoneComputeContext::print_current_in_line(std::ostream &stream) const
|
||||
stream << "Repeat Zone ID: " << output_node_id_;
|
||||
}
|
||||
|
||||
OperatorComputeContext::OperatorComputeContext() : OperatorComputeContext(nullptr) {}
|
||||
|
||||
OperatorComputeContext::OperatorComputeContext(const ComputeContext *parent)
|
||||
: ComputeContext(s_static_type, parent)
|
||||
{
|
||||
hash_.mix_in(s_static_type, strlen(s_static_type));
|
||||
}
|
||||
|
||||
void OperatorComputeContext::print_current_in_line(std::ostream &stream) const
|
||||
{
|
||||
stream << "Operator";
|
||||
}
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
@@ -113,27 +113,6 @@ static const bNodeTree *get_node_group(const bContext &C, PointerRNA &ptr, Repor
|
||||
return group;
|
||||
}
|
||||
|
||||
class OperatorComputeContext : public ComputeContext {
|
||||
private:
|
||||
static constexpr const char *s_static_type = "OPERATOR";
|
||||
|
||||
std::string operator_name_;
|
||||
|
||||
public:
|
||||
OperatorComputeContext(std::string operator_name)
|
||||
: ComputeContext(s_static_type, nullptr), operator_name_(std::move(operator_name))
|
||||
{
|
||||
hash_.mix_in(s_static_type, strlen(s_static_type));
|
||||
hash_.mix_in(operator_name_.data(), operator_name_.size());
|
||||
}
|
||||
|
||||
private:
|
||||
void print_current_in_line(std::ostream &stream) const override
|
||||
{
|
||||
stream << "Operator: " << operator_name_;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Geometry nodes currently requires working on "evaluated" data-blocks (rather than "original"
|
||||
* data-blocks that are part of a #Main data-base). This could change in the future, but for now,
|
||||
@@ -405,7 +384,7 @@ static int run_node_group_exec(bContext *C, wmOperator *op)
|
||||
IDProperty *properties = replace_inputs_evaluated_data_blocks(*op->properties, *depsgraph);
|
||||
BLI_SCOPED_DEFER([&]() { IDP_FreeProperty_ex(properties, false); });
|
||||
|
||||
OperatorComputeContext compute_context(op->type->idname);
|
||||
bke::OperatorComputeContext compute_context;
|
||||
auto eval_log = std::make_unique<geo_log::GeoModifierLog>();
|
||||
|
||||
for (Object *object : objects) {
|
||||
|
||||
Reference in New Issue
Block a user