[Bf-blender-cvs] [51aba69b893] blender2.8: Transform: expose 3D center/axis calculation
Campbell Barton
noreply at git.blender.org
Thu May 3 07:22:37 CEST 2018
Commit: 51aba69b89372f13ace4a278d9a23999dfd755d9
Author: Campbell Barton
Date: Thu May 3 07:15:34 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB51aba69b89372f13ace4a278d9a23999dfd755d9
Transform: expose 3D center/axis calculation
This is needed for other manipulator placement.
===================================================================
M source/blender/editors/include/ED_transform.h
M source/blender/editors/transform/transform_manipulator.c
===================================================================
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index a6bed6c1ee6..a974b6cfe9e 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -194,4 +194,22 @@ bool snapNodesTransform(
/* return args */
float r_loc[2], float *r_dist_px, char *r_node_border);
+
+#define USE_AXIS_BOUNDS
+
+struct TransformBounds {
+ float center[3]; /* Center for transform widget. */
+ float min[3], max[3]; /* Boundbox of selection for transform widget. */
+
+#ifdef USE_AXIS_BOUNDS
+ /* Normalized axis */
+ float axis[3][3];
+ float axis_min[3], axis_max[3];
+#endif
+};
+
+int ED_transform_calc_manipulator_stats(
+ const struct bContext *C, bool use_only_center,
+ struct TransformBounds *tbounds);
+
#endif /* __ED_TRANSFORM_H__ */
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index a56d057cb3b..6fe44d22114 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -92,8 +92,6 @@
#include "DEG_depsgraph_query.h"
-#define USE_AXIS_BOUNDS
-
/* return codes for select, and drawing flags */
#define MAN_TRANS_X (1 << 0)
@@ -172,17 +170,6 @@ typedef struct ManipulatorGroup {
struct wmManipulator *manipulators[MAN_AXIS_LAST];
} ManipulatorGroup;
-struct TransformBounds {
- float center[3]; /* Center for transform widget. */
- float min[3], max[3]; /* Boundbox of selection for transform widget. */
-
-#ifdef USE_AXIS_BOUNDS
- /* Normalized axis */
- float axis[3][3];
- float axis_min[3], axis_max[3];
-#endif
-};
-
/* -------------------------------------------------------------------- */
/** \name Utilities
* \{ */
@@ -599,7 +586,7 @@ bool gimbal_axis(Object *ob, float gmat[3][3])
/* centroid, boundbox, of selection */
/* returns total items selected */
-static int calc_manipulator_stats(
+int ED_transform_calc_manipulator_stats(
const bContext *C, bool use_only_center,
struct TransformBounds *tbounds)
{
@@ -1261,7 +1248,7 @@ static int manipulator_modal(
struct TransformBounds tbounds;
- if (calc_manipulator_stats(C, true, &tbounds)) {
+ if (ED_transform_calc_manipulator_stats(C, true, &tbounds)) {
manipulator_prepare_mat(C, v3d, rv3d, &tbounds);
WM_manipulator_set_matrix_location(widget, rv3d->twmat[3]);
}
@@ -1421,7 +1408,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, true, &tbounds) == 0)))
+ if ((man->all_hidden = (ED_transform_calc_manipulator_stats(C, true, &tbounds) == 0)))
return;
manipulator_prepare_mat(C, v3d, rv3d, &tbounds);
@@ -1653,7 +1640,7 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmManipulatorGroup
struct TransformBounds tbounds;
- if ((calc_manipulator_stats(C, false, &tbounds) == 0) ||
+ if ((ED_transform_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