Cleanup: Add constructor for AttributeFieldInput
This commit is contained in:
parent
756c22bb41
commit
eddc3f5bc8
|
@ -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_;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue