diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-19 05:24:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-19 05:24:40 +0400 |
commit | f3613be1fbfd764d829188b56ac17a3987161a77 (patch) | |
tree | 25f95a7fb44610cf23f95bff7759246ee722b70d /source/blender/editors | |
parent | 4924abaad66acc966158b67f4843e12afde75352 (diff) |
add poll function for VIEW3D_OT_camera_to_view_selected & remove some unused code.
also made it so copying camera sets the dof object to extern.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index c416a60e410..bb268203a33 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -342,7 +342,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot) /* ****************** change view operators ****************** */ -static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) +static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -369,7 +369,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) } -static int view3d_setcameratoview_poll(bContext *C) +static int view3d_camera_to_view_poll(bContext *C) { View3D *v3d= CTX_wm_view3d(C); if(v3d && v3d->camera && v3d->camera->id.lib==NULL) { @@ -390,8 +390,8 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot) ot->idname= "VIEW3D_OT_camera_to_view"; /* api callbacks */ - ot->exec= view3d_setcameratoview_exec; - ot->poll= view3d_setcameratoview_poll; + ot->exec= view3d_camera_to_view_exec; + ot->poll= view3d_camera_to_view_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -431,6 +431,24 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o } } +static int view3d_camera_to_view_selected_poll(bContext *C) +{ + View3D *v3d= CTX_wm_view3d(C); + if(v3d && v3d->camera && v3d->camera->id.lib==NULL) { + RegionView3D *rv3d= CTX_wm_region_view3d(C); + if(rv3d) { + if (rv3d->is_persp == FALSE) { + CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view"); + } + else if (!rv3d->viewlock) { + return 1; + } + } + } + + return 0; +} + void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot) { /* identifiers */ @@ -440,7 +458,7 @@ void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot) /* api callbacks */ ot->exec= view3d_camera_to_view_selected_exec; - // ot->poll= view3d_setcameratoview_poll; + ot->poll= view3d_camera_to_view_selected_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; |