Commit: eddc3f5bc8473a4914476dc3ff3ee9091bb42b9a
Author: Hans Goudey
Date: Tue Sep 28 23:19:33 2021 -0500
Branches: master
https://developer.blender.org/rBeddc3f5bc8473a4914476dc3ff3ee9091bb42b9a
Cleanup: Add constructor for AttributeFieldInput
===================================================================
M source/blender/blenkernel/BKE_geometry_set.hh
M source/blender/modifiers/intern/MOD_nodes_evaluator.cc
M source/blender/nodes/geometry/nodes/node_geo_input_position.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh
b/source/blender/blenkernel/BKE_geometry_set.hh
index 724ca224cab..f182fb527e1 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -722,6 +722,13 @@ class AttributeFieldInput : public fn::FieldInput {
{
}
+ template<typename T> static fn::Field<T> Create(std::string name)
+ {
+ const CPPType &type = CPPType::get<T>();
+ auto field_input = std::make_shared<AttributeFieldInput>(std::move(name),
type);
+ return fn::Field<T>{field_input};
+ }
+
StringRefNull attribute_name() const
{
return name_;
diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
index 592e6180f80..c5213dc304b 100644
--- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
+++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc
@@ -334,8 +334,7 @@ static void get_socket_value(const SocketRef &socket, void
*r_value)
SH_NODE_TEX_NOISE,
GEO_NODE_MESH_TO_POINTS,
GEO_NODE_PROXIMITY)) {
- new (r_value) Field<float3>(
- std::make_shared<bke::AttributeFieldInput>("position",
CPPType::get<float3>()));
+ new (r_value)
Field<float3>(bke::AttributeFieldInput::Create<float3>("position"));
return;
}
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_position.cc
b/source/blender/nodes/geometry/nodes/node_geo_input_position.cc
index f439fb32d31..44874259e20 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_position.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_position.cc
@@ -25,8 +25,7 @@ static void
geo_node_input_position_declare(NodeDeclarationBuilder &b)
static void geo_node_input_position_exec(GeoNodeExecParams params)
{
- Field<float3> position_field{
- std::make_shared<AttributeFieldInput>("position",
CPPType::get<float3>())};
+ Field<float3>
position_field{AttributeFieldInput::Create<float3>("position")};
params.set_output("Position", std::move(position_field));
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs