1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Clear the previously set state when configuring for a new scene root node

Saving a subscene causes the main scene to be re-instantiated. And the resource
instance in the main scene will be reused when the main scene is re-instantiated.
So for resources with `resource_local_to_scene` enabled, resetting state may be
necessary (at least for `ViewportTexture`).

(cherry picked from commit 4795c3cdfa)
This commit is contained in:
Rindbee
2023-07-08 19:38:27 +08:00
committed by Yuri Sizov
parent d5a11e17b8
commit 00d5da2f09
4 changed files with 20 additions and 6 deletions

View File

@@ -226,6 +226,7 @@ void Resource::configure_for_local_scene(Node *p_for_scene, HashMap<Ref<Resource
List<PropertyInfo> plist;
get_property_list(&plist);
reset_local_to_scene();
local_scene = p_for_scene;
for (const PropertyInfo &E : plist) {
@@ -386,6 +387,10 @@ void Resource::setup_local_to_scene() {
emit_signal(SNAME("setup_local_to_scene_requested"));
}
void Resource::reset_local_to_scene() {
// Restores the state as if setup_local_to_scene() hadn't been called.
}
Node *(*Resource::_get_local_scene_func)() = nullptr;
void (*Resource::_update_configuration_warning)() = nullptr;