summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--core/script_debugger_remote.cpp43
-rw-r--r--core/script_debugger_remote.h4
-rw-r--r--core/undo_redo.cpp6
-rw-r--r--core/variant_op.cpp8
-rw-r--r--doc/classes/EditorInterface.xml14
-rw-r--r--doc/classes/EditorPlugin.xml4
-rw-r--r--doc/classes/Vector2.xml4
-rw-r--r--doc/classes/Vector3.xml4
-rw-r--r--editor/editor_node.cpp72
-rw-r--r--editor/editor_settings.cpp31
-rw-r--r--editor/editor_settings.h8
-rw-r--r--editor/editor_themes.cpp91
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp95
-rw-r--r--editor/plugins/tile_set_editor_plugin.h1
-rw-r--r--editor/script_editor_debugger.cpp2
-rw-r--r--main/main.cpp2
-rw-r--r--methods.py2
-rw-r--r--misc/dist/html/default.html2
-rw-r--r--modules/gdnative/doc_classes/GDNativeLibrary.xml2
-rw-r--r--platform/javascript/engine.js10
-rw-r--r--platform/javascript/javascript_main.cpp2
-rw-r--r--platform/javascript/os_javascript.cpp11
-rw-r--r--platform/osx/os_osx.mm65
-rw-r--r--scene/gui/popup_menu.cpp12
-rw-r--r--scene/gui/text_edit.cpp7
-rw-r--r--scene/gui/video_player.cpp8
-rw-r--r--scene/gui/video_player.h2
-rw-r--r--scene/resources/dynamic_font.cpp2
29 files changed, 293 insertions, 225 deletions
diff --git a/.gitignore b/.gitignore
index cbb0b5b133..f8296ef51e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,6 +51,10 @@ gmon.out
.cproject
.settings/
+# Geany/geany-plugins files
+*.geany
+.geanyprj
+
# Misc
.DS_Store
logs/
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index bbc2125c5a..e3dc8eb53a 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -355,6 +355,13 @@ void ScriptDebuggerRemote::_get_output() {
locking = false;
}
+ if (n_messages_dropped > 0) {
+ Message msg;
+ msg.message = "Too many messages! " + String::num_int64(n_messages_dropped) + " messages were dropped.";
+ messages.push_back(msg);
+ n_messages_dropped = 0;
+ }
+
while (messages.size()) {
locking = true;
packet_peer_stream->put_var("message:" + messages.front()->get().message);
@@ -366,6 +373,20 @@ void ScriptDebuggerRemote::_get_output() {
locking = false;
}
+ if (n_errors_dropped > 0) {
+ OutputError oe;
+ oe.error = "TOO_MANY_ERRORS";
+ oe.error_descr = "Too many errors! " + String::num_int64(n_errors_dropped) + " errors were dropped.";
+ oe.warning = false;
+ uint64_t time = OS::get_singleton()->get_ticks_msec();
+ oe.hr = time / 3600000;
+ oe.min = (time / 60000) % 60;
+ oe.sec = (time / 1000) % 60;
+ oe.msec = time % 1000;
+ errors.push_back(oe);
+ n_errors_dropped = 0;
+ }
+
while (errors.size()) {
locking = true;
packet_peer_stream->put_var("error");
@@ -453,7 +474,11 @@ void ScriptDebuggerRemote::_err_handler(void *ud, const char *p_func, const char
if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) {
- sdr->errors.push_back(oe);
+ if (sdr->errors.size() >= sdr->max_errors_per_frame) {
+ sdr->n_errors_dropped++;
+ } else {
+ sdr->errors.push_back(oe);
+ }
}
sdr->mutex->unlock();
@@ -891,10 +916,14 @@ void ScriptDebuggerRemote::send_message(const String &p_message, const Array &p_
mutex->lock();
if (!locking && tcp_client->is_connected_to_host()) {
- Message msg;
- msg.message = p_message;
- msg.data = p_args;
- messages.push_back(msg);
+ if (messages.size() >= max_messages_per_frame) {
+ n_messages_dropped++;
+ } else {
+ Message msg;
+ msg.message = p_message;
+ msg.data = p_args;
+ messages.push_back(msg);
+ }
}
mutex->unlock();
}
@@ -1011,7 +1040,11 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() :
requested_quit(false),
mutex(Mutex::create()),
max_cps(GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second")),
+ max_messages_per_frame(GLOBAL_GET("network/limits/debugger_stdout/max_messages_per_frame")),
+ max_errors_per_frame(GLOBAL_GET("network/limits/debugger_stdout/max_errors_per_frame")),
char_count(0),
+ n_messages_dropped(0),
+ n_errors_dropped(0),
last_msec(0),
msec_count(0),
locking(false),
diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h
index 00ed22dc29..924d5de2c4 100644
--- a/core/script_debugger_remote.h
+++ b/core/script_debugger_remote.h
@@ -87,7 +87,11 @@ class ScriptDebuggerRemote : public ScriptDebugger {
List<String> output_strings;
List<Message> messages;
+ int max_messages_per_frame;
+ int n_messages_dropped;
List<OutputError> errors;
+ int max_errors_per_frame;
+ int n_errors_dropped;
int max_cps;
int char_count;
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index a8eb527b09..a105fba290 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -108,6 +108,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS
+ ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
@@ -127,6 +128,7 @@ void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_A
void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS
+ ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
@@ -149,6 +151,7 @@ void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT
}
void UndoRedo::add_do_property(Object *p_object, const String &p_property, const Variant &p_value) {
+ ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
@@ -163,6 +166,7 @@ void UndoRedo::add_do_property(Object *p_object, const String &p_property, const
}
void UndoRedo::add_undo_property(Object *p_object, const String &p_property, const Variant &p_value) {
+ ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
@@ -182,6 +186,7 @@ void UndoRedo::add_undo_property(Object *p_object, const String &p_property, con
}
void UndoRedo::add_do_reference(Object *p_object) {
+ ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
Operation do_op;
@@ -194,6 +199,7 @@ void UndoRedo::add_do_reference(Object *p_object) {
}
void UndoRedo::add_undo_reference(Object *p_object) {
+ ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0);
ERR_FAIL_COND((current_action + 1) >= actions.size());
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 662371b107..e46fac77ee 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -339,7 +339,7 @@ bool Variant::booleanize() const {
CASE_TYPE(m_prefix, m_op_name, m_name) { \
if (p_b.type == NIL) \
_RETURN(true) \
- DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, ==, true, true, false) \
+ DEFAULT_OP_ARRAY_OP_BODY(m_prefix, m_op_name, m_name, m_type, !=, !=, false, true, true) \
}
#define DEFAULT_OP_ARRAY_LT(m_prefix, m_op_name, m_name, m_type) \
@@ -539,12 +539,12 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
if (arr_b->size() != l)
_RETURN(true);
for (int i = 0; i < l; i++) {
- if (((*arr_a)[i] == (*arr_b)[i])) {
- _RETURN(false);
+ if (((*arr_a)[i] != (*arr_b)[i])) {
+ _RETURN(true);
}
}
- _RETURN(true);
+ _RETURN(false);
}
DEFAULT_OP_NUM_NULL(math, OP_NOT_EQUAL, INT, !=, _int);
diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml
index 4bbbac8cf7..db715d2379 100644
--- a/doc/classes/EditorInterface.xml
+++ b/doc/classes/EditorInterface.xml
@@ -76,6 +76,12 @@
Returns the [ScriptEditor].
</description>
</method>
+ <method name="get_selected_path" qualifiers="const">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="get_selection">
<return type="EditorSelection">
</return>
@@ -141,6 +147,14 @@
Saves the scene as a file at [code]path[/code].
</description>
</method>
+ <method name="select_file">
+ <return type="void">
+ </return>
+ <argument index="0" name="p_file" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
<constants>
</constants>
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index ada0ee56a8..1505845824 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -136,9 +136,7 @@
<method name="forward_canvas_gui_input" qualifiers="virtual">
<return type="bool">
</return>
- <argument index="0" name="canvas_xform" type="Transform2D">
- </argument>
- <argument index="1" name="event" type="InputEvent">
+ <argument index="0" name="event" type="InputEvent">
</argument>
<description>
</description>
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index 976cdbbd90..5c1281b628 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -92,7 +92,7 @@
<argument index="3" name="t" type="float">
</argument>
<description>
- Cubicly interpolates between this Vector and "b", using "pre_a" and "post_b" as handles, and returning the result at position "t".
+ Cubicly interpolates between this Vector and "b", using "pre_a" and "post_b" as handles, and returning the result at position "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
</description>
</method>
<method name="distance_squared_to">
@@ -158,7 +158,7 @@
<argument index="1" name="t" type="float">
</argument>
<description>
- Returns the result of the linear interpolation between this vector and "b", by amount "t".
+ Returns the result of the linear interpolation between this vector and "b", by amount "t". "t" should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
</description>
</method>
<method name="normalized">
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index acb41297a7..dff3d04b0c 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -77,7 +77,7 @@
<argument index="3" name="t" type="float">
</argument>
<description>
- Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount (t).
+ Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount (t). (t) should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
</description>
</method>
<method name="distance_squared_to">
@@ -150,7 +150,7 @@
<argument index="1" name="t" type="float">
</argument>
<description>
- Linearly interpolates the vector to a given one (b), by the given amount (t).
+ Linearly interpolates the vector to a given one (b), by the given amount (t). (t) should be a float of 0.0-1.0, a percentage of how far along the interpolation is.
</description>
</method>
<method name="max_axis">
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 70047bc60c..f480883867 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -393,42 +393,6 @@ void EditorNode::_fs_changed() {
E->get()->invalidate();
}
- if (export_defer.preset != "") {
- Ref<EditorExportPreset> preset;
- for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) {
- preset = EditorExport::get_singleton()->get_export_preset(i);
- if (preset->get_name() == export_defer.preset) {
- break;
- }
- preset.unref();
- }
- if (preset.is_null()) {
- String err = "Unknown export preset: " + export_defer.preset;
- ERR_PRINT(err.utf8().get_data());
- } else {
- Ref<EditorExportPlatform> platform = preset->get_platform();
- if (platform.is_null()) {
- String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
- ERR_PRINT(err.utf8().get_data());
- } else {
- // ensures export_project does not loop infinitely, because notifications may
- // come during the export
- export_defer.preset = "";
- if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) {
- if (export_defer.path.ends_with(".zip")) {
- platform->save_zip(preset, export_defer.path);
- } else if (export_defer.path.ends_with(".pck")) {
- platform->save_pack(preset, export_defer.path);
- }
- } else {
- platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
- }
- }
- }
-
- get_tree()->quit();
- }
-
{
//reload changed resources
List<Ref<Resource> > changed;
@@ -465,6 +429,42 @@ void EditorNode::_fs_changed() {
}
_mark_unsaved_scenes();
+
+ if (export_defer.preset != "" && !EditorFileSystem::get_singleton()->is_scanning()) {
+ Ref<EditorExportPreset> preset;
+ for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) {
+ preset = EditorExport::get_singleton()->get_export_preset(i);
+ if (preset->get_name() == export_defer.preset) {
+ break;
+ }
+ preset.unref();
+ }
+ if (preset.is_null()) {
+ String err = "Unknown export preset: " + export_defer.preset;
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ Ref<EditorExportPlatform> platform = preset->get_platform();
+ if (platform.is_null()) {
+ String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ // ensures export_project does not loop infinitely, because notifications may
+ // come during the export
+ export_defer.preset = "";
+ if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) {
+ if (export_defer.path.ends_with(".zip")) {
+ platform->save_zip(preset, export_defer.path);
+ } else if (export_defer.path.ends_with(".pck")) {
+ platform->save_pack(preset, export_defer.path);
+ }
+ } else {
+ platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
+ }
+ }
+ }
+
+ get_tree()->quit();
+ }
}
void EditorNode::_resources_reimported(const Vector<String> &p_resources) {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index be03e24eee..bcdd232260 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -54,7 +54,18 @@ Ref<EditorSettings> EditorSettings::singleton = NULL;
// Properties
-bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool p_emit_signal) {
+bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
+
+ _THREAD_SAFE_METHOD_
+
+ bool changed = _set_only(p_name, p_value);
+ if (changed) {
+ emit_signal("settings_changed");
+ }
+ return true;
+}
+
+bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value) {
_THREAD_SAFE_METHOD_
@@ -73,7 +84,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool
add_shortcut(name, sc);
}
- return true;
+ return false;
}
bool changed = false;
@@ -102,10 +113,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value, bool
}
}
- if (changed && p_emit_signal) {
- emit_signal("settings_changed");
- }
- return true;
+ return changed;
}
bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
@@ -370,6 +378,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/theme/font", "");
hints["text_editor/theme/font"] = PropertyInfo(Variant::STRING, "text_editor/theme/font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res");
_initial_set("text_editor/completion/auto_brace_complete", false);
+ _initial_set("text_editor/completion/put_callhint_tooltip_below_current_line", true);
+ _initial_set("text_editor/completion/callhint_tooltip_offset", Vector2());
_initial_set("text_editor/files/restore_scripts_on_load", true);
_initial_set("text_editor/completion/complete_file_paths", true);
_initial_set("text_editor/files/maximum_recent_files", 20);
@@ -988,8 +998,7 @@ void EditorSettings::set_initial_value(const StringName &p_setting, const Varian
if (!props.has(p_setting))
return;
- props[p_setting].initial = p_value;
- props[p_setting].has_default_value = true;
+ _initial_set(p_setting, p_value);
}
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default) {
@@ -1174,8 +1183,10 @@ void EditorSettings::list_text_editor_themes() {
void EditorSettings::load_text_editor_theme() {
if (get("text_editor/theme/color_theme") == "Default" || get("text_editor/theme/color_theme") == "Adaptive" || get("text_editor/theme/color_theme") == "Custom") {
- _load_default_text_editor_theme(); // sorry for "Settings changed" console spam
- return;
+ if (get("text_editor/theme/color_theme") == "Default") {
+ _load_default_text_editor_theme();
+ }
+ return; // sorry for "Settings changed" console spam
}
String theme_path = get_text_editor_themes_dir().plus_file((String)get("text_editor/theme/color_theme") + ".tet");
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 0a20212ccd..5fc49de0a7 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -111,7 +111,8 @@ private:
bool save_changed_setting;
bool optimize_save; //do not save stuff that came from config but was not set from engine
- bool _set(const StringName &p_name, const Variant &p_value, bool p_emit_signal = true);
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _set_only(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _initial_set(const StringName &p_name, const Variant &p_value);
void _get_property_list(List<PropertyInfo> *p_list) const;
@@ -146,7 +147,10 @@ public:
void raise_order(const String &p_setting);
void set_initial_value(const StringName &p_setting, const Variant &p_value);
void set_manually(const StringName &p_setting, const Variant &p_value, bool p_emit_signal = false) {
- _set(p_setting, p_value, p_emit_signal);
+ if (p_emit_signal)
+ _set(p_setting, p_value);
+ else
+ _set_only(p_setting, p_value);
}
bool property_can_revert(const String &p_setting);
Variant property_get_revert(const String &p_setting);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index ea114472a8..0ebcef8e5e 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -1063,67 +1063,38 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
EditorSettings *setting = EditorSettings::get_singleton();
String text_editor_color_theme = setting->get("text_editor/theme/color_theme");
if (text_editor_color_theme == "Adaptive") {
- setting->set_manually("text_editor/highlighting/symbol_color", symbol_color);
- setting->set_manually("text_editor/highlighting/keyword_color", keyword_color);
- setting->set_manually("text_editor/highlighting/base_type_color", basetype_color);
- setting->set_manually("text_editor/highlighting/engine_type_color", type_color);
- setting->set_manually("text_editor/highlighting/comment_color", comment_color);
- setting->set_manually("text_editor/highlighting/string_color", string_color);
- setting->set_manually("text_editor/highlighting/background_color", background_color);
- setting->set_manually("text_editor/highlighting/completion_background_color", completion_background_color);
- setting->set_manually("text_editor/highlighting/completion_selected_color", completion_selected_color);
- setting->set_manually("text_editor/highlighting/completion_existing_color", completion_existing_color);
- setting->set_manually("text_editor/highlighting/completion_scroll_color", completion_scroll_color);
- setting->set_manually("text_editor/highlighting/completion_font_color", completion_font_color);
- setting->set_manually("text_editor/highlighting/text_color", text_color);
- setting->set_manually("text_editor/highlighting/line_number_color", line_number_color);
- setting->set_manually("text_editor/highlighting/caret_color", caret_color);
- setting->set_manually("text_editor/highlighting/caret_background_color", caret_background_color);
- setting->set_manually("text_editor/highlighting/text_selected_color", text_selected_color);
- setting->set_manually("text_editor/highlighting/selection_color", selection_color);
- setting->set_manually("text_editor/highlighting/brace_mismatch_color", brace_mismatch_color);
- setting->set_manually("text_editor/highlighting/current_line_color", current_line_color);
- setting->set_manually("text_editor/highlighting/line_length_guideline_color", line_length_guideline_color);
- setting->set_manually("text_editor/highlighting/word_highlighted_color", word_highlighted_color);
- setting->set_manually("text_editor/highlighting/number_color", number_color);
- setting->set_manually("text_editor/highlighting/function_color", function_color);
- setting->set_manually("text_editor/highlighting/member_variable_color", member_variable_color);
- setting->set_manually("text_editor/highlighting/mark_color", mark_color);
- setting->set_manually("text_editor/highlighting/breakpoint_color", breakpoint_color);
- setting->set_manually("text_editor/highlighting/code_folding_color", code_folding_color);
- setting->set_manually("text_editor/highlighting/search_result_color", search_result_color);
- setting->set_manually("text_editor/highlighting/search_result_border_color", search_result_border_color);
+ setting->set_initial_value("text_editor/highlighting/symbol_color", symbol_color);
+ setting->set_initial_value("text_editor/highlighting/keyword_color", keyword_color);
+ setting->set_initial_value("text_editor/highlighting/base_type_color", basetype_color);
+ setting->set_initial_value("text_editor/highlighting/engine_type_color", type_color);
+ setting->set_initial_value("text_editor/highlighting/comment_color", comment_color);
+ setting->set_initial_value("text_editor/highlighting/string_color", string_color);
+ setting->set_initial_value("text_editor/highlighting/background_color", background_color);
+ setting->set_initial_value("text_editor/highlighting/completion_background_color", completion_background_color);
+ setting->set_initial_value("text_editor/highlighting/completion_selected_color", completion_selected_color);
+ setting->set_initial_value("text_editor/highlighting/completion_existing_color", completion_existing_color);
+ setting->set_initial_value("text_editor/highlighting/completion_scroll_color", completion_scroll_color);
+ setting->set_initial_value("text_editor/highlighting/completion_font_color", completion_font_color);
+ setting->set_initial_value("text_editor/highlighting/text_color", text_color);
+ setting->set_initial_value("text_editor/highlighting/line_number_color", line_number_color);
+ setting->set_initial_value("text_editor/highlighting/caret_color", caret_color);
+ setting->set_initial_value("text_editor/highlighting/caret_background_color", caret_background_color);
+ setting->set_initial_value("text_editor/highlighting/text_selected_color", text_selected_color);
+ setting->set_initial_value("text_editor/highlighting/selection_color", selection_color);
+ setting->set_initial_value("text_editor/highlighting/brace_mismatch_color", brace_mismatch_color);
+ setting->set_initial_value("text_editor/highlighting/current_line_color", current_line_color);
+ setting->set_initial_value("text_editor/highlighting/line_length_guideline_color", line_length_guideline_color);
+ setting->set_initial_value("text_editor/highlighting/word_highlighted_color", word_highlighted_color);
+ setting->set_initial_value("text_editor/highlighting/number_color", number_color);
+ setting->set_initial_value("text_editor/highlighting/function_color", function_color);
+ setting->set_initial_value("text_editor/highlighting/member_variable_color", member_variable_color);
+ setting->set_initial_value("text_editor/highlighting/mark_color", mark_color);
+ setting->set_initial_value("text_editor/highlighting/breakpoint_color", breakpoint_color);
+ setting->set_initial_value("text_editor/highlighting/code_folding_color", code_folding_color);
+ setting->set_initial_value("text_editor/highlighting/search_result_color", search_result_color);
+ setting->set_initial_value("text_editor/highlighting/search_result_border_color", search_result_border_color);
} else if (text_editor_color_theme == "Default") {
- setting->set_manually("text_editor/highlighting/symbol_color", Color::html("badfff"));
- setting->set_manually("text_editor/highlighting/keyword_color", Color::html("ffffb3"));
- setting->set_manually("text_editor/highlighting/base_type_color", Color::html("a4ffd4"));
- setting->set_manually("text_editor/highlighting/engine_type_color", Color::html("83d3ff"));
- setting->set_manually("text_editor/highlighting/comment_color", Color::html("676767"));
- setting->set_manually("text_editor/highlighting/string_color", Color::html("ef6ebe"));
- setting->set_manually("text_editor/highlighting/background_color", Color::html("3b000000"));
- setting->set_manually("text_editor/highlighting/completion_background_color", Color::html("2C2A32"));
- setting->set_manually("text_editor/highlighting/completion_selected_color", Color::html("434244"));
- setting->set_manually("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"));
- setting->set_manually("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"));
- setting->set_manually("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"));
- setting->set_manually("text_editor/highlighting/text_color", Color::html("aaaaaa"));
- setting->set_manually("text_editor/highlighting/line_number_color", Color::html("66aaaaaa"));
- setting->set_manually("text_editor/highlighting/caret_color", Color::html("aaaaaa"));
- setting->set_manually("text_editor/highlighting/caret_background_color", Color::html("000000"));
- setting->set_manually("text_editor/highlighting/text_selected_color", Color::html("000000"));
- setting->set_manually("text_editor/highlighting/selection_color", Color::html("6ca9c2"));
- setting->set_manually("text_editor/highlighting/brace_mismatch_color", Color(1, 0.2, 0.2));
- setting->set_manually("text_editor/highlighting/current_line_color", Color(0.3, 0.5, 0.8, 0.15));
- setting->set_manually("text_editor/highlighting/line_length_guideline_color", Color(0.3, 0.5, 0.8, 0.1));
- setting->set_manually("text_editor/highlighting/word_highlighted_color", Color(0.8, 0.9, 0.9, 0.15));
- setting->set_manually("text_editor/highlighting/number_color", Color::html("EB9532"));
- setting->set_manually("text_editor/highlighting/function_color", Color::html("66a2ce"));
- setting->set_manually("text_editor/highlighting/member_variable_color", Color::html("e64e59"));
- setting->set_manually("text_editor/highlighting/mark_color", Color(1.0, 0.4, 0.4, 0.4));
- setting->set_manually("text_editor/highlighting/breakpoint_color", Color(0.8, 0.8, 0.4, 0.2));
- setting->set_manually("text_editor/highlighting/code_folding_color", Color(0.8, 0.8, 0.8, 0.8));
- setting->set_manually("text_editor/highlighting/search_result_color", Color(0.05, 0.25, 0.05, 1));
- setting->set_manually("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1));
+ setting->load_text_editor_theme();
}
return theme;
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index 15e8347bbd..08679b781a 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -618,8 +618,10 @@ void AutotileEditor::_on_edit_mode_changed(int p_edit_mode) {
tool_containers[TOOLBAR_BITMASK]->hide();
tool_containers[TOOLBAR_SHAPE]->show();
tools[TOOL_SELECT]->set_tooltip(TTR("Select current edited sub-tile."));
- current_shape = PoolVector2Array();
spin_priority->hide();
+
+ current_shape = PoolVector2Array();
+ select_coord(edited_shape_coord);
} break;
default: {
tool_containers[TOOLBAR_DUMMY]->show();
@@ -931,50 +933,18 @@ void AutotileEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
edited_shape_coord = coord;
edited_occlusion_shape = tile_set->autotile_get_light_occluder(get_current_tile(), edited_shape_coord);
edited_navigation_shape = tile_set->autotile_get_navigation_polygon(get_current_tile(), edited_shape_coord);
- shape_anchor = edited_shape_coord;
- shape_anchor.x *= (size.x + spacing);
- shape_anchor.y *= (size.y + spacing);
- if (edit_mode == EDITMODE_OCCLUSION) {
- current_shape.resize(0);
- if (edited_occlusion_shape.is_valid()) {
- for (int i = 0; i < edited_occlusion_shape->get_polygon().size(); i++) {
- current_shape.push_back(edited_occlusion_shape->get_polygon()[i] + shape_anchor);
- }
- }
- } else if (edit_mode == EDITMODE_NAVIGATION) {
- current_shape.resize(0);
- if (edited_navigation_shape.is_valid()) {
- if (edited_navigation_shape->get_polygon_count() > 0) {
- PoolVector<Vector2> vertices = edited_navigation_shape->get_vertices();
- for (int i = 0; i < edited_navigation_shape->get_polygon(0).size(); i++) {
- current_shape.push_back(vertices[edited_navigation_shape->get_polygon(0)[i]] + shape_anchor);
- }
- }
- }
- }
- } else {
- if (edit_mode == EDITMODE_COLLISION) {
- Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile());
- for (int i = 0; i < sd.size(); i++) {
- if (sd[i].autotile_coord == coord) {
- Ref<ConvexPolygonShape2D> shape = sd[i].shape;
- if (shape.is_valid()) {
-
- Rect2 bounding_rect;
- PoolVector2Array polygon;
- bounding_rect.position = shape->get_points()[0];
- for (int j = 0; j < shape->get_points().size(); j++) {
- polygon.push_back(shape->get_points()[j] + shape_anchor);
- bounding_rect.expand_to(shape->get_points()[j] + shape_anchor);
- }
- if (bounding_rect.has_point(mb->get_position())) {
- current_shape = polygon;
- edited_collision_shape = shape;
- }
- }
- }
+ Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile());
+ bool found_collision_shape = false;
+ for (int i = 0; i < sd.size(); i++) {
+ if (sd[i].autotile_coord == coord) {
+ edited_collision_shape = sd[i].shape;
+ found_collision_shape = true;
+ break;
}
}
+ if (!found_collision_shape)
+ edited_collision_shape = Ref<ConvexPolygonShape2D>(NULL);
+ select_coord(edited_shape_coord);
}
workspace->update();
} else if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@@ -1341,7 +1311,7 @@ void AutotileEditor::draw_polygon_shapes() {
}
Vector<Vector2> polygon;
Vector<Color> colors;
- if (shape == edited_collision_shape) {
+ if (shape == edited_collision_shape && current_shape.size() > 2) {
for (int j = 0; j < current_shape.size(); j++) {
polygon.push_back(current_shape[j]);
colors.push_back(c_bg);
@@ -1391,7 +1361,7 @@ void AutotileEditor::draw_polygon_shapes() {
}
Vector<Vector2> polygon;
Vector<Color> colors;
- if (shape == edited_occlusion_shape) {
+ if (shape == edited_occlusion_shape && current_shape.size() > 2) {
for (int j = 0; j < current_shape.size(); j++) {
polygon.push_back(current_shape[j]);
colors.push_back(c_bg);
@@ -1439,7 +1409,7 @@ void AutotileEditor::draw_polygon_shapes() {
}
Vector<Vector2> polygon;
Vector<Color> colors;
- if (shape == edited_navigation_shape) {
+ if (shape == edited_navigation_shape && current_shape.size() > 2) {
for (int j = 0; j < current_shape.size(); j++) {
polygon.push_back(current_shape[j]);
colors.push_back(c_bg);
@@ -1549,6 +1519,39 @@ void AutotileEditor::close_shape(const Vector2 &shape_anchor) {
}
}
+void AutotileEditor::select_coord(const Vector2 &coord) {
+ int spacing = tile_set->autotile_get_spacing(get_current_tile());
+ Vector2 size = tile_set->autotile_get_size(get_current_tile());
+ Vector2 shape_anchor = coord;
+ shape_anchor.x *= (size.x + spacing);
+ shape_anchor.y *= (size.y + spacing);
+ if (edit_mode == EDITMODE_COLLISION) {
+ current_shape.resize(0);
+ if (edited_collision_shape.is_valid()) {
+ for (int j = 0; j < edited_collision_shape->get_points().size(); j++) {
+ current_shape.push_back(edited_collision_shape->get_points()[j] + shape_anchor);
+ }
+ }
+ } else if (edit_mode == EDITMODE_OCCLUSION) {
+ current_shape.resize(0);
+ if (edited_occlusion_shape.is_valid()) {
+ for (int i = 0; i < edited_occlusion_shape->get_polygon().size(); i++) {
+ current_shape.push_back(edited_occlusion_shape->get_polygon()[i] + shape_anchor);
+ }
+ }
+ } else if (edit_mode == EDITMODE_NAVIGATION) {
+ current_shape.resize(0);
+ if (edited_navigation_shape.is_valid()) {
+ if (edited_navigation_shape->get_polygon_count() > 0) {
+ PoolVector<Vector2> vertices = edited_navigation_shape->get_vertices();
+ for (int i = 0; i < edited_navigation_shape->get_polygon(0).size(); i++) {
+ current_shape.push_back(vertices[edited_navigation_shape->get_polygon(0)[i]] + shape_anchor);
+ }
+ }
+ }
+ }
+}
+
Vector2 AutotileEditor::snap_point(const Vector2 &point) {
Vector2 p = point;
Vector2 coord = edited_shape_coord;
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index de989a11e8..9bd3e23181 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -144,6 +144,7 @@ private:
void draw_grid_snap();
void draw_polygon_shapes();
void close_shape(const Vector2 &shape_anchor);
+ void select_coord(const Vector2 &coord);
Vector2 snap_point(const Vector2 &point);
void edit(Object *p_node);
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index fa0deb7606..e993c2fd46 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1166,6 +1166,7 @@ void ScriptEditorDebugger::start() {
}
set_process(true);
+ breaked = false;
}
void ScriptEditorDebugger::pause() {
@@ -1177,6 +1178,7 @@ void ScriptEditorDebugger::unpause() {
void ScriptEditorDebugger::stop() {
set_process(false);
+ breaked = false;
server->stop();
diff --git a/main/main.cpp b/main/main.cpp
index b51ea3211c..48537dc3a7 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -665,6 +665,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60);
GLOBAL_DEF("network/limits/debugger_stdout/max_chars_per_second", 2048);
+ GLOBAL_DEF("network/limits/debugger_stdout/max_messages_per_frame", 10);
+ GLOBAL_DEF("network/limits/debugger_stdout/max_errors_per_frame", 10);
if (debug_mode == "remote") {
diff --git a/methods.py b/methods.py
index f9da6c8dd5..fbdac8a966 100644
--- a/methods.py
+++ b/methods.py
@@ -1274,6 +1274,8 @@ def detect_modules():
for x in files:
if (not os.path.isdir(x)):
continue
+ if (not os.path.exists(x + "/config.py")):
+ continue
x = x.replace("modules/", "") # rest of world
x = x.replace("modules\\", "") # win32
module_list.append(x)
diff --git a/misc/dist/html/default.html b/misc/dist/html/default.html
index 0f78fc640e..a1a4e89d02 100644
--- a/misc/dist/html/default.html
+++ b/misc/dist/html/default.html
@@ -350,7 +350,7 @@ $GODOT_HEAD_INCLUDE
};
function printError(text) {
- if (!text.startsWith('**ERROR**: ')) {
+ if (!String.prototype.trim.call(text).startsWith('**ERROR**: ')) {
text = '**ERROR**: ' + text;
}
print(text);
diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml
index 647d27929f..14bd0e9654 100644
--- a/modules/gdnative/doc_classes/GDNativeLibrary.xml
+++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml
@@ -31,6 +31,8 @@
<members>
<member name="load_once" type="bool" setter="set_load_once" getter="should_load_once">
</member>
+ <member name="reloadable" type="bool" setter="set_reloadable" getter="is_reloadable">
+ </member>
<member name="singleton" type="bool" setter="set_singleton" getter="is_singleton">
</member>
<member name="symbol_prefix" type="String" setter="set_symbol_prefix" getter="get_symbol_prefix">
diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js
index dc4bdc7efb..bca1851f40 100644
--- a/platform/javascript/engine.js
+++ b/platform/javascript/engine.js
@@ -138,13 +138,17 @@
}
var actualCanvas = this.rtenv.canvas;
- var context = false;
+ var testContext = false;
+ var testCanvas;
try {
- context = actualCanvas.getContext('webgl2') || actualCanvas.getContext('experimental-webgl2');
+ testCanvas = document.createElement('canvas');
+ testContext = testCanvas.getContext('webgl2') || testCanvas.getContext('experimental-webgl2');
} catch (e) {}
- if (!context) {
+ if (!testContext) {
throw new Error("WebGL 2 not available");
}
+ testCanvas = null;
+ testContext = null;
// canvas can grab focus on click
if (actualCanvas.tabIndex < 0) {
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index b738f37d1b..e85fe0800f 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -65,7 +65,7 @@ int main(int argc, char *argv[]) {
FS.mkdir('/userfs');
FS.mount(IDBFS, {}, '/userfs');
FS.syncfs(true, function(err) {
- Module['ccall']('main_after_fs_sync', null, ['string'], [err ? err.message : ""])
+ ccall('main_after_fs_sync', null, ['string'], [err ? err.message : ""])
});
);
/* clang-format on */
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index a86393c950..b10ef821dd 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -566,7 +566,7 @@ void OS_JavaScript::set_css_cursor(const char *p_cursor) {
/* clang-format off */
EM_ASM_({
- Module.canvas.style.cursor = Module.UTF8ToString($0);
+ Module.canvas.style.cursor = UTF8ToString($0);
}, p_cursor);
/* clang-format on */
}
@@ -576,7 +576,7 @@ const char *OS_JavaScript::get_css_cursor() const {
char cursor[16];
/* clang-format off */
EM_ASM_INT({
- Module.stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16);
+ stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16);
}, cursor);
/* clang-format on */
return cursor;
@@ -792,7 +792,7 @@ void OS_JavaScript::main_loop_begin() {
/* clang-format off */
EM_ASM_ARGS({
- const send_notification = Module.cwrap('send_notification', null, ['number']);
+ const send_notification = cwrap('send_notification', null, ['number']);
const notifs = arguments;
(['mouseover', 'mouseleave', 'focus', 'blur']).forEach(function(event, i) {
Module.canvas.addEventListener(event, send_notification.bind(null, notifs[i]));
@@ -989,6 +989,7 @@ bool OS_JavaScript::is_userfs_persistent() const {
}
OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_user_data_dir_func) {
+
set_cmdline(p_execpath, get_cmdline_args());
main_loop = NULL;
gl_extensions = NULL;
@@ -1001,6 +1002,10 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_us
idbfs_available = false;
time_to_save_sync = -1;
+
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(StdLogger));
+ _set_logger(memnew(CompositeLogger(loggers)));
}
OS_JavaScript::~OS_JavaScript() {
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 662bd4d8a9..19f33c814f 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -74,10 +74,7 @@
static NSRect convertRectToBacking(NSRect contentRect) {
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
- return [OS_OSX::singleton->window_view convertRectToBacking:contentRect];
- else
- return contentRect;
+ return [OS_OSX::singleton->window_view convertRectToBacking:contentRect];
}
static void get_key_modifier_state(unsigned int p_osx_state, Ref<InputEventWithModifiers> state) {
@@ -897,17 +894,12 @@ inline void sendPanEvent(double dx, double dy, int modifierFlags) {
- (void)scrollWheel:(NSEvent *)event {
double deltaX, deltaY;
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
- deltaX = [event scrollingDeltaX];
- deltaY = [event scrollingDeltaY];
+ deltaX = [event scrollingDeltaX];
+ deltaY = [event scrollingDeltaY];
- if ([event hasPreciseScrollingDeltas]) {
- deltaX *= 0.03;
- deltaY *= 0.03;
- }
- } else {
- deltaX = [event deltaX];
- deltaY = [event deltaY];
+ if ([event hasPreciseScrollingDeltas]) {
+ deltaX *= 0.03;
+ deltaY *= 0.03;
}
if ([event phase] != NSEventPhaseNone || [event momentumPhase] != NSEventPhaseNone) {
@@ -1034,7 +1026,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
window_size.width = p_desired.width * displayScale;
window_size.height = p_desired.height * displayScale;
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && displayScale > 1.0) {
+ if (displayScale > 1.0) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
//if (current_videomode.resizable)
[window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
@@ -1046,8 +1038,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
[window_object setAcceptsMouseMovedEvents:YES];
[window_object center];
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
- [window_object setRestorable:NO];
+ [window_object setRestorable:NO];
unsigned int attributeCount = 0;
@@ -1207,34 +1198,42 @@ public:
switch (p_type) {
case ERR_WARNING:
- os_log_info(OS_LOG_DEFAULT,
- "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.",
- p_function, err_details, p_file, p_line);
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
+ os_log_info(OS_LOG_DEFAULT,
+ "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ }
logf_error("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function,
err_details);
logf_error("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line);
break;
case ERR_SCRIPT:
- os_log_error(OS_LOG_DEFAULT,
- "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
- p_function, err_details, p_file, p_line);
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
+ os_log_error(OS_LOG_DEFAULT,
+ "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ }
logf_error("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function,
err_details);
logf_error("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line);
break;
case ERR_SHADER:
- os_log_error(OS_LOG_DEFAULT,
- "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
- p_function, err_details, p_file, p_line);
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
+ os_log_error(OS_LOG_DEFAULT,
+ "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ }
logf_error("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function,
err_details);
logf_error("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line);
break;
case ERR_ERROR:
default:
- os_log_error(OS_LOG_DEFAULT,
- "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
- p_function, err_details, p_file, p_line);
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
+ os_log_error(OS_LOG_DEFAULT,
+ "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ }
logf_error("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
logf_error("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line);
break;
@@ -1807,10 +1806,14 @@ void OS_OSX::set_window_size(const Size2 p_size) {
CGFloat menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
if (menuBarHeight != 0.f) {
size.y += menuBarHeight;
-#if MAC_OS_X_VERSION_MAX_ALLOWED <= 101104
} else {
- size.y += [[NSStatusBar systemStatusBar] thickness];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
+ if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_12) {
+#else
+ {
#endif
+ size.y += [[NSStatusBar systemStatusBar] thickness];
+ }
}
}
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index d7987d4a19..cf01ce8643 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -305,11 +305,15 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
case BUTTON_WHEEL_DOWN: {
- _scroll(-b->get_factor(), b->get_position());
+ if (get_global_position().y + get_size().y > get_viewport_rect().size.y) {
+ _scroll(-b->get_factor(), b->get_position());
+ }
} break;
case BUTTON_WHEEL_UP: {
- _scroll(b->get_factor(), b->get_position());
+ if (get_global_position().y < 0) {
+ _scroll(b->get_factor(), b->get_position());
+ }
} break;
case BUTTON_LEFT: {
@@ -380,7 +384,9 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventPanGesture> pan_gesture = p_event;
if (pan_gesture.is_valid()) {
- _scroll(-pan_gesture->get_delta().y, pan_gesture->get_position());
+ if (get_global_position().y + get_size().y > get_viewport_rect().size.y || get_global_position().y < 0) {
+ _scroll(-pan_gesture->get_delta().y, pan_gesture->get_position());
+ }
}
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 881cdc48f7..a3f59b54fc 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3641,9 +3641,10 @@ void TextEdit::center_viewport_to_cursor() {
int visible_rows = get_visible_rows();
if (h_scroll->is_visible_in_tree())
visible_rows -= ((h_scroll->get_combined_minimum_size().height - 1) / get_row_height());
-
- int max_ofs = text.size() - (scroll_past_end_of_file_enabled ? 1 : num_lines_from(text.size() - 1, -visible_rows));
- cursor.line_ofs = CLAMP(cursor.line - num_lines_from(cursor.line - visible_rows / 2, -visible_rows / 2), 0, max_ofs);
+ if (text.size() >= visible_rows) {
+ int max_ofs = text.size() - (scroll_past_end_of_file_enabled ? 1 : MAX(num_lines_from(text.size() - 1, -visible_rows), 0));
+ cursor.line_ofs = CLAMP(cursor.line - num_lines_from(MAX(cursor.line - visible_rows / 2, 0), -visible_rows / 2), 0, max_ofs);
+ }
int cursor_x = get_column_x_offset(cursor.column, text[cursor.line]);
if (cursor_x > (cursor.x_ofs + visible_width))
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp
index 953ebe84f6..b0739a2f37 100644
--- a/scene/gui/video_player.cpp
+++ b/scene/gui/video_player.cpp
@@ -38,11 +38,6 @@ int VideoPlayer::sp_get_channel_count() const {
return playback->get_channels();
}
-void VideoPlayer::sp_set_mix_rate(int p_rate) {
-
- server_mix_rate = p_rate;
-}
-
bool VideoPlayer::mix(AudioFrame *p_buffer, int p_frames) {
// Check the amount resampler can really handle.
@@ -241,7 +236,7 @@ void VideoPlayer::set_stream(const Ref<VideoStream> &p_stream) {
AudioServer::get_singleton()->lock();
if (channels > 0)
- resampler.setup(channels, playback->get_mix_rate(), server_mix_rate, buffering_ms, 0);
+ resampler.setup(channels, playback->get_mix_rate(), AudioServer::get_singleton()->get_mix_rate(), buffering_ms, 0);
else
resampler.clear();
AudioServer::get_singleton()->unlock();
@@ -494,7 +489,6 @@ VideoPlayer::VideoPlayer() {
bus_index = 0;
buffering_ms = 500;
- server_mix_rate = 44100;
// internal_stream.player=this;
// stream_rid=AudioServer::get_singleton()->audio_stream_create(&internal_stream);
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index 7010c71ad9..5c379b5620 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -50,7 +50,6 @@ class VideoPlayer : public Control {
Ref<VideoStream> stream;
int sp_get_channel_count() const;
- void sp_set_mix_rate(int p_rate); //notify the stream of the mix rate
bool mix(AudioFrame *p_buffer, int p_frames);
RID stream_rid;
@@ -69,7 +68,6 @@ class VideoPlayer : public Control {
bool expand;
bool loops;
int buffering_ms;
- int server_mix_rate;
int audio_track;
int bus_index;
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 00fc601779..575c222cc1 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -651,8 +651,8 @@ DynamicFontAtSize::~DynamicFontAtSize() {
if (valid) {
FT_Done_FreeType(library);
- font->size_cache.erase(id);
}
+ font->size_cache.erase(id);
}
/////////////////////////