[Bf-blender-cvs] [3d904d7650c] blender2.8: Manipulator: Use object bound-box for scale cage
Campbell Barton
noreply at git.blender.org
Thu Oct 26 07:13:17 CEST 2017
Commit: 3d904d7650c0a74e494f3ea94b0df3e10292812a
Author: Campbell Barton
Date: Tue Oct 24 12:40:52 2017 +1100
Branches: blender2.8
https://developer.blender.org/rB3d904d7650c0a74e494f3ea94b0df3e10292812a
Manipulator: Use object bound-box for scale cage
Without this, scaling single objects wasn't working usefully.
===================================================================
M source/blender/editors/transform/transform_manipulator.c
===================================================================
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index a540fe58877..1fa62556bd5 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -584,7 +584,9 @@ bool gimbal_axis(Object *ob, float gmat[3][3])
/* centroid, boundbox, of selection */
/* returns total items selected */
-static int calc_manipulator_stats(const bContext *C, struct TransformBounds *tbounds)
+static int calc_manipulator_stats(
+ const bContext *C, bool use_only_center,
+ struct TransformBounds *tbounds)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
@@ -1004,7 +1006,16 @@ static int calc_manipulator_stats(const bContext *C, struct TransformBounds *tbo
if (TESTBASELIB_NEW(base)) {
if (ob == NULL)
ob = base->object;
- calc_tw_center(tbounds, base->object->obmat[3]);
+ if (use_only_center || base->object->bb == NULL) {
+ calc_tw_center(tbounds, base->object->obmat[3]);
+ }
+ else {
+ for (uint j = 0; j < 8; j++) {
+ float co[3];
+ mul_v3_m4v3(co, base->object->obmat, base->object->bb->vec[j]);
+ calc_tw_center(tbounds, co);
+ }
+ }
protectflag_to_drawflags(base->object->protectflag, &rv3d->twdrawflag);
totsel++;
}
@@ -1181,7 +1192,7 @@ static int manipulator_modal(
struct TransformBounds tbounds;
- if (calc_manipulator_stats(C, &tbounds)) {
+ if (calc_manipulator_stats(C, true, &tbounds)) {
manipulator_prepare_mat(C, v3d, rv3d, &tbounds);
WM_manipulator_set_matrix_location(widget, rv3d->twmat[3]);
}
@@ -1317,7 +1328,7 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
struct TransformBounds tbounds;
/* skip, we don't draw anything anyway */
- if ((man->all_hidden = (calc_manipulator_stats(C, &tbounds) == 0)))
+ if ((man->all_hidden = (calc_manipulator_stats(C, true, &tbounds) == 0)))
return;
manipulator_prepare_mat(C, v3d, rv3d, &tbounds);
@@ -1524,7 +1535,7 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmManipulatorGroup
struct TransformBounds tbounds;
- if ((calc_manipulator_stats(C, &tbounds) == 0) ||
+ if ((calc_manipulator_stats(C, false, &tbounds) == 0) ||
equals_v3v3(rv3d->tw_axis_min, rv3d->tw_axis_max))
{
WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true);
More information about the Bf-blender-cvs
mailing list