diff options
-rw-r--r-- | core/global_constants.cpp | 14 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 13 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 21 | ||||
-rw-r--r-- | editor/script_editor_debugger.h | 7 | ||||
-rw-r--r-- | main/tests/test_shader_lang.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_function.h | 3 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 21 | ||||
-rw-r--r-- | modules/gdscript/gd_script.cpp | 3 | ||||
-rw-r--r-- | modules/svg/image_loader_svg.cpp | 7 | ||||
-rw-r--r-- | modules/visual_script/visual_script_expression.cpp | 1 | ||||
-rw-r--r-- | platform/android/godot_android.cpp | 1 | ||||
-rw-r--r-- | scene/gui/control.cpp | 2 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 3 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 2 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 4 |
16 files changed, 76 insertions, 30 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/text_edit.cpp b/scene/gui/text_edit.cpp index f15fb71f87..68529ae255 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3656,9 +3656,6 @@ void TextEdit::cut() { void TextEdit::copy() { - if (!selection.active) - return; - if (!selection.active) { String clipboard = _base_get_text(cursor.line, 0, cursor.line, text[cursor.line].length()); OS::get_singleton()->set_clipboard(clipboard); 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); |