Explorar o código

Merge pull request #12994 from vnen/plugin-resource-save

Make resources edited by plugins be sent as reference (2.1)
Rémi Verschelde %!s(int64=7) %!d(string=hai) anos
pai
achega
52da15b6fc
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      editor/editor_plugin.cpp

+ 5 - 1
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<Resource>(Object::cast_to<Resource>(p_object)));
+		} else {
+			get_script_instance()->call("edit", p_object);
+		}
 	}
 }