Blender V4.3
node_shader_ies_light.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2018 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "node_shader_util.hh"
6#include "node_util.hh"
7
8#include "RNA_access.hh"
9
10#include "UI_interface.hh"
11#include "UI_resources.hh"
12
14
16{
17 b.add_input<decl::Vector>("Vector").hide_value();
18 b.add_input<decl::Float>("Strength")
19 .default_value(1.0f)
20 .min(0.0f)
21 .max(1000000.0f)
22 .description("Strength of the light source");
23 b.add_output<decl::Float>("Fac");
24}
25
26static void node_shader_buts_ies(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
27{
28 uiLayout *row;
29
30 row = uiLayoutRow(layout, false);
31 uiItemR(row, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
32
33 row = uiLayoutRow(layout, true);
34
35 if (RNA_enum_get(ptr, "mode") == NODE_IES_INTERNAL) {
36 uiItemR(row, ptr, "ies", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
37 }
38 else {
39 uiItemR(row, ptr, "filepath", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
40 }
41}
42
43static void node_shader_init_tex_ies(bNodeTree * /*ntree*/, bNode *node)
44{
45 NodeShaderTexIES *tex = MEM_cnew<NodeShaderTexIES>("NodeShaderIESLight");
46 node->storage = tex;
47}
48
49} // namespace blender::nodes::node_shader_ies_light_cc
50
51/* node type definition */
53{
55
56 static blender::bke::bNodeType ntype;
57
59 ntype.declare = file_ns::node_declare;
60 ntype.draw_buttons = file_ns::node_shader_buts_ies;
61 ntype.initfunc = file_ns::node_shader_init_tex_ies;
63 &ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage);
64
66}
#define SH_NODE_TEX_IES
Definition BKE_node.hh:977
#define NODE_CLASS_TEXTURE
Definition BKE_node.hh:414
@ NODE_IES_INTERNAL
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
@ UI_ITEM_R_EXPAND
local_group_size(16, 16) .push_constant(Type b
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
Definition node.cc:4632
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static void node_shader_init_tex_ies(bNodeTree *, bNode *node)
static void node_shader_buts_ies(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
void register_node_type_sh_tex_ies()
void sh_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
Definition node_util.cc:46
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:58
int RNA_enum_get(PointerRNA *ptr, const char *name)
Defines a node type.
Definition BKE_node.hh:218
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:267
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:238
NodeDeclareFunction declare
Definition BKE_node.hh:347
PointerRNA * ptr
Definition wm_files.cc:4126