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.
This commit is contained in:
parent
27aef8b551
commit
e82b7f1527
Notes:
blender-bot
2023-02-14 00:41:49 +01:00
Referenced by issue #79787, The sensitivity of 3D view navigation depends on Line Width preference Referenced by issue #71791, Can't rotate the view Referenced by issue #70196, Viewport rotation frozen at startup due to config and startup/blend state
|
@ -16,9 +16,14 @@
|
|||
|
||||
/* Preferences Data File 'U_default'. */
|
||||
|
||||
/* For constants. */
|
||||
#include <math.h>
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
|
||||
#include "BLI_math_rotation.h"
|
||||
|
||||
#include "BKE_blender_version.h"
|
||||
|
||||
const UserDef U_default = {
|
||||
|
@ -153,6 +158,8 @@ const UserDef U_default = {
|
|||
.autokey_flag = AUTOKEY_FLAG_XYZ2RGB,
|
||||
.text_render = 0,
|
||||
.navigation_mode = VIEW_NAVIGATION_WALK,
|
||||
.view_rotate_sensitivity_turntable = DEG2RAD(0.4),
|
||||
.view_rotate_sensitivity_trackball = 1.0f,
|
||||
|
||||
/** Initialized by #BKE_colorband_init. */
|
||||
.coba_weight = {0},
|
||||
|
|
|
@ -1459,6 +1459,11 @@ class USERPREF_PT_navigation_orbit(PreferencePanel, Panel):
|
|||
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
|
||||
|
||||
flow.row().prop(inputs, "view_rotate_method", expand=True)
|
||||
if inputs.view_rotate_method == 'TURNTABLE':
|
||||
flow.prop(inputs, "view_rotate_sensitivity_turntable")
|
||||
else:
|
||||
flow.prop(inputs, "view_rotate_sensitivity_trackball")
|
||||
|
||||
flow.prop(inputs, "use_rotate_around_active")
|
||||
flow.prop(inputs, "use_auto_perspective")
|
||||
flow.prop(inputs, "use_mouse_depth_navigate")
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue