diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-30 16:21:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-30 16:33:05 +0300 |
commit | 5954a5c465fed21d19feb4bda3e42448ea003b39 (patch) | |
tree | 551b16aa01d3f212169018aced6d0a9366909b0a /source/blender | |
parent | 375c1eab65ddf0a96097a168950f5c8b3ec9e2e3 (diff) |
Object Modes: pose support for generic mode exit
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/include/ED_object.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_modes.c | 16 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_object_enums.h | 3 |
3 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index efa779c29a1..a5125ce7470 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -216,6 +216,7 @@ bool ED_object_mode_generic_enter( struct bContext *C, eObjectMode object_mode); void ED_object_mode_generic_exit( + struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); bool ED_object_mode_generic_has_data( diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index 7a30c154f23..66c2ad5fa9b 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -45,6 +45,7 @@ #include "DEG_depsgraph.h" +#include "ED_armature.h" #include "ED_screen.h" #include "ED_object.h" /* own include */ @@ -197,10 +198,12 @@ bool ED_object_mode_generic_enter( * Caller can check #OB_MODE_ALL_MODE_DATA to test if this needs to be run. */ static bool ed_object_mode_generic_exit_ex( + struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, bool only_test) { + BLI_assert((bmain == NULL) == only_test); if (ob->mode & OB_MODE_EDIT) { if (BKE_object_is_in_editmode(ob)) { if (only_test) { @@ -233,6 +236,14 @@ static bool ed_object_mode_generic_exit_ex( ED_object_sculptmode_exit_ex(depsgraph, scene, ob); } } + else if (ob->mode & OB_MODE_POSE) { + if (ob->pose != NULL) { + if (only_test) { + return true; + } + ED_object_posemode_exit_ex(bmain, ob); + } + } else { if (only_test) { return false; @@ -244,17 +255,18 @@ static bool ed_object_mode_generic_exit_ex( } void ED_object_mode_generic_exit( + struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob) { - ed_object_mode_generic_exit_ex(depsgraph, scene, ob, false); + ed_object_mode_generic_exit_ex(bmain, depsgraph, scene, ob, false); } bool ED_object_mode_generic_has_data( struct Depsgraph *depsgraph, struct Object *ob) { - return ed_object_mode_generic_exit_ex(depsgraph, NULL, ob, true); + return ed_object_mode_generic_exit_ex(NULL, depsgraph, NULL, ob, true); } /** \} */ diff --git a/source/blender/makesdna/DNA_object_enums.h b/source/blender/makesdna/DNA_object_enums.h index 524c85948f3..802ca6c7d0d 100644 --- a/source/blender/makesdna/DNA_object_enums.h +++ b/source/blender/makesdna/DNA_object_enums.h @@ -47,6 +47,7 @@ typedef enum eObjectMode { #define OB_MODE_ALL_SCULPT (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) /* Any mode that has data we need to free when switching modes, see: #ED_object_mode_generic_exit */ -#define OB_MODE_ALL_MODE_DATA (OB_MODE_EDIT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_SCULPT) +#define OB_MODE_ALL_MODE_DATA \ + (OB_MODE_EDIT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_SCULPT | OB_MODE_POSE) #endif /* __DNA_OBJECT_ENUMS_H__ */ |