diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 17:01:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 17:01:05 +0400 |
commit | 13ddfa921e66440f2e2013de1a1f9cc06411bb87 (patch) | |
tree | 848e172d5c883dda21f411e6e41f6d4732569a28 /source | |
parent | 562ed2b42e7ad8298bd5f041124ed2208c3a7a7c (diff) |
fix [#30862] "Lock" and "Box" Quad View options won't stay put when toggling
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 55 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 11 |
3 files changed, 33 insertions, 35 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 310783e5199..f4fbc620258 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2707,6 +2707,22 @@ static void view3d_localview_update_rv3d(struct RegionView3D *rv3d) } } +static void region_quadview_init_rv3d(ScrArea *sa, ARegion *ar, + const char viewlock, const char view, const char persp) +{ + RegionView3D *rv3d = ar->regiondata; + + rv3d->viewlock = viewlock; + rv3d->view = view; + rv3d->persp = persp; + + ED_view3d_lock(rv3d); + view3d_localview_update_rv3d(rv3d); + if ((viewlock & RV3D_BOXCLIP) && (persp == RV3D_ORTHO)) { + ED_view3d_quadview_update(sa, ar, true); + } +} + /* insert a region in the area region list */ static int region_quadview_exec(bContext *C, wmOperator *op) { @@ -2724,6 +2740,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op) if (sa->spacetype == SPACE_VIEW3D) { RegionView3D *rv3d = ar->regiondata; + rv3d->viewlock_quad = rv3d->viewlock | RV3D_VIEWLOCK_INIT; rv3d->viewlock = 0; rv3d->rflag &= ~RV3D_CLIPPING; } @@ -2764,38 +2781,16 @@ static int region_quadview_exec(bContext *C, wmOperator *op) * * 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; - ED_view3d_lock(rv3d); - view3d_localview_update_rv3d(rv3d); - - ar = ar->next; - rv3d = ar->regiondata; - rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_TOP; rv3d->persp = RV3D_ORTHO; - ED_view3d_lock(rv3d); - view3d_localview_update_rv3d(rv3d); - - ar = ar->next; - rv3d = ar->regiondata; - rv3d->viewlock = RV3D_LOCKED; rv3d->view = RV3D_VIEW_RIGHT; rv3d->persp = RV3D_ORTHO; - ED_view3d_lock(rv3d); - view3d_localview_update_rv3d(rv3d); - - ar = ar->next; - rv3d = ar->regiondata; + RegionView3D *rv3d = ar->regiondata; + const char viewlock = (rv3d->viewlock_quad & RV3D_VIEWLOCK_INIT) ? + (rv3d->viewlock_quad & ~RV3D_VIEWLOCK_INIT) : RV3D_LOCKED; - /* check if we have a camera */ - if (v3d->camera) { - rv3d->view = RV3D_VIEW_CAMERA; rv3d->persp = RV3D_CAMOB; - } - else { - rv3d->view = RV3D_VIEW_PERSPORTHO; rv3d->persp = RV3D_PERSP; - } + region_quadview_init_rv3d(sa, ar, viewlock, RV3D_VIEW_FRONT, RV3D_ORTHO); + region_quadview_init_rv3d(sa, (ar = ar->next), viewlock, RV3D_VIEW_TOP, RV3D_ORTHO); + region_quadview_init_rv3d(sa, (ar = ar->next), viewlock, RV3D_VIEW_RIGHT, RV3D_ORTHO); + if (v3d->camera) region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB); + else region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_PERSPORTHO, RV3D_PERSP); - ED_view3d_lock(rv3d); - view3d_localview_update_rv3d(rv3d); } ED_area_tag_redraw(sa); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 36a2aad4b4a..c07fa85050c 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -190,7 +190,7 @@ static void view3d_draw_clipping(RegionView3D *rv3d) void ED_view3d_clipping_set(RegionView3D *rv3d) { double plane[4]; - const unsigned int tot = (rv3d->viewlock) ? 4 : 6; + const unsigned int tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6; unsigned int a; for (a = 0; a < tot; a++) { diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 294c47aa9db..e961ab67fc9 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -129,7 +129,8 @@ typedef struct RegionView3D { char persp; char view; char viewlock; - char pad[4]; + char viewlock_quad; /* options for quadview (store while out of quad view) */ + char pad[3]; short twdrawflag; short rflag; @@ -246,9 +247,11 @@ typedef struct View3D { #define RV3D_GPULIGHT_UPDATE 16 /* RegionView3d->viewlock */ -#define RV3D_LOCKED 1 -#define RV3D_BOXVIEW 2 -#define RV3D_BOXCLIP 4 +#define RV3D_LOCKED (1 << 0) +#define RV3D_BOXVIEW (1 << 1) +#define RV3D_BOXCLIP (1 << 2) +/* RegionView3d->viewlock_quad */ +#define RV3D_VIEWLOCK_INIT (1 << 7) /* RegionView3d->view */ #define RV3D_VIEW_USER 0 |