diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-01-31 15:01:52 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-02-06 11:46:20 +0300 |
commit | b294600ddcf17183869e61d878f2801efd52d65d (patch) | |
tree | 95eb9a49829be6ca348e6fd5f223119ed4d88f37 /source/blender/editors/space_view3d | |
parent | 2d5e2de88b9cc9837ad4c7e8c16809303ed16aa1 (diff) |
Fix T61051: crash with multi-object mixed mode snapping
rBec3357e03ab1 introduced multi-object snapping.
Seems like this was done without mixed-mode selections in mind.
So code assumed that all selected objects are actually armatures [which
can fail].
In 2.7 this was not a problem, because code only took active object into
account, 2.8 was iterating over all selected_editable_objects.
Now just iterate over objects in posemode instead
Reviewers: brecht, dfelinto
Maniphest Tasks: T61051
Differential Revision: https://developer.blender.org/D4287
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 47b08557222..506d8f31bb0 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -308,8 +308,12 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global } else if (obact && (obact->mode & OB_MODE_POSE)) { struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID); - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) - { + ViewLayer *view_layer = CTX_data_view_layer(C); + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, CTX_wm_view3d(C), + &objects_len, OB_MODE_POSE); + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *ob = objects[ob_index]; bPoseChannel *pchan; bArmature *arm = ob->data; float snap_target_local[3]; @@ -373,7 +377,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); } - CTX_DATA_END; + MEM_freeN(objects); } else { struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID); |