RenderEngine/Nodes: system to check for shading nodes compatibility
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 2 Nov 2011 19:24:30 +0000 (19:24 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 2 Nov 2011 19:24:30 +0000 (19:24 +0000)
* 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.

31 files changed:
release/scripts/startup/bl_ui/space_node.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/scene.c
source/blender/editors/render/render_shading.c
source/blender/editors/space_node/node_header.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_scene.c
source/blender/nodes/intern/node_common.c
source/blender/nodes/shader/nodes/node_shader_camera.c
source/blender/nodes/shader/nodes/node_shader_curves.c
source/blender/nodes/shader/nodes/node_shader_dynamic.c
source/blender/nodes/shader/nodes/node_shader_geom.c
source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
source/blender/nodes/shader/nodes/node_shader_invert.c
source/blender/nodes/shader/nodes/node_shader_mapping.c
source/blender/nodes/shader/nodes/node_shader_material.c
source/blender/nodes/shader/nodes/node_shader_math.c
source/blender/nodes/shader/nodes/node_shader_mixRgb.c
source/blender/nodes/shader/nodes/node_shader_normal.c
source/blender/nodes/shader/nodes/node_shader_output.c
source/blender/nodes/shader/nodes/node_shader_rgb.c
source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
source/blender/nodes/shader/nodes/node_shader_squeeze.c
source/blender/nodes/shader/nodes/node_shader_texture.c
source/blender/nodes/shader/nodes/node_shader_valToRgb.c
source/blender/nodes/shader/nodes/node_shader_value.c
source/blender/nodes/shader/nodes/node_shader_vectMath.c
source/blender/render/extern/include/RE_engine.h

index 2b2cc505f1fc9f15a5b50d9c66841e4d50d56c9c..69766b54e9755c54db9943fc9ee5da98f1bf4570 100644 (file)
@@ -27,6 +27,7 @@ class NODE_HT_header(Header):
     def draw(self, context):
         layout = self.layout
 
+        scene = context.scene
         snode = context.space_data
         snode_id = snode.id
         id_from = snode.id_from
@@ -43,10 +44,14 @@ class NODE_HT_header(Header):
         layout.prop(snode, "tree_type", text="", expand=True)
 
         if snode.tree_type == 'SHADER':
-            if id_from:
-                layout.template_ID(id_from, "active_material", new="material.new")
-            if snode_id:
-                layout.prop(snode_id, "use_nodes")
+            if scene.render.use_shading_nodes:
+                layout.prop(snode, "shader_type", text="", expand=True)
+
+            if not scene.render.use_shading_nodes or snode.shader_type == 'OBJECT':
+                if id_from:
+                    layout.template_ID(id_from, "active_material", new="material.new")
+                if snode_id:
+                    layout.prop(snode_id, "use_nodes")
 
         elif snode.tree_type == 'TEXTURE':
             layout.prop(snode, "texture_type", text="", expand=True)
index dceab4a72e8bd461b08880174f8d0582de348df0..07c860fca31117be7443e15ddac4c1a977c6eb3e 100644 (file)
@@ -2143,10 +2143,11 @@ class VIEW3D_PT_view3d_display(Panel):
         subsub.active = scene.unit_settings.system == 'NONE'
         subsub.prop(view, "grid_subdivisions", text="Subdivisions")
 
-        col = layout.column()
-        col.label(text="Shading:")
-        col.prop(gs, "material_mode", text="")
-        col.prop(view, "show_textured_solid")
+        if not scene.render.use_shading_nodes:
+            col = layout.column()
+            col.label(text="Shading:")
+            col.prop(gs, "material_mode", text="")
+            col.prop(view, "show_textured_solid")
 
         layout.separator()
 
index a819a464d3fdd8d3fa22af486935c37940783462..7509205e9687152fbf002aeeb00b13eff078b557 100644 (file)
@@ -130,7 +130,7 @@ typedef struct bNodeType {
        char name[32];
        float width, minwidth, maxwidth;
        float height, minheight, maxheight;
-       short nclass, flag;
+       short nclass, flag, compatibility;
        
        /* templates for static sockets */
        bNodeSocketTemplate *inputs, *outputs;
@@ -230,8 +230,13 @@ typedef struct bNodeType {
 #define NODE_CLASS_PARTICLES           25
 #define NODE_CLASS_TRANSFORM           30
 #define NODE_CLASS_COMBINE                     31
+#define NODE_CLASS_SHADER                      40
 #define NODE_CLASS_LAYOUT                      100
 
+/* nodetype->compatibility */
+#define NODE_OLD_SHADING       1
+#define NODE_NEW_SHADING       2
+
 /* enum values for input/output */
 #define SOCK_IN                1
 #define SOCK_OUT       2
@@ -388,6 +393,7 @@ void                        node_type_exec_new(struct bNodeType *ntype,
                                                                   void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **));
 void                   node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out));
 void                   node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out));
