diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-02 22:55:32 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-02 22:55:32 +0400 |
commit | 30f1f28a8af3b393608b5869512a8823111294ad (patch) | |
tree | 035cee751100c31e25b55087efa476145b29af64 /source/blender/makesrna/intern/rna_world.c | |
parent | 97a0ae3e1b7eea3c069da8c6d3c7a3535734059d (diff) |
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.
Diffstat (limited to 'source/blender/makesrna/intern/rna_world.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_world.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 21ab9d9c845..d421aff7157 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -46,6 +46,8 @@ #include "BKE_main.h" #include "BKE_texture.h" +#include "ED_node.h" + #include "WM_api.h" static PointerRNA rna_World_lighting_get(PointerRNA *ptr) @@ -119,6 +121,15 @@ static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po WM_main_add_notifier(NC_WORLD|ND_WORLD_STARS, wo); } +static void rna_World_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + World *wrld= (World*)ptr->data; + + if(wrld->use_nodes && wrld->nodetree==NULL) + ED_node_shader_default(scene, &wrld->id); + + rna_World_update(bmain, scene, ptr); +} #else @@ -552,6 +563,17 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Stars", "World stars settings"); + /* 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 worlds"); + + 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 world"); + RNA_def_property_update(prop, 0, "rna_World_use_nodes_update"); + rna_def_lighting(brna); rna_def_world_mist(brna); rna_def_world_stars(brna); |