diff options
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform_manipulator.c | 19 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 33 |
2 files changed, 34 insertions, 18 deletions
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index f94fec341c5..125975eb32b 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -450,16 +450,19 @@ int calc_manipulator_stats(const bContext *C) } else if (obedit->type == OB_MBALL) { MetaBall *mb = (MetaBall *)obedit->data; - MetaElem *ml /* , *ml_sel = NULL */ /* UNUSED */; + MetaElem *ml; - ml = mb->editelems->first; - while (ml) { - if (ml->flag & SELECT) { - calc_tw_center(scene, &ml->x); - /* ml_sel = ml; */ /* UNUSED */ - totsel++; + if ((v3d->around == V3D_ACTIVE) && (ml = mb->lastelem)) { + calc_tw_center(scene, &ml->x); + totsel++; + } + else { + for (ml = mb->editelems->first; ml; ml = ml->next) { + if (ml->flag & SELECT) { + calc_tw_center(scene, &ml->x); + totsel++; + } } - ml = ml->next; } } else if (obedit->type == OB_LATTICE) { diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index f8c06e307b9..ba90926df3b 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -795,18 +795,31 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } else if (obedit->type == OB_MBALL) { MetaBall *mb = obedit->data; + MetaElem *ml; + bool ok = false; + float tmat[3][3]; - if (mb->lastelem) { - float qmat[3][3]; - - /* Rotation of MetaElem is stored in quat */ - quat_to_mat3(qmat, mb->lastelem->quat); - - copy_v3_v3(normal, qmat[2]); + if (activeOnly && (ml = mb->lastelem)) { + quat_to_mat3(tmat, ml->quat); + add_v3_v3(normal, tmat[2]); + add_v3_v3(plane, tmat[1]); + ok = true; + } + else { + for (ml = mb->editelems->first; ml; ml = ml->next) { + if (ml->flag & SELECT) { + quat_to_mat3(tmat, ml->quat); + add_v3_v3(normal, tmat[2]); + add_v3_v3(plane, tmat[1]); + ok = true; + } + } + } - copy_v3_v3(plane, qmat[1]); - - result = ORIENTATION_FACE; + if (ok) { + if (!is_zero_v3(plane)) { + result = ORIENTATION_FACE; + } } } else if (obedit->type == OB_ARMATURE) { |