Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Wed, 11 Apr 2018 07:02:32 +0000 (09:02 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 11 Apr 2018 07:02:32 +0000 (09:02 +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 15ffd09ebd460182155dd18b7269e978dddaf167,f1ae006f958ec3ce8a4edf192cf99a2a3a8696e3..5b1975a92a0762ca94bb43fa8628a07e12f761a8
@@@ -82,34 -81,40 +82,42 @@@ Object *ED_pose_object_from_context(bCo
  }
  
  /* This function is used to process the necessary updates for */
- void ED_armature_enter_posemode(bContext *C, Base *base)
 -bool ED_object_posemode_enter_ex(Base *base)
++bool ED_object_posemode_enter_ex(struct Main *bmain, Base *base)
  {
-       ReportList *reports = CTX_wm_reports(C);
        Object *ob = base->object;
-       
-       if (ID_IS_LINKED(ob)) {
-               BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
-               return;
-       }
+       BLI_assert(!ID_IS_LINKED(ob));
+       bool ok = false;
        
        switch (ob->type) {
                case OB_ARMATURE:
                        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);
-                       WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL);
-                       
 +                      /* 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:
-                       return;
+                       break;
        }
-       
-       /* XXX: disabled as this would otherwise cause a nasty loop... */
-       //ED_object_mode_toggle(C, ob->mode);
+       return ok;
+ }
+ bool ED_object_posemode_enter(bContext *C, Base *base)
+ {
+       ReportList *reports = CTX_wm_reports(C);
+       if (ID_IS_LINKED(base->object)) {
+               BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
+               return false;
+       }
 -      bool ok = ED_object_posemode_enter_ex(base);
++      struct Main *bmain = CTX_data_main(C);
++      bool ok = ED_object_posemode_enter_ex(bmain, base);
+       if (ok) {
+               WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL);
+       }
+       return ok;
  }
  
- void ED_armature_exit_posemode(bContext *C, Base *base)
+ void ED_object_posemode_exit(bContext *C, Base *base)
  {
        if (base) {
                Object *ob = base->object;
index 0181cc20cdc0da81773df2e6a2accfe923e2d12b,2089f81b0d7c0ed8aed4f4f51c1b7120739f96ff..25e792535e0deb586a9b2096b31ae7f4f73cca5a
@@@ -205,11 -195,12 +205,12 @@@ 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_armature_exit_posemode(struct bContext *C, struct Base *base);
- void ED_armature_enter_posemode(struct bContext *C, struct Base *base);
+ void ED_object_posemode_exit(struct bContext *C, struct Base *base);
 -bool ED_object_posemode_enter_ex(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);
  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 bfe0194fe42c9b03d8aeb0bc84c687066684e293,0eda9668c477aa3f6278d2bc7fc24266d57174b4..85f8869a73defdee82ff0325cd6df511acebe048
@@@ -523,13 -714,16 +523,15 @@@ static int posemode_exec(bContext *C, w
        if (ob->type == OB_ARMATURE) {
                if (ob == CTX_data_edit_object(C)) {
                        ED_object_editmode_exit(C, EM_FREEDATA | EM_DO_UNDO);
-                       ED_armature_enter_posemode(C, base);
+                       is_mode_set = false;
                }
-               else if (is_mode_set)
-                       ED_armature_exit_posemode(C, base);
-               else
-                       ED_armature_enter_posemode(C, base);
  
 -              
+               if (is_mode_set) {
+                       ED_object_posemode_exit(C, base);
+               }
+               else {
+                       ED_object_posemode_enter(C, base);
+               }
                return OPERATOR_FINISHED;
        }