From 8f259ff5ca04635d3c229c1947741fe828a96f98 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Sat, 25 Jun 2016 19:02:17 -0500 Subject: [PATCH 01/10] Shortcuts for script switching in script Mode --- scene/gui/text_edit.cpp | 1 + tools/editor/plugins/script_editor_plugin.cpp | 22 ++++++++++++++++++- tools/editor/plugins/script_editor_plugin.h | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 6fd6137ac8c..5a6660819c1 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1973,6 +1973,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } } break; case KEY_TAB: { + if (k.mod.command) break; // avoid tab when command if (readonly) break; diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 10e4fc8475d..ee83b6b0321 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -585,7 +585,6 @@ void ScriptTextEditor::_code_complete_script(const String& p_code, List* Error err = script->get_language()->complete_code(p_code,script->get_path().get_base_dir(),base,r_options,hint); if (hint!="") { get_text_edit()->set_code_hint(hint); - print_line("hint: "+hint.replace(String::chr(0xFFFF),"|")); } } @@ -2316,6 +2315,22 @@ void ScriptEditor::_script_split_dragged(float) { EditorNode::get_singleton()->save_layout(); } +void ScriptEditor::_unhandled_input(const InputEvent& p_event) { + if (p_event.key.pressed || !is_visible()) return; + if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) { + int next_tab = script_list->get_current() + 1; + next_tab %= script_list->get_item_count(); + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } + if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) { + int next_tab = script_list->get_current() - 1; + next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } +} + void ScriptEditor::set_window_layout(Ref p_layout) { if (!bool(EDITOR_DEF("text_editor/restore_scripts_on_load",true))) { @@ -2598,6 +2613,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_history_forward",&ScriptEditor::_history_forward); ObjectTypeDB::bind_method("_history_back",&ScriptEditor::_history_back); ObjectTypeDB::bind_method("_live_auto_reload_running_scripts",&ScriptEditor::_live_auto_reload_running_scripts); + ObjectTypeDB::bind_method("_unhandled_input",&ScriptEditor::_unhandled_input); } @@ -2631,6 +2647,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { tab_container->set_h_size_flags(SIZE_EXPAND_FILL); + ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_GREATER); + ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_LESS); + set_process_unhandled_input(true); + file_menu = memnew( MenuButton ); menu_hb->add_child(file_menu); file_menu->set_text(TTR("File")); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 0636190a412..85412087b42 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -279,6 +279,8 @@ class ScriptEditor : public VBoxContainer { void _script_split_dragged(float); + void _unhandled_input(const InputEvent& p_event); + void _history_forward(); void _history_back(); From f55dc6d0b6a0407fa9f88e38169fe1d216969f74 Mon Sep 17 00:00:00 2001 From: Samuel Grigolato Date: Sun, 26 Jun 2016 17:03:42 -0300 Subject: [PATCH 02/10] Fix issue when switching between FileSystem and other editor docks. #5384 --- tools/editor/scenes_dock.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp index cbd7df9d186..0df4dfacc1c 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/scenes_dock.cpp @@ -164,12 +164,14 @@ void ScenesDock::_notification(int p_what) { if (split_mode) { file_list_vb->hide(); + tree->set_custom_minimum_size(Size2(0,0)); tree->set_v_size_flags(SIZE_EXPAND_FILL); button_back->show(); } else { tree->show(); file_list_vb->show(); + tree->set_custom_minimum_size(Size2(0,200)*EDSCALE); tree->set_v_size_flags(SIZE_FILL); button_back->hide(); if (!EditorFileSystem::get_singleton()->is_scanning()) { @@ -1702,7 +1704,6 @@ ScenesDock::ScenesDock(EditorNode *p_editor) { tree->set_hide_root(true); split_box->add_child(tree); - tree->set_custom_minimum_size(Size2(0,200)*EDSCALE); tree->set_drag_forwarding(this); From 9e751178eb45d048d6edafdd13663fd2dea047f9 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 27 Jun 2016 03:03:42 +0200 Subject: [PATCH 03/10] Fix compiling for X11 on non-86, this fixes #5444 --- platform/x11/detect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 5f272536bad..54940866b21 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -209,5 +209,7 @@ def configure(env): if (env["use_static_cpp"]=="yes"): env.Append(LINKFLAGS=['-static-libstdc++']) - env["x86_opt_gcc"]=True + list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] + if any(platform.machine() in s for s in list_of_x86): + env["x86_opt_gcc"]=True From 081c400ac6481192d0df214fac9da0f3206c1db7 Mon Sep 17 00:00:00 2001 From: sanikoyes Date: Mon, 27 Jun 2016 19:47:40 +0800 Subject: [PATCH 04/10] Add placeholder property for line_edit this useful for user input tip --- scene/gui/line_edit.cpp | 29 ++++++++++++++++++++++++----- scene/gui/line_edit.h | 3 +++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 579a6e2f0a7..cd6d39aa784 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -108,7 +108,7 @@ void LineEdit::_input_event(InputEvent p_event) { selection.doubleclick=false; if (OS::get_singleton()->has_virtual_keyboard()) - OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect()); + OS::get_singleton()->show_virtual_keyboard(text,get_global_rect()); } update(); @@ -634,14 +634,19 @@ void LineEdit::_notification(int p_what) { Color font_color_selected=get_color("font_color_selected"); Color cursor_color=get_color("cursor_color"); + const String& t = text.empty() ? placeholder : text; + // draw placeholder color + if(text.empty()) + font_color.a *= 0.6; + while(true) { //end of string, break! - if (char_ofs>=text.length()) + if (char_ofs>=t.length()) break; - CharType cchar=pass?'*':text[char_ofs]; - CharType next=pass?'*':text[char_ofs+1]; + CharType cchar=pass?'*':t[char_ofs]; + CharType next=pass?'*':t[char_ofs+1]; int char_width=font->get_char_size( cchar,next ).width; // end of widget, break! @@ -678,7 +683,7 @@ void LineEdit::_notification(int p_what) { } if (OS::get_singleton()->has_virtual_keyboard()) - OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect()); + OS::get_singleton()->show_virtual_keyboard(text,get_global_rect()); } break; case NOTIFICATION_FOCUS_EXIT: { @@ -938,6 +943,17 @@ String LineEdit::get_text() const { return text; } +void LineEdit::set_placeholder(String p_text) { + + placeholder = p_text; + update(); +} + +String LineEdit::get_placeholder() const { + + return placeholder; +} + void LineEdit::set_cursor_pos(int p_pos) { if (p_pos>(int)text.length()) @@ -1223,6 +1239,8 @@ void LineEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("select_all"),&LineEdit::select_all); ObjectTypeDB::bind_method(_MD("set_text","text"),&LineEdit::set_text); ObjectTypeDB::bind_method(_MD("get_text"),&LineEdit::get_text); + ObjectTypeDB::bind_method(_MD("set_placeholder","text"),&LineEdit::set_placeholder); + ObjectTypeDB::bind_method(_MD("get_placeholder"),&LineEdit::get_placeholder); ObjectTypeDB::bind_method(_MD("set_cursor_pos","pos"),&LineEdit::set_cursor_pos); ObjectTypeDB::bind_method(_MD("get_cursor_pos"),&LineEdit::get_cursor_pos); ObjectTypeDB::bind_method(_MD("cursor_set_blink_enabled", "enable"),&LineEdit::cursor_set_blink_enabled); @@ -1257,6 +1275,7 @@ void LineEdit::_bind_methods() { BIND_CONSTANT( MENU_MAX ); ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "text" ), _SCS("set_text"),_SCS("get_text") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "placeholder" ), _SCS("set_placeholder"),_SCS("get_placeholder") ); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), _SCS("set_align"), _SCS("get_align")); ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "max_length" ), _SCS("set_max_length"),_SCS("get_max_length") ); ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "editable" ), _SCS("set_editable"),_SCS("is_editable") ); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index e4da0f0b87c..85706982e09 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -67,6 +67,7 @@ private: String undo_text; String text; + String placeholder; PopupMenu *menu; @@ -135,6 +136,8 @@ public: void delete_text(int p_from_column, int p_to_column); void set_text(String p_text); String get_text() const; + void set_placeholder(String p_text); + String get_placeholder() const; void set_cursor_pos(int p_pos); int get_cursor_pos() const; void set_max_length(int p_max_length); From c702981d5785386eea3ea81abca978b640cf6690 Mon Sep 17 00:00:00 2001 From: sanikoyes Date: Tue, 28 Jun 2016 11:45:17 +0800 Subject: [PATCH 05/10] add placeholder alpha property --- scene/gui/line_edit.cpp | 20 ++++++++++++++++++-- scene/gui/line_edit.h | 3 +++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index cd6d39aa784..16000bb55f3 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -637,7 +637,7 @@ void LineEdit::_notification(int p_what) { const String& t = text.empty() ? placeholder : text; // draw placeholder color if(text.empty()) - font_color.a *= 0.6; + font_color.a *= placeholder_alpha; while(true) { @@ -954,6 +954,18 @@ String LineEdit::get_placeholder() const { return placeholder; } + +void LineEdit::set_placeholder_alpha(float p_alpha) { + + placeholder_alpha = p_alpha; + update(); +} + +float LineEdit::get_placeholder_alpha() const { + + return placeholder_alpha; +} + void LineEdit::set_cursor_pos(int p_pos) { if (p_pos>(int)text.length()) @@ -1241,6 +1253,8 @@ void LineEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_text"),&LineEdit::get_text); ObjectTypeDB::bind_method(_MD("set_placeholder","text"),&LineEdit::set_placeholder); ObjectTypeDB::bind_method(_MD("get_placeholder"),&LineEdit::get_placeholder); + ObjectTypeDB::bind_method(_MD("set_placeholder_alpha","alpha"),&LineEdit::set_placeholder_alpha); + ObjectTypeDB::bind_method(_MD("get_placeholder_alpha"),&LineEdit::get_placeholder_alpha); ObjectTypeDB::bind_method(_MD("set_cursor_pos","pos"),&LineEdit::set_cursor_pos); ObjectTypeDB::bind_method(_MD("get_cursor_pos"),&LineEdit::get_cursor_pos); ObjectTypeDB::bind_method(_MD("cursor_set_blink_enabled", "enable"),&LineEdit::cursor_set_blink_enabled); @@ -1275,7 +1289,8 @@ void LineEdit::_bind_methods() { BIND_CONSTANT( MENU_MAX ); ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "text" ), _SCS("set_text"),_SCS("get_text") ); - ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "placeholder" ), _SCS("set_placeholder"),_SCS("get_placeholder") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "placeholder/text" ), _SCS("set_placeholder"),_SCS("get_placeholder") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::REAL, "placeholder/alpha",PROPERTY_HINT_RANGE,"0,1,0.001" ), _SCS("set_placeholder_alpha"),_SCS("get_placeholder_alpha") ); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), _SCS("set_align"), _SCS("get_align")); ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "max_length" ), _SCS("set_max_length"),_SCS("get_max_length") ); ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "editable" ), _SCS("set_editable"),_SCS("is_editable") ); @@ -1294,6 +1309,7 @@ LineEdit::LineEdit() { window_has_focus=true; max_length = 0; pass=false; + placeholder_alpha=0.6; selection_clear(); set_focus_mode( FOCUS_ALL ); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index 85706982e09..112e4ad55ec 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -68,6 +68,7 @@ private: String undo_text; String text; String placeholder; + float placeholder_alpha; PopupMenu *menu; @@ -138,6 +139,8 @@ public: String get_text() const; void set_placeholder(String p_text); String get_placeholder() const; + void set_placeholder_alpha(float p_alpha); + float get_placeholder_alpha() const; void set_cursor_pos(int p_pos); int get_cursor_pos() const; void set_max_length(int p_max_length); From e453c10ff5550a6dd7b17ae68da4b858b6415eff Mon Sep 17 00:00:00 2001 From: volzhs Date: Tue, 28 Jun 2016 21:47:02 +0900 Subject: [PATCH 06/10] remove the warning of instances in use at Project manager exit --- tools/editor/project_manager.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index d8814fd50e3..dafec397c52 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -871,9 +871,6 @@ ProjectManager::ProjectManager() { HBoxContainer *top_hb = memnew( HBoxContainer); vb->add_child(top_hb); - TextureFrame *logo = memnew( TextureFrame ); - logo->set_texture(theme->get_icon("LogoSmall","EditorIcons")); - //top_hb->add_child( logo ); CenterContainer *ccl = memnew( CenterContainer ); Label *l = memnew( Label ); l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")); From afab4168fd33e56beddb857625facdfca305c575 Mon Sep 17 00:00:00 2001 From: Samuel Grigolato Date: Sun, 26 Jun 2016 17:03:42 -0300 Subject: [PATCH 07/10] Add tile index prefixes in tile map editor plugin. #5420 --- tools/editor/plugins/tile_map_editor_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index d5f85d3333c..9d27ac8aa35 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -223,7 +223,7 @@ void TileMapEditor::_update_palette() { String name; if (tileset->tile_get_name(E->get())!="") { - name = tileset->tile_get_name(E->get()); + name = itos(E->get())+" - "+tileset->tile_get_name(E->get()); } else { name = "#"+itos(E->get()); } From 484f4d8dec3ad1f08a3a5d36d6eb59cdfd9ad7d8 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Wed, 29 Jun 2016 14:07:11 +0100 Subject: [PATCH 08/10] Fixed function highlighting with spaces --- scene/gui/text_edit.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 6fd6137ac8c..ca8284cb13a 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -852,6 +852,11 @@ void TextEdit::_notification(int p_what) { k++; } + // check for space between name and bracket + while (k < str.length() && (str[k] == '\t' || str[k] == ' ')) { + k++; + } + if (str[k] == '(') { in_function_name = true; } From fbdb717cae6f7598fb9459d2f05afb2745bfede2 Mon Sep 17 00:00:00 2001 From: Jamil Halabi Date: Wed, 29 Jun 2016 15:04:24 -0400 Subject: [PATCH 09/10] Fixed building for latest Haiku nightlies. --- platform/haiku/context_gl_haiku.cpp | 12 +++++++++++- platform/haiku/context_gl_haiku.h | 5 +++++ platform/haiku/detect.py | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp index 2fedd1532a2..bf890d14bfe 100644 --- a/platform/haiku/context_gl_haiku.cpp +++ b/platform/haiku/context_gl_haiku.cpp @@ -35,6 +35,8 @@ ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow* p_window) { uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH; view = new HaikuGLView(window->Bounds(), type); + + use_vsync = false; } ContextGL_Haiku::~ContextGL_Haiku() { @@ -57,7 +59,7 @@ void ContextGL_Haiku::make_current() { } void ContextGL_Haiku::swap_buffers() { - view->SwapBuffers(); + view->SwapBuffers(use_vsync); } int ContextGL_Haiku::get_window_width() { @@ -68,4 +70,12 @@ int ContextGL_Haiku::get_window_height() { return window->Bounds().IntegerHeight(); } +void ContextGL_Haiku::set_use_vsync(bool p_use) { + use_vsync = p_use; +} + +bool ContextGL_Haiku::is_using_vsync() const { + return use_vsync; +} + #endif diff --git a/platform/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h index 91aae6b3828..c7f80543aa5 100644 --- a/platform/haiku/context_gl_haiku.h +++ b/platform/haiku/context_gl_haiku.h @@ -40,6 +40,8 @@ class ContextGL_Haiku : public ContextGL { private: HaikuGLView* view; HaikuDirectWindow* window; + + bool use_vsync; public: ContextGL_Haiku(HaikuDirectWindow* p_window); @@ -51,6 +53,9 @@ public: virtual void swap_buffers(); virtual int get_window_width(); virtual int get_window_height(); + + virtual void set_use_vsync(bool p_use); + virtual bool is_using_vsync() const; }; #endif diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py index 6d1a96a8daf..f36b0c567eb 100644 --- a/platform/haiku/detect.py +++ b/platform/haiku/detect.py @@ -24,7 +24,7 @@ def get_opts(): def get_flags(): return [ ('builtin_zlib', 'no'), - #('glew', 'yes'), # TODO: investigate the GLEW situation on Haiku + ('glew', 'yes'), ] def configure(env): @@ -38,8 +38,8 @@ def configure(env): env.Append(CPPPATH = ['#platform/haiku']) - env["CC"] = "gcc" - env["CXX"] = "g++" + env["CC"] = "gcc-x86" + env["CXX"] = "g++-x86" if (env["target"]=="release"): if (env["debug_release"]=="yes"): From 2511f48339ab9fa489cf31e7c985547ddb69ae4e Mon Sep 17 00:00:00 2001 From: SuperUserNameMan Date: Wed, 29 Jun 2016 23:00:45 +0200 Subject: [PATCH 10/10] fixes #5464 windows_joystick close_joystick bug --- platform/windows/joystick.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/windows/joystick.cpp b/platform/windows/joystick.cpp index 663bbe3b9b0..e69bfe6a52c 100644 --- a/platform/windows/joystick.cpp +++ b/platform/windows/joystick.cpp @@ -283,7 +283,7 @@ void joystick_windows::close_joystick(int id) { d_joysticks[id].attached = false; attached_joysticks[d_joysticks[id].id] = false; d_joysticks[id].guid.Data1 = d_joysticks[id].guid.Data2 = d_joysticks[id].guid.Data3 = 0; - input->joy_connection_changed(id, false, ""); + input->joy_connection_changed(d_joysticks[id].id, false, ""); joystick_count--; }