Fix dialog spam when inspecting MeshInstance from model file

Avoid load_scene for built-in resources to make sure we don't
open a scene tab and prompt for model file editing.

Load scene as regular resource instead and store the reference to keep
the dependency until the remote inspector cache is cleared.

(cherry picked from commit 01802074a0)
This commit is contained in:
PouleyKetchoupp 2020-05-22 21:50:16 +02:00 committed by Rémi Verschelde
parent 6e8b5aff66
commit c63c902c74
2 changed files with 5 additions and 6 deletions

View File

@ -646,12 +646,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
if (path.find("::") != -1) { if (path.find("::") != -1) {
// built-in resource // built-in resource
String base_path = path.get_slice("::", 0); String base_path = path.get_slice("::", 0);
if (ResourceLoader::get_resource_type(base_path) == "PackedScene") { RES dependency = ResourceLoader::load(base_path);
if (!EditorNode::get_singleton()->is_scene_open(base_path)) { if (dependency.is_valid()) {
EditorNode::get_singleton()->load_scene(base_path); remote_dependencies.insert(dependency);
}
} else {
EditorNode::get_singleton()->load_resource(base_path);
} }
} }
var = ResourceLoader::load(path); var = ResourceLoader::load(path);
@ -2144,6 +2141,7 @@ void ScriptEditorDebugger::_clear_remote_objects() {
memdelete(E->value()); memdelete(E->value());
} }
remote_objects.clear(); remote_objects.clear();
remote_dependencies.clear();
} }
void ScriptEditorDebugger::_clear_errors_list() { void ScriptEditorDebugger::_clear_errors_list() {

View File

@ -100,6 +100,7 @@ private:
ObjectID inspected_object_id; ObjectID inspected_object_id;
ScriptEditorDebuggerVariables *variables; ScriptEditorDebuggerVariables *variables;
Map<ObjectID, ScriptEditorDebuggerInspectedObject *> remote_objects; Map<ObjectID, ScriptEditorDebuggerInspectedObject *> remote_objects;
Set<RES> remote_dependencies;
Set<ObjectID> unfold_cache; Set<ObjectID> unfold_cache;
VBoxContainer *errors_tab; VBoxContainer *errors_tab;