diff options
author | Hans Goudey <h.goudey@me.com> | 2021-01-15 20:04:32 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-01-15 20:04:32 +0300 |
commit | 0b0e45252b11bbc1c0d96a3e04a4087d02f765e3 (patch) | |
tree | 63e8f90c56eed01c1d8c818af02c9984859575a0 /source/blender/nodes | |
parent | 3732508c64ad51c77a6fb83a2444af104d95cfd9 (diff) |
Geometry Nodes: Use a default value in the point scale node
This commit adds the ability to provide a default value to
`attribute_try_get_for_output` and uses it for the `Point Scale` node,
which is important because the node uses multiplication.
The idea is to keep "name-specific" functionality in nodes rather than in
the attribute API, otherwise the complexity will be hard to keep track of.
So this fix doesn't apply to the Attribute Vector Math node, but hopfully
that is okay since that's now a lower level node for this purpose anyway.
Differential Revision: https://developer.blender.org/D10115
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_point_scale.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc b/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc index e5cbe27768d..47fca93d2ab 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc @@ -34,8 +34,9 @@ namespace blender::nodes { static void execute_on_component(GeoNodeExecParams params, GeometryComponent &component) { + static const float3 scale_default = float3(1.0f); OutputAttributePtr scale_attribute = component.attribute_try_get_for_output( - "scale", ATTR_DOMAIN_POINT, CD_PROP_FLOAT3); + "scale", ATTR_DOMAIN_POINT, CD_PROP_FLOAT3, &scale_default); ReadAttributePtr attribute = params.get_input_attribute( "Factor", component, ATTR_DOMAIN_POINT, CD_PROP_FLOAT3, nullptr); if (!attribute) { |