Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_point_rotate.cc
| Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void point_rotate_on_component(GeometryComponent &component, | static void point_rotate_on_component(GeometryComponent &component, | ||||
| const GeoNodeExecParams ¶ms) | const GeoNodeExecParams ¶ms) | ||||
| { | { | ||||
| const bNode &node = params.node(); | const bNode &node = params.node(); | ||||
| const NodeGeometryRotatePoints &storage = *(const NodeGeometryRotatePoints *)node.storage; | const NodeGeometryRotatePoints &storage = *(const NodeGeometryRotatePoints *)node.storage; | ||||
| WriteAttributePtr rotation_attribute = component.attribute_try_ensure_for_write( | OutputAttributePtr rotation_attribute = component.attribute_try_get_for_output( | ||||
| "rotation", ATTR_DOMAIN_POINT, CD_PROP_FLOAT3); | "rotation", ATTR_DOMAIN_POINT, CD_PROP_FLOAT3); | ||||
| if (!rotation_attribute) { | if (!rotation_attribute) { | ||||
| return; | return; | ||||
| } | } | ||||
| MutableSpan<float3> rotations = rotation_attribute->get_span().typed<float3>(); | MutableSpan<float3> rotations = rotation_attribute->get_span<float3>(); | ||||
| const int domain_size = rotations.size(); | const int domain_size = rotations.size(); | ||||
| if (storage.type == GEO_NODE_POINT_ROTATE_TYPE_AXIS_ANGLE) { | if (storage.type == GEO_NODE_POINT_ROTATE_TYPE_AXIS_ANGLE) { | ||||
| Float3ReadAttribute axis = params.get_input_attribute<float3>( | Float3ReadAttribute axis = params.get_input_attribute<float3>( | ||||
| "Axis", component, ATTR_DOMAIN_POINT, {0, 0, 1}); | "Axis", component, ATTR_DOMAIN_POINT, {0, 0, 1}); | ||||
| FloatReadAttribute angles = params.get_input_attribute<float>( | FloatReadAttribute angles = params.get_input_attribute<float>( | ||||
| "Angle", component, ATTR_DOMAIN_POINT, 0); | "Angle", component, ATTR_DOMAIN_POINT, 0); | ||||
| Show All 11 Lines | else { | ||||
| if (storage.space == GEO_NODE_POINT_ROTATE_SPACE_OBJECT) { | if (storage.space == GEO_NODE_POINT_ROTATE_SPACE_OBJECT) { | ||||
| point_rotate__euler__object_space(domain_size, eulers, rotations); | point_rotate__euler__object_space(domain_size, eulers, rotations); | ||||
| } | } | ||||
| else { | else { | ||||
| point_rotate__euler__point_space(domain_size, eulers, rotations); | point_rotate__euler__point_space(domain_size, eulers, rotations); | ||||
| } | } | ||||
| } | } | ||||
| rotation_attribute->apply_span(); | rotation_attribute.apply_span_and_save(); | ||||
| } | } | ||||
| static void geo_node_point_rotate_exec(GeoNodeExecParams params) | static void geo_node_point_rotate_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>()) { | ||||
| point_rotate_on_component(geometry_set.get_component_for_write<MeshComponent>(), params); | point_rotate_on_component(geometry_set.get_component_for_write<MeshComponent>(), params); | ||||
| ▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines | |||||