summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/global_constants.cpp14
-rw-r--r--drivers/gles3/shaders/ssao.glsl5
-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--modules/gdscript/gd_parser.cpp21
-rw-r--r--modules/visual_script/visual_script_editor.cpp8
-rw-r--r--modules/visual_script/visual_script_editor.h1
-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--thirdparty/minizip/godot-zlib-1.2.4-minizip-unbreak-gentoo.patch27
-rw-r--r--thirdparty/minizip/ioapi.h16
13 files changed, 139 insertions, 17 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/drivers/gles3/shaders/ssao.glsl b/drivers/gles3/shaders/ssao.glsl
index d8302bd46e..0e8fc89d6c 100644
--- a/drivers/gles3/shaders/ssao.glsl
+++ b/drivers/gles3/shaders/ssao.glsl
@@ -11,6 +11,7 @@ void main() {
[fragment]
+#define TWO_PI 6.283185307179586476925286766559
#define NUM_SAMPLES (15)
@@ -205,7 +206,7 @@ void main() {
// Hash function used in the HPG12 AlchemyAO paper
- float randomPatternRotationAngle = float((3 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 10);
+ float randomPatternRotationAngle = mod(float((3 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 10), TWO_PI);
// Reconstruct normals from positions. These will lead to 1-pixel black lines
// at depth discontinuities, however the blur will wipe those out so they are not visible
@@ -225,7 +226,7 @@ void main() {
#ifdef ENABLE_RADIUS2
//go again for radius2
- randomPatternRotationAngle = float((5 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 11);
+ randomPatternRotationAngle = mod(float((5 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 11), TWO_PI);
// Reconstruct normals from positions. These will lead to 1-pixel black lines
// at depth discontinuities, however the blur will wipe those out so they are not visible
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/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/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index b9e7a6ffc4..e7aaf0aa4a 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -2716,6 +2716,12 @@ void VisualScriptEditor::_selected_connect_node_method_or_setget(const String &p
_update_graph_connections();
}
+void VisualScriptEditor::_cancel_connect_node_method_or_setget() {
+
+ script->remove_node(edited_func, port_action_new_node);
+ _update_graph();
+}
+
void VisualScriptEditor::_default_value_changed() {
Ref<VisualScriptNode> vsn = script->get_node(edited_func, editing_id);
@@ -3167,6 +3173,7 @@ void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("_button_resource_previewed", &VisualScriptEditor::_button_resource_previewed);
ClassDB::bind_method("_port_action_menu", &VisualScriptEditor::_port_action_menu);
ClassDB::bind_method("_selected_connect_node_method_or_setget", &VisualScriptEditor::_selected_connect_node_method_or_setget);
+ ClassDB::bind_method("_cancel_connect_node_method_or_setget", &VisualScriptEditor::_cancel_connect_node_method_or_setget);
ClassDB::bind_method("_expression_text_changed", &VisualScriptEditor::_expression_text_changed);
ClassDB::bind_method("get_drag_data_fw", &VisualScriptEditor::get_drag_data_fw);
@@ -3364,6 +3371,7 @@ VisualScriptEditor::VisualScriptEditor() {
new_connect_node_select = memnew(PropertySelector);
add_child(new_connect_node_select);
new_connect_node_select->connect("selected", this, "_selected_connect_node_method_or_setget");
+ new_connect_node_select->get_cancel()->connect("pressed", this, "_cancel_connect_node_method_or_setget");
port_action_popup = memnew(PopupMenu);
add_child(port_action_popup);
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index fee4e27bd5..e68711a036 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -176,6 +176,7 @@ class VisualScriptEditor : public ScriptEditorBase {
int port_action_new_node;
void _port_action_menu(int p_option);
void _selected_connect_node_method_or_setget(const String &p_text);
+ void _cancel_connect_node_method_or_setget();
int error_line;
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/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