Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Wed, 11 Apr 2018 07:41:49 +0000 (09:41 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 11 Apr 2018 07:41:49 +0000 (09:41 +0200)
1  2 
source/blender/editors/armature/pose_edit.c
source/blender/editors/include/ED_armature.h
source/blender/editors/object/object_edit.c
source/blender/editors/space_outliner/outliner_select.c

index 5b1975a92a0762ca94bb43fa8628a07e12f761a8,d0c467b2d2cd1bcf0f2b752cbe206e4bcf2e86e6..520ecc797aa7f079da89f80039d4afb1f5ed0bcf
@@@ -82,9 -81,8 +82,8 @@@ Object *ED_pose_object_from_context(bCo
  }
  
  /* This function is used to process the necessary updates for */
- bool ED_object_posemode_enter_ex(struct Main *bmain, Base *base)
 -bool ED_object_posemode_enter_ex(Object *ob)
++bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
  {
-       Object *ob = base->object;
        BLI_assert(!ID_IS_LINKED(ob));
        bool ok = false;
        
                case OB_ARMATURE:
                        ob->restore_mode = ob->mode;
                        ob->mode |= OB_MODE_POSE;
 +                      /* Inform all CoW versions that we changed the mode. */
 +                      DEG_id_tag_update_ex(bmain, &ob->id, DEG_TAG_COPY_ON_WRITE);
                        ok = true;
                        break;
                default:
                        break;
@@@ -109,27 -106,30 +109,35 @@@ bool ED_object_posemode_enter(bContext 
                BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
                return false;
        }
 -      bool ok = ED_object_posemode_enter_ex(ob);
 +      struct Main *bmain = CTX_data_main(C);
-       bool ok = ED_object_posemode_enter_ex(bmain, base);
++      bool ok = ED_object_posemode_enter_ex(bmain, ob);
        if (ok) {
                WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL);
        }
        return ok;
  }
  
- void ED_object_posemode_exit(bContext *C, Base *base)
 -bool ED_object_posemode_exit_ex(Object *ob)
++bool ED_object_posemode_exit_ex(struct Main *bmain, Object *ob)
  {
-       if (base) {
-               Object *ob = base->object;
-               
+       bool ok = false;
+       if (ob) {
                ob->restore_mode = ob->mode;
                ob->mode &= ~OB_MODE_POSE;
-               DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE);
 +
 +              /* Inform all CoW versions that we changed the mode. */
 -      bool ok = ED_object_posemode_exit_ex(ob);
++              DEG_id_tag_update_ex(bmain, &ob->id, DEG_TAG_COPY_ON_WRITE);
+               ok = true;
+       }
+       return ok;
+ }
+ bool ED_object_posemode_exit(bContext *C, Object *ob)
+ {
++      struct Main *bmain = CTX_data_main(C);
++      bool ok = ED_object_posemode_exit_ex(bmain, ob);
+       if (ok) {
                WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
        }
+       return ok;
  }
  
  /* if a selected or active bone is protected, throw error (oonly if warn == 1) and return 1 */
index 25e792535e0deb586a9b2096b31ae7f4f73cca5a,ae54dd802eef334fa492c3c3c1b117b1b62a0821..0dcc4f32e43314da910db5c4ce9075053d1ff572
@@@ -205,12 -195,13 +205,13 @@@ void ED_armature_ebone_listbase_free(st
  void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst, struct ListBase *lb_src);
  
  /* poseobject.c */
- void ED_object_posemode_exit(struct bContext *C, struct Base *base);
- bool ED_object_posemode_enter_ex(struct Main *bmain, struct Base *base);
- bool ED_object_posemode_enter(struct bContext *C, struct Base *base);
 -bool ED_object_posemode_exit_ex(struct Object *ob);
++bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob);
+ bool ED_object_posemode_exit(struct bContext *C, struct Object *ob);
 -bool ED_object_posemode_enter_ex(struct Object *ob);
++bool ED_object_posemode_enter_ex(struct Main *bmain, struct Object *ob);
+ bool ED_object_posemode_enter(struct bContext *C, struct Object *ob);
  void ED_pose_de_selectall(struct Object *ob, int select_mode, const bool ignore_visibility);
  void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select);
 -void ED_pose_recalculate_paths(struct Scene *scene, struct Object *ob);
 +void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob);
  struct Object *ED_pose_object_from_context(struct bContext *C);
  
  /* sketch */
index 85f8869a73defdee82ff0325cd6df511acebe048,844ed1681572652ab48f6323227e39007234604e..f4066360805e6fc77d0cc63c58f9ddb830b22bf3
@@@ -527,11 -718,12 +527,11 @@@ static int posemode_exec(bContext *C, w
                }
  
                if (is_mode_set) {
-                       ED_object_posemode_exit(C, base);
+                       ED_object_posemode_exit(C, ob);
                }
                else {
-                       ED_object_posemode_enter(C, base);
+                       ED_object_posemode_enter(C, ob);
                }
 -              
                return OPERATOR_FINISHED;
        }
        
index 5019e3b1696dd82062e9564ab31d366ce636b638,27c96bd023294ba1e09c2925d88ad94cae433c73..2f44420f3b723d5b104dbdbba18ad7a68fbb9dde
@@@ -667,13 -714,16 +667,16 @@@ static eOLDrawState tree_element_active
        }
  
        if (set != OL_SETSEL_NONE) {
-               if (OBEDIT_FROM_VIEW_LAYER(view_layer))
 -              if (scene->obedit) {
++              if (OBEDIT_FROM_VIEW_LAYER(view_layer)) {
                        ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
+               }
                
-               if (ob->mode & OB_MODE_POSE)
-                       ED_object_posemode_exit(C, base);
-               else 
-                       ED_object_posemode_enter(C, base);
+               if (ob->mode & OB_MODE_POSE) {
+                       ED_object_posemode_exit(C, ob);
+               }
+               else {
+                       ED_object_posemode_enter(C, ob);
+               }
        }
        else {
                if (ob->mode & OB_MODE_POSE) {