Fix [#21145] Preferences: Solid OpenGL lights viewport update
This commit is contained in:
@@ -57,6 +57,8 @@
|
||||
|
||||
#include "BIF_gl.h"
|
||||
|
||||
#include "GPU_draw.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
@@ -602,8 +604,13 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
case NC_SPACE:
|
||||
if(wmn->data == ND_SPACE_VIEW3D)
|
||||
if(wmn->data == ND_SPACE_VIEW3D) {
|
||||
if (wmn->subtype == NS_VIEW3D_GPU) {
|
||||
RegionView3D *rv3d= ar->regiondata;
|
||||
rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
|
||||
}
|
||||
ED_region_tag_redraw(ar);
|
||||
}
|
||||
break;
|
||||
case NC_ID:
|
||||
if(wmn->action == NA_RENAME)
|
||||
|
||||
@@ -2188,6 +2188,12 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
|
||||
/* shadow buffers, before we setup matrices */
|
||||
if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
|
||||
gpu_update_lamps_shadows(scene, v3d);
|
||||
|
||||
/* reset default OpenGL lights if needed (i.e. after preferences have been altered) */
|
||||
if (rv3d->rflag & RV3D_GPULIGHT_UPDATE) {
|
||||
rv3d->rflag &= ~RV3D_GPULIGHT_UPDATE;
|
||||
GPU_default_lights();
|
||||
}
|
||||
|
||||
/* clear background */
|
||||
UI_GetThemeColor3fv(TH_BACK, col);
|
||||
|
||||
@@ -229,6 +229,7 @@ typedef struct View3D {
|
||||
#define RV3D_FLYMODE 2
|
||||
#define RV3D_CLIPPING 4
|
||||
#define RV3D_NAVIGATING 8
|
||||
#define RV3D_GPULIGHT_UPDATE 16
|
||||
|
||||
/* RegionView3d->viewlock */
|
||||
#define RV3D_LOCKED 1
|
||||
|
||||
@@ -201,12 +201,9 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN
|
||||
rna_userdef_update(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
// XXX - todo, this is not accessible from here and it only works when the userprefs are in the same window.
|
||||
// extern int GPU_default_lights(void);
|
||||
static void rna_UserDef_viewport_lights_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
// GPU_default_lights();
|
||||
WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL);
|
||||
WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D|NS_VIEW3D_GPU, NULL);
|
||||
rna_userdef_update(bmain, scene, ptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -267,6 +267,8 @@ typedef struct wmNotifier {
|
||||
#define NS_MODE_POSE (9<<8)
|
||||
#define NS_MODE_PARTICLE (10<<8)
|
||||
|
||||
/* subtype 3d view editing */
|
||||
#define NS_VIEW3D_GPU (16<<8)
|
||||
|
||||
/* action classification */
|
||||
#define NOTE_ACTION (0x000000FF)
|
||||
|
||||
Reference in New Issue
Block a user