[Bf-blender-cvs] [a4d4188c8d3] temp-geometry-nodes-fields: rename field related classes
Jacques Lucke
noreply at git.blender.org
Fri Sep 3 16:13:48 CEST 2021
Commit: a4d4188c8d32a8c011db85300b5e195ab62ac013
Author: Jacques Lucke
Date: Fri Sep 3 16:12:47 2021 +0200
Branches: temp-geometry-nodes-fields
https://developer.blender.org/rBa4d4188c8d32a8c011db85300b5e195ab62ac013
rename field related classes
===================================================================
M source/blender/blenkernel/BKE_geometry_set.hh
M source/blender/blenkernel/intern/attribute_access.cc
M source/blender/functions/FN_field.hh
M source/blender/functions/intern/field.cc
M source/blender/functions/tests/FN_field_test.cc
M source/blender/modifiers/intern/MOD_nodes_evaluator.cc
M source/blender/nodes/NOD_geometry_exec.hh
M source/blender/nodes/geometry/nodes/node_geo_attribute_freeze.cc
M source/blender/nodes/geometry/nodes/node_geo_index.cc
M source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
M source/blender/nodes/geometry/nodes/node_geo_position.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index c1ce0563769..cd77d1570b9 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -608,13 +608,13 @@ class GeometryComponentFieldContext : public fn::FieldContext {
}
};
-class AttributeContextFieldSource : public fn::ContextFieldSource {
+class AttributeFieldInput : public fn::FieldInput {
private:
std::string name_;
public:
- AttributeContextFieldSource(std::string name, const CPPType &type)
- : fn::ContextFieldSource(type, name), name_(std::move(name))
+ AttributeFieldInput(std::string name, const CPPType &type)
+ : fn::FieldInput(type, name), name_(std::move(name))
{
}
@@ -623,18 +623,16 @@ class AttributeContextFieldSource : public fn::ContextFieldSource {
ResourceScope &scope) const override;
uint64_t hash() const override;
- bool is_equal_to(const fn::FieldSource &other) const override;
+ bool is_equal_to(const fn::FieldNode &other) const override;
};
-class AnonymousAttributeContextFieldSource : public fn::ContextFieldSource {
+class AnonymousAttributeFieldInput : public fn::FieldInput {
private:
StrongAnonymousAttributeID anonymous_id_;
public:
- AnonymousAttributeContextFieldSource(StrongAnonymousAttributeID anonymous_id,
- const CPPType &type)
- : fn::ContextFieldSource(type, anonymous_id.debug_name()),
- anonymous_id_(std::move(anonymous_id))
+ AnonymousAttributeFieldInput(StrongAnonymousAttributeID anonymous_id, const CPPType &type)
+ : fn::FieldInput(type, anonymous_id.debug_name()), anonymous_id_(std::move(anonymous_id))
{
}
@@ -643,7 +641,7 @@ class AnonymousAttributeContextFieldSource : public fn::ContextFieldSource {
ResourceScope &scope) const override;
uint64_t hash() const override;
- bool is_equal_to(const fn::FieldSource &other) const override;
+ bool is_equal_to(const fn::FieldNode &other) const override;
};
} // namespace blender::bke
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index e6c50417153..16624320c71 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -1303,8 +1303,9 @@ blender::bke::OutputAttribute GeometryComponent::attribute_try_get_for_output_on
namespace blender::bke {
-const GVArray *AttributeContextFieldSource::try_get_varray_for_context(
- const fn::FieldContext &context, IndexMask UNUSED(mask), ResourceScope &scope) const
+const GVArray *AttributeFieldInput::try_get_varray_for_context(const fn::FieldContext &context,
+ IndexMask UNUSED(mask),
+ ResourceScope &scope) const
{
if (const GeometryComponentFieldContext *geometry_context =
dynamic_cast<const GeometryComponentFieldContext *>(&context)) {
@@ -1317,21 +1318,20 @@ const GVArray *AttributeContextFieldSource::try_get_varray_for_context(
return nullptr;
}
-uint64_t AttributeContextFieldSource::hash() const
+uint64_t AttributeFieldInput::hash() const
{
return get_default_hash_2(name_, type_);
}
-bool AttributeContextFieldSource::is_equal_to(const fn::FieldSource &other) const
+bool AttributeFieldInput::is_equal_to(const fn::FieldNode &other) const
{
- if (const AttributeContextFieldSource *other_typed =
- dynamic_cast<const AttributeContextFieldSource *>(&other)) {
+ if (const AttributeFieldInput *other_typed = dynamic_cast<const AttributeFieldInput *>(&other)) {
return name_ == other_typed->name_ && type_ == other_typed->type_;
}
return false;
}
-const GVArray *AnonymousAttributeContextFieldSource::try_get_varray_for_context(
+const GVArray *AnonymousAttributeFieldInput::try_get_varray_for_context(
const fn::FieldContext &context, IndexMask UNUSED(mask), ResourceScope &scope) const
{
if (const GeometryComponentFieldContext *geometry_context =
@@ -1346,15 +1346,15 @@ const GVArray *AnonymousAttributeContextFieldSource::try_get_varray_for_context(
return nullptr;
}
-uint64_t AnonymousAttributeContextFieldSource::hash() const
+uint64_t AnonymousAttributeFieldInput::hash() const
{
return get_default_hash_2(anonymous_id_.get(), type_);
}
-bool AnonymousAttributeContextFieldSource::is_equal_to(const fn::FieldSource &other) const
+bool AnonymousAttributeFieldInput::is_equal_to(const fn::FieldNode &other) const
{
- if (const AnonymousAttributeContextFieldSource *other_typed =
- dynamic_cast<const AnonymousAttributeContextFieldSource *>(&other)) {
+ if (const AnonymousAttributeFieldInput *other_typed =
+ dynamic_cast<const AnonymousAttributeFieldInput *>(&other)) {
return anonymous_id_.get() == other_typed->anonymous_id_.get() && type_ == other_typed->type_;
}
return false;
diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh
index 482fdab0600..34ff83fe2b9 100644
--- a/source/blender/functions/FN_field.hh
+++ b/source/blender/functions/FN_field.hh
@@ -41,18 +41,18 @@
namespace blender::fn {
-class FieldSource {
+class FieldNode {
public:
- ~FieldSource() = default;
+ ~FieldNode() = default;
virtual const CPPType &cpp_type_of_output_index(int output_index) const = 0;
- virtual bool is_context_source() const
+ virtual bool is_input_node() const
{
return false;
}
- virtual bool is_operation_source() const
+ virtual bool is_operation_node() const
{
return false;
}
@@ -62,25 +62,25 @@ class FieldSource {
return get_default_hash(this);
}
- friend bool operator==(const FieldSource &a, const FieldSource &b)
+ friend bool operator==(const FieldNode &a, const FieldNode &b)
{
return a.is_equal_to(b);
}
- virtual bool is_equal_to(const FieldSource &other) const
+ virtual bool is_equal_to(const FieldNode &other) const
{
return this == &other;
}
};
/** Common base class for fields to avoid declaring the same methods for #GField and #GFieldRef. */
-template<typename SourcePtr> class GFieldBase {
+template<typename NodePtr> class GFieldBase {
protected:
- SourcePtr source_ = nullptr;
- int source_output_index_ = 0;
+ NodePtr node_ = nullptr;
+ int node_output_index_ = 0;
- GFieldBase(SourcePtr source, const int source_output_index)
- : source_(std::move(source)), source_output_index_(source_output_index)
+ GFieldBase(NodePtr node, const int node_output_index)
+ : node_(std::move(node)), node_output_index_(node_output_index)
{
}
@@ -89,42 +89,42 @@ template<typename SourcePtr> class GFieldBase {
operator bool() const
{
- return source_ != nullptr;
+ return node_ != nullptr;
}
friend bool operator==(const GFieldBase &a, const GFieldBase &b)
{
- return &*a.source_ == &*b.source_ && a.source_output_index_ == b.source_output_index_;
+ return &*a.node_ == &*b.node_ && a.node_output_index_ == b.node_output_index_;
}
uint64_t hash() const
{
- return get_default_hash_2(source_, source_output_index_);
+ return get_default_hash_2(node_, node_output_index_);
}
const fn::CPPType &cpp_type() const
{
- return source_->cpp_type_of_output_index(source_output_index_);
+ return node_->cpp_type_of_output_index(node_output_index_);
}
- bool has_context_source() const
+ bool has_context_node() const
{
- return source_->is_context_source();
+ return node_->is_input_node();
}
- bool has_operation_source() const
+ bool has_operation_node() const
{
- return source_->is_operation_source();
+ return node_->is_operation_node();
}
- const FieldSource &source() const
+ const FieldNode &node() const
{
- return *source_;
+ return *node_;
}
- int source_output_index() const
+ int node_output_index() const
{
- return source_output_index_;
+ return node_output_index_;
}
};
@@ -132,12 +132,12 @@ template<typename SourcePtr> class GFieldBase {
* Describes the output of a function. Generally corresponds to the combination of an output socket
* and link combination in a node graph.
*/
-class GField : public GFieldBase<std::shared_ptr<FieldSource>> {
+class GField : public GFieldBase<std::shared_ptr<FieldNode>> {
public:
GField() = default;
- GField(std::shared_ptr<FieldSource> source, const int source_output_index = 0)
- : GFieldBase<std::shared_ptr<FieldSource>>(std::move(source), source_output_index)
+ GField(std::shared_ptr<FieldNode> node, const int node_output_index = 0)
+ : GFieldBase<std::shared_ptr<FieldNode>>(std::move(node), node_output_index)
{
}
};
@@ -145,17 +145,17 @@ class GField : public GFieldBase<std::shared_ptr<FieldSource>> {
/** Same as #GField but is cheaper to copy/move around, because it does not contain a
* #std::shared_ptr.
*/
-class GFieldRef : public GFieldBase<const FieldSource *> {
+class GFieldRef : public GFieldBase<const FieldNode *> {
public:
GFieldRef() = default;
GFieldRef(const GField &field)
- : GFieldBase<const FieldSource *>(&field.source(), field.source_output_index())
+ : GFieldBase<const FieldNode *>(&field.node(), field.node_output_index())
{
}
- GFieldRef(const FieldSource &source, const int source_output_index = 0)
- : GFieldBase<const FieldSource *>(&source, source_output_index)
+ GFieldRef(const FieldNode &node, const int node_output_index = 0)
+ : GFieldBase<const FieldNode *>(&node, node_output_index)
{
}
};
@@ -169,26 +169,26 @@ template<typename T> class Field : public GField {
BLI_assert(this->cpp_type().template is<T>());
}
- Field(std::shared_ptr<FieldSource> source, const int source_output_index = 0)
- : Field(GField(std::move(source), source_output_index))
+ Field(std::shared_ptr<FieldNode> node, const int node_output_index = 0)
+ : Field(GField(std::move(node), node_output_index))
{
}
};
-class O
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list