Blender V5.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
8
9#include "node_shader_util.hh"
10#include "node_util.hh"
11
12#include "RNA_access.hh"
13
15#include "UI_resources.hh"
16
17namespace blender {
18
20
22{
23 b.add_input<decl::Vector>("Vector"_ustr).hide_value();
24 b.add_input<decl::Float>("Strength"_ustr)
25 .default_value(1.0f)
26 .min(0.0f)
27 .max(1000000.0f)
28 .description("Strength of the light source")
29 .translation_context(BLT_I18NCONTEXT_AMOUNT);
30 b.add_output<decl::Float>("Factor"_ustr, "Fac"_ustr);
31}
32
33static void node_shader_buts_ies(ui::Layout &layout, bContext * /*C*/, PointerRNA *ptr)
34{
35 {
36 ui::Layout &row = layout.row(false);
37 row.prop(
38 ptr, "mode", ui::ITEM_R_SPLIT_EMPTY_NAME | ui::ITEM_R_EXPAND, std::nullopt, ICON_NONE);
39 }
40
41 {
42 ui::Layout &row = layout.row(true);
43 if (RNA_enum_get(ptr, "mode") == NODE_IES_INTERNAL) {
44 row.prop(ptr, "ies", ui::ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
45 }
46 else {
47 row.prop(ptr, "filepath", ui::ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
48 }
49 }
50}
51
52static void node_shader_init_tex_ies(bNodeTree * /*ntree*/, bNode *node)
53{
54 NodeShaderTexIES *tex = MEM_new<NodeShaderTexIES>("NodeShaderIESLight");
55 node->storage = tex;
56}
57
58} // namespace nodes::node_shader_ies_light_cc
59
60/* node type definition */
62{
63 namespace file_ns = nodes::node_shader_ies_light_cc;
64
65 static bke::bNodeType ntype;
66
67 sh_node_type_base(&ntype, "ShaderNodeTexIES"_ustr, SH_NODE_TEX_IES);
68 ntype.ui_name = "IES Texture";
69 ntype.ui_description =
70 "Match real world lights with IES files, which store the directional intensity distribution "
71 "of light sources";
72 ntype.enum_name_legacy = "TEX_IES";
74 ntype.declare = file_ns::node_declare;
75 ntype.draw_buttons = file_ns::node_shader_buts_ies;
76 ntype.initfunc = file_ns::node_shader_init_tex_ies;
78 ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage);
79
81}
82
83} // namespace blender
#define NODE_CLASS_TEXTURE
Definition BKE_node.hh:488
#define SH_NODE_TEX_IES
#define BLT_I18NCONTEXT_AMOUNT
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
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:6166
static void node_shader_init_tex_ies(bNodeTree *, bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
static void node_shader_buts_ies(ui::Layout &layout, bContext *, PointerRNA *ptr)
BMesh Iterators.
int RNA_enum_get(PointerRNA *ptr, const char *name)
void register_node_type_sh_tex_ies()
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:57
void node_free_standard_storage(bNode *node)
Definition node_util.cc:45
Defines a node type.
Definition BKE_node.hh:265
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:290
std::string ui_description
Definition BKE_node.hh:271
void(*) initfunc(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:320
const char * enum_name_legacy
Definition BKE_node.hh:274
NodeDeclareFunction declare
Definition BKE_node.hh:393
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
Layout & row(bool align)