diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-27 12:06:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-27 12:06:29 +0300 |
commit | 9a74b603670cc3fab14d9fcd7be7b3c17731a8ee (patch) | |
tree | 0611021c1450e586308d58223353793dcc137afe /source/blender/makesrna | |
parent | 474971f3d84e5eacde7e92fc86ef4e10a5e0786c (diff) | |
parent | bc3727a94374d9c56745c943a1e6574627a88510 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 56 |
2 files changed, 57 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 4744b2e33df..1cd907aeb91 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -527,6 +527,7 @@ extern StructRNA RNA_ShaderNodeCombineRGB; extern StructRNA RNA_ShaderNodeExtendedMaterial; extern StructRNA RNA_ShaderNodeGeometry; extern StructRNA RNA_ShaderNodeHueSaturation; +extern StructRNA RNA_ShaderNodeIESLight; extern StructRNA RNA_ShaderNodeInvert; extern StructRNA RNA_ShaderNodeLampData; extern StructRNA RNA_ShaderNodeMapping; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index e05e9d32277..182e606a357 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2950,6 +2950,30 @@ static bNodeSocket *rna_NodeOutputFile_slots_new(ID *id, bNode *node, bContext * return sock; } +static void rna_ShaderNodeTexIES_mode_set(PointerRNA *ptr, int value) +{ + bNode *node = (bNode *)ptr->data; + NodeShaderTexIES *nss = node->storage; + + if (nss->mode != value) { + nss->mode = value; + nss->filepath[0] = '\0'; + + /* replace text datablock by filepath */ + if (node->id) { + Text *text = (Text *)node->id; + + if (value == NODE_IES_EXTERNAL && text->name) { + BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath)); + BLI_path_rel(nss->filepath, G.main->name); + } + + id_us_min(node->id); + node->id = NULL; + } + } +} + static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value) { bNode *node = (bNode *)ptr->data; @@ -3292,6 +3316,12 @@ static const EnumPropertyItem node_script_mode_items[] = { {0, NULL, 0, NULL, NULL} }; +static EnumPropertyItem node_ies_mode_items[] = { + {NODE_IES_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text datablock"}, + {NODE_IES_EXTERNAL, "EXTERNAL", 0, "External", "Use external .ies file"}, + {0, NULL, 0, NULL, NULL} +}; + static const EnumPropertyItem node_principled_distribution_items[] = { {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""}, {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""}, @@ -4403,6 +4433,32 @@ static void def_sh_subsurface(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeSubsurface_update"); } +static void def_sh_tex_ies(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "ies", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "id"); + RNA_def_property_struct_type(prop, "Text"); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); + RNA_def_property_ui_text(prop, "IES Text", "Internal IES file"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + RNA_def_struct_sdna_from(srna, "NodeShaderTexIES", "storage"); + + prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_ui_text(prop, "File Path", "IES light path"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeTexIES_mode_set", NULL); + RNA_def_property_enum_items(prop, node_ies_mode_items); + RNA_def_property_ui_text(prop, "Source", "Whether the IES file is loaded from disk or from a Text datablock"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + RNA_def_struct_sdna_from(srna, "bNode", NULL); +} + static void def_sh_script(StructRNA *srna) { PropertyRNA *prop; |