Fix editor-only visibility for lights
* Update visibility again for editor-only lights if owner changes.
Fixes #26399, supersedes #52327
(cherry picked from commit d69e3791bf
)
This commit is contained in:
parent
2d54d3d71d
commit
995281ca90
6 changed files with 20 additions and 0 deletions
|
@ -81,6 +81,11 @@ Rect2 Light2D::get_anchorable_rect() const {
|
|||
return Rect2(texture_offset - s / 2.0, s);
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -79,6 +79,8 @@ private:
|
|||
|
||||
void _update_light_visibility();
|
||||
|
||||
virtual void owner_changed_notify();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
|
|
@ -144,6 +144,11 @@ Light::BakeMode Light::get_bake_mode() const {
|
|||
return bake_mode;
|
||||
}
|
||||
|
||||
void Light::owner_changed_notify() {
|
||||
// For cases where owner changes _after_ entering tree (as example, editor editing).
|
||||
_update_visibility();
|
||||
}
|
||||
|
||||
void Light::_update_visibility() {
|
||||
if (!is_inside_tree()) {
|
||||
return;
|
||||
|
|
|
@ -81,6 +81,8 @@ private:
|
|||
|
||||
// bind helpers
|
||||
|
||||
virtual void owner_changed_notify();
|
||||
|
||||
protected:
|
||||
RID light;
|
||||
|
||||
|
|
|
@ -458,6 +458,9 @@ void Node::move_child_notify(Node *p_child) {
|
|||
// to be used when not wanted
|
||||
}
|
||||
|
||||
void Node::owner_changed_notify() {
|
||||
}
|
||||
|
||||
void Node::_physics_interpolated_changed() {}
|
||||
|
||||
void Node::set_physics_process(bool p_process) {
|
||||
|
@ -1605,6 +1608,8 @@ void Node::_set_owner_nocheck(Node *p_owner) {
|
|||
data.owner = p_owner;
|
||||
data.owner->data.owned.push_back(this);
|
||||
data.OW = data.owner->data.owned.back();
|
||||
|
||||
owner_changed_notify();
|
||||
}
|
||||
|
||||
void Node::_release_unique_name_in_owner() {
|
||||
|
|
|
@ -236,6 +236,7 @@ protected:
|
|||
virtual void add_child_notify(Node *p_child);
|
||||
virtual void remove_child_notify(Node *p_child);
|
||||
virtual void move_child_notify(Node *p_child);
|
||||
virtual void owner_changed_notify();
|
||||
|
||||
virtual void _physics_interpolated_changed();
|
||||
|
||||
|
|
Loading…
Reference in a new issue