Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Yurkovich <deadpin>2021-10-15 12:42:21 +0300
committerClément Foucault <foucault.clem@gmail.com>2021-10-15 12:42:44 +0300
commit93a8fd1249ffc64ee089b8c3192908dec247fc07 (patch)
tree7bb64d08dbf1ff2f20894675628a758ba2549e4b /source/blender/draw
parent30bed8761dfb0c6ddb5ecd4b7c31c2e721a57535 (diff)
Cleanup: Commonize code for checking scene lights/world settings
There were several places attempting to check to see if scene lights and world were enabled for display. This tries to find a common place for both of these to reduce duplication. Honestly, I couldn't find a really good spot for these and settled on DRW_engine. It's not the best spot since they're not strictly drawing related, but let's start here. Reviewed By: fclem Differential Revision: https://developer.blender.org/D12658
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c12
-rw-r--r--source/blender/draw/intern/draw_color_management.cc11
2 files changed, 6 insertions, 17 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 1078cebdbff..50e32040522 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -120,15 +120,9 @@ void GPENCIL_engine_init(void *ved)
bool use_scene_world = false;
if (v3d) {
- use_scene_lights = ((v3d->shading.type == OB_MATERIAL) &&
- (v3d->shading.flag & V3D_SHADING_SCENE_LIGHTS)) ||
- ((v3d->shading.type == OB_RENDER) &&
- (v3d->shading.flag & V3D_SHADING_SCENE_LIGHTS_RENDER));
-
- use_scene_world = ((v3d->shading.type == OB_MATERIAL) &&
- (v3d->shading.flag & V3D_SHADING_SCENE_WORLD)) ||
- ((v3d->shading.type == OB_RENDER) &&
- (v3d->shading.flag & V3D_SHADING_SCENE_WORLD_RENDER));
+ use_scene_lights = V3D_USES_SCENE_LIGHTS(v3d);
+
+ use_scene_world = V3D_USES_SCENE_WORLD(v3d);
stl->pd->v3d_color_type = (v3d->shading.type == OB_SOLID) ? v3d->shading.color_type : -1;
/* Special case: If Vertex Paint mode, use always Vertex mode. */
diff --git a/source/blender/draw/intern/draw_color_management.cc b/source/blender/draw/intern/draw_color_management.cc
index 23fa18c83c5..70035c7c6f8 100644
--- a/source/blender/draw/intern/draw_color_management.cc
+++ b/source/blender/draw/intern/draw_color_management.cc
@@ -30,6 +30,7 @@
#include "GPU_texture.h"
#include "DNA_space_types.h"
+#include "DNA_view3d_types.h"
#include "BKE_colortools.h"
@@ -60,14 +61,8 @@ static eDRWColorManagementType drw_color_management_type_for_v3d(const Scene &sc
{
const bool use_workbench = BKE_scene_uses_blender_workbench(&scene);
- const bool use_scene_lights = ((v3d.shading.type == OB_MATERIAL) &&
- (v3d.shading.flag & V3D_SHADING_SCENE_LIGHTS)) ||
- ((v3d.shading.type == OB_RENDER) &&
- (v3d.shading.flag & V3D_SHADING_SCENE_LIGHTS_RENDER));
- const bool use_scene_world = ((v3d.shading.type == OB_MATERIAL) &&
- (v3d.shading.flag & V3D_SHADING_SCENE_WORLD)) ||
- ((v3d.shading.type == OB_RENDER) &&
- (v3d.shading.flag & V3D_SHADING_SCENE_WORLD_RENDER));
+ const bool use_scene_lights = V3D_USES_SCENE_LIGHTS(&v3d);
+ const bool use_scene_world = V3D_USES_SCENE_WORLD(&v3d);
if ((use_workbench && v3d.shading.type == OB_RENDER) || use_scene_lights || use_scene_world) {
return eDRWColorManagementType::UseRenderSettings;