Differential D10109 Diff 32776 source/blender/nodes/geometry/nodes/node_geo_attribute_vector_math.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_attribute_vector_math.cc
| Show First 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | if (use_input_c) { | ||||
| attribute_c = params.get_input_attribute("C", component, result_domain, read_type_c, nullptr); | attribute_c = params.get_input_attribute("C", component, result_domain, read_type_c, nullptr); | ||||
| if (!attribute_c) { | if (!attribute_c) { | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| /* Get result attribute first, in case it has to overwrite one of the existing attributes. */ | /* Get result attribute first, in case it has to overwrite one of the existing attributes. */ | ||||
| const std::string result_name = params.get_input<std::string>("Result"); | const std::string result_name = params.get_input<std::string>("Result"); | ||||
| WriteAttributePtr attribute_result = component.attribute_try_ensure_for_write( | OutputAttributePtr attribute_result = component.attribute_try_get_for_output( | ||||
| result_name, result_domain, result_type); | result_name, result_domain, result_type); | ||||
| if (!attribute_result) { | if (!attribute_result) { | ||||
| return; | return; | ||||
| } | } | ||||
| switch (operation) { | switch (operation) { | ||||
| case NODE_VECTOR_MATH_ADD: | case NODE_VECTOR_MATH_ADD: | ||||
| case NODE_VECTOR_MATH_SUBTRACT: | case NODE_VECTOR_MATH_SUBTRACT: | ||||
| Show All 28 Lines | switch (operation) { | ||||
| case NODE_VECTOR_MATH_TANGENT: | case NODE_VECTOR_MATH_TANGENT: | ||||
| do_math_operation_fl3_to_fl3(*attribute_a, *attribute_result, operation); | do_math_operation_fl3_to_fl3(*attribute_a, *attribute_result, operation); | ||||
| break; | break; | ||||
| case NODE_VECTOR_MATH_WRAP: | case NODE_VECTOR_MATH_WRAP: | ||||
| do_math_operation_fl3_fl3_fl3_to_fl3( | do_math_operation_fl3_fl3_fl3_to_fl3( | ||||
| *attribute_a, *attribute_b, *attribute_c, *attribute_result, operation); | *attribute_a, *attribute_b, *attribute_c, *attribute_result, operation); | ||||
| break; | break; | ||||
| } | } | ||||
| attribute_result.save(); | |||||
| } | } | ||||
| static void geo_node_attribute_vector_math_exec(GeoNodeExecParams params) | static void geo_node_attribute_vector_math_exec(GeoNodeExecParams params) | ||||
| { | { | ||||
| GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); | GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); | ||||
| if (geometry_set.has<MeshComponent>()) { | if (geometry_set.has<MeshComponent>()) { | ||||
| attribute_vector_math_calc(geometry_set.get_component_for_write<MeshComponent>(), params); | attribute_vector_math_calc(geometry_set.get_component_for_write<MeshComponent>(), params); | ||||
| Show All 26 Lines | |||||