mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Metaball transform, support active-only option
This commit is contained in:
parent
164841e30e
commit
d2ed5563d7
2 changed files with 34 additions and 18 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Rotation of MetaElem is stored in quat */
|
||||
quat_to_mat3(qmat, mb->lastelem->quat);
|
||||
|
||||
copy_v3_v3(normal, qmat[2]);
|
||||
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue