diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-07-02 11:50:31 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-07-03 18:51:13 +0300 |
commit | c6a199e2542b41b8f75a967579b1180d25196084 (patch) | |
tree | e5af4071cef0dd1a084f39803ad182506847e30a /source/blender/editors/transform | |
parent | 5277557755eb32a527addbf47e09de3a781f96ed (diff) |
Fix T66311: skin resize (ctrl+a) could crash
could happen when used on multiple objects with multi edit, and skin
modifier was not present on all participating objects
Reviewers: brecht
Maniphest Tasks: T66311
Differential Revision: https://developer.blender.org/D5165
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 15 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 23 |
2 files changed, 28 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 1ed0d5e9221..95c2f088e5d 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2935,11 +2935,16 @@ static void VertsToTransData(TransInfo *t, } else if (t->mode == TFM_SKIN_RESIZE) { MVertSkin *vs = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MVERT_SKIN); - /* skin node size */ - td->ext = tx; - copy_v3_v3(tx->isize, vs->radius); - tx->size = vs->radius; - td->val = vs->radius; + if (vs) { + /* skin node size */ + td->ext = tx; + copy_v3_v3(tx->isize, vs->radius); + tx->size = vs->radius; + td->val = vs->radius; + } + else { + td->flag |= TD_SKIP; + } } else if (t->mode == TFM_SHRINKFATTEN) { td->ext = tx; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index f028f2dc506..60518e34990 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -33,6 +33,7 @@ #include "BKE_global.h" #include "BKE_report.h" #include "BKE_editmesh.h" +#include "BKE_layer.h" #include "BKE_scene.h" #include "RNA_access.h" @@ -756,12 +757,24 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot) static bool skin_resize_poll(bContext *C) { - struct Object *obedit = CTX_data_edit_object(C); - if (obedit && obedit->type == OB_MESH) { - BMEditMesh *em = BKE_editmesh_from_object(obedit); - return (em && CustomData_has_layer(&em->bm->vdata, CD_MVERT_SKIN)); + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data( + CTX_data_view_layer(C), CTX_wm_view3d(C), &objects_len); + + bool ok = false; + + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *obedit = objects[ob_index]; + if (obedit->type == OB_MESH) { + BMEditMesh *em = BKE_editmesh_from_object(obedit); + if (em && CustomData_has_layer(&em->bm->vdata, CD_MVERT_SKIN)) { + ok = true; + } + } } - return 0; + MEM_freeN(objects); + + return ok; } static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot) |