summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/global_constants.cpp14
-rw-r--r--editor/editor_themes.cpp2
-rw-r--r--editor/plugins/script_text_editor.cpp13
-rw-r--r--editor/script_editor_debugger.cpp21
-rw-r--r--editor/script_editor_debugger.h7
-rw-r--r--main/tests/test_shader_lang.cpp2
-rw-r--r--modules/gdscript/gd_function.h3
-rw-r--r--modules/gdscript/gd_parser.cpp21
-rw-r--r--modules/gdscript/gd_script.cpp3
-rw-r--r--modules/svg/image_loader_svg.cpp7
-rw-r--r--modules/visual_script/visual_script_expression.cpp1
-rw-r--r--platform/android/godot_android.cpp1
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/scroll_bar.cpp9
-rw-r--r--scene/gui/text_edit.cpp13
-rw-r--r--scene/gui/text_edit.h1
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/resources/style_box.cpp4
-rw-r--r--thirdparty/minizip/godot-zlib-1.2.4-minizip-unbreak-gentoo.patch27
-rw-r--r--thirdparty/minizip/ioapi.h16
20 files changed, 140 insertions, 29 deletions
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index d296b678b9..cd9a302ba6 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -45,15 +45,15 @@ struct _GlobalConstant {
_GlobalConstant() {}
#ifdef DEBUG_METHODS_ENABLED
- _GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value) {
- enum_name = p_enum_name;
- name = p_name;
- value = p_value;
+ _GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value)
+ : enum_name(p_enum_name),
+ name(p_name),
+ value(p_value) {
}
#else
- _GlobalConstant(const char *p_name, int p_value) {
- name = p_name;
- value = p_value;
+ _GlobalConstant(const char *p_name, int p_value)
+ : name(p_name),
+ value(p_value) {
}
#endif
};
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 4f1e6c1771..f628a23d5f 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -411,6 +411,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("SceneTabFG", "EditorStyles", make_flat_stylebox(title_color_hl, 10, 5, 10, 5));
theme->set_stylebox("SceneTabBG", "EditorStyles", make_empty_stylebox(6, 5, 6, 5));
theme->set_icon("close", "Tabs", theme->get_icon("GuiClose", "EditorIcons"));
+ theme->set_stylebox("button_pressed", "Tabs", style_menu);
+ theme->set_stylebox("button", "Tabs", style_menu);
// Separators (no separators)
theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width));
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 19de027287..e69fa6da88 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -977,16 +977,27 @@ void ScriptTextEditor::_edit_option(int p_op) {
Ref<Script> scr = get_edited_script();
if (scr.is_null())
return;
+
+ te->begin_complex_operation();
int begin, end;
if (te->is_selection_active()) {
begin = te->get_selection_from_line();
end = te->get_selection_to_line();
+ // ignore if the cursor is not past the first column
+ if (te->get_selection_to_column() == 0) {
+ end--;
+ }
} else {
begin = 0;
end = te->get_line_count() - 1;
}
scr->get_language()->auto_indent_code(text, begin, end);
- te->set_text(text);
+ Vector<String> lines = text.split("\n");
+ for (int i = begin; i <= end; ++i) {
+ te->set_line(i, lines[i]);
+ }
+
+ te->end_complex_operation();
} break;
case EDIT_TRIM_TRAILING_WHITESAPCE: {
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index fee67df9c9..d1ad503542 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -306,8 +306,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String error = p_data[1];
step->set_disabled(!can_continue);
next->set_disabled(!can_continue);
- reason->set_text(error);
- reason->set_tooltip(error);
+ _set_reason_text(error, MESSAGE_ERROR);
breaked = true;
dobreak->set_disabled(true);
docontinue->set_disabled(false);
@@ -761,6 +760,21 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
}
}
+void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType p_type) {
+ switch (p_type) {
+ case MESSAGE_ERROR:
+ reason->add_color_override("font_color", get_color("error_color", "Editor"));
+ break;
+ case MESSAGE_WARNING:
+ reason->add_color_override("font_color", get_color("warning_color", "Editor"));
+ break;
+ default:
+ reason->add_color_override("font_color", get_color("success_color", "Editor"));
+ }
+ reason->set_text(p_reason);
+ reason->set_tooltip(p_reason);
+}
+
void ScriptEditorDebugger::_performance_select(Object *, int, bool) {
perf_draw->update();
@@ -921,8 +935,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
dobreak->set_disabled(false);
tabs->set_current_tab(0);
- reason->set_text(TTR("Child Process Connected"));
- reason->set_tooltip(TTR("Child Process Connected"));
+ _set_reason_text(TTR("Child Process Connected"), MESSAGE_SUCCESS);
profiler->clear();
inspect_scene_tree->clear();
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index d255d73167..bee49bf15c 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -56,6 +56,12 @@ class ScriptEditorDebugger : public Control {
GDCLASS(ScriptEditorDebugger, Control);
+ enum MessageType {
+ MESSAGE_ERROR,
+ MESSAGE_WARNING,
+ MESSAGE_SUCCESS,
+ };
+
AcceptDialog *msgdialog;
Button *debugger_button;
@@ -144,6 +150,7 @@ class ScriptEditorDebugger : public Control {
void _scene_tree_selected();
void _scene_tree_request();
void _parse_message(const String &p_msg, const Array &p_data);
+ void _set_reason_text(const String &p_msg, MessageType p_type);
void _scene_tree_property_select_object(ObjectID p_object);
void _scene_tree_property_value_edited(const String &p_prop, const Variant &p_value);
diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp
index dc581a71e2..f9516dad99 100644
--- a/main/tests/test_shader_lang.cpp
+++ b/main/tests/test_shader_lang.cpp
@@ -56,8 +56,6 @@ static String _mktab(int p_level) {
static String _typestr(SL::DataType p_type) {
return ShaderLanguage::get_datatype_name(p_type);
-
- return "";
}
static String _prestr(SL::DataPrecision p_pres) {
diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gd_function.h
index 6d20b19777..661de0acce 100644
--- a/modules/gdscript/gd_function.h
+++ b/modules/gdscript/gd_function.h
@@ -210,8 +210,9 @@ public:
#ifdef TOOLS_ENABLED
ERR_FAIL_INDEX_V(p_idx, arg_names.size(), StringName());
return arg_names[p_idx];
-#endif
+#else
return StringName();
+#endif
}
Variant get_default_argument(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, default_arguments.size(), Variant());
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 7d3857266e..b349b6b9a8 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -1894,7 +1894,26 @@ GDParser::PatternNode *GDParser::_parse_pattern(bool p_static) {
return NULL;
}
- if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) {
+ if (value->type == Node::TYPE_OPERATOR) {
+ // Maybe it's SomeEnum.VALUE
+ Node *current_value = value;
+
+ while (current_value->type == Node::TYPE_OPERATOR) {
+ OperatorNode *op_node = static_cast<OperatorNode *>(current_value);
+
+ if (op_node->op != OperatorNode::OP_INDEX_NAMED) {
+ _set_error("Invalid operator in pattern. Only index (`A.B`) is allowed");
+ return NULL;
+ }
+ current_value = op_node->arguments[0];
+ }
+
+ if (current_value->type != Node::TYPE_IDENTIFIER) {
+ _set_error("Only constant expression or variables allowed in a pattern");
+ return NULL;
+ }
+
+ } else if (value->type != Node::TYPE_IDENTIFIER && value->type != Node::TYPE_CONSTANT) {
_set_error("Only constant expressions or variables allowed in a pattern");
return NULL;
}
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 2d06c0f5d2..23201dc1b0 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -559,8 +559,9 @@ bool GDScript::_update_exports() {
return changed;
-#endif
+#else
return false;
+#endif
}
void GDScript::update_exports() {
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index 46931fb0f6..c74188d9ea 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -82,9 +82,9 @@ Error ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, const char *s
size_t str_len = strlen(svg_str);
PoolVector<uint8_t> src_data;
- src_data.resize(str_len);
+ src_data.resize(str_len + 1);
PoolVector<uint8_t>::Write src_w = src_data.write();
- memcpy(src_w.ptr(), svg_str, str_len);
+ memcpy(src_w.ptr(), svg_str, str_len + 1);
return _create_image(p_image, &src_data, p_scale, upsample);
}
@@ -93,9 +93,10 @@ Error ImageLoaderSVG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
uint32_t size = f->get_len();
PoolVector<uint8_t> src_image;
- src_image.resize(size);
+ src_image.resize(size + 1);
PoolVector<uint8_t>::Write src_w = src_image.write();
f->get_buffer(src_w.ptr(), size);
+ src_w.ptr()[size] = '\0';
return _create_image(p_image, &src_image, p_scale, 1.0);
}
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index 78b70934c0..25c2ebd6d2 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -585,7 +585,6 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
r_token.type = TK_BASIC_TYPE;
r_token.value = i;
return OK;
- break;
}
}
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index 5933b83d06..2dd2c0532a 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -833,7 +833,6 @@ void android_main(struct android_app *app) {
if (engine.requested_quit) {
engine_term_display(&engine);
exit(0);
- return;
}
// LOGI("end\n");
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 6a3ef66e0a..36fc9a6b3a 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1839,8 +1839,6 @@ Control *Control::find_prev_valid_focus() const {
}
return NULL;
-
- return NULL;
}
Control::FocusMode Control::get_focus_mode() const {
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 6519cde6d3..4242ee4523 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -40,6 +40,11 @@ void ScrollBar::set_can_focus_by_default(bool p_can_focus) {
void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
+ Ref<InputEventMouseMotion> m = p_event;
+ if (!m.is_valid() || drag.active) {
+ emit_signal("scrolling");
+ }
+
Ref<InputEventMouseButton> b = p_event;
if (b.is_valid()) {
@@ -143,8 +148,6 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
}
}
- Ref<InputEventMouseMotion> m = p_event;
-
if (m.is_valid()) {
accept_event();
@@ -823,6 +826,8 @@ void ScrollBar::_bind_methods() {
ClassDB::bind_method(D_METHOD("_drag_slave_input"), &ScrollBar::_drag_slave_input);
ClassDB::bind_method(D_METHOD("_drag_slave_exit"), &ScrollBar::_drag_slave_exit);
+ ADD_SIGNAL(MethodInfo("scrolling"));
+
ADD_PROPERTY(PropertyInfo(Variant::REAL, "custom_step", PROPERTY_HINT_RANGE, "-1,4096"), "set_custom_step", "get_custom_step");
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 68529ae255..245e7e04be 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2880,6 +2880,8 @@ void TextEdit::_post_shift_selection() {
}
void TextEdit::_scroll_lines_up() {
+ scrolling = false;
+
// adjust the vertical scroll
if (get_v_scroll() > 0) {
set_v_scroll(get_v_scroll() - 1);
@@ -2892,6 +2894,8 @@ void TextEdit::_scroll_lines_up() {
}
void TextEdit::_scroll_lines_down() {
+ scrolling = false;
+
// calculate the maximum vertical scroll position
int max_v_scroll = get_line_count() - 1;
if (!scroll_past_end_of_file_enabled) {
@@ -3156,6 +3160,7 @@ int TextEdit::get_visible_rows() const {
return total;
}
void TextEdit::adjust_viewport_to_cursor() {
+ scrolling = false;
if (cursor.line_ofs > cursor.line)
cursor.line_ofs = cursor.line;
@@ -3195,6 +3200,7 @@ void TextEdit::adjust_viewport_to_cursor() {
}
void TextEdit::center_viewport_to_cursor() {
+ scrolling = false;
if (cursor.line_ofs > cursor.line)
cursor.line_ofs = cursor.line;
@@ -3313,6 +3319,10 @@ bool TextEdit::cursor_is_block_mode() const {
return block_caret;
}
+void TextEdit::_v_scroll_input() {
+ scrolling = false;
+}
+
void TextEdit::_scroll_moved(double p_to_val) {
if (updating_scrolls)
@@ -4706,6 +4716,7 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_push_current_op"), &TextEdit::_push_current_op);
ClassDB::bind_method(D_METHOD("_click_selection_held"), &TextEdit::_click_selection_held);
ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &TextEdit::_toggle_draw_caret);
+ ClassDB::bind_method(D_METHOD("_v_scroll_input"), &TextEdit::_v_scroll_input);
BIND_ENUM_CONSTANT(SEARCH_MATCH_CASE);
BIND_ENUM_CONSTANT(SEARCH_WHOLE_WORDS);
@@ -4843,6 +4854,8 @@ TextEdit::TextEdit() {
h_scroll->connect("value_changed", this, "_scroll_moved");
v_scroll->connect("value_changed", this, "_scroll_moved");
+ v_scroll->connect("scrolling", this, "_v_scroll_input");
+
cursor_changed_dirty = false;
text_changed_dirty = false;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 1abfe368dd..6321cad2da 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -299,6 +299,7 @@ class TextEdit : public Control {
void adjust_viewport_to_cursor();
void _scroll_moved(double);
void _update_scrollbars();
+ void _v_scroll_input();
void _click_selection_held();
void _pre_shift_selection();
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 00460e9eda..10ab28150b 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -630,7 +630,7 @@ void SceneTree::_notification(int p_notification) {
case NOTIFICATION_WM_ABOUT: {
#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
+ if (EditorNode::get_singleton()) {
EditorNode::get_singleton()->show_about();
} else {
#endif
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 3100aab8ad..7b2a9ffbc2 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -273,8 +273,8 @@ void StyleBoxTexture::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_margin_size", "margin"), &StyleBoxTexture::get_margin_size);
ClassDB::bind_method(D_METHOD("set_expand_margin_size", "margin", "size"), &StyleBoxTexture::set_expand_margin_size);
- ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxFlat::set_expand_margin_size_all);
- ClassDB::bind_method(D_METHOD("set_expand_margin_individual", "size_left", "size_top", "size_right", "size_bottom"), &StyleBoxFlat::set_expand_margin_size_individual);
+ ClassDB::bind_method(D_METHOD("set_expand_margin_all", "size"), &StyleBoxTexture::set_expand_margin_size_all);
+ ClassDB::bind_method(D_METHOD("set_expand_margin_individual", "size_left", "size_top", "size_right", "size_bottom"), &StyleBoxTexture::set_expand_margin_size_individual);
ClassDB::bind_method(D_METHOD("get_expand_margin_size", "margin"), &StyleBoxTexture::get_expand_margin_size);
ClassDB::bind_method(D_METHOD("set_region_rect", "region"), &StyleBoxTexture::set_region_rect);
diff --git a/thirdparty/minizip/godot-zlib-1.2.4-minizip-unbreak-gentoo.patch b/thirdparty/minizip/godot-zlib-1.2.4-minizip-unbreak-gentoo.patch
new file mode 100644
index 0000000000..9292e32ac6
--- /dev/null
+++ b/thirdparty/minizip/godot-zlib-1.2.4-minizip-unbreak-gentoo.patch
@@ -0,0 +1,27 @@
+diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
+index f25ab6464..6043d34ce 100644
+--- a/thirdparty/minizip/ioapi.h
++++ b/thirdparty/minizip/ioapi.h
+@@ -44,6 +44,22 @@
+ #include <stdlib.h>
+ #include "zlib.h"
+
++/* GODOT start */
++/* Mighty Gentoo saves the day by breaking the API of their zlib.h,
++ * removing this definition of OF(args) for no practical reason
++ * worth breaking compatibility with all projects that embed minizip
++ * while trying not to diverge too much from upstream zlib.
++ * Cf. https://github.com/godotengine/godot/issues/10539
++ *
++ * "By and large, this is good open source behaviour, and fits with
++ * the gentoo _don't fuck with upstream's releases_ philosophy"
++ * -- Gentoo philosopher
++ */
++#ifndef OF /* function prototypes */
++ #define OF(args) args
++#endif
++/* GODOT end */
++
+ #if defined(USE_FILE32API)
+ #define fopen64 fopen
+ #define ftello64 ftell
diff --git a/thirdparty/minizip/ioapi.h b/thirdparty/minizip/ioapi.h
index f25ab6464f..6043d34cea 100644
--- a/thirdparty/minizip/ioapi.h
+++ b/thirdparty/minizip/ioapi.h
@@ -44,6 +44,22 @@
#include <stdlib.h>
#include "zlib.h"
+/* GODOT start */
+/* Mighty Gentoo saves the day by breaking the API of their zlib.h,
+ * removing this definition of OF(args) for no practical reason
+ * worth breaking compatibility with all projects that embed minizip
+ * while trying not to diverge too much from upstream zlib.
+ * Cf. https://github.com/godotengine/godot/issues/10539
+ *
+ * "By and large, this is good open source behaviour, and fits with
+ * the gentoo _don't fuck with upstream's releases_ philosophy"
+ * -- Gentoo philosopher
+ */
+#ifndef OF /* function prototypes */
+ #define OF(args) args
+#endif
+/* GODOT end */
+
#if defined(USE_FILE32API)
#define fopen64 fopen
#define ftello64 ftell