diff options
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 50 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 2 |
2 files changed, 39 insertions, 13 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 39bc31c35cf..f4244245194 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -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 */ diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 166bd76500a..9d840ad13e8 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -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 */ |