From 30f1f28a8af3b393608b5869512a8823111294ad Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 2 Nov 2011 18:55:32 +0000 Subject: Nodes: add support for shader nodes on world and lamps, in addition to materials. The internal render engine does not support them, and they are not accesible in the UI yet, but cycles will use them. --- source/blender/makesrna/intern/rna_lamp.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/blender/makesrna/intern/rna_lamp.c') 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); -- cgit v1.2.3