summaryrefslogtreecommitdiffstats
path: root/scene/2d
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-06-23 08:19:18 +0200
committerreduz <reduzio@gmail.com>2022-06-23 08:19:18 +0200
commitd69e3791bf41dca6c29a9eb24bb92648cce2d692 (patch)
treea8ca3ff213aad1d5d8210a608092d4ed33b9f637 /scene/2d
parentabb92861f44427e9376fab9ee2f414f14848d6b5 (diff)
downloadredot-engine-d69e3791bf41dca6c29a9eb24bb92648cce2d692.tar.gz
Fix editor-only visibility for lights
* Update visibility again for editor-only lights if owner changes. Fixes #26399, supersedes #52327
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/light_2d.cpp5
-rw-r--r--scene/2d/light_2d.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 28d9b284e6..0481a58431 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -30,6 +30,11 @@
#include "light_2d.h"
+void Light2D::owner_changed_notify() {
+ // For cases where owner changes _after_ entering tree (as example, editor editing).
+ _update_light_visibility();
+}
+
void Light2D::_update_light_visibility() {
if (!is_inside_tree()) {
return;
diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h
index f7b1f420e3..a84b6516c0 100644
--- a/scene/2d/light_2d.h
+++ b/scene/2d/light_2d.h
@@ -73,6 +73,8 @@ private:
void _update_light_visibility();
+ virtual void owner_changed_notify() override;
+
protected:
_FORCE_INLINE_ RID _get_light() const { return canvas_light; }
void _notification(int p_what);