Commit: b330804ff3eca68cdd65e26d551d1829fae5ff36
Author: Campbell Barton
Date:   Wed Feb 14 01:06:41 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBb330804ff3eca68cdd65e26d551d1829fae5ff36

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/editors/include/ED_object.h
index 94ee228f4f8,8456c15c79d..757a463f171
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@@ -126,6 -120,7 +126,8 @@@ void ED_object_toggle_modes(struct bCon
  #define EM_WAITCURSOR   4
  #define EM_DO_UNDO      8
  #define EM_IGNORE_LAYER 16
 -void ED_object_editmode_exit_ex(struct bContext *C, struct Scene *scene, 
struct Object *obedit, int flag);
++void ED_object_editmode_exit_ex(
++        struct bContext *C, struct WorkSpace *workspace, struct Scene *scene, 
struct Object *obedit, int flag);
  void ED_object_editmode_exit(struct bContext *C, int flag);
  void ED_object_editmode_enter(struct bContext *C, int flag);
  bool ED_object_editmode_load(struct Object *obedit);
diff --cc source/blender/editors/object/object_edit.c
index a74af68ca7d,dc010ac40ec..03c497bcef0
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@@ -260,21 -441,25 +260,23 @@@ bool ED_object_editmode_load(Object *ob
        return ED_object_editmode_load_ex(G.main, obedit, false);
  }
  
- void ED_object_editmode_exit(bContext *C, int flag)
+ /**
+  * \param C: Can be NULL, only if #EM_DO_UNDO isn't set.
+  * \param flag:
+  * - Only in exceptional cases should #EM_DO_UNDO NOT be in the flag.
+  * - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly.
+  */
 -void ED_object_editmode_exit_ex(bContext *C, Scene *scene, Object *obedit, 
int flag)
++void ED_object_editmode_exit_ex(bContext *C, WorkSpace *workspace, Scene 
*scene, Object *obedit, int flag)
  {
-       /* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the 
flag */
-       /* Note! if 'EM_FREEDATA' isn't in the flag, use 
ED_object_editmode_load directly */
-       WorkSpace *workspace = CTX_wm_workspace(C);
-       Scene *scene = CTX_data_scene(C);
-       Object *obedit = CTX_data_edit_object(C);
+       BLI_assert(C || !(flag & EM_DO_UNDO));
        const bool freedata = (flag & EM_FREEDATA) != 0;
  
        if (flag & EM_WAITCURSOR) waitcursor(1);
  
-       if (ED_object_editmode_load_ex(CTX_data_main(C), obedit, freedata) == 
false) {
+       if (ED_object_editmode_load_ex(G.main, obedit, freedata) == false) {
                /* in rare cases (background mode) its possible active object
                 * is flagged for editmode, without 'obedit' being set [#35489] 
*/
 -              if (UNLIKELY(scene->basact && (scene->basact->object->mode & 
OB_MODE_EDIT))) {
 -                      scene->basact->object->mode &= ~OB_MODE_EDIT;
 -              }
 +              workspace->object_mode &= ~OB_MODE_EDIT;
                if (flag & EM_WAITCURSOR) waitcursor(0);
                return;
        }
@@@ -303,17 -488,25 +305,29 @@@
                if (flag & EM_DO_UNDO)
                        ED_undo_push(C, "Editmode");
  
-               WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, 
scene);
+               if (C != NULL) {
+                       WM_event_add_notifier(C, NC_SCENE | ND_MODE | 
NS_MODE_OBJECT, scene);
+               }
+               else {
+                       WM_main_add_notifier(NC_SCENE | ND_MODE | 
NS_MODE_OBJECT, scene);
+               }
  
 -              obedit->mode &= ~OB_MODE_EDIT;
 +              workspace->object_mode &= ~OB_MODE_EDIT;
        }
  
        if (flag & EM_WAITCURSOR) waitcursor(0);
 +
 +      /* This way we ensure scene's obedit is copied into all CoW scenes.  */
 +      DEG_id_tag_update(&scene->id, 0);
  }
  
+ void ED_object_editmode_exit(bContext *C, int flag)
+ {
++      WorkSpace *workspace = CTX_wm_workspace(C);
+       Scene *scene = CTX_data_scene(C);
+       Object *obedit = CTX_data_edit_object(C);
 -      ED_object_editmode_exit_ex(C, scene, obedit, flag);
++      ED_object_editmode_exit_ex(C, workspace, scene, obedit, flag);
+ }
  
  void ED_object_editmode_enter(bContext *C, int flag)
  {
diff --cc source/blender/editors/render/render_preview.c
index 2e3091268a9,e52dd7c65c8..c76a6aa175a
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@@ -454,22 -382,26 +454,27 @@@ static Scene *preview_prepare_scene(Mai
                                        }
                                }
                                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;
 +                                              sce->world = 
preview_get_localized_world(sp, 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) {
                                        if (mat->material_type == MA_TYPE_HALO) 
{
 -                                              sce->lay = 1 << MA_FLAT;
 +                                              set_preview_layer(view_layer, 
MA_FLAT);
                                        }
                                        else {
 -                                              sce->lay = 1 << MA_SPHERE_A;
 +                                              set_preview_layer(view_layer, 
MA_SPHERE_A);
- 
-                                               /* same as above, use current 
scene world to light sphere */
-                                               if 
(BKE_scene_use_new_shading_nodes(scene))
-                                                       sce->world = 
preview_get_localized_world(sp, scene->world);
                                        }
                                }
                                else {
@@@ -568,10 -500,16 +573,18 @@@
                                }
                        }
                        else {
 +                              set_preview_layer(view_layer, MA_LAMP);
++
+                               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) {
 +                      for (Base *base = view_layer->object_bases.first; base; 
base = base->next) {
                                if (base->object->id.name[2] == 'p') {
                                        if (base->object->type == OB_LAMP)
                                                base->object->data = la;

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

Reply via email to