Blender V4.3
node_geo_viewport_transform.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BLI_math_matrix.hh"
6
8
10
12{
13 b.add_output<decl::Matrix>("Projection")
14 .description(
15 "Transforms points in view space to region space (\"clip space\" or \"normalized device "
16 "coordinates\")");
17 b.add_output<decl::Matrix>("View").description(
18 "Transforms points from object space to view space using the viewport's location and "
19 "rotation");
20 b.add_output<decl::Bool>("Is Orthographic")
21 .description("Whether the viewport is using orthographic projection");
22}
23
25{
27 return;
28 }
29 const Object &self_object = *params.self_object();
30 const GeoNodesOperatorData &data = *params.user_data()->call_data->operator_data;
31
32 params.set_output("Projection", data.viewport_winmat);
33 params.set_output("View", data.viewport_viewmat * self_object.object_to_world());
34 params.set_output("Is Orthographic", !data.viewport_is_perspective);
35}
36
37static void node_register()
38{
39 static blender::bke::bNodeType ntype;
41 &ntype, GEO_NODE_TOOL_VIEWPORT_TRANSFORM, "Viewport Transform", NODE_CLASS_INPUT);
42 ntype.declare = node_declare;
46}
48
49} // namespace blender::nodes::node_geo_viewport_transform_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:404
#define NOD_REGISTER_NODE(REGISTER_FUNC)
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
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