mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 06:03:09 +00:00
Fix no unsaved indicator Save As resource
This commit is contained in:
parent
61598c5c88
commit
b97c128b34
@ -175,6 +175,13 @@ void EditorResourcePicker::_file_quick_selected() {
|
||||
_file_selected(quick_open->get_selected());
|
||||
}
|
||||
|
||||
void EditorResourcePicker::_resource_saved(Object *p_resource) {
|
||||
if (edited_resource.is_valid() && p_resource == edited_resource.ptr()) {
|
||||
emit_signal(SNAME("resource_changed"), edited_resource);
|
||||
_update_resource();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorResourcePicker::_update_menu() {
|
||||
_update_menu_items();
|
||||
|
||||
@ -408,6 +415,10 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
|
||||
if (edited_resource.is_null()) {
|
||||
return;
|
||||
}
|
||||
Callable resource_saved = callable_mp(this, &EditorResourcePicker::_resource_saved);
|
||||
if (!EditorNode::get_singleton()->is_connected("resource_saved", resource_saved)) {
|
||||
EditorNode::get_singleton()->connect("resource_saved", resource_saved);
|
||||
}
|
||||
EditorNode::get_singleton()->save_resource_as(edited_resource);
|
||||
} break;
|
||||
|
||||
@ -833,6 +844,13 @@ void EditorResourcePicker::_notification(int p_what) {
|
||||
assign_button->queue_redraw();
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
Callable resource_saved = callable_mp(this, &EditorResourcePicker::_resource_saved);
|
||||
if (EditorNode::get_singleton()->is_connected("resource_saved", resource_saved)) {
|
||||
EditorNode::get_singleton()->disconnect("resource_saved", resource_saved);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,8 @@ class EditorResourcePicker : public HBoxContainer {
|
||||
void _file_quick_selected();
|
||||
void _file_selected(const String &p_path);
|
||||
|
||||
void _resource_saved(Object *p_resource);
|
||||
|
||||
void _update_menu();
|
||||
void _update_menu_items();
|
||||
void _edit_menu_cbk(int p_which);
|
||||
|
Loading…
Reference in New Issue
Block a user