diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-01 19:43:10 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-01 19:44:24 +0300 |
commit | 18f06186778ea67583a362a611b1efa8c9da5fbd (patch) | |
tree | 70f2fd8b2d9f9f0d9c47899d2ea210d1b9d8a71a /source/blender/blenkernel/BKE_layer.h | |
parent | 9ed522db735b1d798a5d68c6bf547e8123d33a4b (diff) |
Fix T58412: in weight paint + pose mode certain armature operations crash.
The cause is that FOREACH_OBJECT_IN_MODE_BEGIN assumed that the active
object is in the correct mode, which is wrong in this case. It also
only considered objects of the same type as active, which had to be
replaced with an explicit type parameter.
Diffstat (limited to 'source/blender/blenkernel/BKE_layer.h')
-rw-r--r-- | source/blender/blenkernel/BKE_layer.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index e98fa189379..db363148bc8 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -160,6 +160,7 @@ void BKE_view_layer_selected_editable_objects_iterator_end(BLI_Iterator *iter); struct ObjectsInModeIteratorData { int object_mode; + int object_type; struct ViewLayer *view_layer; struct View3D *v3d; struct Base *base_active; @@ -226,10 +227,11 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter); ITER_END; \ } ((void)0) -#define FOREACH_BASE_IN_MODE_BEGIN(_view_layer, _v3d, _object_mode, _instance) \ +#define FOREACH_BASE_IN_MODE_BEGIN(_view_layer, _v3d, _object_type, _object_mode, _instance) \ { \ struct ObjectsInModeIteratorData data_ = { \ .object_mode = _object_mode, \ + .object_type = _object_type, \ .view_layer = _view_layer, \ .v3d = _v3d, \ .base_active = _view_layer->basact, \ @@ -244,20 +246,20 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter); } ((void)0) #define FOREACH_BASE_IN_EDIT_MODE_BEGIN(_view_layer, _v3d, _instance) \ - FOREACH_BASE_IN_MODE_BEGIN(_view_layer, _v3d, OB_MODE_EDIT, _instance) + FOREACH_BASE_IN_MODE_BEGIN(_view_layer, _v3d, -1, OB_MODE_EDIT, _instance) #define FOREACH_BASE_IN_EDIT_MODE_END \ FOREACH_BASE_IN_MODE_END -#define FOREACH_OBJECT_IN_MODE_BEGIN(_view_layer, _v3d, _object_mode, _instance) \ - FOREACH_BASE_IN_MODE_BEGIN(_view_layer, _v3d, _object_mode, _base) { \ +#define FOREACH_OBJECT_IN_MODE_BEGIN(_view_layer, _v3d, _object_type, _object_mode, _instance) \ + FOREACH_BASE_IN_MODE_BEGIN(_view_layer, _v3d, _object_type, _object_mode, _base) { \ Object *_instance = _base->object; #define FOREACH_OBJECT_IN_MODE_END \ } FOREACH_BASE_IN_MODE_END -#define FOREACH_OBJECT_IN_EDIT_MODE_BEGIN(_view_layer, _instance) \ - FOREACH_BASE_IN_EDIT_MODE_BEGIN(_view_layer, _base) { \ +#define FOREACH_OBJECT_IN_EDIT_MODE_BEGIN(_view_layer, _v3d, _instance) \ + FOREACH_BASE_IN_EDIT_MODE_BEGIN(_view_layer, _v3d, _base) { \ Object *_instance = _base->object; #define FOREACH_OBJECT_IN_EDIT_MODE_END \ |