fix [#30862] "Lock" and "Box" Quad View options won't stay put when toggling

This commit is contained in:
Campbell Barton
2013-05-08 13:01:05 +00:00
parent 562ed2b42e
commit 13ddfa921e
3 changed files with 33 additions and 35 deletions

View File

@@ -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;
RegionView3D *rv3d = ar->regiondata;
const char viewlock = (rv3d->viewlock_quad & RV3D_VIEWLOCK_INIT) ?
(rv3d->viewlock_quad & ~RV3D_VIEWLOCK_INIT) : RV3D_LOCKED;
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;
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);
/* 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;
}
ED_view3d_lock(rv3d);
view3d_localview_update_rv3d(rv3d);
}
ED_area_tag_redraw(sa);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);

View File

@@ -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++) {

View File

@@ -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