From 1a7aae7443194f7d6137901af369c843b3911b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=83zvan=20Cosmin=20R=C4=83dulescu?= Date: Sat, 27 Aug 2016 17:33:45 +0200 Subject: [PATCH 001/181] (Array) pop_front, pop_back return values pop_front, pop_back now return values instead of `void`. Things I didn't know how to properly implement: 1. pop_front & pop_back shows in the help menu Object as return value. I know this is incorrect but if not Object than what? Cause it can't be void. It needs to be a generic type that includes all the Array types --- core/array.cpp | 20 +++++++++++++++----- core/array.h | 4 ++-- core/variant_call.cpp | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/core/array.cpp b/core/array.cpp index 23792f90fc..683a43e3d0 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -276,16 +276,26 @@ void Array::push_front(const Variant& p_value) { _p->array.insert(0,p_value); } -void Array::pop_back(){ +Variant Array::pop_back(){ - if (!_p->array.empty()) - _p->array.resize( _p->array.size() -1 ); + if (!_p->array.empty()) { + int n = _p->array.size() - 1; + Variant ret = _p->array.get(n); + _p->array.resize(n); + return ret; + } + return Variant(); } -void Array::pop_front(){ - if (!_p->array.empty()) +Variant Array::pop_front(){ + + if (!_p->array.empty()) { + Variant ret = _p->array.get(0); _p->array.remove(0); + return ret; + } + return Variant(); } diff --git a/core/array.h b/core/array.h index dfc902525c..eb79b0cf33 100644 --- a/core/array.h +++ b/core/array.h @@ -80,8 +80,8 @@ public: void erase(const Variant& p_value); void push_front(const Variant& p_value); - void pop_back(); - void pop_front(); + Variant pop_back(); + Variant pop_front(); Array(const Array& p_from); Array(bool p_shared=false); diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 8473fdcd19..f7bc38ac06 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -464,8 +464,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Array,hash); VCALL_LOCALMEM1(Array,push_back); VCALL_LOCALMEM1(Array,push_front); - VCALL_LOCALMEM0(Array,pop_back); - VCALL_LOCALMEM0(Array,pop_front); + VCALL_LOCALMEM0R(Array,pop_back); + VCALL_LOCALMEM0R(Array,pop_front); VCALL_LOCALMEM1(Array,append); VCALL_LOCALMEM1(Array,resize); VCALL_LOCALMEM2(Array,insert); From 66dac878ac9fc278044281b7f67fbed668e4523d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Wed, 14 Sep 2016 04:02:18 +0200 Subject: [PATCH 002/181] Improve debug focus behavior Fix focusing debugged game on Windows Add re-focusing editor on continue --- core/os/os.h | 1 + core/script_debugger_remote.cpp | 3 +++ main/main.cpp | 10 ++++++++++ platform/windows/os_windows.cpp | 7 ++++++- platform/windows/os_windows.h | 1 + tools/editor/editor_node.h | 1 + tools/editor/editor_run.cpp | 4 ++++ tools/editor/editor_run.h | 2 ++ tools/editor/script_editor_debugger.cpp | 2 ++ 9 files changed, 30 insertions(+), 1 deletion(-) diff --git a/core/os/os.h b/core/os/os.h index 8e9293b3c8..c2b46a5420 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -372,6 +372,7 @@ public: virtual void set_screen_orientation(ScreenOrientation p_orientation); ScreenOrientation get_screen_orientation() const; + virtual void enable_for_stealing_focus(ProcessID pid) {} virtual void move_window_to_foreground() {} virtual void debug_break(); diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 99d1e22c07..d3cd824620 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -134,6 +134,8 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { ERR_FAIL(); } + OS::get_singleton()->enable_for_stealing_focus(Globals::get_singleton()->get("editor_pid")); + packet_peer_stream->put_var("debug_enter"); packet_peer_stream->put_var(2); packet_peer_stream->put_var(p_can_continue); @@ -271,6 +273,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { set_depth(-1); set_lines_left(-1); + OS::get_singleton()->move_window_to_foreground(); break; } else if (command=="break") { ERR_PRINT("Got break when already broke!"); diff --git a/main/main.cpp b/main/main.cpp index e339f399de..e8c989c88b 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -559,6 +559,16 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } else { goto error; + } + } else if (I->get()=="-epid") { + if (I->next()) { + + int editor_pid=I->next()->get().to_int(); + Globals::get_singleton()->set("editor_pid",editor_pid); + N=I->next()->next(); + } else { + goto error; + } } else { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index cebafdabce..a3ac12a838 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2154,10 +2154,15 @@ String OS_Windows::get_stdin_string(bool p_block) { } +void OS_Windows::enable_for_stealing_focus(ProcessID pid) { + + AllowSetForegroundWindow(pid); + +} + void OS_Windows::move_window_to_foreground() { SetForegroundWindow(hWnd); - BringWindowToTop(hWnd); } diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index e3e037e57b..70ef694957 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -269,6 +269,7 @@ public: virtual String get_locale() const; virtual LatinKeyboardVariant get_latin_keyboard_variant() const; + virtual void enable_for_stealing_focus(ProcessID pid); virtual void move_window_to_foreground(); virtual String get_data_dir() const; virtual String get_system_dir(SystemDir p_dir) const; diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index e6119cf577..e69063d56d 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -690,6 +690,7 @@ public: void notify_child_process_exited(); + OS::ProcessID get_child_process_id() const { return editor_run.get_pid(); } void stop_child_process(); Ref get_editor_theme() const { return theme; } diff --git a/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp index fb0f24c084..5fbb4ae2a0 100644 --- a/tools/editor/editor_run.cpp +++ b/tools/editor/editor_run.cpp @@ -52,6 +52,9 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List args.push_back("localhost:"+String::num(GLOBAL_DEF("debug/debug_port", 6007))); } + args.push_back("-epid"); + args.push_back(String::num(OS::get_singleton()->get_process_ID())); + if (p_custom_args!="") { Vector cargs=p_custom_args.split(" ",false); @@ -132,6 +135,7 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List } + if (p_breakpoints.size()) { args.push_back("-bp"); diff --git a/tools/editor/editor_run.h b/tools/editor/editor_run.h index 0b96a2c91c..5aa2adf801 100644 --- a/tools/editor/editor_run.h +++ b/tools/editor/editor_run.h @@ -53,6 +53,8 @@ public: void run_native_notify() { status=STATUS_PLAY; } void stop(); + OS::ProcessID get_pid() const { return pid; } + void set_debug_collisions(bool p_debug); bool get_debug_collisions() const; diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index da42f54095..694413cf18 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -216,6 +216,8 @@ void ScriptEditorDebugger::debug_continue() { ERR_FAIL_COND(connection.is_null()); ERR_FAIL_COND(!connection->is_connected()); + OS::get_singleton()->enable_for_stealing_focus(EditorNode::get_singleton()->get_child_process_id()); + Array msg; msg.push_back("continue"); ppeer->put_var(msg); From 663d4ee7de9741e4e55255908fbecd8582097ae3 Mon Sep 17 00:00:00 2001 From: yg2f Date: Thu, 15 Sep 2016 18:04:26 +0200 Subject: [PATCH 003/181] scons detects standalone MSVC on Windows Under Windows, Scons is now capable of detecting and compiling with standalone MSVC compilers (aka "Visual C++ Build Tools"). http://landinghub.visualstudio.com/visual-cpp-build-tools Tried with version 2015, and native x86 and x64 compilers under Windows 10 pro 64 and Windows 8.1 64, with the default Win8 SDK provided by the "Visual C++ Build Tools" web-installer. Follow the same compiling instructions than for compiling with Visual Studio, except that Visual Studio is no more required. KNOWN ISSUES : - ``methods.detect_visual_c_compiler_version()`` will emit a warning message on computers where the ``VSINSTALLDIR`` environement variable is not present. But it should compile just fine and still automatically detects the 32 or 64 bits according to the compiler you picked. TODO : - eventually, update ``platform/winrt/dectet.py`` with function ``methods.msvc_is_detected()`` and try to compile winrt/UWP with these standalone compilers (if you did not select Win10 SDK when installing the standalone tools, you can run it again). - update doc to make users aware of "Visual C++ Build Tools" aka "stadalone MSVC". - eventually, update ``methods.detect_visual_c_compiler_version()`` --- SConstruct | 3 +-- drivers/builtin_openssl2/SCsub | 3 ++- methods.py | 6 ++++++ platform/windows/detect.py | 25 ++++++++++++++++--------- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/SConstruct b/SConstruct index d168820f66..0c85023b21 100644 --- a/SConstruct +++ b/SConstruct @@ -16,7 +16,6 @@ platform_list = [] # list of platforms platform_opts = {} # options for each platform platform_flags = {} # flags for each platform - active_platforms=[] active_platform_ids=[] platform_exporters=[] @@ -60,7 +59,7 @@ platform_arg = ARGUMENTS.get("platform", False) if (os.name=="posix"): pass elif (os.name=="nt"): - if (os.getenv("VSINSTALLDIR")==None or platform_arg=="android"): + if (not methods.msvc_is_detected() or platform_arg=="android"): custom_tools=['mingw'] env_base=Environment(tools=custom_tools); diff --git a/drivers/builtin_openssl2/SCsub b/drivers/builtin_openssl2/SCsub index a28bc2922c..0c035cc4a5 100644 --- a/drivers/builtin_openssl2/SCsub +++ b/drivers/builtin_openssl2/SCsub @@ -656,7 +656,8 @@ if "platform" in env and env["platform"] == "winrt": # Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517) import os -if not (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None): # not Windows and not MSVC +import methods +if not (os.name=="nt" and methods.msvc_is_detected() ): # not Windows and not MSVC env_drivers.Append(CFLAGS=["-Wno-error=implicit-function-declaration"]) env_drivers.add_source_files(env.drivers_sources,openssl_sources) diff --git a/methods.py b/methods.py index c28ed55dda..c4951c69bd 100755 --- a/methods.py +++ b/methods.py @@ -1516,6 +1516,12 @@ def detect_visual_c_compiler_version(tools_env): return vc_chosen_compiler_str +def msvc_is_detected() : + # looks for VisualStudio env variable + # or for Visual C++ Build Tools (which is a standalone MSVC) + return os.getenv("VSINSTALLDIR") or os.getenv("VS100COMNTOOLS") or os.getenv("VS110COMNTOOLS") or os.getenv("VS120COMNTOOLS") or os.getenv("VS140COMNTOOLS"); + + def precious_program(env, program, sources, **args): program = env.ProgramOriginal(program, sources, **args) env.Precious(program) diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 0548b84cfa..12ea5a93ee 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -1,10 +1,11 @@ # -# tested on | Windows native | Linux cross-compilation -# ------------------------+-------------------+--------------------------- -# MSVS C++ 2010 Express | WORKS | n/a -# Mingw-w64 | WORKS | WORKS -# Mingw-w32 | WORKS | WORKS -# MinGW | WORKS | untested +# tested on | Windows native | Linux cross-compilation +# ----------------------------+-------------------+--------------------------- +# MSVS C++ 2010 Express | WORKS | n/a +# Visual C++ Build Tools 2015 | WORKS | n/a +# Mingw-w64 | WORKS | WORKS +# Mingw-w32 | WORKS | WORKS +# MinGW | WORKS | untested # ##### # Notes about MSVS C++ : @@ -12,6 +13,12 @@ # - MSVC2010-Express compiles to 32bits only. # ##### +# Note about Visual C++ Build Tools : +# +# - Visual C++ Build Tools is the standalone MSVC compiler : +# http://landinghub.visualstudio.com/visual-cpp-build-tools +# +##### # Notes about Mingw-w64 and Mingw-w32 under Windows : # # - both can be installed using the official installer : @@ -78,7 +85,7 @@ ##### # TODO : -# +# # - finish to cleanup this script to remove all the remains of previous hacks and workarounds # - make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express # - confirm it works well with other Visual Studio versions. @@ -102,7 +109,7 @@ def can_build(): if (os.name=="nt"): #building natively on windows! - if (os.getenv("VSINSTALLDIR")): + if ( methods.msvc_is_detected() ): return True else: print("\nMSVC not detected, attempting Mingw.") @@ -197,7 +204,7 @@ def configure(env): env.Append(CPPPATH=['#platform/windows']) env['is_mingw']=False - if (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None): + if (os.name=="nt" and methods.msvc_is_detected() ): #build using visual studio env['ENV']['TMP'] = os.environ['TMP'] env.Append(CPPPATH=['#platform/windows/include']) From cc7bc07e33107d3474ed5f09faf6d9d5840d5f13 Mon Sep 17 00:00:00 2001 From: Brickcaster Date: Fri, 16 Sep 2016 11:25:07 -0400 Subject: [PATCH 004/181] Fix for issue #6496 Canged order of NOTIFICATION_DRAW to update scrollbar before scrollbar is checked to see which list elements to display. --- scene/gui/item_list.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 89cd509fbd..f69ad8fa7e 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -959,7 +959,23 @@ void ItemList::_notification(int p_what) { shape_changed=false; } + //ensure_selected_visible needs to be checked before we draw the list. + if (ensure_selected_visible && current>=0 && current <=items.size()) { + Rect2 r = items[current].rect_cache; + int from = scroll_bar->get_val(); + int to = from + scroll_bar->get_page(); + + if (r.pos.y < from) { + scroll_bar->set_val(r.pos.y); + } else if (r.pos.y+r.size.y > to) { + scroll_bar->set_val(r.pos.y+r.size.y - (to-from)); + } + + + } + + ensure_selected_visible=false; Vector2 base_ofs = bg->get_offset(); base_ofs.y-=int(scroll_bar->get_val()); @@ -1147,25 +1163,6 @@ void ItemList::_notification(int p_what) { for(int i=0;iget_margin(MARGIN_LEFT),base_ofs.y+separators[i]),Vector2(size.width-bg->get_margin(MARGIN_LEFT),base_ofs.y+separators[i]),guide_color); } - - - if (ensure_selected_visible && current>=0 && current <=items.size()) { - - Rect2 r = items[current].rect_cache; - int from = scroll_bar->get_val(); - int to = from + scroll_bar->get_page(); - - if (r.pos.y < from) { - scroll_bar->set_val(r.pos.y); - } else if (r.pos.y+r.size.y > to) { - scroll_bar->set_val(r.pos.y+r.size.y - (to-from)); - } - - - } - - ensure_selected_visible=false; - } } From 7904b2b4050dfc26db330da8c603d64bed462dc2 Mon Sep 17 00:00:00 2001 From: George Marques Date: Sat, 17 Sep 2016 11:59:12 -0300 Subject: [PATCH 005/181] Expose bottom panel show/hide for plugins --- tools/editor/editor_plugin.cpp | 13 +++++++++++++ tools/editor/editor_plugin.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 55f0e52c88..4e93d36f94 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -315,6 +315,16 @@ Control *EditorPlugin::get_base_control() { return EditorNode::get_singleton()->get_gui_base(); } +void EditorPlugin::make_bottom_panel_item_visible(Control * p_item) { + + EditorNode::get_singleton()->make_bottom_panel_item_visible(p_item); +} + +void EditorPlugin::hide_bottom_panel() { + + EditorNode::get_singleton()->hide_bottom_panel(); +} + void EditorPlugin::inspect_object(Object *p_obj,const String& p_for_property) { EditorNode::get_singleton()->push_item(p_obj,p_for_property); @@ -346,6 +356,9 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("inspect_object","object","for_property"),&EditorPlugin::inspect_object,DEFVAL(String())); ObjectTypeDB::bind_method(_MD("update_canvas"),&EditorPlugin::update_canvas); + ObjectTypeDB::bind_method(_MD("make_bottom_panel_item_visible","item:Control"), &EditorPlugin::make_bottom_panel_item_visible); + ObjectTypeDB::bind_method(_MD("hide_bottom_panel"), &EditorPlugin::hide_bottom_panel); + ObjectTypeDB::bind_method(_MD("get_base_control:Control"),&EditorPlugin::get_base_control); ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo); ObjectTypeDB::bind_method(_MD("get_selection:EditorSelection"),&EditorPlugin::get_selection); diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index 5b944cc27a..a036b7c0d9 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -130,6 +130,9 @@ public: Control *get_base_control(); + void make_bottom_panel_item_visible(Control *p_item); + void hide_bottom_panel(); + void add_import_plugin(const Ref& p_editor_import); void remove_import_plugin(const Ref& p_editor_import); From 9e5aaa27bc48bcba7392febeb583b4959a826c9e Mon Sep 17 00:00:00 2001 From: Pawel Kowal Date: Sat, 17 Sep 2016 21:29:55 +0200 Subject: [PATCH 006/181] Add scrolling to Tree control in Drag and Drop mode --- scene/gui/tree.cpp | 31 +++++++++++++++++++ scene/gui/tree.h | 3 ++ .../resources/default_theme/default_theme.cpp | 2 ++ 3 files changed, 36 insertions(+) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 20794b2faa..5a614fb1b2 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -32,6 +32,7 @@ #include "os/keyboard.h" #include "globals.h" #include "os/input.h" +#include "scene/main/viewport.h" @@ -829,6 +830,8 @@ void Tree::update_cache() { cache.guide_width=get_constant("guide_width"); cache.draw_relationship_lines=get_constant("draw_relationship_lines"); cache.relationship_line_color=get_color("relationship_line_color"); + cache.scroll_border=get_constant("scroll_border"); + cache.scroll_speed=get_constant("scroll_speed"); cache.title_button = get_stylebox("title_button_normal"); cache.title_button_pressed = get_stylebox("title_button_pressed"); @@ -2681,11 +2684,17 @@ void Tree::_notification(int p_what) { if (p_what==NOTIFICATION_DRAG_END) { drop_mode_flags=0; + scrolling = false; + set_fixed_process(false); update(); } if (p_what==NOTIFICATION_DRAG_BEGIN) { single_select_defer=NULL; + if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_pos() - get_global_pos())) { + scrolling = true; + set_fixed_process(true); + } } if (p_what==NOTIFICATION_FIXED_PROCESS) { @@ -2731,6 +2740,28 @@ void Tree::_notification(int p_what) { } } + + if (scrolling) { + Point2 point = get_viewport()->get_mouse_pos() - get_global_pos(); + if (point.x < cache.scroll_border) { + point.x -= cache.scroll_border; + } else if (point.x > get_size().width - cache.scroll_border) { + point.x -= get_size().width - cache.scroll_border; + } else { + point.x = 0; + } + if (point.y < cache.scroll_border) { + point.y -= cache.scroll_border; + } else if (point.y > get_size().height - cache.scroll_border) { + point.y -= get_size().height - cache.scroll_border; + } else { + point.y = 0; + } + point *= cache.scroll_speed * get_fixed_process_delta_time(); + point += get_scroll(); + h_scroll->set_val(point.x); + v_scroll->set_val(point.y); + } } if (p_what==NOTIFICATION_DRAW) { diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 2124dce749..6c2f1dae40 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -390,6 +390,8 @@ friend class TreeItem; int button_margin; Point2 offset; int draw_relationship_lines; + int scroll_border; + int scroll_speed; enum ClickType { CLICK_NONE, @@ -448,6 +450,7 @@ friend class TreeItem; bool drag_touching_deaccel; bool click_handled; bool allow_rmb_select; + bool scrolling; bool force_select_on_already_selected; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index dea612735c..0740b591c4 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -714,6 +714,8 @@ void fill_default_theme(Ref& t, const Ref & default_font, const Ref t->set_constant("item_margin","Tree",12 *scale); t->set_constant("button_margin","Tree",4 *scale); t->set_constant("draw_relationship_lines", "Tree", 0); + t->set_constant("scroll_border", "Tree", 4); + t->set_constant("scroll_speed", "Tree", 12); // ItemList From b8ec4a3e02da5af82af3e06718893704f73c0cd6 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Sun, 18 Sep 2016 10:19:02 -0500 Subject: [PATCH 007/181] New distraction free mode icon --- .../editor/icons/2x/icon_distraction_free.png | Bin 0 -> 575 bytes .../editor/icons/2x/icon_remote_transform.png | Bin 1435 -> 1140 bytes tools/editor/icons/icon_distraction_free.png | Bin 224 -> 397 bytes tools/editor/icons/icon_remote_transform.png | Bin 680 -> 530 bytes .../icons/source/icon_distraction_free.svg | 104 ++++++++++++++++++ 5 files changed, 104 insertions(+) create mode 100644 tools/editor/icons/2x/icon_distraction_free.png create mode 100644 tools/editor/icons/source/icon_distraction_free.svg diff --git a/tools/editor/icons/2x/icon_distraction_free.png b/tools/editor/icons/2x/icon_distraction_free.png new file mode 100644 index 0000000000000000000000000000000000000000..034239a4e70e1b1d17beef0553b102ee7a6727d2 GIT binary patch literal 575 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}Y)RhkE)4%caKYZ?lNlHo zzj(ShhD5Z!op#Vm#!;BgEW~x88 zt`3{`TtHBAX~42s-5o1lSvL5uES<~{bap=TMNR{$-n`#4*abcxWH|k_==>SJ-%K-Z z&Ulhy(9n@HaZkayQnBchmgb5-V_mk*XJvR0zf2(82ak+PY99{ZCzSgcWyw33I?z&axD*Va<;;E7E+FDO-y3;#D-$U+6 zrQP~0yP19N43m~8ZWnhg6rIP?uvzEyJLd+S)9)B-ILqo{M2_CNxcZgl$-3awwBPrB z*Qb?D+EDgtZ+yjj{;HWOBKImgw@T+uSu;KB&=QMvc{}XS?L61sR-EVdDL<>hmdQkP zef)ZcWw`?9c1kt~zud8HZt-SyhK-LlhA@BF_)?4Q!_IG-vlf}2C~Xi}qMtn16SzfP;L8 g-81RVjz8=ZL`?RsNzyySz`(%Z>FVdQ&MBb@043l5bN~PV literal 0 HcmV?d00001 diff --git a/tools/editor/icons/2x/icon_remote_transform.png b/tools/editor/icons/2x/icon_remote_transform.png index 9ee66bc70cff2ff0aeb7e104436afbab837b0b29..dad528615a684e9785879261a33732fd2aed1472 100644 GIT binary patch delta 1119 zcmbQu{e@$KNk@oAJbZ48(A^~9$p`M5yy_SUZXS_%FU3NEgNW>`Q zIPe~O;S?d@(!90sww}k#@Aqu=el6RUnx@sf>0-T6_wRT0KYz@vKEJp8!G67$M?6nI zZQXc6_}Gl&EWbjwvOBoAiRxKcOf!CFtSMIi+nsSs)Z0>}Xwj|)^Y+T7R|h4w-4|im zA7kzykE-+v~#nI$=l(VxjOU>-CH86JNs&a;o6YD!<{9RVHCVh-~wmtFzFTyrm&4UG4R-QbDZZ`ax#1`uXp-{jAyU zeK}QWlk`Lv*Eo;k$M#)#_;8Q8!3VJdiHWo48m{;2zkboMM|-L-m-?r~AIY14R*BqA zf55T9A>{iFg&Q-z9*K0wnf1+cWy#9qhBmdVt-Ecn${uLGx%_fxarEv(A8Ob>ny!jl zRh6&Eb6zd*3+ILR3CZ`qe|KPyHi$K=_YG&xZkYFG`!VBZvpc<>uG{nezrw0emo@2Y z`5Rtc)OoqMS0b0On%d2BCbw^m-{xtwE~*pgMZ@9eAXo?CpH;pomu;%HMKr$+!6HB_n|>U z>vBkl)6p`-27)Yg}eT+V?))>n*CiYE0%Q{UR~34 zT=3w*>Ab(s^)2LBv2Cxj%agt>Y7%w|fdI`;W5|LrsJOQ%IY zSaX+G=lr*-bryaJ(`6+sD|AmTJZc-zzi5(^#aG9aNe-a`Kj)pac53KeR25+)wzA~s zzt(JDKHqH$>#k1ge8suo!jv1|*T3eRzgF^K$^U=RuBAIdKh--2Geqe{GwsuRx&U(M=b#Y7bAJsv`S7 z<+_u>t{;4^Yr?cSjz($6cK?0Atypr!_wp*woHFC@JL~PA_{}-{#;45byJ>sGt&UpJOWX(Uv-*pD@DMuQpIuY4GFG}57y8I}^y!rjzmzUe8SIY;*sM+)WIrCvjg5b-X z#CUP<#ckFb^0S+55;MzFlOA>MW3(~fuGmt*vtu!jMV^HKKdZ)l2U9?bQ1LH<~Bbmu#B({5((C z>f_NLPk;S&mh;bn0%eCp|1HjI*0MyJ2`$;KK6&zey;gJ4!aeuD-Sv>x`zo#@u}{MO z|DSRb+t?o$7G^sw{p7r4JJacDW!p|&3>Rj4^7U7BV|(N3|Nbw;C;scMmA&-K?0fui z#hQTN;N>+hE|?zORk~ld{E>^y@o3X}yL}>GmEX;r$#^imVfAUg`||A@EIlt@SDQR} z_G7o?6W{zE98W!QyUU{P(AHboTgu<>FRGBAz`XdZz^d>q%&C_9MA|=i`uhG|JUf0~ z>h4BmkJlUPMa`vlo7l#-RQ;XZ=J`haQSo!P-)s?##UCDo{ycENw#hm*{ zPoAtl&hV+~uik?ftm*gXE_u1JxScJp{ zr^}ckepxj<6uX|aIQ7Nir?>jnF;q@_tM}=TX8KJJbNQw9FOy7cYO-w%KVCdF&z9fC z+4(jrw}+4qqe|sJ={KJl9CxuQh#c)SI=U>B(Z>3>)sl9dTB3v^D*|f zSN$z-`+nkIG~Z+9%v}W^+xvQ1({HXzIIrSbD4=le^X?9%hUr?p$ATG}WK~bhw`Slm zFO%k*c8?>6HRt6umbAv(w`->?>psxVQ1j!%SI1l7U2<2yl)Rfcv%ZnxJ%h%B<#TNV zME3U0yJer7|MH>tiV(a0EsVcQQtUY{$jJQR5O>?DeKt+qfn|Bs6O(VQ60R5fs~C@* zeRiCso<(iyvhI2F`kM0P)9KrjP5#O` z6h1o>&SRd?E^vtP#U}%<$ZZMrFQ0|Y+ZMg=O8AGEl=nK>_pjcX&%H^$=kgc3hS28@ z4eP&oUCYb1T~xUFC-=?sN%m5_{P*ui#fvVulwqS&(YAG;;aWzgtFKOSlpXc_^icG2 z@zs{%Vrgd%f9Ba%TX)TVWAEx&^!w>Q?k&;JRn}b9Qfzt8BprG4>-5e4Z~QBBqM*Fx&)Pw|koX1@gAGg!p0_m})u^09P-d`IHKhHT}C zO@F7SWWM~q>-)W@b*9MGOw>LliGAn3J_{6Jq>qh27ca?;tM~*#W z;+i7UDn4+8%mcAa1?yX?8|;imIS+l#h)Dre3qx_9PHb-w%tWe$dGQJE7`q>g`F zaZXpPyIN54y5(Ba#l0>?LbDhZ`W~k<^ef)yP|#E=GMs<@yK`dw(b!2jCDHsdES?uJ z#4f$EeCxLZ;$4ewWN(dn&#+7B6YGPOf(lB?Yrht3jhf4Rf>DNP$EQVQyK8+nu`B4G z{uGh@S3yZS`QNszo|o-=443WC-BRDNzfU0a=tgtxrACv2v)>-*UbB^XQt;A{XU;u_ zngP3Ap5NgIjCp_jnpBqsirme;_`Xe^Ysn0mnYEhQ3=9km Mp00i_>zopr09#O?5&!@I delta 179 zcmeBWe!w`vw4Q;pz$3Dlfq`2Xgc%uT&5>YWU|=ut^mS!_z{$%aDAnYx(ZImKkn8E< z7-DhyY_K(-gCfV`mf!Oy&i)`KzER`Y(~T1Ud{-8fR~ky^Pmr19pS|YdjK`N1R9iPX z?s>B1hD>`}2*-s7yge>41qMI0`oGO*oOom1x(TnvST08BL~&{IOfIeD*d>ZZPu^NwR;@5Dn+ z+FZ#Tyez`bYgs#adpXarX6Ri!=2qOQW^zm-XUA^U>jF}LI45Wvb8}uk)vRja#*GGz zwq@yd+&9kV^{w{#v&uaGUd`vd?`|8ppUcOvoGMjmCk3yD-ox~?OXA7faKGMm{Bo9ptt$lyewo7LDw&JEj#q8>@8yZ=>Fa-AYgjv>WfkMg!1dy%R?D?)U|>**w(I*H zDI?F+VDVj9IP%1acJZ`x3_q-V0+<>-8P|!wwfHXUFl*v@mI{%EyNOH_3;)_MIWSFr zTBh_oPUieA{uWLpPYsS%rtUZL9IPw1^#yGaUKIKxsykz)WBmh*$xl}CcPTM*{#tOtw_9a} zgBDlGWhH@}S^eKD{kYTP&Z@mwr#HR2?oKt|#U&=@+m+XaoD+~>*ud|=eR4g67>~ip zn0L|1*K@?f)6@8Nc|C1r^s9cb?EAj^6Zd}lx2Pf3?^ndx=kEVF7Z~O;E%TL-V|&nJ zm>jlCWx;8$=P76EIi2Hj9d3MS)iBcIiJ$m}r9l44t|gBr>`FbO&|tE+K4I_u+ae4M zS8M(`>{|SIa&)vc)27302Ww)q=Bid6WQy(E^Yq_zoX~U;lt-A?{x9;xzPS_QiHZhT7P{*-t)hy-g;_k zyK=s%G}w9dXB~aC@kmIJguHmenkDiRZat{&3}SOgHD+D8|6c0Lzcp(Ee#nV)@k>vT zkno7yt&za+#F)XB;a+~P;f*ts*0Pi_y~yn`QdWMSb?zSQ$2fAM?`KNN#%|Kqc7Lo;Z=t`ycJID<{tPQE_9?zp_h{(czP7$n$W`vzzHjGv zi*nwCZ;I3w;}5K2T#)*C#gX~b%SyM_XCL7dU@)=1{c=t&O0m9n%<`F*?OJf%ir@wn}6|!di>PSIJ2h@l-w9R MUHx3vIVCg!0G^H^T>t<8 diff --git a/tools/editor/icons/source/icon_distraction_free.svg b/tools/editor/icons/source/icon_distraction_free.svg new file mode 100644 index 0000000000..4ae48b2fb6 --- /dev/null +++ b/tools/editor/icons/source/icon_distraction_free.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + From 9c71e5a9df7ae5e3a81acd3332d16d5bc4e04556 Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Mon, 19 Sep 2016 14:17:48 +0200 Subject: [PATCH 008/181] Fix ability to cut/paste text in LineEdit/TextEdit in readonly mode. Fixes #6466 --- scene/gui/line_edit.cpp | 14 +++++++++----- scene/gui/text_edit.cpp | 22 +++++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 90a8af9238..9e58199f35 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1191,24 +1191,28 @@ void LineEdit::menu_option(int p_option) { switch(p_option) { case MENU_CUT: { - cut_text(); + if (editable) { + cut_text(); + } } break; case MENU_COPY: { copy_text(); } break; case MENU_PASTE: { - - paste_text(); + if (editable) { + paste_text(); + } } break; case MENU_CLEAR: { - clear(); + if (editable) { + clear(); + } } break; case MENU_SELECT_ALL: { select_all(); } break; case MENU_UNDO: { - undo(); } break; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 9db0a66395..8a9ed98a5f 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2542,7 +2542,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } break; case KEY_X: { - + if (readonly) { + break; + } if (!k.mod.command || k.mod.shift || k.mod.alt) { scancode_handled=false; break; @@ -2574,7 +2576,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { undo(); } break; case KEY_V: { - + if (readonly) { + break; + } if (!k.mod.command || k.mod.shift || k.mod.alt) { scancode_handled=false; break; @@ -4527,18 +4531,22 @@ void TextEdit::menu_option(int p_option) { switch( p_option ) { case MENU_CUT: { - - cut(); + if (!readonly) { + cut(); + } } break; case MENU_COPY: { copy(); } break; case MENU_PASTE: { - - paste(); + if (!readonly) { + paste(); + } } break; case MENU_CLEAR: { - clear(); + if (!readonly) { + clear(); + } } break; case MENU_SELECT_ALL: { select_all(); From a2bff72eee3bde88184a97f2386055d369ed03f6 Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Mon, 19 Sep 2016 18:52:08 +0200 Subject: [PATCH 009/181] Make the choosable default editor layout the same as the actual default one. Fixes #6266 --- tools/editor/editor_node.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 3b1e90a907..dc1f20d619 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -6254,9 +6254,9 @@ EditorNode::EditorNode() { overridden_default_layout=-1; default_layout.instance(); - default_layout->set_value(docks_section, "dock_3", TTR("Scene")); - default_layout->set_value(docks_section, "dock_4", TTR("FileSystem")); - default_layout->set_value(docks_section, "dock_5", TTR("Inspector")); + default_layout->set_value(docks_section, "dock_3", TTR("FileSystem")); + default_layout->set_value(docks_section, "dock_5", TTR("Scene")); + default_layout->set_value(docks_section, "dock_6", TTR("Inspector")+","+TTR("Node")); for(int i=0;iset_value(docks_section, "dock_hsplit_"+itos(i+1), 0); From dd4f2a2ccb2d32aec0157562095e086b6c6a11be Mon Sep 17 00:00:00 2001 From: Pawel Kowal Date: Mon, 19 Sep 2016 23:07:24 +0200 Subject: [PATCH 010/181] Use full width of TreeItem::Cell to change value in CELL_MODE_CHECK --- scene/gui/tree.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 20794b2faa..2a03218059 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1701,16 +1701,11 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_ } break; case TreeItem::CELL_MODE_CHECK: { - Ref checked = cache.checked; bring_up_editor=false; //checkboxes are not edited with editor - if (x>=0 && x<= checked->get_width()+cache.hseparation ) { - - - p_item->set_checked(col,!c.checked); - item_edited(col,p_item); - click_handled=true; - //p_item->edited_signal.call(col); - } + p_item->set_checked(col, !c.checked); + item_edited(col, p_item); + click_handled = true; + //p_item->edited_signal.call(col); } break; case TreeItem::CELL_MODE_RANGE: From c21412fa7e098ac31b5d667d4d9f8eee3f12a2cd Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Mon, 19 Sep 2016 23:10:30 +0200 Subject: [PATCH 011/181] Expose Vector2::clamped() to scripts Needed this and wondered that there's no built-in function for it. So I wanted to implement it and saw that it's actually already there, just wasn't bound ^^ --- core/variant_call.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 8473fdcd19..5f052bce8e 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -346,6 +346,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Vector2,angle); // VCALL_LOCALMEM1R(Vector2,cross); VCALL_LOCALMEM0R(Vector2,abs); + VCALL_LOCALMEM1R(Vector2,clamped); VCALL_LOCALMEM0R(Rect2,get_area); VCALL_LOCALMEM1R(Rect2,intersects); @@ -1457,6 +1458,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray()); //ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray()); ADDFUNC0(VECTOR2,VECTOR2,Vector2,abs,varray()); + ADDFUNC1(VECTOR2,VECTOR2,Vector2,clamped,REAL,"length",varray()); ADDFUNC0(RECT2,REAL,Rect2,get_area,varray()); ADDFUNC1(RECT2,BOOL,Rect2,intersects,RECT2,"b",varray()); From 7cd64c3c8d5d4f087cc6f910ba38bffbf0d9bbf5 Mon Sep 17 00:00:00 2001 From: George Marques Date: Mon, 19 Sep 2016 16:37:17 -0300 Subject: [PATCH 012/181] Add docs for XMLparser, VideoPlayer and most of Tree --- doc/base/classes.xml | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index f6ea8b08ee..ab4610d4f7 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -42920,18 +42920,33 @@ + Control to show a tree of items. + This shows a tree of items that can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like text editing, buttons and popups. It can be useful for structural displaying and interactions. + Trees are built via code, using [TreeItem] objects to create the structure. They have a single root but multiple root can be simulated if a dummy hidden root is added. + [codeblock] + func _ready(): + var tree = Tree.new() + var root = tree.create_item() + tree.set_hide_root(true) + var child1 = tree.create_item(root) + var child2 = tree.create_item(root) + var subchild1 = tree.create_item(child1) + subchild1.set_text(0, "Subchild1") + [/codeblock] + Get whether the column titles are being shown. + Clear the tree. This erases all of the items. @@ -42940,16 +42955,19 @@ + Create an item in the tree and add it as the last child of [code]parent[/code]. If parent is not given, it will be added as the last child of the root, or it'll the be the root itself if the tree is empty. + Make the current selected item visible. This will scroll the tree to make sure the selected item is in sight. + Get whether a right click can select items. @@ -42958,6 +42976,7 @@ + Get the column index under the given point. @@ -42966,6 +42985,7 @@ + Get the title of the given column. @@ -42974,36 +42994,42 @@ + Get the width of the given column in pixels. + Get the amount of columns. + Get the rectangle for custom popups. Helper to create custom cell controls that display a popup. See [method TreeItem.set_cell_mode]. + Get the flags of the current drop mode. + Get the current edited item. This is only available for custom cell mode. + Get the column of the cell for the current edited icon. This is only available for custom cell mode. @@ -43014,6 +43040,7 @@ + Get the rectangle area of the the specified item. If column is specified, only get the position and size of that column, otherwise get the rectangle containing all columns. @@ -43022,6 +43049,7 @@ + Get the tree item at the specified position (relative to the tree origin position). @@ -43030,42 +43058,49 @@ + Get the next selected item after the given one. + Get the index of the last pressed button. + Get the root item of the tree. + Get the current scrolling position. + Get the currently selected item. + Get the column number of the current selection. + Get whether the editing of a cell should only happen when it is already selected. @@ -43078,12 +43113,14 @@ + Get whether the folding arrow is hidden. + Set whether or not a right mouse button click can select items. @@ -43092,6 +43129,7 @@ + Set whether a column will have the "Expand" flag of [Control]. @@ -43100,6 +43138,7 @@ + Set the minimum width of a column. @@ -43108,18 +43147,21 @@ + Set the title of a column. + Set whether the column titles visibility. + Set the amount of columns. @@ -43132,30 +43174,35 @@ + Set the drop mode as an OR combination of flags. See [code]DROP_MODE_*[/code] constants. + Set whether the folding arrow should be hidden. + Set whether the root of the tree should be hidden. + Set the selection mode. Use one of the [code]SELECT_*[/code] constants. + Set whether the editing of a cell should only happen when it is already selected. @@ -43168,32 +43215,38 @@ + Emitted when a button on the tree was pressed (see [method TreeItem.add_button]). + Emitted when a cell is selected. + Emitted when a cell with the [code]CELL_MODE_CUSTOM[/code] is clicked to be edited. + Emitted when the right mouse button is pressed if RMB selection is active and the tree is empty. + Emitted when an item is activated (double-clicked). + Emitted when an item is collapsed by a click on the folding arrow. @@ -43202,16 +43255,19 @@ + Emitted when an item is editted. + Emitted when an item is selected with right mouse button. + Emitted when an item is selected with right mouse button. @@ -45238,136 +45294,160 @@ do_property]. + Control to play video files. + This control has the ability to play video streams. The only format accepted is the OGV Theora, so any other format must be converted before using in a project. + Get the selected audio track (for multitrack videos). + Get the amount of miliseconds to store in buffer while playing. + Get the video stream. + Get the name of the video stream. + Get the current position of the stream, in seconds. + Get the current frame of the video as a [Texture]. + Get the volume of the audio track as a linear value. + Get the volume of the audio track in decibels. + Get whether or not the video is set as autoplay. + Get whether or not the expand property is set. + Get whether or not the video is paused. + Get whether or not the video is playing. + Start the video playback. + Set the audio track (for multitrack videos). + Set whether this node should start playing automatically. + Set the amount of miliseconds to buffer during playback. + Set the expand property. If enabled, the video will grow or shrink to fit the player size, otherwise it will play at the stream resolution. + Set whether the video should pause the playback. + Set the video stream for this player. + Set the audio volume as a linear value. + Set the audio volume in decibels. + Stop the video playback. @@ -49767,14 +49847,17 @@ do_property]. + Low-level class for creating parsers for XML files. + This class can serve as base to make custom XML parsers. Since XML is a very flexible standard, this interface is low level so it can be applied to any possible schema. + Get the amount of attributes in the current element. @@ -49783,6 +49866,7 @@ do_property]. + Get the name of the attribute specified by the index in [code]idx[/code] argument. @@ -49791,12 +49875,14 @@ do_property]. + Get the value of the attribute specified by the index in [code]idx[/code] argument. + Get the current line in the parsed file (currently not implemented). @@ -49805,6 +49891,7 @@ do_property]. + Get the value of a certain attribute of the current element by name. This will raise an error if the element has no such attribute. @@ -49813,30 +49900,35 @@ do_property]. + Get the value of a certain attribute of the current element by name. This will return an empty [String] if the attribute is not found. + Get the contents of a text node. This will raise an error in any other type of node. + Get the name of the current element node. This will raise an error if the current node type is not [code]NODE_ELEMENT[/code] nor [code]NODE_ELEMENT_END[/code] + Get the byte offset of the current node since the beginning of the file or buffer. + Get the type of the current node. Compare with [code]NODE_*[/code] constants. @@ -49845,12 +49937,14 @@ do_property]. + Check whether or not the current element has a certain attribute. + Check whether the current element is empty (this only works for completely empty tags, e.g. <element \>). @@ -49859,6 +49953,7 @@ do_property]. + Open a XML file for parsing. This returns an error code. @@ -49867,12 +49962,14 @@ do_property]. + Open a XML raw buffer for parsing. This returns an error code. + Read the next node of the file. This returns an error code. @@ -49881,27 +49978,36 @@ do_property]. + Move the buffer cursor to a certain offset (since the beginning) and read the next node there. This returns an error code. + Skips the current section. If the node contains other elements, they will be ignored and the cursor will go to the closing of the current element. + There's no node (no file or buffer opened) + Element (tag) + End of element + Text node + Comment node + CDATA content + Unknown node From 623c483ebaffa8de8f9e53b3910d6cfdf8207e59 Mon Sep 17 00:00:00 2001 From: Pawel Kowal Date: Mon, 19 Sep 2016 23:41:48 +0200 Subject: [PATCH 013/181] Show True/False tooltip in property editor for bool values --- tools/editor/property_editor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 1a8d373f7f..26ddff938e 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -3182,6 +3182,7 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CHECK ); item->set_text(1,TTR("On")); + item->set_tooltip(1, obj->get(p.name) ? "True" : "False"); item->set_checked( 1, obj->get( p.name ) ); if (show_type_icons) item->set_icon( 0, get_icon("Bool","EditorIcons") ); @@ -3828,6 +3829,7 @@ void PropertyEditor::_item_edited() { case Variant::BOOL: { _edit_set(name,item->is_checked(1)); + item->set_tooltip(1, item->is_checked(1) ? "True" : "False"); } break; case Variant::INT: case Variant::REAL: { From aa5ade834c8646b81e2320089314393c00ee8020 Mon Sep 17 00:00:00 2001 From: anneomcl Date: Mon, 19 Sep 2016 21:36:24 -0700 Subject: [PATCH 014/181] Fix for #6158. Converting Vector2 to Size2 for scaling functions. --- core/math/math_2d.cpp | 22 ++++++++-------------- core/math/math_2d.h | 15 +++++---------- scene/2d/node_2d.cpp | 2 +- scene/2d/node_2d.h | 4 +--- scene/2d/polygon_2d.cpp | 4 ++-- scene/2d/polygon_2d.h | 6 +++--- scene/main/canvas_layer.h | 6 +++--- servers/physics_2d/shape_2d_sw.cpp | 14 +++++++------- servers/physics_2d/shape_2d_sw.h | 18 +++++++++--------- 9 files changed, 39 insertions(+), 52 deletions(-) diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp index 0e2060008c..2cc11aa738 100644 --- a/core/math/math_2d.cpp +++ b/core/math/math_2d.cpp @@ -475,18 +475,18 @@ Matrix32::Matrix32(real_t p_rot, const Vector2& p_pos) { elements[2]=p_pos; } -Vector2 Matrix32::get_scale() const { +Size2 Matrix32::get_scale() const { - return Vector2( elements[0].length(), elements[1].length() ); + return Size2( elements[0].length(), elements[1].length() ); } -void Matrix32::scale(const Vector2& p_scale) { +void Matrix32::scale(const Size2& p_scale) { elements[0]*=p_scale; elements[1]*=p_scale; elements[2]*=p_scale; } -void Matrix32::scale_basis(const Vector2& p_scale) { +void Matrix32::scale_basis(const Size2& p_scale) { elements[0]*=p_scale; elements[1]*=p_scale; @@ -501,7 +501,6 @@ void Matrix32::translate( const Vector2& p_translation ) { elements[2]+=basis_xform(p_translation); } - void Matrix32::orthonormalize() { // Gram-Schmidt Process @@ -550,11 +549,6 @@ void Matrix32::operator*=(const Matrix32& p_transform) { elements[2] = xform(p_transform.elements[2]); float x0,x1,y0,y1; -/* - x0 = p_transform.tdotx(elements[0]); - x1 = p_transform.tdoty(elements[0]); - y0 = p_transform.tdotx(elements[1]); - y1 = p_transform.tdoty(elements[1]);*/ x0 = tdotx(p_transform.elements[0]); x1 = tdoty(p_transform.elements[0]); @@ -576,7 +570,7 @@ Matrix32 Matrix32::operator*(const Matrix32& p_transform) const { } -Matrix32 Matrix32::scaled(const Vector2& p_scale) const { +Matrix32 Matrix32::scaled(const Size2& p_scale) const { Matrix32 copy=*this; copy.scale(p_scale); @@ -584,7 +578,7 @@ Matrix32 Matrix32::scaled(const Vector2& p_scale) const { } -Matrix32 Matrix32::basis_scaled(const Vector2& p_scale) const { +Matrix32 Matrix32::basis_scaled(const Size2& p_scale) const { Matrix32 copy=*this; copy.scale_basis(p_scale); @@ -629,8 +623,8 @@ Matrix32 Matrix32::interpolate_with(const Matrix32& p_transform, float p_c) cons real_t r1 = get_rotation(); real_t r2 = p_transform.get_rotation(); - Vector2 s1 = get_scale(); - Vector2 s2 = p_transform.get_scale(); + Size2 s1 = get_scale(); + Size2 s2 = p_transform.get_scale(); //slerp rotation Vector2 v1(Math::cos(r1), Math::sin(r1)); diff --git a/core/math/math_2d.h b/core/math/math_2d.h index 90aae9fe50..38c1ac9656 100644 --- a/core/math/math_2d.h +++ b/core/math/math_2d.h @@ -553,10 +553,8 @@ struct Rect2i { struct Matrix32 { - Vector2 elements[3]; - _FORCE_INLINE_ float tdotx(const Vector2& v) const { return elements[0][0] * v.x + elements[1][0] * v.y; } _FORCE_INLINE_ float tdoty(const Vector2& v) const { return elements[0][1] * v.x + elements[1][1] * v.y; } @@ -577,26 +575,25 @@ struct Matrix32 { _FORCE_INLINE_ void set_rotation_and_scale(real_t p_phi,const Size2& p_scale); void rotate(real_t p_phi); - void scale(const Vector2& p_scale); - void scale_basis(const Vector2& p_scale); + void scale(const Size2& p_scale); + void scale_basis(const Size2& p_scale); void translate( real_t p_tx, real_t p_ty); void translate( const Vector2& p_translation ); float basis_determinant() const; - Vector2 get_scale() const; + Size2 get_scale() const; _FORCE_INLINE_ const Vector2& get_origin() const { return elements[2]; } _FORCE_INLINE_ void set_origin(const Vector2& p_origin) { elements[2]=p_origin; } - Matrix32 scaled(const Vector2& p_scale) const; - Matrix32 basis_scaled(const Vector2& p_scale) const; + Matrix32 scaled(const Size2& p_scale) const; + Matrix32 basis_scaled(const Size2& p_scale) const; Matrix32 translated(const Vector2& p_offset) const; Matrix32 rotated(float p_phi) const; Matrix32 untranslated() const; - void orthonormalize(); Matrix32 orthonormalized() const; @@ -615,7 +612,6 @@ struct Matrix32 { _FORCE_INLINE_ Rect2 xform(const Rect2& p_vec) const; _FORCE_INLINE_ Rect2 xform_inv(const Rect2& p_vec) const; - operator String() const; Matrix32(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) { @@ -630,7 +626,6 @@ struct Matrix32 { Matrix32(real_t p_rot, const Vector2& p_pos); Matrix32() { elements[0][0]=1.0; elements[1][1]=1.0; } - }; bool Rect2::intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const { diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index df43e8e373..b3f925cb14 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -253,7 +253,7 @@ void Node2D::global_translate(const Vector2& p_amount) { set_global_pos( get_global_pos() + p_amount ); } -void Node2D::scale(const Vector2& p_amount) { +void Node2D::scale(const Size2& p_amount) { set_scale( get_scale() * p_amount ); } diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index aa8d0ef33c..b31ee08af6 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -79,7 +79,7 @@ public: void move_y(float p_delta,bool p_scaled=false); void translate(const Vector2& p_amount); void global_translate(const Vector2& p_amount); - void scale(const Vector2& p_amount); + void scale(const Size2& p_amount); Point2 get_pos() const; float get_rot() const; @@ -110,8 +110,6 @@ public: Matrix32 get_relative_transform_to_parent(const Node *p_parent) const; - - Matrix32 get_transform() const; Node2D(); diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index cfb87fb998..12893524d1 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -288,12 +288,12 @@ float Polygon2D::_get_texture_rotationd() const{ } -void Polygon2D::set_texture_scale(const Vector2& p_scale){ +void Polygon2D::set_texture_scale(const Size2& p_scale){ tex_scale=p_scale; update(); } -Vector2 Polygon2D::get_texture_scale() const{ +Size2 Polygon2D::get_texture_scale() const{ return tex_scale; } diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index 04e8aeb6fd..cecb9081f7 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -40,7 +40,7 @@ class Polygon2D : public Node2D { DVector vertex_colors; Color color; Ref texture; - Vector2 tex_scale; + Size2 tex_scale; Vector2 tex_ofs; bool tex_tile; float tex_rot; @@ -81,8 +81,8 @@ public: void set_texture_rotation(float p_rot); float get_texture_rotation() const; - void set_texture_scale(const Vector2& p_scale); - Vector2 get_texture_scale() const; + void set_texture_scale(const Size2& p_scale); + Size2 get_texture_scale() const; void set_invert(bool p_rot); bool get_invert() const; diff --git a/scene/main/canvas_layer.h b/scene/main/canvas_layer.h index 6aad90a09d..a1311390be 100644 --- a/scene/main/canvas_layer.h +++ b/scene/main/canvas_layer.h @@ -40,7 +40,7 @@ class CanvasLayer : public Node { bool locrotscale_dirty; Vector2 ofs; - Vector2 scale; + Size2 scale; real_t rot; int layer; Matrix32 transform; @@ -81,8 +81,8 @@ public: void set_rotationd(real_t p_degrees); real_t get_rotationd() const; - void set_scale(const Vector2& p_scale); - Vector2 get_scale() const; + void set_scale(const Size2& p_scale); + Size2 get_scale() const; Ref get_world_2d() const; diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 9291aa6c17..77245c687d 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -136,7 +136,7 @@ bool LineShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_en return true; } -real_t LineShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t LineShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return 0; } @@ -191,7 +191,7 @@ bool RayShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end } -real_t RayShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t RayShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return 0; //rays are mass-less } @@ -252,7 +252,7 @@ bool SegmentShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p return true; } -real_t SegmentShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t SegmentShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { Vector2 s[2]={a*p_scale,b*p_scale}; @@ -336,7 +336,7 @@ bool CircleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_ return true; } -real_t CircleShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t CircleShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { return (radius*radius)*(p_scale.x*0.5+p_scale.y*0.5); @@ -407,7 +407,7 @@ bool RectangleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& return get_aabb().intersects_segment(p_begin,p_end,&r_point,&r_normal); } -real_t RectangleShape2DSW::get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { +real_t RectangleShape2DSW::get_moment_of_inertia(float p_mass,const Size2& p_scale) const { Vector2 he2=half_extents*2*p_scale; return p_mass*he2.dot(he2)/12.0f; @@ -540,7 +540,7 @@ bool CapsuleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p return collided; //todo } -real_t CapsuleShape2DSW::get_moment_of_inertia(float p_mass, const Vector2 &p_scale) const { +real_t CapsuleShape2DSW::get_moment_of_inertia(float p_mass, const Size2 &p_scale) const { Vector2 he2=Vector2(radius*2,height+radius*2)*p_scale; return p_mass*he2.dot(he2)/12.0f; @@ -670,7 +670,7 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2& p_begin,const Vect return inters; //todo } -real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { +real_t ConvexPolygonShape2DSW::get_moment_of_inertia(float p_mass,const Size2& p_scale) const { Rect2 aabb; aabb.pos=points[0].pos*p_scale; diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h index 4164896696..b90c36bc04 100644 --- a/servers/physics_2d/shape_2d_sw.h +++ b/servers/physics_2d/shape_2d_sw.h @@ -86,7 +86,7 @@ public: virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const=0; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const=0; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const=0; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const=0; virtual void set_data(const Variant& p_data)=0; virtual Variant get_data() const=0; @@ -175,7 +175,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -218,7 +218,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -266,7 +266,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -304,7 +304,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -344,7 +344,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -432,7 +432,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -495,7 +495,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const; + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const; virtual void set_data(const Variant& p_data); virtual Variant get_data() const; @@ -584,7 +584,7 @@ public: virtual bool contains_point(const Vector2& p_point) const; virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const; - virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { return 0; } + virtual real_t get_moment_of_inertia(float p_mass,const Size2& p_scale) const { return 0; } virtual void set_data(const Variant& p_data); virtual Variant get_data() const; From 217e09c79da008e15bd789260e8b2513689c90bd Mon Sep 17 00:00:00 2001 From: yg2f Date: Tue, 20 Sep 2016 13:54:17 +0200 Subject: [PATCH 015/181] Fixes #6487, GDscript compiler ignores OPCODE_LINE and OPCODE_BREAKPOINT in Release mode When godot is in release mode, GDscript compiler does not generate bytecodes for OPCODE_LINE and OPCODE_BREAKPOINT anymore. This optimizes GDscript execution speed when the script contains a lot of comments in blocs executed in loops. Fixes #6487 --- modules/gdscript/gd_compiler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 2e2cbe7b29..b75b13551e 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -1005,12 +1005,12 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo switch(s->type) { case GDParser::Node::TYPE_NEWLINE: { - +#ifdef DEBUG_ENABLED const GDParser::NewLineNode *nl = static_cast(s); codegen.opcodes.push_back(GDFunction::OPCODE_LINE); codegen.opcodes.push_back(nl->line); codegen.current_line=nl->line; - +#endif } break; case GDParser::Node::TYPE_CONTROL_FLOW: { // try subblocks @@ -1201,8 +1201,10 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo codegen.opcodes.push_back(ret); } break; case GDParser::Node::TYPE_BREAKPOINT: { +#ifdef DEBUG_ENABLED // try subblocks codegen.opcodes.push_back(GDFunction::OPCODE_BREAKPOINT); +#endif } break; case GDParser::Node::TYPE_LOCAL_VAR: { From fd236a4b6cb4619844c7fd0bafa6a4dc089d8019 Mon Sep 17 00:00:00 2001 From: Geequlim Date: Tue, 20 Sep 2016 20:41:57 +0800 Subject: [PATCH 016/181] More custom theme support for editor --- tools/editor/editor_log.cpp | 12 ++++++++---- tools/editor/editor_log.h | 2 ++ tools/editor/editor_node.cpp | 2 +- tools/editor/plugins/theme_editor_plugin.cpp | 2 +- tools/editor/project_manager.cpp | 14 +++++++------- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp index 20613467d3..02af9712a8 100644 --- a/tools/editor/editor_log.cpp +++ b/tools/editor/editor_log.cpp @@ -161,7 +161,7 @@ void EditorLog::_undo_redo_cbk(void *p_self,const String& p_name) { void EditorLog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_clear_request"),&EditorLog::_clear_request ); - + ObjectTypeDB::bind_method("_override_logger_styles",&EditorLog::_override_logger_styles ); //ObjectTypeDB::bind_method(_MD("_dragged"),&EditorLog::_dragged ); ADD_SIGNAL( MethodInfo("clear_request")); } @@ -193,11 +193,10 @@ EditorLog::EditorLog() { ec->set_custom_minimum_size(Size2(0,180)); ec->set_v_size_flags(SIZE_EXPAND_FILL); - - PanelContainer *pc = memnew( PanelContainer ); - pc->add_style_override("panel",get_stylebox("normal","TextEdit")); + pc = memnew( PanelContainer ); ec->add_child(pc); pc->set_area_as_parent_rect(); + pc->connect("enter_tree", this, "_override_logger_styles"); log = memnew( RichTextLabel ); log->set_scroll_follow(true); @@ -224,6 +223,11 @@ void EditorLog::deinit() { } +void EditorLog::_override_logger_styles() { + + pc->add_style_override("panel",get_stylebox("normal","TextEdit")); + +} EditorLog::~EditorLog() { diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h index 699be710d8..bbf35b63cb 100644 --- a/tools/editor/editor_log.h +++ b/tools/editor/editor_log.h @@ -50,6 +50,7 @@ class EditorLog : public VBoxContainer { HBoxContainer *title_hb; // PaneDrag *pd; Control *ec; + PanelContainer *pc; static void _error_handler(void *p_self, const char*p_func, const char*p_file,int p_line, const char*p_error,const char*p_errorexp,ErrorHandlerType p_type); @@ -64,6 +65,7 @@ protected: static void _bind_methods(); void _notification(int p_what); + void _override_logger_styles(); public: void add_message(const String& p_msg, bool p_error=false); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 1ee0b93114..2ba0d8ef2d 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -2678,7 +2678,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_PLAY_NATIVE: { - + bool autosave = EDITOR_DEF("run/auto_save_before_running",true); if (autosave) { _menu_option_confirm(FILE_SAVE_ALL_SCENES, false); diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index 5db331ba45..84568aa8c0 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -668,7 +668,7 @@ ThemeEditor::ThemeEditor() { theme_menu = memnew( MenuButton ); - theme_menu->set_text("Theme"); + theme_menu->set_text(TTR("Theme")); theme_menu->get_popup()->add_item(TTR("Add Item"),POPUP_ADD); theme_menu->get_popup()->add_item(TTR("Add Class Items"),POPUP_CLASS_ADD); theme_menu->get_popup()->add_item(TTR("Remove Item"),POPUP_REMOVE); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index b2eae2f6d1..18a4e845a0 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -506,7 +506,7 @@ void ProjectManager::_panel_draw(Node *p_hb) { hb->draw_line(Point2(0,hb->get_size().y+1),Point2(hb->get_size().x-10,hb->get_size().y+1),get_color("guide_color","Tree")); if (selected_list.has(hb->get_meta("name"))) { - hb->draw_style_box(get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0))); + hb->draw_style_box( gui_base->get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0))); } } @@ -753,7 +753,7 @@ void ProjectManager::_load_recent_projects() { List properties; EditorSettings::get_singleton()->get_property_list(&properties); - Color font_color = get_color("font_color","Tree"); + Color font_color = gui_base->get_color("font_color","Tree"); List projects; List favorite_projects; @@ -864,6 +864,7 @@ void ProjectManager::_load_recent_projects() { hb->set_meta("favorite",is_favorite); hb->connect("draw",this,"_panel_draw",varray(hb)); hb->connect("input_event",this,"_panel_input",varray(hb)); + hb->add_constant_override("separation",10*EDSCALE); VBoxContainer *favorite_box = memnew( VBoxContainer ); TextureButton *favorite = memnew( TextureButton ); @@ -885,7 +886,7 @@ void ProjectManager::_load_recent_projects() { ec->set_custom_minimum_size(Size2(0,1)); vb->add_child(ec); Label *title = memnew( Label(project_name) ); - title->add_font_override("font",get_font("large","Fonts")); + title->add_font_override("font", gui_base->get_font("large","Fonts")); title->add_color_override("font_color",font_color); vb->add_child(title); Label *fpath = memnew( Label(path) ); @@ -1205,6 +1206,7 @@ ProjectManager::ProjectManager() { gui_base = memnew( Control ); add_child(gui_base); gui_base->set_area_as_parent_rect(); + gui_base->set_theme(create_custom_theme()); Panel *panel = memnew( Panel ); gui_base->add_child(panel); @@ -1227,7 +1229,7 @@ ProjectManager::ProjectManager() { CenterContainer *ccl = memnew( CenterContainer ); Label *l = memnew( Label ); l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")); - l->add_font_override("font",get_font("doc","EditorFonts")); + l->add_font_override("font", gui_base->get_font("doc","EditorFonts")); ccl->add_child(l); top_hb->add_child(ccl); top_hb->add_spacer(); @@ -1263,7 +1265,7 @@ ProjectManager::ProjectManager() { search_tree_vb->add_child(search_box); PanelContainer *pc = memnew( PanelContainer); - pc->add_style_override("panel",get_stylebox("bg","Tree")); + pc->add_style_override("panel", gui_base->get_stylebox("bg","Tree")); search_tree_vb->add_child(pc); pc->set_v_size_flags(SIZE_EXPAND_FILL); @@ -1392,8 +1394,6 @@ ProjectManager::ProjectManager() { last_clicked = ""; SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped"); - - gui_base->set_theme(create_custom_theme()); } From e0fcd9331a7ce0e3afd7240a65ecf3e8c59ef9a3 Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Tue, 20 Sep 2016 22:12:52 +0200 Subject: [PATCH 017/181] Add function to get readable names for joystick events Closes #6476 --- core/os/input.cpp | 4 +++ core/os/input.h | 5 ++++ main/input_default.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++ main/input_default.h | 5 ++++ 4 files changed, 72 insertions(+) diff --git a/core/os/input.cpp b/core/os/input.cpp index 401ab7ffe2..88c17740b1 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -64,6 +64,10 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks); ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); + ObjectTypeDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string); + ObjectTypeDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string); + ObjectTypeDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string); + ObjectTypeDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string); ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); diff --git a/core/os/input.h b/core/os/input.h index 665fb4ad99..d8f3be09df 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -96,6 +96,11 @@ public: virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2())=0; virtual void set_mouse_in_window(bool p_in_window)=0; + virtual String get_joy_button_string(int p_button)=0; + virtual String get_joy_axis_string(int p_axis)=0; + virtual int get_joy_button_index_from_string(String p_button)=0; + virtual int get_joy_axis_index_from_string(String p_axis)=0; + Input(); }; diff --git a/main/input_default.cpp b/main/input_default.cpp index 089772edc5..0e7fe5b907 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -1152,3 +1152,61 @@ Array InputDefault::get_connected_joysticks() { } return ret; } + +static const char* _buttons[] = { + "Face Button Bottom", + "Face Button Right", + "Face Button Left", + "Face Button Top", + "L", + "R", + "L2", + "R2", + "L3", + "R3", + "Select", + "Start", + "DPAD Up", + "DPAD Down", + "DPAD Left", + "DPAD Right" +}; + +static const char* _axes[] = { + "Left Stick X", + "Left Stick Y", + "Right Stick X", + "Right Stick Y", + "", + "", + "L2", + "R2" +}; + +String InputDefault::get_joy_button_string(int p_button) { + ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, ""); + return _buttons[p_button]; +} + +int InputDefault::get_joy_button_index_from_string(String p_button) { + for (int i = 0; i < JOY_BUTTON_MAX; i++) { + if (p_button == _buttons[i]) { + return i; + } + } + ERR_FAIL_V(-1); +} + +String InputDefault::get_joy_axis_string(int p_axis) { + ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, ""); + return _axes[p_axis]; +} + +int InputDefault::get_joy_axis_index_from_string(String p_axis) { + for (int i = 0; i < JOY_AXIS_MAX; i++) { + if (p_axis == _axes[i]) { + return i; + } + } + ERR_FAIL_V(-1); +} diff --git a/main/input_default.h b/main/input_default.h index fbf7837b3b..2db6d28abf 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -235,6 +235,11 @@ public: virtual bool is_joy_known(int p_device); virtual String get_joy_guid(int p_device) const; + virtual String get_joy_button_string(int p_button); + virtual String get_joy_axis_string(int p_axis); + virtual int get_joy_axis_index_from_string(String p_axis); + virtual int get_joy_button_index_from_string(String p_button); + bool is_joy_mapped(int p_device); String get_joy_guid_remapped(int p_device) const; void set_fallback_mapping(String p_guid); From 5c21d49caf58d949baebfc605b8dc993428a3b7b Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 20 Sep 2016 20:02:58 -0300 Subject: [PATCH 018/181] Change winrt build to be less dependent on ANGLE Now it does not try to build if the solution is not found. This way it's possible to provide a minimal package with includes and libs and make it build correctly. Also remove messages from detect.py since it is ran for every platform target. --- platform/winrt/SCsub | 7 +++++-- platform/winrt/detect.py | 8 +++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/platform/winrt/SCsub b/platform/winrt/SCsub index ef7a653d53..fde0c11f3b 100644 --- a/platform/winrt/SCsub +++ b/platform/winrt/SCsub @@ -13,7 +13,10 @@ files = [ 'os_winrt.cpp', ] -cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None)) +if "build_angle" in env and env["build_angle"]: + cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None)) prog = env.Program('#bin/godot', files) -env.Depends(prog, [cmd]) + +if "build_angle" in env and env["build_angle"]: + env.Depends(prog, [cmd]) diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py index 6ba4cf5cbc..7f220736d7 100644 --- a/platform/winrt/detect.py +++ b/platform/winrt/detect.py @@ -17,11 +17,6 @@ def can_build(): if (os.getenv("VSINSTALLDIR")): if (os.getenv("ANGLE_SRC_PATH") == None): - print("You need to define ANGLE_SRC_PATH to the path of ANGLE source root.") - return False - - if not os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"): - print ("Couldn't find the ANGLE solution. Is ANGLE_SRC_PATH configured to the right path?") return False return True @@ -56,6 +51,9 @@ def configure(env): jobs = str(env.GetOption("num_jobs")) angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform=" + if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"): + env["build_angle"] = True + if os.getenv('Platform') == "ARM": print "Compiled program architecture will be an ARM executable. (forcing bits=32)." From 708a028ce8a3192d4c879c346ed0126f82b23b6b Mon Sep 17 00:00:00 2001 From: knd Date: Wed, 21 Sep 2016 05:23:42 +0300 Subject: [PATCH 019/181] removed redundant assign operation in mesh_add_surface: elem_count is reassigned a value before the old one has been used. --- drivers/gles2/rasterizer_gles2.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index d5becc0bfc..56489cf4df 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -1998,7 +1998,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, if (use_VBO) { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=true; normalize=true; @@ -2007,7 +2006,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, } else { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLfloat); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=false; datatype=GL_FLOAT; @@ -2019,7 +2017,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, if (use_VBO) { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLubyte); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=true; datatype=GL_UNSIGNED_BYTE; @@ -2027,7 +2024,6 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, } else { elem_size=VS::ARRAY_WEIGHTS_SIZE*sizeof(GLushort); - elem_count=VS::ARRAY_WEIGHTS_SIZE; valid_local=false; bind=false; datatype=GL_UNSIGNED_SHORT; From 2c9d98bb4869ad8a8ec7af9ba0c8dd7d7c243fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Wed, 21 Sep 2016 12:46:40 +0200 Subject: [PATCH 020/181] Fix manifest generation bug in Android export --- platform/android/export/export.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 8f3edfcaa7..4735a91f43 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -913,15 +913,13 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector& p_manifest,bool } - ret.resize(ret.size()+stable_extra.size()); + for(int i=0;i Date: Wed, 21 Sep 2016 19:17:55 -0300 Subject: [PATCH 021/181] Fix crash when disabling main screen plugin --- tools/editor/editor_node.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 1ee0b93114..fe97fe2881 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3018,6 +3018,10 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_text()) { + if (singleton->main_editor_buttons[i]->is_pressed()) { + singleton->_editor_select(EDITOR_SCRIPT); + } + memdelete( singleton->main_editor_buttons[i] ); singleton->main_editor_buttons.remove(i); From 6fcf2b2bd87e16c9cfc55f3c1293797c24124e85 Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Thu, 22 Sep 2016 12:24:44 +0200 Subject: [PATCH 022/181] x11: Fix event.is_action() for release of modifier keys The bug was that the release events for these also had the modifier state set, so the event comparison failed. Fixes #5901 --- platform/x11/os_x11.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 9a2d610e78..5f1ab5b4aa 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1176,6 +1176,19 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) { event.key.mod.shift=true; } + //don't set mod state if modifier keys are released by themselves + //else event.is_action() will not work correctly here + if (!event.key.pressed) { + if (event.key.scancode == KEY_SHIFT) + event.key.mod.shift = false; + else if (event.key.scancode == KEY_CONTROL) + event.key.mod.control = false; + else if (event.key.scancode == KEY_ALT) + event.key.mod.alt = false; + else if (event.key.scancode == KEY_META) + event.key.mod.meta = false; + } + //printf("key: %x\n",event.key.scancode); input->parse_input_event( event); } From c1e23589143e8372612b906d0e09bb8bd6b48546 Mon Sep 17 00:00:00 2001 From: yg2f Date: Thu, 22 Sep 2016 23:01:44 +0200 Subject: [PATCH 023/181] expose GeometryInstance.get_aabb() etc fixes #6587 expose ``GeometryInstance.get_aabb();`` to gdscript expose ``VisualInstance.get_transformed_aabb();`` to gdscript and debug ``ImmediateGeometry::add_vertex()``; --- scene/3d/immediate_geometry.cpp | 1 + scene/3d/visual_instance.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index c9319904bd..99c7fd047f 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -72,6 +72,7 @@ void ImmediateGeometry::add_vertex(const Vector3& p_vertex){ if (empty) { aabb.pos=p_vertex; aabb.size=Vector3(); + empty=false; } else { aabb.expand_to(p_vertex); } diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index b15226cce3..b4f7a4e5b4 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -128,6 +128,8 @@ void VisualInstance::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_layer_mask","mask"), &VisualInstance::set_layer_mask); ObjectTypeDB::bind_method(_MD("get_layer_mask"), &VisualInstance::get_layer_mask); + ObjectTypeDB::bind_method(_MD("get_transformed_aabb"), &VisualInstance::get_transformed_aabb); + ADD_PROPERTY( PropertyInfo( Variant::INT, "layers",PROPERTY_HINT_ALL_FLAGS), _SCS("set_layer_mask"), _SCS("get_layer_mask")); @@ -376,6 +378,8 @@ void GeometryInstance::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_extra_cull_margin","margin"), &GeometryInstance::set_extra_cull_margin); ObjectTypeDB::bind_method(_MD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin); + ObjectTypeDB::bind_method(_MD("get_aabb"),&GeometryInstance::get_aabb); + ObjectTypeDB::bind_method(_MD("_baked_light_changed"), &GeometryInstance::_baked_light_changed); ADD_PROPERTYI( PropertyInfo( Variant::BOOL, "geometry/visible"), _SCS("set_flag"), _SCS("get_flag"),FLAG_VISIBLE); From 94d6757a0d7426f6805c6f9d50a8afc0c2f6061a Mon Sep 17 00:00:00 2001 From: romeojulietthotel Date: Thu, 22 Sep 2016 22:38:57 -0700 Subject: [PATCH 024/181] Use pkgconfig to locate ALSA libs (#6119) * This allows building when ALSA libs are in a non-standard location. PKG_CONFIG_PATH alone is not enough as the final link fails. Adding this makes the final link succeed. * The extra LIBS flag for alsa is not needed so removing. --- platform/x11/detect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 356de7b2bc..ba232f6d4e 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -155,7 +155,7 @@ def configure(env): if os.system("pkg-config --exists alsa")==0: print("Enabling ALSA") env.Append(CPPFLAGS=["-DALSA_ENABLED"]) - env.Append(LIBS=['asound']) + env.ParseConfig('pkg-config alsa --cflags --libs') else: print("ALSA libraries not found, disabling driver") From 3cce39c2d37d73124038def2f002cc372ddceb8c Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Fri, 23 Sep 2016 14:57:54 +0200 Subject: [PATCH 025/181] AnimationEditor: zoom using ctrl+wheel closes #6585 --- tools/editor/animation_editor.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 2f67df1fc3..a556031e5e 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -1933,12 +1933,20 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) { - v_scroll->set_val( v_scroll->get_val() - v_scroll->get_page() / 8 ); + if (mb.mod.command) { + zoom->set_val(zoom->get_val() + zoom->get_step()); + } else { + v_scroll->set_val( v_scroll->get_val() - v_scroll->get_page() / 8 ); + } } if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) { - v_scroll->set_val( v_scroll->get_val() + v_scroll->get_page() / 8 ); + if (mb.mod.command) { + zoom->set_val(zoom->get_val() - zoom->get_step()); + } else { + v_scroll->set_val( v_scroll->get_val() + v_scroll->get_page() / 8 ); + } } if (mb.button_index==BUTTON_RIGHT && mb.pressed) { From cfd17de23098297d076def400cd6d506700a5f03 Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Sun, 25 Sep 2016 11:58:54 +0200 Subject: [PATCH 026/181] Add CC parameter to allow use of custom C compiler --- SConstruct | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index d168820f66..e08c46c51e 100644 --- a/SConstruct +++ b/SConstruct @@ -138,7 +138,8 @@ opts.Add('etc1','etc1 Texture compression support (yes/no)','yes') opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes') opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no') opts.Add('musepack','Musepack Audio (yes/no)','yes') -opts.Add("CXX", "Compiler"); +opts.Add("CXX", "C++ Compiler") +opts.Add("CC", "C Compiler") opts.Add("CCFLAGS", "Custom flags for the C++ compiler"); opts.Add("CFLAGS", "Custom flags for the C compiler"); opts.Add("LINKFLAGS", "Custom flags for the linker"); From a27fafb2736a530a8a04f887dd8d6e67da3d8972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Sun, 25 Sep 2016 12:57:56 +0200 Subject: [PATCH 027/181] Add compatibility with old OpenGL 2.1 drivers If ARB_framebuffer_object is not supported, try to fall-back to EXT_framebuffer_object if present. In current version of godot, the way framebuffers are used is backward compatible with the older EXT_framebuffer_object extension. Fixes #6591 Done with SuperUserNameMan --- drivers/gles2/rasterizer_gles2.cpp | 40 +++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 56489cf4df..cb137294d8 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -10809,8 +10809,46 @@ void RasterizerGLES2::init() { print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION)); } + // Godot makes use of functions from ARB_framebuffer_object extension which is not implemented by all drivers. + // On the other hand, these drivers might implement the older EXT_framebuffer_object extension + // with which current source code is backward compatible. + + bool framebuffer_object_is_supported = glewIsSupported("GL_ARB_framebuffer_object"); + + if ( !framebuffer_object_is_supported ) { + WARN_PRINT("GL_ARB_framebuffer_object not supported by your graphics card."); + + if ( glewIsSupported("GL_EXT_framebuffer_object") ) { + // falling-back to the older EXT function if present + WARN_PRINT("Falling-back to GL_EXT_framebuffer_object."); + + glIsRenderbuffer = glIsRenderbufferEXT; + glBindRenderbuffer = glBindRenderbufferEXT; + glDeleteRenderbuffers = glDeleteRenderbuffersEXT; + glGenRenderbuffers = glGenRenderbuffersEXT; + glRenderbufferStorage = glRenderbufferStorageEXT; + glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT; + glIsFramebuffer = glIsFramebufferEXT; + glBindFramebuffer = glBindFramebufferEXT; + glDeleteFramebuffers = glDeleteFramebuffersEXT; + glGenFramebuffers = glGenFramebuffersEXT; + glCheckFramebufferStatus = glCheckFramebufferStatusEXT; + glFramebufferTexture1D = glFramebufferTexture1DEXT; + glFramebufferTexture2D = glFramebufferTexture2DEXT; + glFramebufferTexture3D = glFramebufferTexture3DEXT; + glFramebufferRenderbuffer = glFramebufferRenderbufferEXT; + glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT; + glGenerateMipmap = glGenerateMipmapEXT; + + framebuffer_object_is_supported = true; + } + else { + ERR_PRINT("Framebuffer Object is not supported by your graphics card."); + } + } + // Check for GL 2.1 compatibility, if not bail out - if (!glewIsSupported("GL_VERSION_2_1")) { + if (!(glewIsSupported("GL_VERSION_2_1") && framebuffer_object_is_supported)) { ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n" "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n" From ca3b8deb7860eb54c2b5ef44eb686799a688febc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Sun, 25 Sep 2016 13:06:12 +0200 Subject: [PATCH 028/181] Don't crach when OpenGL version is unsupported --- drivers/gles2/rasterizer_gles2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 56489cf4df..dcdea7f993 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -36,6 +36,7 @@ #include "servers/visual/particle_system_sw.h" #include "gl_context/context_gl.h" #include +#include #ifdef GLEW_ENABLED #define _GL_HALF_FLOAT_OES 0x140B @@ -10812,11 +10813,11 @@ void RasterizerGLES2::init() { // Check for GL 2.1 compatibility, if not bail out if (!glewIsSupported("GL_VERSION_2_1")) { ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n" - "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); + "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot is now going to terminate."); OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n" "Godot Engine will self-destruct as soon as you acknowledge this error message.", "Fatal error: Insufficient OpenGL / GLES drivers"); - // TODO: If it's even possible, we should stop the execution without segfault and memory leaks :) + exit(1); } #endif From 7b8fe97888dc1d9586d443498281df532ec1db3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Sun, 25 Sep 2016 13:09:21 +0200 Subject: [PATCH 029/181] Don't crash in "_process_hdr()" if "framebuffer.luminance" is empty If "glFramebufferTexture2D()" fails on old drivers the Vector is empty. Don't allow to read from empty Vector (NULL pointer). --- drivers/gles2/rasterizer_gles2.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 56489cf4df..aeb3d9e039 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -7018,6 +7018,10 @@ void RasterizerGLES2::_process_glow_bloom() { void RasterizerGLES2::_process_hdr() { + if (framebuffer.luminance.empty()) { + return; + } + glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.luminance[0].fbo); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, framebuffer.color ); From 276087e92dd707d990565a373ab9f51a3a52ef2d Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Sun, 25 Sep 2016 19:21:21 +0200 Subject: [PATCH 030/181] Throw error when trying to emit a non-existing signal. closes #6017 --- core/object.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/object.cpp b/core/object.cpp index 8cd4e07097..9a1e9be8d5 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1215,6 +1215,15 @@ void Object::emit_signal(const StringName& p_name,const Variant** p_args,int p_a Signal *s = signal_map.getptr(p_name); if (!s) { +#ifdef DEBUG_ENABLED + bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_name); + //check in script + if (!signal_is_valid && !script.is_null() && !Ref