Blender V5.0
node_fn_project_point.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.use_custom_socket_order();
14 b.allow_any_socket_order();
15 b.is_function_node();
16 b.add_input<decl::Vector>("Vector").subtype(PROP_XYZ);
17 b.add_output<decl::Vector>("Vector").subtype(PROP_XYZ).align_with_previous();
18 b.add_input<decl::Matrix>("Transform");
19}
20
22{
23 static auto fn = mf::build::SI2_SO<float3, float4x4, float3>(
24 "Project Point",
25 [](float3 point, float4x4 matrix) { return math::project_point(matrix, point); });
26 builder.set_matching_fn(fn);
27}
28
29static void node_register()
30{
31 static blender::bke::bNodeType ntype;
32 fn_node_type_base(&ntype, "FunctionNodeProjectPoint", FN_NODE_PROJECT_POINT);
33 ntype.ui_name = "Project Point";
34 ntype.ui_description =
35 "Project a point using a matrix, using location, rotation, scale, and perspective divide";
36 ntype.enum_name_legacy = "PROJECT_POINT";
38 ntype.declare = node_declare;
41}
43
44} // namespace blender::nodes::node_fn_project_point_cc
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:453
#define FN_NODE_PROJECT_POINT
#define NOD_REGISTER_NODE(REGISTER_FUNC)
@ PROP_XYZ
Definition RNA_types.hh:269
void set_matching_fn(const mf::MultiFunction *fn)
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
VectorT project_point(const MatT &mat, const VectorT &point)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_declare(NodeDeclarationBuilder &b)
MatBase< float, 4, 4 > float4x4
VecBase< float, 3 > float3
void fn_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
Defines a node type.
Definition BKE_node.hh:238
std::string ui_description
Definition BKE_node.hh:244
NodeMultiFunctionBuildFunction build_multi_function
Definition BKE_node.hh:351
const char * enum_name_legacy
Definition BKE_node.hh:247
NodeDeclareFunction declare
Definition BKE_node.hh:362