Differential D13571 Diff 46024 source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_set_spline_resolution.cc
| Show All 32 Lines | static void set_resolution_in_component(GeometryComponent &component, | ||||
| const Field<int> &resolution_field) | const Field<int> &resolution_field) | ||||
| { | { | ||||
| GeometryComponentFieldContext field_context{component, ATTR_DOMAIN_CURVE}; | GeometryComponentFieldContext field_context{component, ATTR_DOMAIN_CURVE}; | ||||
| const int domain_size = component.attribute_domain_size(ATTR_DOMAIN_CURVE); | const int domain_size = component.attribute_domain_size(ATTR_DOMAIN_CURVE); | ||||
| if (domain_size == 0) { | if (domain_size == 0) { | ||||
| return; | return; | ||||
| } | } | ||||
| fn::FieldEvaluator selection_evaluator{field_context, domain_size}; | |||||
| selection_evaluator.add(selection_field); | |||||
| selection_evaluator.evaluate(); | |||||
| const IndexMask selection = selection_evaluator.get_evaluated_as_mask(0); | |||||
| OutputAttribute_Typed<int> resolutions = component.attribute_try_get_for_output_only<int>( | OutputAttribute_Typed<int> resolutions = component.attribute_try_get_for_output_only<int>( | ||||
| "resolution", ATTR_DOMAIN_CURVE); | "resolution", ATTR_DOMAIN_CURVE); | ||||
| fn::FieldEvaluator resolution_evaluator{field_context, &selection}; | |||||
| resolution_evaluator.add_with_destination(resolution_field, resolutions.varray()); | fn::FieldEvaluator evaluator{field_context, domain_size}; | ||||
| resolution_evaluator.evaluate(); | evaluator.set_selection(selection_field); | ||||
| evaluator.add_with_destination(resolution_field, resolutions.varray()); | |||||
| evaluator.evaluate(); | |||||
| resolutions.save(); | resolutions.save(); | ||||
| } | } | ||||
| static void node_geo_exec(GeoNodeExecParams params) | static void node_geo_exec(GeoNodeExecParams params) | ||||
| { | { | ||||
| GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); | GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); | ||||
| Field<bool> selection_field = params.extract_input<Field<bool>>("Selection"); | Field<bool> selection_field = params.extract_input<Field<bool>>("Selection"); | ||||
| Field<int> resolution_field = params.extract_input<Field<int>>("Resolution"); | Field<int> resolution_field = params.extract_input<Field<int>>("Resolution"); | ||||
| Show All 39 Lines | |||||