+void                   node_type_compatibility(struct bNodeType *ntype, short compatibility);
 
 /* ************** COMMON NODES *************** */
 
index 5c214b2892a30f7622134496db58efb83965bcb4..45ee6fd4ebd0fe884bbc9f1160361850b72d2e70 100644 (file)
@@ -98,6 +98,8 @@ int get_render_child_particle_number(struct RenderData *r, int num);
 int get_render_shadow_samples(struct RenderData *r, int samples);
 float get_render_aosss_error(struct RenderData *r, float error);
 
+int scene_use_new_shading_nodes(struct Scene *scene);
+
 #ifdef __cplusplus
 }
 #endif
index 824e59a82c5e64093f627a9f149467fb980e51d8..f35f034387bdacdd6c054a767b68721fb61a5b83 100644 (file)
 #include <string.h>
 #include <limits.h>
 
+#include "DNA_action_types.h"
 #include "DNA_anim_types.h"
 #include "DNA_node_types.h"
+#include "DNA_node_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_action_types.h"
 
 #include "BLI_string.h"
 #include "BLI_math.h"
@@ -1751,6 +1752,10 @@ void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMate
        ntype->gpuextfunc = gpuextfunc;
 }
 
+void node_type_compatibility(struct bNodeType *ntype, short compatibility)
+{
+       ntype->compatibility = compatibility;
+}
 
 static bNodeType *is_nodetype_registered(ListBase *typelist, int type) 
 {
index 6b3786663df24b63aa47d1630dcdc9aab0ef1dd5..c902bee80a8c37f47ef8768b02f6b23a6811848f 100644 (file)
@@ -72,6 +72,8 @@
 
 #include "BKE_sound.h"
 
+#include "RE_engine.h"
+
 //XXX #include "BIF_previewrender.h"
 //XXX #include "BIF_editseq.h"
 
@@ -1127,3 +1129,10 @@ Base *_setlooper_base_step(Scene **sce_iter, Base *base)
 
        return NULL;
 }
+
+int scene_use_new_shading_nodes(Scene *scene)
+{
+       RenderEngineType *type= RE_engines_find(scene->r.engine);
+       return (type->flag & RE_USE_SHADING_NODES);
+}
+
index 35d679146fe243e94ff734a7888b195f5321fdd5..80c54d970b433b3ee589a215763306e3dbcaefbe 100644 (file)
@@ -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);
 
index 68f5dd6bf1492b2afb859f8bf92c6085290df6a3..42b5dafa3e1eef6f7b517bf78ed9019abcc8603b 100644 (file)
 
 #include "BKE_context.h"
 #include "BKE_global.h"
-#include "BKE_screen.h"
-#include "BKE_node.h"
 #include "BKE_main.h"
+#include "BKE_node.h"
+#include "BKE_scene.h"
+#include "BKE_screen.h"
 
 #include "RNA_access.h"
 
@@ -168,10 +169,11 @@ static int node_tree_has_type(int treetype, int nodetype)
 static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
 {
        Main *bmain= CTX_data_main(C);
+       Scene *scene= CTX_data_scene(C);
        SpaceNode *snode= CTX_wm_space_node(C);
        bNodeTree *ntree;
        int nodeclass= GET_INT_FROM_POINTER(arg_nodeclass);
-       int event;
+       int event, compatibility= 0;
        
        ntree = snode->nodetree;
        
@@ -179,6 +181,13 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
                uiItemS(layout);
                return;
        }
