Blender V5.3
node_geo_set_grease_pencil_depth_mode.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6
8#include "UI_resources.hh"
9
10#include "NOD_rna_define.hh"
11
12#include "RNA_enum_types.hh"
13
15
16#include "node_geometry_util.hh"
17
19
24
26{
27 b.use_custom_socket_order();
28 b.allow_any_socket_order();
29 b.add_input<decl::Geometry>("Grease Pencil"_ustr)
31 .description("Grease Pencil to set the depth order of");
32 b.add_output<decl::Geometry>("Grease Pencil"_ustr)
33 .propagate_all_geometry()
34 .align_with_previous();
35 b.add_input<decl::Menu>("Depth Order"_ustr)
38}
39
40static void node_init(bNodeTree * /*tree*/, bNode *node)
41{
42 node->custom1 = 0;
43}
44
46{
47 const auto depth_order = params.get_input<Mode>("Depth Order"_ustr);
48 GeometrySet geometry_set = params.extract_input<GeometrySet>("Grease Pencil"_ustr);
49
51 if (GreasePencil *grease_pencil = geometry.get_grease_pencil_for_write()) {
54 }
55 });
56
57 params.set_output("Grease Pencil"_ustr, std::move(geometry_set));
58}
59
60static void node_register()
61{
62 static bke::bNodeType ntype;
63
64 geo_node_type_base(&ntype, "GeometryNodeSetGreasePencilDepth"_ustr);
65 ntype.ui_name = "Set Grease Pencil Depth";
66 ntype.ui_description = "Set the Grease Pencil depth order to use";
69 ntype.declare = node_declare;
70 ntype.initfunc = node_init;
73}
75
76} // namespace blender::nodes::node_geo_grease_pencil_set_depth_mode
Low-level operations for grease pencil.
#define NODE_CLASS_GEOMETRY
Definition BKE_node.hh:492
#define SET_FLAG_FROM_TEST(value, test, flag)
T extract_input(const UString identifier)
T get_input(const UString identifier) const
void set_output(const UString identifier, T &&value)
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
const EnumPropertyItem rna_enum_stroke_depth_order_items[]
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
signed char int8_t
Definition BKE_text.h:76
static constexpr int _180
Definition BKE_node.hh:247
Defines a node type.
Definition BKE_node.hh:265
std::string ui_description
Definition BKE_node.hh:271
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:385
void(*) initfunc(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:320
NodeDeclareFunction declare
Definition BKE_node.hh:393