forked from bartvdbraak/blender
Fix sequencer border-flickering
Offscreen viewport drawing wasn't properly restoring the theme. Add API calls to store/restore the theme so it can be temporarily overridden.
This commit is contained in:
parent
3447944c3f
commit
c7eb83bc17
@ -301,6 +301,11 @@ enum {
|
||||
struct bTheme;
|
||||
struct PointerRNA;
|
||||
|
||||
struct bThemeState {
|
||||
struct bTheme *theme;
|
||||
int spacetype, regionid;
|
||||
};
|
||||
|
||||
// THE CODERS API FOR THEMES:
|
||||
|
||||
// sets the color
|
||||
@ -360,6 +365,9 @@ void UI_SetTheme(int spacetype, int regionid);
|
||||
// get current theme
|
||||
struct bTheme *UI_GetTheme(void);
|
||||
|
||||
void UI_Theme_Store(struct bThemeState *theme_state);
|
||||
void UI_Theme_Restore(struct bThemeState *theme_state);
|
||||
|
||||
// return shadow width outside menus and popups */
|
||||
int UI_ThemeMenuShadowWidth(void);
|
||||
|
||||
|
@ -61,9 +61,16 @@
|
||||
/* global for themes */
|
||||
typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
|
||||
|
||||
static bTheme *theme_active = NULL;
|
||||
static int theme_spacetype = SPACE_VIEW3D;
|
||||
static int theme_regionid = RGN_TYPE_WINDOW;
|
||||
/* be sure to keep 'bThemeState' in sync */
|
||||
static struct bThemeState g_theme_state = {
|
||||
NULL,
|
||||
SPACE_VIEW3D,
|
||||
RGN_TYPE_WINDOW,
|
||||
};
|
||||
|
||||
#define theme_active g_theme_state.theme
|
||||
#define theme_spacetype g_theme_state.spacetype
|
||||
#define theme_regionid g_theme_state.regionid
|
||||
|
||||
void ui_resources_init(void)
|
||||
{
|
||||
@ -1215,6 +1222,18 @@ bTheme *UI_GetTheme(void)
|
||||
return U.themes.first;
|
||||
}
|
||||
|
||||
/**
|
||||
* for the rare case we need to temp swap in a different theme (offscreen render)
|
||||
*/
|
||||
void UI_Theme_Store(struct bThemeState *theme_state)
|
||||
{
|
||||
*theme_state = g_theme_state;
|
||||
}
|
||||
void UI_Theme_Restore(struct bThemeState *theme_state)
|
||||
{
|
||||
g_theme_state = *theme_state;
|
||||
}
|
||||
|
||||
/* for space windows only */
|
||||
void UI_ThemeColor(int colorid)
|
||||
{
|
||||
|
@ -1529,7 +1529,6 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
|
||||
|
||||
if (sseq->draw_flag & SEQ_DRAW_BACKDROP) {
|
||||
draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
|
||||
UI_SetTheme(SPACE_SEQ, RGN_TYPE_WINDOW);
|
||||
UI_view2d_view_ortho(v2d);
|
||||
}
|
||||
|
||||
|
@ -3012,6 +3012,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
|
||||
float viewmat[4][4], float winmat[4][4],
|
||||
bool do_bgpic, bool do_sky)
|
||||
{
|
||||
struct bThemeState theme_state;
|
||||
int bwinx, bwiny;
|
||||
rcti brect;
|
||||
|
||||
@ -3029,7 +3030,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
|
||||
ar->winrct.xmax = winx;
|
||||
ar->winrct.ymax = winy;
|
||||
|
||||
/* set theme */
|
||||
UI_Theme_Store(&theme_state);
|
||||
UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW);
|
||||
|
||||
/* set flags */
|
||||
@ -3076,8 +3077,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
/* XXX, without this the sequencer flickers with opengl draw enabled, need to find out why - campbell */
|
||||
glColor4ub(255, 255, 255, 255);
|
||||
UI_Theme_Restore(&theme_state);
|
||||
|
||||
G.f &= ~G_RENDER_OGL;
|
||||
}
|
||||
@ -3148,7 +3148,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
|
||||
|
||||
if (ibuf->rect_float && ibuf->rect)
|
||||
IMB_rect_from_float(ibuf);
|
||||
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user