Blender V4.3
node_geo_tool_3d_cursor.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BLI_math_matrix.hh"
6
7#include "BKE_scene.hh"
8
10
12
14{
15 b.add_output<decl::Vector>("Location")
16 .subtype(PROP_TRANSLATION)
18 "The location of the scene's 3D cursor, in the local space of the modified object");
19 b.add_output<decl::Rotation>("Rotation")
20 .description(
21 "The rotation of the scene's 3D cursor, in the local space of the modified object");
22}
23
25{
27 return;
28 }
29 const GeoNodesOperatorData &data = *params.user_data()->call_data->operator_data;
30 const float4x4 &world_to_object = params.self_object()->world_to_object();
31
32 const float3 location_global = data.cursor_position;
33 params.set_output("Location", math::transform_point(world_to_object, location_global));
34
35 math::Quaternion rotation_global = data.cursor_rotation;
36 params.set_output("Rotation", math::to_quaternion(world_to_object) * rotation_global);
37}
38
39static void node_register()
40{
41 static blender::bke::bNodeType ntype;
42 geo_node_type_base(&ntype, GEO_NODE_TOOL_3D_CURSOR, "3D Cursor", NODE_CLASS_INPUT);
43 ntype.declare = node_declare;
47}
49
50} // namespace blender::nodes::node_geo_tool_3d_cursor_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:404
#define NOD_REGISTER_NODE(REGISTER_FUNC)
@ PROP_TRANSLATION
Definition RNA_types.hh:164
local_group_size(16, 16) .push_constant(Type b
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
QuaternionBase< T > to_quaternion(const AxisAngleBase< T, AngleT > &axis_angle)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
void search_link_ops_for_tool_node(GatherLinkSearchOpParams &params)
bool check_tool_context_and_error(GeoNodeExecParams &params)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition BKE_node.hh:218
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:339
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:363
NodeDeclareFunction declare
Definition BKE_node.hh:347