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-06-14 11:39:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-14 11:39:36 +0300
commit7449dc8d131561c24bad99a8b057706fb69c3ecb (patch)
treebeb7614e7c87c8d732965db6a830349e7a83ff59 /source/blender/editors/transform
parent4ee97c9a1cbfb4590d939d5a9c11c41aa2be2f56 (diff)
3D View: Tweak transform plane manipulator fading
The threshold to fade out and hide was too small.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform_manipulator_3d.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c
index 9d3ea2ab156..0e96bc79c4d 100644
--- a/source/blender/editors/transform/transform_manipulator_3d.c
+++ b/source/blender/editors/transform/transform_manipulator_3d.c
@@ -107,8 +107,15 @@
#define MAN_SCALE_C (MAN_SCALE_X | MAN_SCALE_Y | MAN_SCALE_Z)
/* threshold for testing view aligned manipulator axis */
-#define TW_AXIS_DOT_MIN 0.02f
-#define TW_AXIS_DOT_MAX 0.1f
+struct {
+ float min, max;
+} g_tw_axis_range[2] = {
+ /* Regular range */
+ {0.02f, 0.1f},
+ /* Use a different range because we flip the dot product,
+ * also the view aligned planes are harder to see so hiding early is preferred. */
+ {0.175f, 0.25f},
+};
/* axes as index */
enum {
@@ -255,7 +262,7 @@ static bool manipulator_is_axis_visible(
if (is_plane) {
idot_axis = 1.0f - idot_axis;
}
- if (idot_axis < TW_AXIS_DOT_MIN) {
+ if (idot_axis < g_tw_axis_range[is_plane].min) {
return false;
}
}
@@ -337,13 +344,16 @@ static void manipulator_get_axis_color(
const int axis_idx_norm = manipulator_orientation_axis(axis_idx, &is_plane);
/* get alpha fac based on axis angle, to fade axis out when hiding it because it points towards view */
if (axis_idx_norm < 3) {
+ const float idot_min = g_tw_axis_range[is_plane].min;
+ const float idot_max = g_tw_axis_range[is_plane].max;
float idot_axis = idot[axis_idx_norm];
if (is_plane) {
idot_axis = 1.0f - idot_axis;
}
- alpha_fac = (idot_axis > TW_AXIS_DOT_MAX) ?
- 1.0f : (idot_axis < TW_AXIS_DOT_MIN) ?
- 0.0f : ((idot_axis - TW_AXIS_DOT_MIN) / (TW_AXIS_DOT_MAX - TW_AXIS_DOT_MIN));
+ alpha_fac = (
+ (idot_axis > idot_max) ?
+ 1.0f : (idot_axis < idot_min) ?
+ 0.0f : ((idot_axis - idot_min) / (idot_max - idot_min)));
}
else {
/* trackball rotation axis is a special case, we only draw a slight overlay */