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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate.c33
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate_dolly.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate_move.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate_rotate.c8
5 files changed, 26 insertions, 34 deletions
diff --git a/source/blender/editors/space_view3d/view3d_navigate.c b/source/blender/editors/space_view3d/view3d_navigate.c
index 9b7304a6741..692a3005607 100644
--- a/source/blender/editors/space_view3d/view3d_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_navigate.c
@@ -59,22 +59,29 @@
/** \name Navigation Polls
* \{ */
-static bool view3d_pan_poll(bContext *C)
+static bool view3d_navigation_poll_impl(bContext *C, const char viewlock)
{
- if (ED_operator_region_view3d_active(C)) {
- const RegionView3D *rv3d = CTX_wm_region_view3d(C);
- return !(RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_LOCATION);
+ if (!ED_operator_region_view3d_active(C)) {
+ return false;
}
- return false;
+
+ const RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ return !(RV3D_LOCK_FLAGS(rv3d) & viewlock);
+}
+
+bool view3d_location_poll(bContext *C)
+{
+ return view3d_navigation_poll_impl(C, RV3D_LOCK_LOCATION);
+}
+
+bool view3d_rotation_poll(bContext *C)
+{
+ return view3d_navigation_poll_impl(C, RV3D_LOCK_ROTATION);
}
bool view3d_zoom_or_dolly_poll(bContext *C)
{
- if (ED_operator_region_view3d_active(C)) {
- const RegionView3D *rv3d = CTX_wm_region_view3d(C);
- return !(RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ZOOM_AND_DOLLY);
- }
- return false;
+ return view3d_navigation_poll_impl(C, RV3D_LOCK_ZOOM_AND_DOLLY);
}
/** \} */
@@ -1053,7 +1060,7 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
/* api callbacks */
ot->exec = viewcenter_cursor_exec;
- ot->poll = view3d_pan_poll;
+ ot->poll = view3d_location_poll;
/* flags */
ot->flag = 0;
@@ -1105,7 +1112,7 @@ void VIEW3D_OT_view_center_pick(wmOperatorType *ot)
/* api callbacks */
ot->invoke = viewcenter_pick_invoke;
- ot->poll = view3d_pan_poll;
+ ot->poll = view3d_location_poll;
/* flags */
ot->flag = 0;
@@ -1582,7 +1589,7 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot)
/* api callbacks */
ot->invoke = viewpan_invoke;
- ot->poll = view3d_pan_poll;
+ ot->poll = view3d_location_poll;
/* flags */
ot->flag = 0;
diff --git a/source/blender/editors/space_view3d/view3d_navigate.h b/source/blender/editors/space_view3d/view3d_navigate.h
index 9afae4db3bf..c44f1f94708 100644
--- a/source/blender/editors/space_view3d/view3d_navigate.h
+++ b/source/blender/editors/space_view3d/view3d_navigate.h
@@ -149,6 +149,8 @@ typedef struct ViewOpsData {
} ViewOpsData;
/* view3d_navigate.c */
+bool view3d_location_poll(struct bContext *C);
+bool view3d_rotation_poll(struct bContext *C);
bool view3d_zoom_or_dolly_poll(struct bContext *C);
enum eViewOpsFlag viewops_flag_from_prefs(void);
diff --git a/source/blender/editors/space_view3d/view3d_navigate_dolly.c b/source/blender/editors/space_view3d/view3d_navigate_dolly.c
index ee92cb2abd5..7273ec7f7fa 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_dolly.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_dolly.c
@@ -243,12 +243,6 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_alloc(C, op);
vod = op->customdata;
- /* poll should check but in some cases fails, see poll func for details */
- if (RV3D_LOCK_FLAGS(vod->rv3d) & RV3D_LOCK_ROTATION) {
- viewops_data_free(C, op);
- return OPERATOR_PASS_THROUGH;
- }
-
ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
/* needs to run before 'viewops_data_create' so the backup 'rv3d->ofs' is correct */
@@ -329,7 +323,7 @@ void VIEW3D_OT_dolly(wmOperatorType *ot)
ot->invoke = viewdolly_invoke;
ot->exec = viewdolly_exec;
ot->modal = viewdolly_modal;
- ot->poll = ED_operator_region_view3d_active;
+ ot->poll = view3d_rotation_poll;
ot->cancel = viewdolly_cancel;
/* flags */
diff --git a/source/blender/editors/space_view3d/view3d_navigate_move.c b/source/blender/editors/space_view3d/view3d_navigate_move.c
index 38b3f445ca9..e23767923b1 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_move.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_move.c
@@ -133,17 +133,12 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* makes op->customdata */
viewops_data_alloc(C, op);
- vod = op->customdata;
- if (RV3D_LOCK_FLAGS(vod->rv3d) & RV3D_LOCK_LOCATION) {
- viewops_data_free(C, op);
- return OPERATOR_PASS_THROUGH;
- }
-
viewops_data_create(C,
op,
event,
(viewops_flag_from_prefs() & ~VIEWOPS_FLAG_ORBIT_SELECT) |
(use_cursor_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
+ vod = op->customdata;
ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
@@ -179,7 +174,7 @@ void VIEW3D_OT_move(wmOperatorType *ot)
/* api callbacks */
ot->invoke = viewmove_invoke;
ot->modal = viewmove_modal;
- ot->poll = ED_operator_region_view3d_active;
+ ot->poll = view3d_location_poll;
ot->cancel = viewmove_cancel;
/* flags */
diff --git a/source/blender/editors/space_view3d/view3d_navigate_rotate.c b/source/blender/editors/space_view3d/view3d_navigate_rotate.c
index e846a3ba1db..c65acde0ad0 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_rotate.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_rotate.c
@@ -386,12 +386,6 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_alloc(C, op);
vod = op->customdata;
- /* poll should check but in some cases fails, see poll func for details */
- if (RV3D_LOCK_FLAGS(vod->rv3d) & RV3D_LOCK_ROTATION) {
- viewops_data_free(C, op);
- return OPERATOR_PASS_THROUGH;
- }
-
ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
viewops_data_create(C,
@@ -446,7 +440,7 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
/* api callbacks */
ot->invoke = viewrotate_invoke;
ot->modal = viewrotate_modal;
- ot->poll = ED_operator_region_view3d_active;
+ ot->poll = view3d_rotation_poll;
ot->cancel = viewrotate_cancel;
/* flags */