diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-06 19:53:51 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-06 21:22:03 +0300 |
commit | a6340a5068fd6ed8117ce8618f8b5901f324204d (patch) | |
tree | f5df7b7d18975a8a762138df839d243c0420fc9f /source/blender/makesrna | |
parent | aed09d43295de3dcba3d318345a4fd1396a16ea1 (diff) |
Viewport: in Lookdev shading, disable scene lights and world by default.
Now we light with just a user defined HDRI by default, which is useful
for material setup and texture painting and lighting without having to
set up any scene lights.
Previously it would use the scene world without lights by default, which
in some files is just black.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 4d85d845081..ab83cedd232 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -800,8 +800,13 @@ static int rna_View3DShading_studio_light_get(PointerRNA *ptr) flag = STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE; } StudioLight *sl = BKE_studiolight_find(dna_storage, flag); - BLI_strncpy(dna_storage, sl->name, FILE_MAXFILE); - return sl->index; + if (sl) { + BLI_strncpy(dna_storage, sl->name, FILE_MAXFILE); + return sl->index; + } + else { + return 0; + } } static void rna_View3DShading_studio_light_set(PointerRNA *ptr, int value) @@ -818,7 +823,9 @@ static void rna_View3DShading_studio_light_set(PointerRNA *ptr, int value) flag = STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE; } StudioLight *sl = BKE_studiolight_findindex(value, flag); - BLI_strncpy(dna_storage, sl->name, FILE_MAXFILE); + if (sl) { + BLI_strncpy(dna_storage, sl->name, FILE_MAXFILE); + } } static const EnumPropertyItem *rna_View3DShading_studio_light_itemf( @@ -846,8 +853,10 @@ static const EnumPropertyItem *rna_View3DShading_studio_light_itemf( bool show_studiolight = false; if (sl->flag & STUDIOLIGHT_INTERNAL) { - /* always show internal lights */ - show_studiolight = true; + /* always show internal lights for solid */ + if (v3d->drawtype == OB_SOLID) { + show_studiolight = true; + } } else { switch (v3d->drawtype) { @@ -2479,10 +2488,16 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); 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); + prop = RNA_def_property(srna, "use_scene_lights", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "shading.flag", V3D_SHADING_SCENE_LIGHTS); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Scene Lights", "Render lights and light probes of the scene"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "use_scene_world", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "shading.flag", V3D_SHADING_SCENE_WORLD); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Scene Light", "Render lights and light probes of the scene"); + RNA_def_property_ui_text(prop, "Scene World", "Use scene world for lighting"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "show_specular_highlight", PROP_BOOLEAN, PROP_NONE); |