fix [#35629] Incorrect Rendered Viewport Horizontal Splitting

previously the order didnt matter but with viewport render, its noticable.
This commit is contained in:
Campbell Barton
2013-06-04 21:23:32 +00:00
parent c89c716e84
commit 98d3278189
2 changed files with 39 additions and 13 deletions

View File

@@ -370,6 +370,10 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
split = testsplitpoint(sa, dir, fac);
if (split == 0) return NULL;
/* note regarding (fac > 0.5f) checks below.
* notmally it shouldn't matter which is used since the copy should match the original
* however with viewport rendering and python console this isn't the case. - campbell */
if (dir == 'h') {
/* new vertices */
sv1 = screen_addvert(sc, sa->v1->vec.x, split);
@@ -382,14 +386,25 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
screen_addedge(sc, sv2, sa->v4);
screen_addedge(sc, sv1, sv2);
/* new areas: top */
newa = screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->headertype, sa->spacetype);
if (fac > 0.5f) {
/* new areas: top */
newa = screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->headertype, sa->spacetype);
/* area below */
sa->v2 = sv1;
sa->v3 = sv2;
}
else {
/* new areas: bottom */
newa = screen_addarea(sc, sa->v1, sv1, sv2, sa->v4, sa->headertype, sa->spacetype);
/* area above */
sa->v1 = sv1;
sa->v4 = sv2;
}
area_copy_data(newa, sa, 0);
/* area below */
sa->v2 = sv1;
sa->v3 = sv2;
}
else {
/* new vertices */
@@ -403,13 +418,24 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
screen_addedge(sc, sv2, sa->v3);
screen_addedge(sc, sv1, sv2);
/* new areas: left */
newa = screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->headertype, sa->spacetype);
if (fac > 0.5f) {
/* new areas: right */
newa = screen_addarea(sc, sv1, sv2, sa->v3, sa->v4, sa->headertype, sa->spacetype);
/* area left */
sa->v3 = sv2;
sa->v4 = sv1;
}
else {
/* new areas: left */
newa = screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->headertype, sa->spacetype);
/* area right */
sa->v1 = sv1;
sa->v2 = sv2;
}
area_copy_data(newa, sa, 0);
/* area right */
sa->v1 = sv1;
sa->v2 = sv2;
}
/* remove double vertices en edges */

View File

@@ -133,7 +133,7 @@ typedef struct uiList { /* some list UI data need to be saved in file */
typedef struct ScrArea {
struct ScrArea *next, *prev;
ScrVert *v1, *v2, *v3, *v4;
ScrVert *v1, *v2, *v3, *v4; /* ordered (bl, tl, tr, br) */
bScreen *full; /* if area==full, this is the parent */
rcti totrct; /* rect bound by v1 v2 v3 v4 */