diff options
-rw-r--r-- | editor/editor_export.cpp | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 15 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 4 | ||||
-rw-r--r-- | editor/project_manager.cpp | 18 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 34 | ||||
-rw-r--r-- | scene/gui/item_list.h | 8 |
9 files changed, 70 insertions, 29 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index abbce0199a..6bf92ddd2d 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -716,7 +716,7 @@ void EditorExport::_save() { config->set_value(section, "name", preset->get_name()); config->set_value(section, "platform", preset->get_platform()->get_name()); config->set_value(section, "runnable", preset->is_runnable()); - config->set_value(section, "custom_feaures", preset->get_custom_features()); + config->set_value(section, "custom_features", preset->get_custom_features()); bool save_files = false; switch (preset->get_export_filter()) { case EditorExportPreset::EXPORT_ALL_RESOURCES: { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ea4cbd4853..990628d6af 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -58,6 +58,7 @@ #include "servers/physics_2d_server.h" #include "translation.h" #include "version.h" +#include "version_hash.gen.h" #include <stdio.h> // plugins #include "asset_library_editor_plugin.h" @@ -5986,14 +5987,18 @@ EditorNode::EditorNode() { logo->set_texture(gui_base->get_icon("Logo", "EditorIcons")); hbc->add_child(logo); + String hash = String(VERSION_HASH); + if (hash.length() != 0) + hash = "." + hash.left(7); + Label *about_text = memnew(Label); about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER); - about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + + about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + TTR("Godot Engine contributors") + "\n"); hbc->add_child(about_text); TabContainer *tc = memnew(TabContainer); - tc->set_custom_minimum_size(Size2(600, 240) * EDSCALE); + tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE); tc->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(tc); @@ -6021,14 +6026,14 @@ EditorNode::EditorNode() { dev_vbc->add_child(lbl); ItemList *il = memnew(ItemList); - il->set_max_columns(32); + il->set_max_columns(16); il->set_h_size_flags(Control::SIZE_EXPAND_FILL); - il->set_custom_minimum_size(Size2(0, i == 3 ? DEV_NAMES_COUNT * 7.6 : 30) * EDSCALE); + il->set_fixed_column_width(230 * EDSCALE); + il->set_auto_height(true); const char **dev_names_ptr = dev_src[i]; while (*dev_names_ptr) il->add_item(String::utf8(*dev_names_ptr++), NULL, false); dev_vbc->add_child(il); - il->set_fixed_column_width(240 * EDSCALE); HSeparator *hs = memnew(HSeparator); hs->set_modulate(Color(0, 0, 0, 0)); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 968be43946..c65065db43 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -175,7 +175,7 @@ Node *EditorPlugin::get_edited_scene_root() { return EditorNode::get_singleton()->get_edited_scene(); } -Array EditorPlugin::get_opened_scenes_list() const { +Array EditorPlugin::get_open_scenes() const { Array ret; Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes(); @@ -440,7 +440,7 @@ void EditorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::add_import_plugin); ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::remove_import_plugin); ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled); - ClassDB::bind_method(D_METHOD("get_opened_scenes_list"), &EditorPlugin::get_opened_scenes_list); + ClassDB::bind_method(D_METHOD("get_open_scenes"), &EditorPlugin::get_open_scenes); ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &EditorPlugin::get_edited_scene_root); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 2c920323a1..a0f64fb1ea 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -118,7 +118,7 @@ public: bool is_input_event_forwarding_always_enabled() { return input_event_forwarding_always_enabled; } Node *get_edited_scene_root(); - Array get_opened_scenes_list() const; + Array get_open_scenes() const; ScriptEditor *get_script_editor(); void notify_main_screen_changed(const String &screen_name); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index aeb16f13ee..c90d66f914 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -793,10 +793,10 @@ Ref<Script> ScriptEditor::_get_current_script() { } } -Array ScriptEditor::_get_opened_script_list() const { +Array ScriptEditor::_get_open_scripts() const { Array ret; - Vector<Ref<Script> > scripts = get_opened_scripts(); + Vector<Ref<Script> > scripts = get_open_scripts(); int scrits_amount = scripts.size(); for (int idx_script = 0; idx_script < scrits_amount; idx_script++) { ret.push_back(scripts[idx_script]); @@ -1159,7 +1159,7 @@ void ScriptEditor::notify_script_close(const Ref<Script> &p_script) { } void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) { - emit_signal("script_changed", p_script); + emit_signal("editor_script_changed", p_script); } static const Node *_find_node_with_script(const Node *p_node, const RefPtr &p_script) { @@ -2104,7 +2104,7 @@ void ScriptEditor::_history_back() { } } -Vector<Ref<Script> > ScriptEditor::get_opened_scripts() const { +Vector<Ref<Script> > ScriptEditor::get_open_scripts() const { Vector<Ref<Script> > out_scripts = Vector<Ref<Script> >(); @@ -2213,9 +2213,9 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input); ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script); - ClassDB::bind_method(D_METHOD("get_opened_scripts_list"), &ScriptEditor::_get_opened_script_list); + ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts); - ADD_SIGNAL(MethodInfo("script_changed", PropertyInfo(Variant::OBJECT, "script:Script"))); + ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script:Script"))); ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::STRING, "script:String"))); } diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 3d03eb0f49..d8a9415df1 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -322,7 +322,7 @@ class ScriptEditor : public PanelContainer { void _file_dialog_action(String p_file); Ref<Script> _get_current_script(); - Array _get_opened_script_list() const; + Array _get_open_scripts() const; static void _open_script_request(const String &p_path); @@ -357,7 +357,7 @@ public: void get_window_layout(Ref<ConfigFile> p_layout); void set_scene_root_script(Ref<Script> p_script); - Vector<Ref<Script> > get_opened_scripts() const; + Vector<Ref<Script> > get_open_scripts() const; bool script_goto_method(Ref<Script> p_script, const String &p_method); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index e3f22c833e..acf5fe02cc 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -202,10 +202,10 @@ private: f->store_line("\n"); f->store_line("[application]"); f->store_line("\n"); - f->store_line("name=\"" + project_name->get_text() + "\""); - f->store_line("icon=\"res://icon.png\""); + f->store_line("config/name=\"" + project_name->get_text() + "\""); + f->store_line("config/icon=\"res://icon.png\""); f->store_line("[rendering]"); - f->store_line("viewport/default_environment=\"res://default_env.tres\""); + f->store_line("environment/default_environment=\"res://default_env.tres\""); memdelete(f); ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons")); @@ -811,16 +811,16 @@ void ProjectManager::_load_recent_projects() { String project_name = TTR("Unnamed Project"); - if (cf->has_section_key("application", "name")) { - project_name = static_cast<String>(cf->get_value("application", "name")).xml_unescape(); + if (cf->has_section_key("application", "config/name")) { + project_name = static_cast<String>(cf->get_value("application", "config/name")).xml_unescape(); } if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && project_name.findn(search_term) == -1) continue; Ref<Texture> icon; - if (cf->has_section_key("application", "icon")) { - String appicon = cf->get_value("application", "icon"); + if (cf->has_section_key("application", "config/icon")) { + String appicon = cf->get_value("application", "config/icon"); if (appicon != "") { Ref<Image> img; img.instance(); @@ -840,8 +840,8 @@ void ProjectManager::_load_recent_projects() { } String main_scene; - if (cf->has_section_key("application", "main_scene")) { - main_scene = cf->get_value("application", "main_scene"); + if (cf->has_section_key("application", "run/main_scene")) { + main_scene = cf->get_value("application", "run/main_scene"); } selected_list_copy.erase(project); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index eff9d801b6..97f49da2be 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "item_list.h" -#include "project_settings.h" #include "os/os.h" +#include "project_settings.h" void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, bool p_selectable) { @@ -743,12 +743,10 @@ void ItemList::_notification(int p_what) { Size2 size = get_size(); - float page = size.height - bg->get_minimum_size().height; int width = size.width - bg->get_minimum_size().width; if (scroll_bar->is_visible()) { width -= mw + bg->get_margin(MARGIN_RIGHT); } - scroll_bar->set_page(page); draw_style_box(bg, Rect2(Point2(), size)); @@ -883,8 +881,12 @@ void ItemList::_notification(int p_what) { } if (all_fit) { + float page = size.height - bg->get_minimum_size().height; float max = MAX(page, ofs.y + max_h); + if (auto_height) + auto_height_value = ofs.y + max_h + bg->get_minimum_size().height; scroll_bar->set_max(max); + scroll_bar->set_page(page); //print_line("max: "+rtos(max)+" page "+rtos(page)); if (max <= page) { scroll_bar->set_value(0); @@ -1253,6 +1255,26 @@ Array ItemList::_get_items() const { return items; } +Size2 ItemList::get_minimum_size() const { + + if (auto_height) { + return Size2(0, auto_height_value); + } + return Size2(); +} + +void ItemList::set_auto_height(bool p_enable) { + + auto_height = p_enable; + shape_changed = true; + update(); +} + +bool ItemList::has_auto_height() const { + + return auto_height; +} + void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("add_item", "text", "icon:Texture", "selectable"), &ItemList::add_item, DEFVAL(Variant()), DEFVAL(true)); @@ -1323,6 +1345,9 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("set_allow_rmb_select", "allow"), &ItemList::set_allow_rmb_select); ClassDB::bind_method(D_METHOD("get_allow_rmb_select"), &ItemList::get_allow_rmb_select); + ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height); + ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height); + ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos", "exact"), &ItemList::get_item_at_pos, DEFVAL(false)); ClassDB::bind_method(D_METHOD("ensure_current_is_visible"), &ItemList::ensure_current_is_visible); @@ -1340,6 +1365,7 @@ void ItemList::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Multi"), "set_select_mode", "get_select_mode"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select"); ADD_PROPERTYNO(PropertyInfo(Variant::INT, "max_text_lines"), "set_max_text_lines", "get_max_text_lines"); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "auto_height"), "set_auto_height", "has_auto_height"); ADD_GROUP("Columns", ""); ADD_PROPERTYNO(PropertyInfo(Variant::INT, "max_columns"), "set_max_columns", "get_max_columns"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "same_column_width"), "set_same_column_width", "is_same_column_width"); @@ -1372,6 +1398,8 @@ ItemList::ItemList() { same_column_width = false; max_text_lines = 1; max_columns = 1; + auto_height = false; + auto_height_value = 0.0f; scroll_bar = memnew(VScrollBar); add_child(scroll_bar); diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index 9cb7016b60..137eff8885 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -78,6 +78,9 @@ private: bool ensure_selected_visible; bool same_column_width; + bool auto_height; + float auto_height_value; + Vector<Item> items; Vector<int> separators; @@ -198,6 +201,11 @@ public: void set_icon_scale(real_t p_scale); real_t get_icon_scale() const; + void set_auto_height(bool p_enable); + bool has_auto_height() const; + + Size2 get_minimum_size() const; + VScrollBar *get_v_scroll() { return scroll_bar; } ItemList(); |