diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_lamp.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_lamp.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 572559546c8..629711fcf96 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -46,6 +46,7 @@ #include "BKE_main.h" #include "BKE_texture.h" +#include "ED_node.h" #include "WM_api.h" #include "WM_types.h" @@ -145,6 +146,15 @@ static void rna_Lamp_spot_size_set(PointerRNA *ptr, float value) la->spotsize= RAD2DEGF(value); } +static void rna_Lamp_use_nodes_update(Main *blain, Scene *scene, PointerRNA *ptr) +{ + Lamp *la= (Lamp*)ptr->data; + + if(la->use_nodes && la->nodetree==NULL) + ED_node_shader_default(scene, &la->id); + + rna_Lamp_update(blain, scene, ptr); +} #else @@ -366,6 +376,17 @@ static void rna_def_lamp(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_DIFF); RNA_def_property_ui_text(prop, "Diffuse", "Lamp does diffuse shading"); RNA_def_property_update(prop, 0, "rna_Lamp_update"); + + /* nodes */ + prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); + RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based lamps"); + + prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the lamp"); + RNA_def_property_update(prop, 0, "rna_Lamp_use_nodes_update"); /* common */ rna_def_animdata_common(srna); |