EEVEE: LookDev use_scene_light draw option

Scene lights are rendered when
 - v3d is not available
 - or shading type is other then OB_MATERIAL
 - or shading type is OB_MATERIAL and use_scene_light is true
This commit is contained in:
Jeroen Bakker 2018-05-29 10:59:37 +02:00
parent 2bb4977c4a
commit a0b08e7b66
Notes: blender-bot 2023-02-14 05:48:57 +01:00
Referenced by issue #55245, View layers bug on multiple windows after undo
Referenced by issue #55242, Selecting infinitely thin objects that are perpendicular to the view is not possible (without wireframe)
Referenced by issue #55244, Parenting object(s) to curve crashes blender
6 changed files with 16 additions and 3 deletions

View File

@ -3549,6 +3549,7 @@ class VIEW3D_PT_shading(Panel):
col.row().template_icon_view(shading, "studio_light")
if shading.studio_light_orientation == 'WORLD':
col.row().prop(shading, "studiolight_rot_z")
col.row().prop(shading, "use_scene_light")
class VIEW3D_PT_overlay(Panel):

View File

@ -148,6 +148,9 @@ static void eevee_cache_populate(void *vedata, Object *ob)
EEVEE_lights_cache_shcaster_object_add(sldata, ob);
}
}
else if (!USE_SCENE_LIGHT(draw_ctx->v3d)) {
/* do not add any light sources to the cache */
}
else if (ob->type == OB_LIGHTPROBE) {
if ((ob->base_flag & BASE_FROMDUPLI) != 0) {
/* TODO: Special case for dupli objects because we cannot save the object pointer. */

View File

@ -1633,7 +1633,7 @@ void EEVEE_materials_cache_finish(EEVEE_Data *vedata)
/* Look-Dev */
const DRWContextState *draw_ctx = DRW_context_state_get();
const View3D *v3d = draw_ctx->v3d;
if (v3d && v3d->drawtype == OB_MATERIAL) {
if (LOOK_DEV_OVERLAY_ENABLED(v3d)) {
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
EEVEE_LampsInfo *linfo = sldata->lamps;
struct Gwn_Batch *sphere = DRW_cache_sphere_get();

View File

@ -93,7 +93,9 @@ extern struct DrawEngineType draw_engine_eevee_type;
} ((void)0)
#define OVERLAY_ENABLED(v3d) ((v3d) && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
#define LOOK_DEV_OVERLAY_ENABLED(v3d) (OVERLAY_ENABLED(v3d) && ((v3d->overlay.flag & V3D_OVERLAY_LOOK_DEV) > 0))
#define LOOK_DEV_MODE_ENABLED(v3d) ((v3d) && (v3d->drawtype == OB_MATERIAL))
#define LOOK_DEV_OVERLAY_ENABLED(v3d) (LOOK_DEV_MODE_ENABLED(v3d) && OVERLAY_ENABLED(v3d) && ((v3d->overlay.flag & V3D_OVERLAY_LOOK_DEV) > 0))
#define USE_SCENE_LIGHT(v3d) ((!v3d) || (!LOOK_DEV_MODE_ENABLED(v3d)) || ((LOOK_DEV_MODE_ENABLED(v3d) && (v3d->shading.flag & V3D_SHADING_SCENE_LIGHT))))
/* World shader variations */
enum {

View File

@ -338,8 +338,9 @@ enum {
/* View3DShading->flag */
enum {
V3D_SHADING_OBJECT_OUTLINE = (1 << 0),
V3D_SHADING_XRAY = (1 << 1),
V3D_SHADING_XRAY = (1 << 1),
V3D_SHADING_SHADOW = (1 << 2),
V3D_SHADING_SCENE_LIGHT = (1 << 3),
};
/* View3DShading->single_color_type */

View File

@ -2330,6 +2330,12 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "X-Ray", "Show whole scene transparent");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "use_scene_light", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "shading.flag", V3D_SHADING_SCENE_LIGHT);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Scene Light", "Render lamps and light probes of the scene");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "object_outline_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "shading.object_outline_color");
RNA_def_property_array(prop, 3);