mirror of
https://github.com/godotengine/godot.git
synced 2024-11-23 04:33:29 +00:00
Merge pull request #51228 from timothyqiu/inspector-update
Disable save button when Inspector is not editing anything
This commit is contained in:
commit
7eedc2c348
@ -408,22 +408,12 @@ void InspectorDock::update(Object *p_object) {
|
||||
|
||||
current = p_object;
|
||||
|
||||
if (!p_object) {
|
||||
open_docs_button->set_disabled(true);
|
||||
object_menu->set_disabled(true);
|
||||
warning->hide();
|
||||
search->set_editable(false);
|
||||
editor_path->clear_path();
|
||||
return;
|
||||
}
|
||||
|
||||
bool is_resource = p_object->is_class("Resource");
|
||||
bool is_node = p_object->is_class("Node");
|
||||
|
||||
object_menu->set_disabled(false);
|
||||
search->set_editable(true);
|
||||
editor_path->enable_path();
|
||||
const bool is_object = p_object != nullptr;
|
||||
const bool is_resource = is_object && p_object->is_class("Resource");
|
||||
const bool is_node = is_object && p_object->is_class("Node");
|
||||
|
||||
object_menu->set_disabled(!is_object);
|
||||
search->set_editable(is_object);
|
||||
resource_save_button->set_disabled(!is_resource);
|
||||
open_docs_button->set_disabled(!is_resource && !is_node);
|
||||
|
||||
@ -431,6 +421,14 @@ void InspectorDock::update(Object *p_object) {
|
||||
resource_extra_popup->set_item_disabled(resource_extra_popup->get_item_index(RESOURCE_COPY), !is_resource);
|
||||
resource_extra_popup->set_item_disabled(resource_extra_popup->get_item_index(RESOURCE_MAKE_BUILT_IN), !is_resource);
|
||||
|
||||
if (!is_object) {
|
||||
warning->hide();
|
||||
editor_path->clear_path();
|
||||
return;
|
||||
}
|
||||
|
||||
editor_path->enable_path();
|
||||
|
||||
PopupMenu *p = object_menu->get_popup();
|
||||
|
||||
p->clear();
|
||||
|
Loading…
Reference in New Issue
Block a user