diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-02 23:24:30 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-11-02 23:24:30 +0400 |
commit | ac52c79cb19ac85e06651a7b9af2e54efcd45a97 (patch) | |
tree | c0366c96ed66c6899af093cc0194ab572b9df750 /source/blender/editors/render/render_shading.c | |
parent | 30f1f28a8af3b393608b5869512a8823111294ad (diff) |
RenderEngine/Nodes: system to check for shading nodes compatibility
* Scene.use_shading_nodes property to check if RenderEngine is using new shading
nodes system, and RenderEngine.bl_use_shading_nodes to set this.
* Add mechanism for tagging nodes as being compatible with the old/new system.
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r-- | source/blender/editors/render/render_shading.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 35d679146fe..80c54d970b4 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -26,7 +26,6 @@ * \ingroup edrend */ - #include <stdlib.h> #include <string.h> @@ -76,6 +75,7 @@ #include "ED_curve.h" #include "ED_mesh.h" +#include "ED_node.h" #include "ED_render.h" #include "ED_screen.h" @@ -363,16 +363,24 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot) static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) { + Scene *scene= CTX_data_scene(C); Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; PointerRNA ptr, idptr; PropertyRNA *prop; /* add or copy material */ - if(ma) + if(ma) { ma= copy_material(ma); - else + } + else { ma= add_material("Material"); + if(scene_use_new_shading_nodes(scene)) { + ED_node_shader_default(scene, &ma->id); + ma->use_nodes= 1; + } + } + /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); @@ -455,16 +463,24 @@ void TEXTURE_OT_new(wmOperatorType *ot) static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) { + Scene *scene= CTX_data_scene(C); World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data; PointerRNA ptr, idptr; PropertyRNA *prop; /* add or copy world */ - if(wo) + if(wo) { wo= copy_world(wo); - else + } + else { wo= add_world("World"); + if(scene_use_new_shading_nodes(scene)) { + ED_node_shader_default(scene, &wo->id); + wo->use_nodes= 1; + } + } + /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); |