diff options
-rw-r--r-- | core/object.cpp | 2 | ||||
-rw-r--r-- | core/ustring.cpp | 4 | ||||
-rw-r--r-- | editor/code_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 28 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 14 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 4 |
8 files changed, 36 insertions, 26 deletions
diff --git a/core/object.cpp b/core/object.cpp index e1bc4b97f0..b643aecdd8 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1519,7 +1519,7 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const Signal *s = signal_map.getptr(p_signal); ERR_FAIL_COND_MSG(!s, "Nonexistent signal: " + p_signal + "."); - ERR_FAIL_COND_MSG(s->lock > 0, "Attempt to disconnect signal '" + p_signal + "' while emitting (locks: " + itos(s->lock) + ")."); + ERR_FAIL_COND_MSG(s->lock > 0, "Attempt to disconnect signal '" + p_signal + "' while in emission callback. Use CONNECT_DEFERRED (to be able to safely disconnect) or CONNECT_ONESHOT (for automatic disconnection) as connection flags."); Signal::Target target(p_to_object->get_instance_id(), p_to_method); diff --git a/core/ustring.cpp b/core/ustring.cpp index 345db0eb13..502e6a5a88 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -28,6 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS // to disable build-time warning which suggested to use strcpy_s instead strcpy +#endif + #include "ustring.h" #include "core/color.h" diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 44cd15ab90..9a4513d18a 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1509,7 +1509,7 @@ void CodeTextEditor::_set_show_warnings_panel(bool p_show) { } void CodeTextEditor::_toggle_scripts_pressed() { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel(this) ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); } void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) { diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 727d92ba05..6e15bad9af 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -510,8 +510,8 @@ void CurveEditor::set_hover_point_index(int index) { } void CurveEditor::update_view_transform() { - Vector2 control_size = get_size(); - const real_t margin = 24; + Ref<Font> font = get_font("font", "Label"); + const real_t margin = font->get_height() + 2 * EDSCALE; float min_y = 0; float max_y = 1; @@ -521,15 +521,19 @@ void CurveEditor::update_view_transform() { max_y = _curve_ref->get_max_value(); } - Rect2 world_rect = Rect2(Curve::MIN_X, min_y, Curve::MAX_X, max_y - min_y); - Vector2 wm = Vector2(margin, margin) / control_size; - wm.y *= (max_y - min_y); - world_rect.position -= wm; - world_rect.size += 2.0 * wm; + const Rect2 world_rect = Rect2(Curve::MIN_X, min_y, Curve::MAX_X, max_y - min_y); + const Size2 view_margin(margin, margin); + const Size2 view_size = get_size() - view_margin * 2; + const Vector2 scale = view_size / world_rect.size; + + Transform2D world_trans; + world_trans.translate(-world_rect.position - Vector2(0, world_rect.size.y)); + world_trans.scale(Vector2(scale.x, -scale.y)); + + Transform2D view_trans; + view_trans.translate(view_margin); - _world_to_view = Transform2D(); - _world_to_view.translate(-world_rect.position - Vector2(0, world_rect.size.y)); - _world_to_view.scale(Vector2(control_size.x, -control_size.y) / world_rect.size); + _world_to_view = view_trans * world_trans; } Vector2 CurveEditor::get_tangent_view_pos(int i, TangentIndex tangent) const { @@ -735,10 +739,10 @@ void CurveEditor::_draw() { if (_selected_point > 0 && _selected_point + 1 < curve.get_point_count()) { text_color.a *= 0.4; - draw_string(font, Vector2(50, font_height), TTR("Hold Shift to edit tangents individually"), text_color); + draw_string(font, Vector2(50 * EDSCALE, font_height), TTR("Hold Shift to edit tangents individually"), text_color); } else if (curve.get_point_count() == 0) { text_color.a *= 0.4; - draw_string(font, Vector2(50, font_height), TTR("Right click to add point"), text_color); + draw_string(font, Vector2(50 * EDSCALE, font_height), TTR("Right click to add point"), text_color); } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 54b9cf0630..3d814878a3 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -987,11 +987,8 @@ Array ScriptEditor::_get_open_scripts() const { return ret; } -bool ScriptEditor::toggle_scripts_panel(CodeTextEditor *p_editor) { +bool ScriptEditor::toggle_scripts_panel() { list_split->set_visible(!list_split->is_visible()); - if (p_editor) { - p_editor->update_toggle_scripts_button(); - } return list_split->is_visible(); } @@ -1141,14 +1138,13 @@ void ScriptEditor::_menu_option(int p_option) { } break; case TOGGLE_SCRIPTS_PANEL: { if (current) { - CodeTextEditor *code_editor = NULL; - ScriptTextEditor *editor = dynamic_cast<ScriptTextEditor *>(current); + ScriptTextEditor *editor = Object::cast_to<ScriptTextEditor>(current); + toggle_scripts_panel(); if (editor) { - code_editor = editor->code_editor; + editor->update_toggle_scripts_button(); } - toggle_scripts_panel(code_editor); } else { - toggle_scripts_panel(NULL); + toggle_scripts_panel(); } } } diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index e40d596be7..e2fd67676b 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -419,7 +419,7 @@ protected: public: static ScriptEditor *get_singleton() { return script_editor; } - bool toggle_scripts_panel(CodeTextEditor *p_editor); + bool toggle_scripts_panel(); bool is_scripts_panel_toggled(); void ensure_focus_current(); void apply_scripts() const; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 9bda0f50e4..ec1cda5287 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -966,6 +966,12 @@ void ScriptTextEditor::_lookup_symbol(const String &p_symbol, int p_row, int p_c } } +void ScriptTextEditor::update_toggle_scripts_button() { + if (code_editor != NULL) { + code_editor->update_toggle_scripts_button(); + } +} + void ScriptTextEditor::_update_connected_methods() { TextEdit *text_edit = code_editor->get_text_edit(); text_edit->clear_info_icons(); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 82d365fcaa..ac29e90c02 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -55,6 +55,7 @@ class ScriptTextEditor : public ScriptEditorBase { GDCLASS(ScriptTextEditor, ScriptEditorBase); + CodeTextEditor *code_editor; RichTextLabel *warnings_panel; Ref<Script> script; @@ -186,12 +187,11 @@ protected: void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); public: - CodeTextEditor *code_editor; - void _update_connected_methods(); virtual void add_syntax_highlighter(SyntaxHighlighter *p_highlighter); virtual void set_syntax_highlighter(SyntaxHighlighter *p_highlighter); + void update_toggle_scripts_button(); virtual void apply_code(); virtual RES get_edited_resource() const; |