Code cleanup: reorder BKE_scene_use_new_shading_nodes checks last
authorCampbell Barton <ideasman42@gmail.com>
Wed, 28 May 2014 16:32:25 +0000 (02:32 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 13 Jun 2014 14:47:11 +0000 (00:47 +1000)
source/blender/editors/render/render_preview.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/nodes/shader/node_shader_tree.c

index 467776854428b2ee03735c7963e9700d45055ee1..e3b4051b8e0b97a1b0b942a6329bfae6d6160418 100644 (file)
@@ -299,10 +299,10 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 
                sce->r.cfra = scene->r.cfra;
 
-               if (id_type == ID_TE && ELEM(sp->pr_method, PR_ICON_RENDER, PR_NODE_RENDER)) {
-                       /* Force blender internal for texture icons and nodes render,
+               if (id_type == ID_TE && sp->pr_method == PR_ICON_RENDER) {
+                       /* force blender internal for texture icons render,
                         * seems commonly used render engines does not support
-                        * such kind of rendering.
+                        * such kind of rendering
                         */
                        BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine));
                }
@@ -1137,6 +1137,11 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
        wmJob *wm_job;
        ShaderPreview *sp;
        Scene *scene = CTX_data_scene(C);
+       const bool use_new_shading = BKE_scene_use_new_shading_nodes(scene);
+
+       /* node previews not supported for cycles */
+       if ((method == PR_NODE_RENDER) && use_new_shading)
+               return;
 
        wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview",
                            WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
@@ -1154,7 +1159,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
 
        /* hardcoded preview .blend for cycles/internal, this should be solved
         * once with custom preview .blend path for external engines */
-       if (BKE_scene_use_new_shading_nodes(scene) && method != PR_NODE_RENDER)
+       if (use_new_shading)
                sp->pr_main = G_pr_main_cycles;
        else
                sp->pr_main = G_pr_main;
index 03f2fa86ecb1930d27028e6b92c172ccdb3add93..56b6b6a89a73b479e2215a10d8b95cfe42e46199 100644 (file)
@@ -947,7 +947,10 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
                         Object *ob, DerivedMesh *dm, const int draw_flags)
 {
        /* if not cycles, or preview-modifiers, or drawing matcaps */
-       if ((!BKE_scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW) || (v3d->flag2 & V3D_SHOW_SOLID_MATCAP)) {
+       if ((draw_flags & DRAW_MODIFIERS_PREVIEW) ||
+           (v3d->flag2 & V3D_SHOW_SOLID_MATCAP) ||
+           (BKE_scene_use_new_shading_nodes(scene) == false))
+       {
                draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags);
                return;
        }
index 53f97e0d36c0f4084a38d0a1eb7cf9eb4a0d626b..4288b8fbcdcf0c973fb4371af8b94b841442dd5b 100644 (file)
@@ -79,7 +79,9 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre
        Scene *scene = CTX_data_scene(C);
        Object *ob = OBACT;
        
-       if (!BKE_scene_use_new_shading_nodes(scene) || snode->shaderfrom == SNODE_SHADER_OBJECT) {
+       if ((snode->shaderfrom == SNODE_SHADER_OBJECT) ||
+           (BKE_scene_use_new_shading_nodes(scene) == false))
+       {
                if (ob) {
                        *r_from = &ob->id;
                        if (ob->type == OB_LAMP) {