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:
authorCampbell Barton <ideasman42@gmail.com>2014-05-09 14:23:04 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-09 14:23:04 +0400
commitd2ed5563d7127a44571e3518f535d71d0bdaf1ae (patch)
tree9807a524ad886ea7108ece016baf03991ea08f49
parent164841e30eddcfbb874a7dbcef72ba851074b5ee (diff)
Metaball transform, support active-only option
-rw-r--r--source/blender/editors/transform/transform_manipulator.c19
-rw-r--r--source/blender/editors/transform/transform_orientations.c33
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) {