Blender V4.5
node_fn_input_color.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 "BLI_math_vector.h"
8
9#include "UI_interface.hh"
10#include "UI_resources.hh"
11
13
15{
16 b.add_output<decl::Color>("Color").custom_draw([](CustomSocketDrawParams &params) {
18 uiLayout &col = params.layout.column(false);
19 uiTemplateColorPicker(&col, &params.node_ptr, "value", true, false, false, true);
20 col.prop(&params.node_ptr, "value", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
21 });
22}
23
31
32static void node_init(bNodeTree * /*tree*/, bNode *node)
33{
35 copy_v4_fl4(data->color, 0.5f, 0.5f, 0.5f, 1.0f);
36 node->storage = data;
37}
38
39static void node_register()
40{
41 static blender::bke::bNodeType ntype;
42
43 fn_node_type_base(&ntype, "FunctionNodeInputColor", FN_NODE_INPUT_COLOR);
44 ntype.ui_name = "Color";
45 ntype.enum_name_legacy = "INPUT_COLOR";
47 ntype.declare = node_declare;
48 ntype.initfunc = node_init;
53}
55
56} // namespace blender::nodes::node_fn_input_color_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:433
#define FN_NODE_INPUT_COLOR
MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, blender::StringRefNull propname, bool value_slider, bool lock, bool lock_luminosity, bool cubic)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
@ UI_LAYOUT_ALIGN_EXPAND
void uiLayoutSetAlignment(uiLayout *layout, char alignment)
BMesh const char void * data
uint col
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
static void node_init(bNodeTree *, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
Definition BLI_color.hh:342
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