diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-08 10:44:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-08 10:44:30 +0300 |
commit | 092c3d8a85dbfb0a5eb41ae2f2ac6a5363cf4c97 (patch) | |
tree | f57826e1b199283882426e49bb6cbb79a8bb374a /source/blender | |
parent | ae57e8c8c17cac3a5479990d1592feed9b4096b3 (diff) |
fix bug [#26315] Background and 3D view mistakes
The bug is caused by a fix for [#22111], commits r29356, r28545.
exiting localview would set the rv3d->view but use the original rv3d->viewquat.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 1 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 19 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 18 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 4 |
4 files changed, 29 insertions, 13 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 48f3a40b0f9..9b70b655b3d 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -177,6 +177,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int Base *ED_view3d_give_base_under_cursor(struct bContext *C, short *mval); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip); +int ED_view3d_lock(struct RegionView3D *rv3d); unsigned int ED_viewedit_datamask(struct bScreen *screen); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 70bb4d48296..d69011cf2af 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -66,6 +66,7 @@ #include "ED_armature.h" #include "ED_screen_types.h" #include "ED_keyframes_draw.h" +#include "ED_view3d.h" #include "RNA_access.h" #include "RNA_define.h" @@ -2464,26 +2465,36 @@ static int region_quadview_exec(bContext *C, wmOperator *op) /* lock views and set them */ if(sa->spacetype==SPACE_VIEW3D) { + /* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set, + * otherwise when restoring rv3d->localvd the 'viewquat' won't + * match the 'view', set on entering localview See: [#26315], + * + * We could avoid manipulating rv3d->localvd here if exiting + * localview with a 4-split would assign these view locks */ RegionView3D *rv3d; rv3d= ar->regiondata; rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_FRONT; rv3d->persp= RV3D_ORTHO; - if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; } + ED_view3d_lock(rv3d); + if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);} ar= ar->next; rv3d= ar->regiondata; rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_TOP; rv3d->persp= RV3D_ORTHO; - if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; } + ED_view3d_lock(rv3d); + if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);} ar= ar->next; rv3d= ar->regiondata; rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_RIGHT; rv3d->persp= RV3D_ORTHO; - if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; } + ED_view3d_lock(rv3d); + if (rv3d->localvd) { rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);} ar= ar->next; rv3d= ar->regiondata; rv3d->view= RV3D_VIEW_CAMERA; rv3d->persp= RV3D_CAMOB; - if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; } + ED_view3d_lock(rv3d); + if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);} } ED_area_tag_redraw(sa); WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 4b290f277b6..a1726d8a537 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1179,33 +1179,37 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short #define QUATSET(a, b, c, d, e) a[0]=b; a[1]=c; a[2]=d; a[3]=e; -static void view3d_viewlock(RegionView3D *rv3d) +int ED_view3d_lock(RegionView3D *rv3d) { switch(rv3d->view) { case RV3D_VIEW_BOTTOM : QUATSET(rv3d->viewquat,0.0, -1.0, 0.0, 0.0); break; - + case RV3D_VIEW_BACK: QUATSET(rv3d->viewquat,0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0)); break; - + case RV3D_VIEW_LEFT: QUATSET(rv3d->viewquat,0.5, -0.5, 0.5, 0.5); break; - + case RV3D_VIEW_TOP: QUATSET(rv3d->viewquat,1.0, 0.0, 0.0, 0.0); break; - + case RV3D_VIEW_FRONT: QUATSET(rv3d->viewquat,(float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0); break; - + case RV3D_VIEW_RIGHT: QUATSET(rv3d->viewquat, 0.5, -0.5, -0.5, -0.5); break; + default: + return FALSE; } + + return TRUE; } /* dont set windows active in in here, is used by renderwin too */ @@ -1224,7 +1228,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) else { /* should be moved to better initialize later on XXX */ if(rv3d->viewlock) - view3d_viewlock(rv3d); + ED_view3d_lock(rv3d); quat_to_mat4( rv3d->viewmat,rv3d->viewquat); if(rv3d->persp==RV3D_PERSP) rv3d->viewmat[3][2]-= rv3d->dist; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index a089fea5129..c9a440522d1 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -112,7 +112,7 @@ typedef struct RegionView3D { struct bGPdata *gpd; /* Grease-Pencil Data (annotation layers) */ - struct RegionView3D *localvd; + struct RegionView3D *localvd; /* allocated backup of its self while in localview */ struct RenderInfo *ri; struct ViewDepths *depths; @@ -151,7 +151,7 @@ typedef struct View3D { struct ListBase bgpicbase; struct BGpic *bgpic; /* deprecated, use bgpicbase, only kept for do_versions(...) */ - struct View3D *localvd; + struct View3D *localvd; /* allocated backup of its self while in localview */ char ob_centre_bone[32]; /* optional string for armature bone to define center */ |