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>2018-05-03 08:15:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-03 08:19:33 +0300
commit51aba69b89372f13ace4a278d9a23999dfd755d9 (patch)
tree1084e659481ae93f0692f7bf84076baa11d33291
parentf5cb96704bcdbd94cc7dacfef51c8028c28f4c4d (diff)
Transform: expose 3D center/axis calculation
This is needed for other manipulator placement.
-rw-r--r--source/blender/editors/include/ED_transform.h18
-rw-r--r--source/blender/editors/transform/transform_manipulator.c21
2 files changed, 22 insertions, 17 deletions
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);