Blender V4.5
node_fn_input_int.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
7#include "UI_interface.hh"
8#include "UI_resources.hh"
9
11
13
15{
16 b.add_output<decl::Int>("Integer").custom_draw([](CustomSocketDrawParams &params) {
17 uiLayout &row = params.layout.row(true);
18 row.prop(&params.node_ptr, "integer", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
20 row.prop(&params.socket_ptr, "pin_gizmo", UI_ITEM_NONE, "", ICON_GIZMO);
21 }
22 });
23 ;
24}
25
27{
28 const bNode &bnode = builder.node();
29 NodeInputInt *node_storage = static_cast<NodeInputInt *>(bnode.storage);
30 builder.construct_and_set_matching_fn<mf::CustomMF_Constant<int>>(node_storage->integer);
31}
32
33static void node_init(bNodeTree * /*tree*/, bNode *node)
34{
36 node->storage = data;
37}
38
39static void node_register()
40{
41 static blender::bke::bNodeType ntype;
42
43 fn_node_type_base(&ntype, "FunctionNodeInputInt", FN_NODE_INPUT_INT);
44 ntype.ui_name = "Integer";
45 ntype.enum_name_legacy = "INPUT_INT";
47 ntype.declare = node_declare;
48 ntype.initfunc = node_init;
53}
55
56} // namespace blender::nodes::node_fn_input_int_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:433
#define FN_NODE_INPUT_INT
#define NOD_REGISTER_NODE(REGISTER_FUNC)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
#define UI_ITEM_NONE
BMesh const char void * data
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void node_register_type(bNodeType &ntype)
Definition node.cc:2748
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
Definition node.cc:5603
bool value_node_has_gizmo(const bNodeTree &tree, const bNode &node)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_declare(NodeDeclarationBuilder &b)
static void node_init(bNodeTree *, bNode *node)
void fn_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
Definition node_util.cc:42
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:54
void * storage
Defines a node type.
Definition BKE_node.hh:226
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:277
NodeMultiFunctionBuildFunction build_multi_function
Definition BKE_node.hh:344
const char * enum_name_legacy
Definition BKE_node.hh:235
NodeDeclareFunction declare
Definition BKE_node.hh:355
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)