Commit: b37dff923919623b1ea6dc66f9fe6dfcf8639a45
Author: Brecht Van Lommel
Date:   Mon Feb 12 20:08:50 2018 +0100
Branches: master
https://developer.blender.org/rBb37dff923919623b1ea6dc66f9fe6dfcf8639a45

Fix part of T53080: don't use current scene world for icon previews.

This can be very slow if it contains a big texture, and it's not
necessarily setup in a useful way anyway, and materials can be used
in multiple scenes.

===================================================================

M       source/blender/editors/render/render_preview.c

===================================================================

diff --git a/source/blender/editors/render/render_preview.c 
b/source/blender/editors/render/render_preview.c
index 9656a57e2b7..e52dd7c65c8 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -382,9 +382,18 @@ static Scene *preview_prepare_scene(Main *bmain, Scene 
*scene, ID *id, int id_ty
                                        }
                                }
                                else {
-                                       /* use current scene world to light 
sphere */
-                                       if (mat->pr_type == MA_SPHERE_A)
+                                       if (mat->pr_type == MA_SPHERE_A && 
sp->pr_method == PR_BUTS_RENDER) {
+                                               /* Use current scene world to 
light sphere. */
                                                sce->world = scene->world;
+                                       }
+                                       else if (sce->world) {
+                                               /* Use a default world color. 
Using the current
+                                                * scene world can be slow if 
it has big textures. */
+                                               sce->world->use_nodes = false;
+                                               sce->world->horr = 0.5f;
+                                               sce->world->horg = 0.5f;
+                                               sce->world->horb = 0.5f;
+                                       }
                                }
                                
                                if (sp->pr_method == PR_ICON_RENDER) {
@@ -393,10 +402,6 @@ static Scene *preview_prepare_scene(Main *bmain, Scene 
*scene, ID *id, int id_ty
                                        }
                                        else {
                                                sce->lay = 1 << MA_SPHERE_A;
-
-                                               /* same as above, use current 
scene world to light sphere */
-                                               if 
(BKE_scene_use_new_shading_nodes(scene))
-                                                       sce->world = 
scene->world;
                                        }
                                }
                                else {
@@ -494,6 +499,15 @@ static Scene *preview_prepare_scene(Main *bmain, Scene 
*scene, ID *id, int id_ty
                                        sce->camera = (Object 
*)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name) + 2);
                                }
                        }
+                       else {
+                               if (sce->world) {
+                                       /* Only use lighting from the lamp. */
+                                       sce->world->use_nodes = false;
+                                       sce->world->horr = 0.0f;
+                                       sce->world->horg = 0.0f;
+                                       sce->world->horb = 0.0f;
+                               }
+                       }
                                
                        for (base = sce->base.first; base; base = base->next) {
                                if (base->object->id.name[2] == 'p') {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to