From 2ed0ddef047b961272e70108e37af9526405ae7d Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 5 Feb 2011 19:07:54 +0000 Subject: todo list item: 3D View: In quad-view mode, the options to set back/bottom/left views were blocked. Now they work again. Note: the oparator polls don't have a check for properties... so it cannot be finegrained here. Checks are inside code. --- source/blender/editors/space_view3d/view3d_edit.c | 32 +++++----------------- .../blender/editors/space_view3d/view3d_intern.h | 1 - source/blender/editors/space_view3d/view3d_view.c | 7 +++++ 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 6df0793f2fe..bc9c41f3add 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -766,7 +766,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event) if(rv3d->viewlock) { /* poll should check but in some cases fails, see poll func for details */ viewops_data_free(C, op); - return OPERATOR_CANCELLED; + return OPERATOR_PASS_THROUGH; } /* switch from camera view when: */ @@ -828,21 +828,6 @@ static int view3d_camera_active_poll(bContext *C) return 0; } -static int view3d_rotate_poll(bContext *C) -{ - if (!ED_operator_region_view3d_active(C)) { - return 0; - } else { - RegionView3D *rv3d= CTX_wm_region_view3d(C); - /* rv3d is null in menus, but it's ok when the menu is clicked on */ - /* XXX of course, this doesn't work with quadview - * Maybe having exec return PASSTHROUGH would be better than polling here - * Poll functions are full of problems anyway. - * */ - return rv3d == NULL || rv3d->viewlock == 0; - } -} - void VIEW3D_OT_rotate(wmOperatorType *ot) { @@ -854,7 +839,7 @@ void VIEW3D_OT_rotate(wmOperatorType *ot) /* api callbacks */ ot->invoke= viewrotate_invoke; ot->modal= viewrotate_modal; - ot->poll= view3d_rotate_poll; + ot->poll= ED_operator_region_view3d_active; /* flags */ ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -1953,6 +1938,9 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) viewnum = RNA_enum_get(op->ptr, "type"); align_active = RNA_boolean_get(op->ptr, "align_active"); + /* set this to zero, gets handled in axis_set_view */ + if(rv3d->viewlock) + align_active= 0; /* Use this to test if we started out with a camera */ @@ -2060,12 +2048,6 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -int region3d_unlocked_poll(bContext *C) -{ - RegionView3D *rv3d= CTX_wm_region_view3d(C); - return (rv3d && rv3d->viewlock==0); -} - void VIEW3D_OT_viewnumpad(wmOperatorType *ot) { @@ -2076,7 +2058,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot) /* api callbacks */ ot->exec= viewnumpad_exec; - ot->poll= region3d_unlocked_poll; + ot->poll= ED_operator_region_view3d_active; /* flags */ ot->flag= 0; @@ -2144,7 +2126,7 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot) /* api callbacks */ ot->exec= vieworbit_exec; - ot->poll= view3d_rotate_poll; + ot->poll= ED_operator_region_view3d_active; /* flags */ ot->flag= 0; diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 73c07e8ac25..0f1fe2fba07 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -85,7 +85,6 @@ void VIEW3D_OT_drawtype(struct wmOperatorType *ot); void view3d_boxview_copy(ScrArea *sa, ARegion *ar); void view3d_persp_mat4(struct RegionView3D *rv3d, float mat[][4]); -int region3d_unlocked_poll(struct bContext *C); /* view3d_fly.c */ void view3d_keymap(struct wmKeyConfig *keyconf); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 49071af8bdd..7ed85cacc1e 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -477,6 +477,13 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } +static int region3d_unlocked_poll(bContext *C) +{ + RegionView3D *rv3d= CTX_wm_region_view3d(C); + return (rv3d && rv3d->viewlock==0); +} + + void VIEW3D_OT_object_as_camera(wmOperatorType *ot) { -- cgit v1.2.3