Blender V5.0
node_geo_input_named_layer_selection.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
6
8
10
12{
13 b.add_input<decl::String>("Name").is_layer_name().optional_label();
14 b.add_output<decl::Bool>("Selection").field_source_reference_all();
15}
16
18{
19 std::string name = params.extract_input<std::string>("Name");
20 if (name.empty()) {
21 params.set_default_remaining_outputs();
22 return;
23 }
24
25 Field<bool> selection_field{
26 std::make_shared<bke::NamedLayerSelectionFieldInput>(std::move(name))};
27 params.set_output("Selection", std::move(selection_field));
28}
29
30static void node_register()
31{
32 static blender::bke::bNodeType ntype;
33
35 &ntype, "GeometryNodeInputNamedLayerSelection", GEO_NODE_INPUT_NAMED_LAYER_SELECTION);
36 ntype.ui_name = "Named Layer Selection";
37 ntype.ui_description = "Output a selection of a Grease Pencil layer";
38 ntype.enum_name_legacy = "INPUT_NAMED_LAYER_SELECTION";
41 ntype.declare = node_declare;
44}
46
47} // namespace blender::nodes::node_geo_input_named_layer_selection__cc
constexpr int NODE_DEFAULT_MAX_WIDTH
Definition BKE_node.hh:1250
#define NODE_CLASS_INPUT
Definition BKE_node.hh:447
#define GEO_NODE_INPUT_NAMED_LAYER_SELECTION
#define NOD_REGISTER_NODE(REGISTER_FUNC)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_type_size(bNodeType &ntype, int width, int minwidth, int maxwidth)
Definition node.cc:5384
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
const char * name
Defines a node type.
Definition BKE_node.hh:238
std::string ui_description
Definition BKE_node.hh:244
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:354
const char * enum_name_legacy
Definition BKE_node.hh:247
NodeDeclareFunction declare
Definition BKE_node.hh:362