+
+       if(ntree->type == NTREE_SHADER) {
+               if(scene_use_new_shading_nodes(scene))
+                       compatibility= NODE_NEW_SHADING;
+               else
+                       compatibility= NODE_OLD_SHADING;
+       }
        
        if (nodeclass==NODE_CLASS_GROUP) {
                bNodeTree *ngroup;
@@ -210,14 +219,16 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
                uiLayoutSetFunc(layout, do_node_add_static, NULL);
                
                for (ntype=ntreeGetType(ntree->type)->node_types.first; ntype; ntype=ntype->next) {
-                       if(ntype->nclass==nodeclass && ntype->name)
-                               uiItemV(layout, ntype->name, 0, ntype->type);
+                       if (ntype->nclass==nodeclass && ntype->name)
+                               if (!compatibility || (ntype->compatibility & compatibility))
+                                       uiItemV(layout, ntype->name, 0, ntype->type);
                }
        }
 }
 
 static void node_menu_add(const bContext *C, Menu *menu)
 {
+       Scene *scene= CTX_data_scene(C);
        SpaceNode *snode= CTX_wm_space_node(C);
        uiLayout *layout= menu->layout;
 
@@ -227,11 +238,15 @@ static void node_menu_add(const bContext *C, Menu *menu)
        if(snode->treetype==NTREE_SHADER) {
                uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
                uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
+               if(scene_use_new_shading_nodes(scene)) {
+                       uiItemMenuF(layout, IFACE_("Shader"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_SHADER));
+                       uiItemMenuF(layout, IFACE_("Texture"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE));
+               }
                uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
                uiItemMenuF(layout, IFACE_("Vector"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR));
                uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
                uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
-               uiItemMenuF(layout, IFACE_("Dynamic"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC));
+               //uiItemMenuF(layout, IFACE_("Dynamic"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC));
                uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
        }
        else if(snode->treetype==NTREE_COMPOSIT) {
index 2ed06516c55f463990462060305c9fcf3533dcab..530d162b1fea79306a18edf6e175ab70b842ead0 100644 (file)
@@ -372,6 +372,10 @@ static void rna_def_render_engine(BlenderRNA *brna)
        RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
        RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
 
+       prop= RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES);
+       RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
        RNA_define_verify_sdna(1);
 }
 
index ce62550feeba73ecbfddc95b67f88473c3059b98..63fce2d9edb7630f53f07c76433d627946f5d071 100644 (file)
@@ -838,6 +838,12 @@ static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
        return (BLI_countlist(&R_engines) > 1);
 }
 
+static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr)
+{
+       Scene *scene= (Scene*)ptr->id.data;
+       return scene_use_new_shading_nodes(scene);
+}
+
 static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
 {
        RenderData *rd= (RenderData*)ptr->data;
@@ -3227,6 +3233,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available");
 
+       prop= RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_shading_nodes_get", NULL);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Use Shading Nodes", "Active render engine uses new shading nodes system");
+
        prop= RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_game_engine_get", NULL);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
index c43c1b36a8498c082d8be4eb15a05628874e6376..11dcf44a288bf7dcb3bdcbfd78118c10df101b4e 100644 (file)
@@ -980,6 +980,7 @@ void register_node_type_frame(ListBase *lb)
 
        node_type_base(ntype, NODE_FRAME, "Frame", NODE_CLASS_LAYOUT, NODE_BACKGROUND);
        node_type_size(ntype, 150, 100, 0);
+       node_type_compatibility(ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
        
        ntype->needs_free = 1;
        nodeRegisterType(lb, ntype);
index 15332bfa066efde8a7f331b5f667b15d0997df75..c7882a6e0e2682d61161a9acf681b415ecd72acb 100644 (file)
@@ -62,6 +62,7 @@ void register_node_type_sh_camera(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, NULL, sh_node_camera_out);
        node_type_size(&ntype, 95, 95, 120);
        node_type_storage(&ntype, "node_camera", NULL, NULL);
index 9c441e456567383db3021e45673d3038f573c505..7ac05bb28bfd638103169e43be05c8abed29979c 100644 (file)
@@ -74,6 +74,7 @@ void register_node_type_sh_curve_vec(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_curve_vec_in, sh_node_curve_vec_out);
        node_type_size(&ntype, 200, 140, 320);
        node_type_init(&ntype, node_shader_init_curve_vec);
@@ -128,6 +129,7 @@ void register_node_type_sh_curve_rgb(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_curve_rgb_in, sh_node_curve_rgb_out);
        node_type_size(&ntype, 200, 140, 320);
        node_type_init(&ntype, node_shader_init_curve_rgb);
index d41ddecbab388b0edcb1826c2ee2145d43282582..51ddb865c540a2187068ab19e93f710b3beb8acb 100644 (file)
@@ -766,6 +766,7 @@ void register_node_type_sh_dynamic(ListBase *lb)
        static bNodeType ntype;
        
        node_type_base(&ntype, NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, NODE_OPTIONS, NULL, NULL);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_size(&ntype, 150, 60, 300);
        node_type_init(&ntype, node_dynamic_init_cb);
        node_type_storage(&ntype, "NodeScriptDict", node_dynamic_free_storage_cb, node_dynamic_copy_cb);
@@ -781,6 +782,7 @@ void register_node_type_sh_dynamic(ListBase *lb)
        static bNodeType ntype;
        
        node_type_base(&ntype, NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, 0);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        
        nodeRegisterType(lb, &ntype);
 }
