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>2019-08-03 18:22:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-03 18:31:25 +0300
commite82b7f15270eb4e4dbcd119ea09d1f0204f1dc11 (patch)
treea3250de9f9d1ffa7a71737c19fcf80ac18b445ff /source/blender
parent27aef8b551bd30817bac13cfe77d5a142ac0d037 (diff)
3D View: preferences for rotate sensitivity
Added because the current default is too fast for painting with tablets, see D5385. Turntable and trackball have different settings because turn-table uses an angle-per-pixel, where as trackball values are relative to the view-port size so a scale is used. The sensitivity is scaled by the pixel size so hi-dpi views don't rotate faster.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenloader/intern/versioning_280.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c11
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h11
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c15
4 files changed, 33 insertions, 8 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 1a79b7c9b5a..5780221bcc5 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3551,5 +3551,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
/* Versioning code until next subversion bump goes here. */
+ if (U.view_rotate_sensitivity_turntable == 0) {
+ U.view_rotate_sensitivity_turntable = DEG2RADF(0.4f);
+ U.view_rotate_sensitivity_trackball = 1.0f;
+ }
}
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 0d0cfce07d7..62673d9bd5a 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -729,6 +729,10 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2])
angle = (len_v3(dvec) / (2.0f * TRACKBALLSIZE)) * (float)M_PI;
+ /* Before applying the sensitivity this is rotating 1:1,
+ * where the cursor would match the surface of a sphere in the view. */
+ angle *= U.view_rotate_sensitivity_trackball;
+
/* Allow for rotation beyond the interval [-pi, pi] */
angle = angle_wrap_rad(angle);
@@ -751,11 +755,8 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2])
const float zvec_global[3] = {0.0f, 0.0f, 1.0f};
float xaxis[3];
- /* Sensitivity will control how fast the viewport rotates. 0.007 was
- * obtained experimentally by looking at viewport rotation sensitivities
- * on other modeling programs. */
- /* Perhaps this should be a configurable user parameter. */
- const float sensitivity = 0.007f;
+ /* Radians per-pixel. */
+ const float sensitivity = U.view_rotate_sensitivity_turntable / U.pixelsize;
/* Get the 3x3 matrix and its inverse from the quaternion */
quat_to_mat3(m, vod->curr.viewquat);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 2d3d091c65d..b90f1fd16df 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -735,11 +735,16 @@ typedef struct UserDef {
short autokey_flag;
/** Options for text rendering. */
- short text_render;
- char _pad9;
-
+ char text_render;
char navigation_mode;
+ char _pad9[2];
+
+ /** Turn-table rotation amount per-pixel in radians. Scaled with DPI. */
+ float view_rotate_sensitivity_turntable;
+ /** Track-ball rotation scale. */
+ float view_rotate_sensitivity_trackball;
+
/** From texture.h. */
struct ColorBand coba_weight;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 7b7d9e71cd2..e649a95fb06 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -30,6 +30,7 @@
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
+#include "BLI_math_rotation.h"
#include "BLT_translation.h"
@@ -5230,6 +5231,20 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "WalkNavigation");
RNA_def_property_ui_text(prop, "Walk Navigation", "Settings for walk navigation mode");
+ prop = RNA_def_property(srna, "view_rotate_sensitivity_turntable", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, DEG2RADF(0.001f), DEG2RADF(15.0f));
+ RNA_def_property_float_default(prop, DEG2RADF(0.4f));
+ RNA_def_property_ui_range(prop, DEG2RADF(0.001f), DEG2RADF(15.0f), 1.0f, 2);
+ RNA_def_property_ui_text(prop,
+ "Rotate Sensitivity",
+ "Rotation amount per-pixel to control how fast the viewport rotates");
+
+ prop = RNA_def_property(srna, "view_rotate_sensitivity_trackball", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.1f, 10.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_range(prop, 0.1f, 2.0f, 0.01f, 2);
+ RNA_def_property_ui_text(prop, "Rotate Sensitivity", "Scale trackball rotation sensitivity");
+
/* tweak tablet & mouse preset */
prop = RNA_def_property(srna, "drag_threshold_mouse", PROP_INT, PROP_PIXEL);
RNA_def_property_range(prop, 1, 255);