diff options
Diffstat (limited to 'editor/inspector_dock.cpp')
-rw-r--r-- | editor/inspector_dock.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 750fca2852..8a0812973f 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -130,8 +130,7 @@ void InspectorDock::_menu_option(int p_option) { ERR_FAIL_INDEX(idx, methods.size()); String name = methods[idx].name; - if (current) - current->call(name); + current->call(name); } } } @@ -170,7 +169,7 @@ void InspectorDock::_save_resource(bool save_as) const { uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL; - ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)) + ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); RES current_res = RES(Object::cast_to<Resource>(current_obj)); @@ -184,7 +183,7 @@ void InspectorDock::_unref_resource() const { uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL; - ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)) + ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); RES current_res = RES(Object::cast_to<Resource>(current_obj)); current_res->set_path(""); @@ -195,7 +194,7 @@ void InspectorDock::_copy_resource() const { uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current(); Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL; - ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)) + ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj)); RES current_res = RES(Object::cast_to<Resource>(current_obj)); @@ -334,6 +333,7 @@ void InspectorDock::_notification(int p_what) { set_theme(editor->get_gui_base()->get_theme()); resource_new_button->set_icon(get_icon("New", "EditorIcons")); resource_load_button->set_icon(get_icon("Load", "EditorIcons")); + resource_save_button->set_icon(get_icon("Save", "EditorIcons")); backward_button->set_icon(get_icon("Back", "EditorIcons")); forward_button->set_icon(get_icon("Forward", "EditorIcons")); history_menu->set_icon(get_icon("History", "EditorIcons")); @@ -416,6 +416,7 @@ void InspectorDock::update(Object *p_object) { object_menu->set_disabled(false); search->set_editable(true); + resource_save_button->set_disabled(!is_resource); PopupMenu *p = object_menu->get_popup(); @@ -515,6 +516,16 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { resource_load_button->connect("pressed", this, "_open_resource_selector"); resource_load_button->set_focus_mode(Control::FOCUS_NONE); + resource_save_button = memnew(MenuButton); + resource_save_button->set_tooltip(TTR("Save the currently edited resource.")); + resource_save_button->set_icon(get_icon("Save", "EditorIcons")); + general_options_hb->add_child(resource_save_button); + resource_save_button->get_popup()->add_item(TTR("Save"), RESOURCE_SAVE); + resource_save_button->get_popup()->add_item(TTR("Save As..."), RESOURCE_SAVE_AS); + resource_save_button->get_popup()->connect("id_pressed", this, "_menu_option"); + resource_save_button->set_focus_mode(Control::FOCUS_NONE); + resource_save_button->set_disabled(true); + general_options_hb->add_spacer(); backward_button = memnew(ToolButton); |