Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_transform.cc
| Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | void transform_mesh(Mesh &mesh, | ||||
| const float4x4 matrix = float4x4::from_loc_eul_scale(translation, rotation, scale); | const float4x4 matrix = float4x4::from_loc_eul_scale(translation, rotation, scale); | ||||
| transform_mesh(mesh, matrix); | transform_mesh(mesh, matrix); | ||||
| } | } | ||||
| } // namespace blender::nodes | } // namespace blender::nodes | ||||
| namespace blender::nodes::node_geo_transform_cc { | namespace blender::nodes::node_geo_transform_cc { | ||||
| static void geo_node_transform_declare(NodeDeclarationBuilder &b) | static void node_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Geometry>(N_("Geometry")); | b.add_input<decl::Geometry>(N_("Geometry")); | ||||
| b.add_input<decl::Vector>(N_("Translation")).subtype(PROP_TRANSLATION); | b.add_input<decl::Vector>(N_("Translation")).subtype(PROP_TRANSLATION); | ||||
| b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER); | b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER); | ||||
| b.add_input<decl::Vector>(N_("Scale")).default_value({1, 1, 1}).subtype(PROP_XYZ); | b.add_input<decl::Vector>(N_("Scale")).default_value({1, 1, 1}).subtype(PROP_XYZ); | ||||
| b.add_output<decl::Geometry>(N_("Geometry")); | b.add_output<decl::Geometry>(N_("Geometry")); | ||||
| } | } | ||||
| static void geo_node_transform_exec(GeoNodeExecParams params) | static void node_exec(GeoNodeExecParams params) | ||||
| { | { | ||||
| GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); | GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry"); | ||||
| const float3 translation = params.extract_input<float3>("Translation"); | const float3 translation = params.extract_input<float3>("Translation"); | ||||
| const float3 rotation = params.extract_input<float3>("Rotation"); | const float3 rotation = params.extract_input<float3>("Rotation"); | ||||
| const float3 scale = params.extract_input<float3>("Scale"); | const float3 scale = params.extract_input<float3>("Scale"); | ||||
| /* Use only translation if rotation and scale don't apply. */ | /* Use only translation if rotation and scale don't apply. */ | ||||
| if (use_translate(rotation, scale)) { | if (use_translate(rotation, scale)) { | ||||
| Show All 11 Lines | |||||
| void register_node_type_geo_transform() | void register_node_type_geo_transform() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_geo_transform_cc; | namespace file_ns = blender::nodes::node_geo_transform_cc; | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| geo_node_type_base(&ntype, GEO_NODE_TRANSFORM, "Transform", NODE_CLASS_GEOMETRY, 0); | geo_node_type_base(&ntype, GEO_NODE_TRANSFORM, "Transform", NODE_CLASS_GEOMETRY, 0); | ||||
| ntype.declare = file_ns::geo_node_transform_declare; | ntype.declare = file_ns::node_declare; | ||||
| ntype.geometry_node_execute = file_ns::geo_node_transform_exec; | ntype.geometry_node_execute = file_ns::node_exec; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||