diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 21 | ||||
-rw-r--r-- | editor/code_editor.h | 2 | ||||
-rw-r--r-- | editor/editor_help.cpp | 2 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 22 | ||||
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.h | 3 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/text_editor.cpp | 2 |
11 files changed, 41 insertions, 21 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index aeb304d3b9..3136b0f012 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1060,7 +1060,7 @@ void CodeTextEditor::delete_lines() { text_editor->end_complex_operation(); } -void CodeTextEditor::code_lines_down() { +void CodeTextEditor::clone_lines_down() { int from_line = text_editor->cursor_get_line(); int to_line = text_editor->cursor_get_line(); int column = text_editor->cursor_get_column(); @@ -1072,22 +1072,21 @@ void CodeTextEditor::code_lines_down() { } int next_line = to_line + 1; - if (to_line >= text_editor->get_line_count() - 1) { - text_editor->set_line(to_line, text_editor->get_line(to_line) + "\n"); - } - + bool caret_at_start = text_editor->cursor_get_line() == from_line; text_editor->begin_complex_operation(); for (int i = from_line; i <= to_line; i++) { - text_editor->unfold_line(i); - if (i >= text_editor->get_line_count() - 1) { - text_editor->set_line(i, text_editor->get_line(i) + "\n"); - } - String line_clone = text_editor->get_line(i); - text_editor->insert_at(line_clone, next_line); + text_editor->set_line(next_line - 1, text_editor->get_line(next_line - 1) + "\n"); + text_editor->set_line(next_line, text_editor->get_line(i)); next_line++; } + if (caret_at_start) { + text_editor->cursor_set_line(to_line + 1); + } else { + text_editor->cursor_set_line(next_line - 1); + } + text_editor->cursor_set_column(column); if (text_editor->is_selection_active()) { text_editor->select(to_line + 1, text_editor->get_selection_from_column(), next_line - 1, text_editor->get_selection_to_column()); diff --git a/editor/code_editor.h b/editor/code_editor.h index ee47eff9a8..2f9403843e 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -203,7 +203,7 @@ public: void move_lines_up(); void move_lines_down(); void delete_lines(); - void code_lines_down(); + void clone_lines_down(); void goto_line(int p_line); void goto_line_selection(int p_line, int p_begin, int p_end); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index c639ec86da..3ee8d9c6c5 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -36,7 +36,7 @@ #include "editor_node.h" #include "editor_settings.h" -#define CONTRIBUTE_URL "http://docs.godotengine.org/en/latest/community/contributing/updating_the_class_reference.html" +#define CONTRIBUTE_URL "https://docs.godotengine.org/en/latest/community/contributing/updating_the_class_reference.html" #define CONTRIBUTE2_URL "https://github.com/godotengine/godot-docs" #define REQUEST_URL "https://github.com/godotengine/godot-docs/issues/new" diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 1230588016..75b364089d 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1143,10 +1143,8 @@ void EditorInspectorSection::_notification(int p_what) { Color color = get_color("font_color", "Tree"); draw_string(font, Point2(hs, font->get_ascent() + (h - font->get_height()) / 2).floor(), label, color, get_size().width); - int ofs = 0; if (arrow.is_valid()) { draw_texture(arrow, Point2(get_size().width - arrow->get_width(), (h - arrow->get_height()) / 2).floor()); - ofs += hs + arrow->get_width(); } } } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f2a4591754..81bcbd63a1 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2270,7 +2270,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { emit_signal("request_help_search", ""); } break; case HELP_DOCS: { - OS::get_singleton()->shell_open("http://docs.godotengine.org/"); + OS::get_singleton()->shell_open("https://docs.godotengine.org/"); } break; case HELP_QA: { OS::get_singleton()->shell_open("https://godotengine.org/qa/"); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 5dcbca2ed6..ab94258c44 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -32,6 +32,7 @@ #include "canvas_item_editor_plugin.h" #include "core/io/image_loader.h" +#include "scene/2d/cpu_particles_2d.h" #include "scene/gui/separator.h" #include "scene/resources/particles_material.h" @@ -82,6 +83,25 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) { emission_mask->popup_centered_minsize(); } break; + case MENU_OPTION_CONVERT_TO_CPU_PARTICLES: { + + UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); + + CPUParticles2D *cpu_particles = memnew(CPUParticles2D); + cpu_particles->convert_from_particles(particles); + cpu_particles->set_name(particles->get_name()); + cpu_particles->set_transform(particles->get_transform()); + cpu_particles->set_visible(particles->is_visible()); + cpu_particles->set_pause_mode(particles->get_pause_mode()); + + undo_redo->create_action("Replace Particles by CPUParticles"); + undo_redo->add_do_method(particles, "replace_by", cpu_particles); + undo_redo->add_undo_method(cpu_particles, "replace_by", particles); + undo_redo->add_do_reference(cpu_particles); + undo_redo->add_undo_reference(particles); + undo_redo->commit_action(); + + } break; } } @@ -355,6 +375,8 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { menu->get_popup()->add_separator(); menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK); // menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK); + menu->get_popup()->add_separator(); + menu->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES); menu->set_text(TTR("Particles")); toolbar->add_child(menu); diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h index 71ca8ef499..eaa96d84e9 100644 --- a/editor/plugins/particles_2d_editor_plugin.h +++ b/editor/plugins/particles_2d_editor_plugin.h @@ -46,7 +46,8 @@ class Particles2DEditorPlugin : public EditorPlugin { MENU_GENERATE_VISIBILITY_RECT, MENU_LOAD_EMISSION_MASK, - MENU_CLEAR_EMISSION_MASK + MENU_CLEAR_EMISSION_MASK, + MENU_OPTION_CONVERT_TO_CPU_PARTICLES }; enum EmissionMode { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f4dfa0300e..323dfa681b 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -981,7 +981,7 @@ void ScriptEditor::_menu_option(int p_option) { } break; case SEARCH_WEBSITE: { - OS::get_singleton()->shell_open("http://docs.godotengine.org/"); + OS::get_singleton()->shell_open("https://docs.godotengine.org/"); } break; case WINDOW_NEXT: { diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 0796a93dc3..c3e2aa86f0 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -773,7 +773,7 @@ void ScriptTextEditor::_edit_option(int p_op) { } break; case EDIT_CLONE_DOWN: { - code_editor->code_lines_down(); + code_editor->clone_lines_down(); } break; case EDIT_TOGGLE_FOLD_LINE: { diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 17f93b55a1..638de1b213 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -263,7 +263,7 @@ void ShaderEditor::_menu_option(int p_option) { shader_editor->delete_lines(); } break; case EDIT_CLONE_DOWN: { - shader_editor->code_lines_down(); + shader_editor->clone_lines_down(); } break; case EDIT_TOGGLE_COMMENT: { diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index 1a43b16f3e..4a8eae1ba4 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -360,7 +360,7 @@ void TextEditor::_edit_option(int p_op) { } break; case EDIT_CLONE_DOWN: { - code_editor->code_lines_down(); + code_editor->clone_lines_down(); } break; case EDIT_TOGGLE_FOLD_LINE: { |