From 5e4f092acd327f3082c907a46ac16337fd8c6827 Mon Sep 17 00:00:00 2001 From: George Marques Date: Fri, 17 Nov 2017 13:48:33 -0200 Subject: [PATCH] Make resources edited by plugins be sent as reference This ensures that a plugin can save a resource using the ResourceSaver. --- editor/editor_plugin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 1bdc62f99b..5b501ae643 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -176,7 +176,11 @@ void EditorPlugin::make_visible(bool p_visible) { void EditorPlugin::edit(Object *p_object) { if (get_script_instance() && get_script_instance()->has_method("edit")) { - get_script_instance()->call("edit", p_object); + if (p_object->is_class("Resource")) { + get_script_instance()->call("edit", Ref(Object::cast_to(p_object))); + } else { + get_script_instance()->call("edit", p_object); + } } }