diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-02-05 00:26:46 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-02-06 14:21:41 +0300 |
commit | 6081f6c3870718660e984da3fbfcd44c55abcc20 (patch) | |
tree | afe56aefccd7d13a72277c816861bbd6478d931c /source | |
parent | e602fe60c042c7ff0a1ebbe2deab3b347f4ccc86 (diff) |
Fix T47204: selection failing directly after disabling multisample in user prefs.
Now store the multisample setting each window was created with.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 9 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 4 |
7 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b8470b16e14..2935b118c3a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6060,9 +6060,12 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) win->drawfail = 0; win->active = 0; - win->cursor = 0; - win->lastcursor = 0; - win->modalcursor = 0; + win->cursor = 0; + win->lastcursor = 0; + win->modalcursor = 0; + win->grabcursor = 0; + win->addmousemove = 0; + win->multisamples = 0; win->stereo3d_format = newdataadr(fd, win->stereo3d_format); /* multiview always fallback to anaglyph at file opening diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index d44c401e2a3..d8a3f5e75f5 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -74,6 +74,7 @@ typedef struct ViewContext { struct Object *obedit; struct ARegion *ar; struct View3D *v3d; + struct wmWindow *win; struct RegionView3D *rv3d; struct BMEditMesh *em; int mval[2]; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 32ba0590cbb..f396b5d809f 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1310,7 +1310,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) /* *********************** backdraw for selection *************** */ -static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) +static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d) { RegionView3D *rv3d = ar->regiondata; struct Base *base = scene->basact; @@ -1365,7 +1365,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) if (multisample_enabled) glDisable(GL_MULTISAMPLE); - if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) { + if (win->multisamples != USER_MULTISAMPLE_NONE) { /* for multisample we use an offscreen FBO. multisample drawing can fail * with color coded selection drawing, and reading back depths from such * a buffer can also cause a few seconds freeze on OS X / NVidia. */ @@ -1456,7 +1456,7 @@ static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, void ED_view3d_backbuf_validate(ViewContext *vc) { if (vc->v3d->flag & V3D_INVALID_BACKBUF) - backdrawview3d(vc->scene, vc->ar, vc->v3d); + backdrawview3d(vc->scene, vc->win, vc->ar, vc->v3d); } /** @@ -3830,6 +3830,7 @@ static void update_lods(Scene *scene, float camera_pos[3]) static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit) { + wmWindow *win = CTX_wm_window(C); RegionView3D *rv3d = ar->regiondata; unsigned int lay_used = v3d->lay_used; @@ -3883,7 +3884,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie view3d_main_region_clear(scene, v3d, ar); /* enables anti-aliasing for 3D view drawing */ - if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) { + if (win->multisamples != USER_MULTISAMPLE_NONE) { glEnable(GL_MULTISAMPLE); } @@ -3896,7 +3897,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie } /* Disable back anti-aliasing */ - if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) { + if (win->multisamples != USER_MULTISAMPLE_NONE) { glDisable(GL_MULTISAMPLE); } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 0a465c751d2..18cb9fb728d 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -108,6 +108,7 @@ void view3d_set_viewcontext(bContext *C, ViewContext *vc) vc->ar = CTX_wm_region(C); vc->scene = CTX_data_scene(C); vc->v3d = CTX_wm_view3d(C); + vc->win = CTX_wm_window(C); vc->rv3d = CTX_wm_region_view3d(C); vc->obact = CTX_data_active_object(C); vc->obedit = CTX_data_edit_object(C); diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index baaa2da5d30..14400c84b69 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -190,6 +190,8 @@ typedef struct wmWindow { short modalcursor; /* the current modal cursor */ short grabcursor; /* cursor grab mode */ short addmousemove; /* internal: tag this for extra mousemove event, makes cursors/buttons active on UI switching */ + short multisamples; /* amount of samples for OpenGL FSA the ghost window was created with, if zero no FSA */ + short pad[3]; int winid; /* winid also in screens, is for retrieving this window after read */ diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index e3172de626a..3e2976bb8e0 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -182,6 +182,7 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist) static void wm_window_substitute_old(wmWindowManager *wm, wmWindow *oldwin, wmWindow *win) { win->ghostwin = oldwin->ghostwin; + win->multisamples = oldwin->multisamples; win->active = oldwin->active; if (win->active) wm->winactive = win; @@ -190,6 +191,7 @@ static void wm_window_substitute_old(wmWindowManager *wm, wmWindow *oldwin, wmWi GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */ oldwin->ghostwin = NULL; + oldwin->multisamples = 0; win->eventstate = oldwin->eventstate; oldwin->eventstate = NULL; diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 9bb790cd925..932f9994a4a 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -163,6 +163,7 @@ static void wm_ghostwindow_destroy(wmWindow *win) if (win->ghostwin) { GHOST_DisposeWindow(g_system, win->ghostwin); win->ghostwin = NULL; + win->multisamples = 0; } } @@ -432,6 +433,9 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm if (win->eventstate == NULL) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); + + /* store multisamples window was created with, in case user prefs change */ + win->multisamples = multisamples; /* store actual window size in blender window */ bounds = GHOST_GetClientBounds(win->ghostwin); |