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:
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 643e08ab405..44950655ae1 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -86,6 +86,27 @@
/* for ndof prints */
// #define DEBUG_NDOF_MOTION
+static void view3d_offset_lock_report(ReportList *reports)
+{
+ BKE_report(reports, RPT_WARNING, "View offset is locked");
+}
+
+bool ED_view3d_offset_lock_check(struct View3D *v3d, struct RegionView3D *rv3d)
+{
+ return (rv3d->persp != RV3D_CAMOB) && (v3d->ob_centre_cursor || v3d->ob_centre);
+}
+
+#define VIEW3D_OP_OFS_LOCK_TEST(C, op) \
+ { \
+ View3D *v3d_tmp = CTX_wm_view3d(C); \
+ RegionView3D *rv3d_tmp = CTX_wm_region_view3d(C); \
+ if (ED_view3d_offset_lock_check(v3d_tmp, rv3d_tmp)) { \
+ view3d_offset_lock_report((op)->reports); \
+ return OPERATOR_CANCELLED; \
+ } \
+ } (void)0
+
+
/* ********************** view3d_edit: view manipulations ********************* */
bool ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
@@ -1286,7 +1307,7 @@ void VIEW3D_OT_ndof_orbit_zoom(struct wmOperatorType *ot)
/* -- "pan" navigation
* -- zoom or dolly?
*/
-static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
+static int ndof_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
if (event->type != NDOF_MOTION)
return OPERATOR_CANCELLED;
@@ -1295,6 +1316,8 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *e
RegionView3D *rv3d = CTX_wm_region_view3d(C);
wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
+ VIEW3D_OP_OFS_LOCK_TEST(C, op);
+
ED_view3d_camera_lock_init(v3d, rv3d);
rv3d->rot_angle = 0.f; /* we're panning here! so erase any leftover rotation from other operators */
@@ -1586,6 +1609,8 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ViewOpsData *vod;
+ VIEW3D_OP_OFS_LOCK_TEST(C, op);
+
/* makes op->customdata */
viewops_data_create(C, op, event);
vod = op->customdata;
@@ -2164,6 +2189,8 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ViewOpsData *vod;
+ VIEW3D_OP_OFS_LOCK_TEST(C, op);
+
/* makes op->customdata */
viewops_data_create(C, op, event);
vod = op->customdata;
@@ -3482,6 +3509,8 @@ static int viewpan_exec(bContext *C, wmOperator *op)
float zfac;
int pandir;
+ VIEW3D_OP_OFS_LOCK_TEST(C, op);
+
pandir = RNA_enum_get(op->ptr, "type");
ED_view3d_camera_lock_init(v3d, rv3d);