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 <campbell@blender.org>2022-02-23 13:25:46 +0300
committerCampbell Barton <campbell@blender.org>2022-02-23 13:25:46 +0300
commit391c3848b1326db1c29fc5c5f791d732d7d282a3 (patch)
tree9c835b3618a8177b5b724454f635e0f19d0f171d
parent34294449059744ba4b3d4b16eb5fb14a48c16265 (diff)
NDOF: make camera view/pan behavior optional
User request since adding this option in: 51975b89edfcc02131f1f8248e1b3442ea2778fa When disabled, use the previous behavior when orbiting a camera view.
-rw-r--r--release/datafiles/userdef/userdef_default.c2
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py1
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate_ndof.c16
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c7
7 files changed, 25 insertions, 8 deletions
diff --git a/release/datafiles/userdef/userdef_default.c b/release/datafiles/userdef/userdef_default.c
index 34168cc0126..7cf8158c42d 100644
--- a/release/datafiles/userdef/userdef_default.c
+++ b/release/datafiles/userdef/userdef_default.c
@@ -144,7 +144,7 @@ const UserDef U_default = {
* so invert this by default, see: T67579. */
NDOF_ROTX_INVERT_AXIS | NDOF_ROTY_INVERT_AXIS | NDOF_ROTZ_INVERT_AXIS |
NDOF_PANX_INVERT_AXIS | NDOF_PANY_INVERT_AXIS | NDOF_PANZ_INVERT_AXIS |
- NDOF_ZOOM_INVERT),
+ NDOF_ZOOM_INVERT | NDOF_CAMERA_PAN_ZOOM),
.image_draw_method = IMAGE_DRAW_METHOD_AUTO,
.glalphaclip = 0.004,
.autokey_mode = (AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON),
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index fc1911910c4..f80ad378b3c 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1718,6 +1718,7 @@ class USERPREF_PT_ndof_settings(Panel):
if show_3dview_settings:
col.prop(props, "ndof_show_guide")
col.prop(props, "ndof_zoom_invert")
+ col.prop(props, "ndof_lock_camera_pan_zoom")
row = col.row(heading="Pan")
row.prop(props, "ndof_pan_yz_swap_axis", text="Swap Y and Z Axes")
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index d09b0a02ad8..6f22e45d8d5 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -31,7 +31,7 @@ extern "C" {
* version. Older Blender versions will test this and show a warning if the file
* was written with too new a version. */
#define BLENDER_FILE_MIN_VERSION 300
-#define BLENDER_FILE_MIN_SUBVERSION 42
+#define BLENDER_FILE_MIN_SUBVERSION 43
/** User readable version string. */
const char *BKE_blender_version_string(void);
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 8685a0fa62d..10160e9aadc 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -948,6 +948,10 @@ void blo_do_versions_userdef(UserDef *userdef)
}
}
+ if (!USER_VERSION_ATLEAST(300, 43)) {
+ userdef->ndof_flag |= NDOF_CAMERA_PAN_ZOOM;
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/editors/space_view3d/view3d_navigate_ndof.c b/source/blender/editors/space_view3d/view3d_navigate_ndof.c
index 67b48154e8c..6b77f464773 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_ndof.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_ndof.c
@@ -500,9 +500,11 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
return OPERATOR_CANCELLED;
}
- const int camera_retval = view3d_ndof_cameraview_pan_zoom(C, event);
- if (camera_retval != OPERATOR_PASS_THROUGH) {
- return camera_retval;
+ if (U.ndof_flag & NDOF_CAMERA_PAN_ZOOM) {
+ const int camera_retval = view3d_ndof_cameraview_pan_zoom(C, event);
+ if (camera_retval != OPERATOR_PASS_THROUGH) {
+ return camera_retval;
+ }
}
const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
@@ -619,9 +621,11 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *e
return OPERATOR_CANCELLED;
}
- const int camera_retval = view3d_ndof_cameraview_pan_zoom(C, event);
- if (camera_retval != OPERATOR_PASS_THROUGH) {
- return camera_retval;
+ if (U.ndof_flag & NDOF_CAMERA_PAN_ZOOM) {
+ const int camera_retval = view3d_ndof_cameraview_pan_zoom(C, event);
+ if (camera_retval != OPERATOR_PASS_THROUGH) {
+ return camera_retval;
+ }
}
const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index e081be73a1c..80a107e4bae 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -1318,6 +1318,7 @@ typedef enum eNdof_Flag {
NDOF_PANY_INVERT_AXIS = (1 << 13),
NDOF_PANZ_INVERT_AXIS = (1 << 14),
NDOF_TURNTABLE = (1 << 15),
+ NDOF_CAMERA_PAN_ZOOM = (1 << 16),
} eNdof_Flag;
#define NDOF_PIXELS_PER_SECOND 600.0f
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e32bedf3ed0..2a759dde39a 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6040,6 +6040,13 @@ static void rna_def_userdef_input(BlenderRNA *brna)
"Helicopter Mode",
"Device up/down directly controls the Z position of the 3D viewport");
+ prop = RNA_def_property(srna, "ndof_lock_camera_pan_zoom", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_CAMERA_PAN_ZOOM);
+ RNA_def_property_ui_text(
+ prop,
+ "Lock Camera Pan/Zoom",
+ "Pan/zoom the camera view instead of leaving the camera view when orbiting");
+
/* let Python know whether NDOF is enabled */
prop = RNA_def_boolean(srna, "use_ndof", true, "", "");
# else