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`).
This commit is contained in:
@ -239,6 +239,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) {
|
||||
@ -382,6 +383,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user