1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Make resources edited by plugins be sent as reference

This ensures that a plugin can save a resource using the ResourceSaver.
This commit is contained in:
George Marques
2017-11-17 13:48:33 -02:00
parent 64caa4733c
commit e90cfa6f82

View File

@@ -455,8 +455,12 @@ void EditorPlugin::make_visible(bool p_visible) {
void EditorPlugin::edit(Object *p_object) { void EditorPlugin::edit(Object *p_object) {
if (get_script_instance() && get_script_instance()->has_method("edit")) { if (get_script_instance() && get_script_instance()->has_method("edit")) {
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); get_script_instance()->call("edit", p_object);
} }
}
} }
bool EditorPlugin::handles(Object *p_object) const { bool EditorPlugin::handles(Object *p_object) const {