Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Tue, 10 Apr 2018 18:17:56 +0000 (20:17 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 10 Apr 2018 18:17:56 +0000 (20:17 +0200)
1  2 
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/include/ED_object.h
source/blender/editors/object/object_add.c
source/blender/editors/object/object_edit.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tools.c

index 2f9d32eadb6ab0a0e080e3dd921e58896fb386e5,8b922082fe8cc98cf4ea8b0f3bcaae8d1fc9778a..4af8089ffea501282d6e8a8cbe6c93a280d736fd
@@@ -2725,8 -2720,8 +2725,8 @@@ static int mouse_anim_channels(bContex
                                        adt->flag |= ADT_UI_ACTIVE;
  
                                /* ensure we exit editmode on whatever object was active before to avoid getting stuck there - T48747 */
 -                              if (ob != sce->obedit)
 +                              if (ob != CTX_data_edit_object(C))
-                                       ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
+                                       ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
  
                                notifierFlags |= (ND_ANIMCHAN | NA_SELECTED);
                        }
index ebd9313f7c5ee2325c38bb4972c085db4b3744aa,11dde2f5913d00265168ca7262e64f1b5c4814aa..831190622037bece44ae506a60b0c66d8c0ee4b2
@@@ -119,13 -112,13 +119,14 @@@ struct Base *ED_object_add_duplicate(st
  void ED_object_parent(struct Object *ob, struct Object *parent, const int type, const char *substr);
  
  /* bitflags for enter/exit editmode */
- #define EM_FREEDATA     1
- #define EM_FREEUNDO     2
- #define EM_WAITCURSOR   4
- #define EM_DO_UNDO      8
- #define EM_IGNORE_LAYER 16
+ enum {
+       EM_FREEDATA         = (1 << 0),
+       EM_WAITCURSOR       = (1 << 1),
+       EM_DO_UNDO          = (1 << 2),
+       EM_IGNORE_LAYER     = (1 << 3),
+ };
 -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 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);
index bfeb48f9308c41281eb5f8fa6eea7e570028ba5d,c6820c83f95c359a8e6417a47c7440c41e07511e..4334a80cd3953976a58a6ecd521d02ec7a183c04
@@@ -432,15 -413,16 +432,15 @@@ Object *ED_object_add_type
  
        /* for as long scene has editmode... */
        if (CTX_data_edit_object(C)) 
-               ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);  /* freedata, and undo */
+               ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);  /* freedata, and undo */
  
        /* deselects all, sets scene->basact */
 -      ob = BKE_object_add(bmain, scene, type, name);
 -      BASACT->lay = ob->lay = layer;
 +      ob = BKE_object_add(bmain, scene, view_layer, type, name);
        /* editor level activate, notifiers */
 -      ED_base_object_activate(C, BASACT);
 +      ED_object_base_activate(C, view_layer->basact);
  
        /* more editor stuff */
 -      ED_object_base_init_transform(C, BASACT, loc, rot);
 +      ED_object_base_init_transform(C, view_layer->basact, loc, rot);
  
        /* Ignore collisions by default for non-mesh objects */
        if (type != OB_MESH) {
index bfa8633ab7d1986371d14ea0462a6e14485f687a,305afc206c45ef8972ef190bc5634a8a8e283f0a..6626eeb19f4be983deaee435fec5dc7d5f3cd734
@@@ -194,8 -240,8 +194,8 @@@ static eOLDrawState tree_element_set_ac
                }
        }
        
 -      if (ob != scene->obedit)
 +      if (ob != OBEDIT_FROM_VIEW_LAYER(view_layer))
-               ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
+               ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
                
        return OL_DRAWSEL_NORMAL;
  }
@@@ -667,8 -714,8 +667,8 @@@ static eOLDrawState tree_element_active
        }
  
        if (set != OL_SETSEL_NONE) {
 -              if (scene->obedit)
 +              if (OBEDIT_FROM_VIEW_LAYER(view_layer))
-                       ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
+                       ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
                
                if (ob->mode & OB_MODE_POSE)
                        ED_armature_exit_posemode(C, base);
index c19dcc0e1cbfd1eac37657b06afd601b33fd36eb,e8275d597a6073b292e90b23d27b9a8d5fe9ddb4..735e2b5a37aae59b6f0e8779cecbf3e4fa63310d
@@@ -419,10 -417,10 +419,10 @@@ static void object_delete_cb
                }
  
                // check also library later
 -              if (scene->obedit == base->object)
 +              if (ob == CTX_data_edit_object(C)) {
-                       ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
+                       ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
 -              
 -              ED_base_object_free_and_unlink(CTX_data_main(C), scene, base);
 +              }
 +              ED_object_base_free_and_unlink(CTX_data_main(C), scene, ob);
                /* leave for ED_outliner_id_unref to handle */
  #if 0
                te->directdata = NULL;