Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-12-01 19:43:10 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-12-01 19:44:24 +0300
commit18f06186778ea67583a362a611b1efa8c9da5fbd (patch)
tree70f2fd8b2d9f9f0d9c47899d2ea210d1b9d8a71a /source/blender/blenkernel/intern/layer.c
parent9ed522db735b1d798a5d68c6bf547e8123d33a4b (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/intern/layer.c')
-rw-r--r--source/blender/blenkernel/intern/layer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index f525893a854..c591fa4bd80 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1414,6 +1414,11 @@ void BKE_view_layer_renderable_objects_iterator_end(BLI_Iterator *UNUSED(iter))
/** \name BKE_view_layer_bases_in_mode_iterator
* \{ */
+static bool base_is_in_mode(struct ObjectsInModeIteratorData *data, Base *base)
+{
+ return (base->object->type == data->object_type) && (base->object->mode & data->object_mode) != 0;
+}
+
void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_in)
{
struct ObjectsInModeIteratorData *data = data_in;
@@ -1427,7 +1432,12 @@ void BKE_view_layer_bases_in_mode_iterator_begin(BLI_Iterator *iter, void *data_
iter->data = data_in;
iter->current = base;
- if (object_bases_iterator_is_valid(data->v3d, base) == false) {
+ /* default type is active object type */
+ if (data->object_type < 0) {
+ data->object_type = base->object->type;
+ }
+
+ if (object_bases_iterator_is_valid(data->v3d, base) == false || !base_is_in_mode(data, base)) {
BKE_view_layer_bases_in_mode_iterator_next(iter);
}
}
@@ -1449,9 +1459,8 @@ void BKE_view_layer_bases_in_mode_iterator_next(BLI_Iterator *iter)
}
while (base) {
- if ((base->object->type == data->base_active->object->type) &&
- (base != data->base_active) &&
- (base->object->mode & data->object_mode) &&
+ if ((base != data->base_active) &&
+ base_is_in_mode(data, base) &&
object_bases_iterator_is_valid(data->v3d, base))
{
iter->current = base;