index 1b073f6415bd4c1ac9746118e9ce1c2a7c5bdf23..dedc25092c1c3951212a4b2ded1b59dc1445ec91 100644 (file)
@@ -139,6 +139,7 @@ void register_node_type_sh_geom(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, NULL, sh_node_geom_out);
        node_type_size(&ntype, 120, 80, 160);
        node_type_init(&ntype, node_shader_init_geometry);
index db717c48a886b75f637b1af6c81317ef3880eb10..7fb31d80ffc0af0529633ade62b5a670c3494954 100644 (file)
@@ -85,6 +85,7 @@ void register_node_type_sh_hue_sat(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_hue_sat_in, sh_node_hue_sat_out);
        node_type_size(&ntype, 150, 80, 250);
        node_type_exec(&ntype, node_shader_exec_hue_sat);
index 44d26bfff4e9b9ebb4c267ff31c6a640de70929a..066ff14a87011c527e97e8632e875de7bfbe5c13 100644 (file)
@@ -77,6 +77,7 @@ void register_node_type_sh_invert(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_invert_in, sh_node_invert_out);
        node_type_size(&ntype, 90, 80, 100);
        node_type_exec(&ntype, node_shader_exec_invert);
index 7ec30952ea1068ab1be5ba646e6b0d3450365d85..862c52187dc30d2281daa12507c83c6994e290f6 100644 (file)
@@ -91,6 +91,7 @@ void register_node_type_sh_mapping(ListBase *lb)
        static bNodeType ntype;
        
        node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_mapping_in, sh_node_mapping_out);
        node_type_size(&ntype, 240, 160, 320);
        node_type_init(&ntype, node_shader_init_mapping);
index 408b7b0ea483c5be0a4b3dcd448fdef3edce61b8..f93928d8884505a84180ab93029642d52b3f3448 100644 (file)
@@ -305,6 +305,7 @@ void register_node_type_sh_material(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_material_in, sh_node_material_out);
        node_type_size(&ntype, 120, 80, 240);
        node_type_init(&ntype, node_shader_init_material);
@@ -320,6 +321,7 @@ void register_node_type_sh_material_ext(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_material_ext_in, sh_node_material_ext_out);
        node_type_size(&ntype, 120, 80, 240);
        node_type_init(&ntype, node_shader_init_material);
index 6faad500793581954a44bae6a05dd774250d0739..13ee1f79fe602d79e70346f507efcfb1acf3804c 100644 (file)
@@ -241,6 +241,7 @@ void register_node_type_sh_math(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_math_in, sh_node_math_out);
        node_type_size(&ntype, 120, 110, 160);
        node_type_label(&ntype, node_math_label);
index 463146ec59c70ec9e1ab61852cefbfdd5c607f29..7aed6bce4c4f3aa4668b24172c61f0b9d6bf7800 100644 (file)
@@ -78,6 +78,7 @@ void register_node_type_sh_mix_rgb(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out);
        node_type_size(&ntype, 100, 60, 150);
        node_type_label(&ntype, node_blend_label);
index 0038570c5b1097632c00b7898d9236c6133e37da..c23c6d328cf984142c925031fa2d49648664fc06 100644 (file)
@@ -84,6 +84,7 @@ void register_node_type_sh_normal(ListBase *lb)
        static bNodeType ntype;
        
        node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_normal_in, sh_node_normal_out);
        node_type_init(&ntype, node_shader_init_normal);
        node_type_exec(&ntype, node_shader_exec_normal);
