From 34603315e4f4390227a531f0db42112f90d6f3f8 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 27 Mar 2024 08:04:16 +0100 Subject: [PATCH] Don't emit changed signal for disabled lights. --- modules/vertex_lights_2d/vertex_lights_2d_server.cpp | 2 +- modules/vertex_lights_2d/vertex_lights_2d_server.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/vertex_lights_2d/vertex_lights_2d_server.cpp b/modules/vertex_lights_2d/vertex_lights_2d_server.cpp index fd55702db..cc046839f 100644 --- a/modules/vertex_lights_2d/vertex_lights_2d_server.cpp +++ b/modules/vertex_lights_2d/vertex_lights_2d_server.cpp @@ -162,7 +162,7 @@ void VertexLights2DServer::light_set_enabled(RID p_light, const bool p_enabled) light->enabled = p_enabled; - _light_changed(light); + _light_enabled_changed(light); } Vector2 VertexLights2DServer::light_get_position(RID p_light) { diff --git a/modules/vertex_lights_2d/vertex_lights_2d_server.h b/modules/vertex_lights_2d/vertex_lights_2d_server.h index 70b2f01b4..6a85e48e1 100644 --- a/modules/vertex_lights_2d/vertex_lights_2d_server.h +++ b/modules/vertex_lights_2d/vertex_lights_2d_server.h @@ -215,6 +215,12 @@ protected: }; _FORCE_INLINE_ void _light_changed(const VertexLightData2D *p_light) const { + if (p_light && p_light->enabled && p_light->map) { + _changed_maps.insert(p_light->map->self); + } + } + + _FORCE_INLINE_ void _light_enabled_changed(const VertexLightData2D *p_light) const { if (p_light && p_light->map) { _changed_maps.insert(p_light->map->self); }