Multiview: remove option to preview the selected stereo 3d mode and error when quadbuffer not supported

This was causing glitches when switching from/to fullscreen modes (e.g.,
side by side to anaglyph).

As for the quadbuffer errors this is part of a more complete solution to
be committed later.
This commit is contained in:
Dalai Felinto 2015-04-09 20:43:59 -03:00
parent 33028d17a0
commit 52f511269b
Notes: blender-bot 2023-02-14 11:25:11 +01:00
Referenced by issue #44336, Unable to select cycles-specific passes in UV/image editor
1 changed files with 34 additions and 21 deletions

View File

@ -352,6 +352,13 @@ void wm_method_draw_stereo3d(const bContext *UNUSED(C), wmWindow *win)
}
}
static bool wm_stereo3d_quadbuffer_supported()
{
int gl_stereo = 0;
glGetBooleanv(GL_STEREO, (GLboolean *)&gl_stereo);
return gl_stereo != 0;
}
static bool wm_stereo3d_is_fullscreen_required(eStereoDisplayMode stereo_display)
{
return ELEM(stereo_display,
@ -364,11 +371,14 @@ bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
{
bScreen *screen = win->screen;
if ((skip_stereo3d_check == false) && (ED_screen_stereo3d_required(screen) == false))
if ((skip_stereo3d_check == false) && (ED_screen_stereo3d_required(screen) == false)) {
return false;
}
if (wm_stereo3d_is_fullscreen_required(win->stereo3d_format->display_mode)) {
return (GHOST_GetWindowState(win->ghostwin) == GHOST_kWindowStateFullScreen);
if (GHOST_GetWindowState(win->ghostwin) != GHOST_kWindowStateFullScreen) {
return false;
}
}
return true;
@ -379,10 +389,10 @@ typedef struct Stereo3dData {
Stereo3dFormat stereo3d_format;
} Stereo3dData;
static bool wm_stereo3d_set_properties(bContext *C, wmOperator *op)
static bool wm_stereo3d_set_properties(bContext *UNUSED(C), wmOperator *op)
{
wmWindow *win = CTX_wm_window(C);
Stereo3dFormat *s3d = win->stereo3d_format;
Stereo3dData *s3dd = op->customdata;
Stereo3dFormat *s3d = &s3dd->stereo3d_format;
PropertyRNA *prop;
bool is_set = false;
@ -441,12 +451,24 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
const bool is_fullscreen = WM_window_is_fullscreen(win);
char display_mode = win->stereo3d_format->display_mode;
if (G.background)
return OPERATOR_CANCELLED;
/* pagelfip requires a new window to be created with the proper OS flags */
if (op->customdata) {
Stereo3dData *s3dd = op->customdata;
*win->stereo3d_format = s3dd->stereo3d_format;
}
/* pageflip requires a new window to be created with the proper OS flags */
if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
if (wm_stereo3d_quadbuffer_supported() == false) {
BKE_reportf(op->reports, RPT_ERROR,
"Quadbuffer not supported by the system");
win->stereo3d_format->display_mode = display_mode;
return OPERATOR_CANCELLED;
}
if (wm_window_duplicate_exec(C, op) == OPERATOR_FINISHED) {
wm_window_close(C, wm, win);
win = wm->windows.last;
@ -454,6 +476,7 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
else {
BKE_reportf(op->reports, RPT_ERROR,
"Fail to create a window compatible with time sequential (page-flip) display method");
win->stereo3d_format->display_mode = display_mode;
return OPERATOR_CANCELLED;
}
}
@ -482,21 +505,19 @@ int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(ev
return WM_operator_props_dialog_popup(C, op, 250, 100);
}
void wm_stereo3d_set_draw(bContext *C, wmOperator *op)
void wm_stereo3d_set_draw(bContext *UNUSED(C), wmOperator *op)
{
wmWindow *win = CTX_wm_window(C);
Stereo3dFormat *stereo3d_format;
Stereo3dData *s3dd = op->customdata;
PointerRNA stereo3d_format_ptr;
uiLayout *layout = op->layout;
uiLayout *col;
stereo3d_format = win->stereo3d_format;
RNA_pointer_create(NULL, &RNA_Stereo3dDisplay, stereo3d_format, &stereo3d_format_ptr);
RNA_pointer_create(NULL, &RNA_Stereo3dDisplay, &s3dd->stereo3d_format, &stereo3d_format_ptr);
col = uiLayoutColumn(layout, false);
uiItemR(col, &stereo3d_format_ptr, "display_mode", 0, NULL, ICON_NONE);
switch (stereo3d_format->display_mode) {
switch (s3dd->stereo3d_format.display_mode) {
case S3D_DISPLAY_ANAGLYPH:
{
uiItemR(col, &stereo3d_format_ptr, "anaglyph_type", 0, NULL, ICON_NONE);
@ -530,16 +551,8 @@ bool wm_stereo3d_set_check(bContext *UNUSED(C), wmOperator *UNUSED(op))
return true;
}
void wm_stereo3d_set_cancel(bContext *C, wmOperator *op)
void wm_stereo3d_set_cancel(bContext *UNUSED(C), wmOperator *op)
{
Stereo3dData *s3dd = op->customdata;
wmWindow *win = CTX_wm_window(C);
/* roll back to the original */
if (win) {
*win->stereo3d_format = s3dd->stereo3d_format;
}
MEM_freeN(op->customdata);
op->customdata = NULL;
}