index 98a23534f9036181962b7f46877cbe91d3ce50c5..ea7fae8f961e5d791d9c6190d598c8bdaee1e675 100644 (file)
@@ -83,6 +83,7 @@ void register_node_type_sh_output(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_output_in, NULL);
        node_type_size(&ntype, 80, 60, 200);
        node_type_exec(&ntype, node_shader_exec_output);
index db2e9905a015d5d6490d6913df4a1f97ea298bc2..1a0b4ea616b25ce6901269dbfe496f1100606c74 100644 (file)
@@ -71,6 +71,7 @@ void register_node_type_sh_rgb(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, NULL, sh_node_rgb_out);
        node_type_init(&ntype, node_shader_init_rgb);
        node_type_size(&ntype, 140, 80, 140);
index 77d8cdf033ae03748da9dd72cc9d0cd33801728c..4f409bb3ec114119c35f1158298bf8c8f771da9f 100644 (file)
@@ -61,6 +61,7 @@ void register_node_type_sh_seprgb(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_seprgb_in, sh_node_seprgb_out);
        node_type_size(&ntype, 80, 40, 140);
        node_type_exec(&ntype, node_shader_exec_seprgb);
@@ -100,6 +101,7 @@ void register_node_type_sh_combrgb(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_combrgb_in, sh_node_combrgb_out);
        node_type_size(&ntype, 80, 40, 140);
        node_type_exec(&ntype, node_shader_exec_combrgb);
index ec2c1860597b6372c15b49026e728f4a861c2c8d..16a9ae8aedc4d0e7127662271a9a2dc32ca21f42 100644 (file)
@@ -67,6 +67,7 @@ void register_node_type_sh_squeeze(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_squeeze_in, sh_node_squeeze_out);
        node_type_size(&ntype, 120, 110, 160);
        node_type_storage(&ntype, "node_squeeze", NULL, NULL);
index 199af9a69a9264446a51e6c06ba9fb82b2f85fc6..588cdc1da838bb8004ae372b19edd694a0afdb45 100644 (file)
@@ -136,6 +136,7 @@ void register_node_type_sh_texture(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_texture_in, sh_node_texture_out);
        node_type_size(&ntype, 120, 80, 240);
        node_type_exec(&ntype, node_shader_exec_texture);
index bc418a7c416d2bcb45ee7c7ef803d13474c2b3a7..4d41e62b2428ef3277c3e560e09823a35ca6e0ca 100644 (file)
@@ -76,6 +76,7 @@ void register_node_type_sh_valtorgb(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_valtorgb_in, sh_node_valtorgb_out);
        node_type_size(&ntype, 240, 200, 300);
        node_type_init(&ntype, node_shader_init_valtorgb);
@@ -116,6 +117,7 @@ void register_node_type_sh_rgbtobw(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out);
        node_type_size(&ntype, 80, 40, 120);
        node_type_exec(&ntype, node_shader_exec_rgbtobw);
index 95ee54e225db33abf8f664e48f8f39f870bd9bca..4a8aa6c9cf48e6c76937e8ee0e757c5d4a2bfa72 100644 (file)
@@ -71,6 +71,7 @@ void register_node_type_sh_value(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, NULL, sh_node_value_out);
        node_type_init(&ntype, node_shader_init_value);
        node_type_size(&ntype, 80, 50, 120);
index 4282b40cb4d63de2b6e02f87dc03032781d5a22f..b3f995dcdce32fc6b775ffcaa09ec8c108e12672 100644 (file)
@@ -135,6 +135,7 @@ void register_node_type_sh_vect_math(ListBase *lb)
        static bNodeType ntype;
 
        node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
+       node_type_compatibility(&ntype, NODE_OLD_SHADING);
        node_type_socket_templates(&ntype, sh_node_vect_math_in, sh_node_vect_math_out);
        node_type_size(&ntype, 80, 75, 140);
        node_type_label(&ntype, node_vect_math_label);
index ef6c8a37b2e2a74f62f1a0ae1269f11a046bbeae..e521479bbcd1075775d997174e426fae3437420c 100644 (file)
@@ -51,6 +51,7 @@ struct Scene;
 #define RE_GAME                                        2
 #define RE_USE_PREVIEW                 4
 #define RE_USE_POSTPROCESS             8
+#define RE_USE_SHADING_NODES   16
 
 /* RenderEngine.flag */
 #define RE_ENGINE_ANIMATION            1