Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_point_scale.cc
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | GVArrayPtr attribute = params.get_input_attribute( | ||||
| "Factor", component, ATTR_DOMAIN_POINT, data_type, nullptr); | "Factor", component, ATTR_DOMAIN_POINT, data_type, nullptr); | ||||
| if (!attribute) { | if (!attribute) { | ||||
| return; | return; | ||||
| } | } | ||||
| MutableSpan<float3> scale_span = scale_attribute.as_span(); | MutableSpan<float3> scale_span = scale_attribute.as_span(); | ||||
| if (data_type == CD_PROP_FLOAT) { | if (data_type == CD_PROP_FLOAT) { | ||||
| GVArray_Typed<float> factors{*attribute}; | GVArray_Typed<float> factors{*attribute}; | ||||
| for (const int i : scale_span.index_range()) { | for (const int i : iter_indices(scale_span)) { | ||||
| scale_span[i] = scale_span[i] * factors[i]; | scale_span[i] = scale_span[i] * factors[i]; | ||||
| } | } | ||||
| } | } | ||||
| else if (data_type == CD_PROP_FLOAT3) { | else if (data_type == CD_PROP_FLOAT3) { | ||||
| GVArray_Typed<float3> factors{*attribute}; | GVArray_Typed<float3> factors{*attribute}; | ||||
| for (const int i : scale_span.index_range()) { | for (const int i : iter_indices(scale_span)) { | ||||
| scale_span[i] = scale_span[i] * factors[i]; | scale_span[i] = scale_span[i] * factors[i]; | ||||
| } | } | ||||
| } | } | ||||
| scale_attribute.save(); | scale_attribute.save(); | ||||
| } | } | ||||
| static void geo_node_point_scale_exec(GeoNodeExecParams params) | static void geo_node_point_scale_exec(GeoNodeExecParams params) | ||||
| ▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines | |||||