summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp81
-rw-r--r--editor/animation_track_editor.h14
-rw-r--r--editor/code_editor.cpp5
-rw-r--r--editor/code_editor.h1
-rw-r--r--editor/editor_autoload_settings.cpp2
-rw-r--r--editor/editor_layouts_dialog.cpp (renamed from editor/editor_name_dialog.cpp)75
-rw-r--r--editor/editor_layouts_dialog.h (renamed from editor/editor_name_dialog.h)23
-rw-r--r--editor/editor_node.cpp6
-rw-r--r--editor/editor_node.h5
-rw-r--r--editor/icons/icon_key_valid.svg5
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp6
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.h3
-rw-r--r--editor/plugins/cpu_particles_editor_plugin.cpp8
-rw-r--r--editor/plugins/cpu_particles_editor_plugin.h1
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp10
-rw-r--r--editor/plugins/particles_2d_editor_plugin.h3
-rw-r--r--editor/plugins/particles_editor_plugin.cpp11
-rw-r--r--editor/plugins/particles_editor_plugin.h1
-rw-r--r--editor/plugins/script_editor_plugin.cpp5
-rw-r--r--editor/plugins/script_text_editor.cpp7
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/tile_set_editor_plugin.h1
24 files changed, 188 insertions, 90 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 6e47fadb20..1bed5a9524 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1203,7 +1203,9 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
////////////////////////////////////
void AnimationTrackEdit::_notification(int p_what) {
+
if (p_what == NOTIFICATION_DRAW) {
+
if (animation.is_null())
return;
ERR_FAIL_INDEX(track, animation->get_track_count());
@@ -1240,20 +1242,15 @@ void AnimationTrackEdit::_notification(int p_what) {
int ofs = in_group ? check->get_width() : 0; //not the best reference for margin but..
check_rect = Rect2(Point2(ofs, int(get_size().height - check->get_height()) / 2), check->get_size());
-
draw_texture(check, check_rect.position);
-
ofs += check->get_width() + hsep;
Ref<Texture> type_icon = type_icons[animation->track_get_type(track)];
-
draw_texture(type_icon, Point2(ofs, int(get_size().height - type_icon->get_height()) / 2));
ofs += type_icon->get_width() + hsep;
NodePath path = animation->track_get_path(track);
-
Node *node = NULL;
-
if (root && root->has_node(path)) {
node = root->get_node(path);
}
@@ -1308,12 +1305,11 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
}
- // KEYFAMES //
+ // KEYFRAMES //
draw_bg(limit, get_size().width - timeline->get_buttons_width());
{
-
float scale = timeline->get_zoom_scale();
int limit_end = get_size().width - timeline->get_buttons_width();
@@ -1342,6 +1338,7 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_fg(limit, get_size().width - timeline->get_buttons_width());
// BUTTONS //
+
{
Ref<Texture> wrap_icon[2] = {
@@ -1566,7 +1563,18 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
if (p_x < p_clip_left || p_x > p_clip_right)
return;
- Vector2 ofs(p_x - type_icon->get_width() / 2, int(get_size().height - type_icon->get_height()) / 2);
+ Ref<Texture> icon_to_draw = p_selected ? selected_icon : type_icon;
+
+ // Override type icon for invalid value keys, unless selected.
+ if (!p_selected && animation->track_get_type(track) == Animation::TYPE_VALUE) {
+ const Variant &v = animation->track_get_key_value(track, p_index);
+ Variant::Type valid_type = Variant::NIL;
+ if (!_is_value_key_valid(v, valid_type)) {
+ icon_to_draw = get_icon("KeyInvalid", "EditorIcons");
+ }
+ }
+
+ Vector2 ofs(p_x - icon_to_draw->get_width() / 2, int(get_size().height - icon_to_draw->get_height()) / 2);
if (animation->track_get_type(track) == Animation::TYPE_METHOD) {
Ref<Font> font = get_font("font", "Label");
@@ -1590,16 +1598,13 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
}
text += ")";
- int limit = MAX(0, p_clip_right - p_x - type_icon->get_width());
+ int limit = MAX(0, p_clip_right - p_x - icon_to_draw->get_width());
if (limit > 0) {
- draw_string(font, Vector2(p_x + type_icon->get_width(), int(get_size().height - font->get_height()) / 2 + font->get_ascent()), text, color, limit);
+ draw_string(font, Vector2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height()) / 2 + font->get_ascent()), text, color, limit);
}
}
- if (p_selected) {
- draw_texture(selected_icon, ofs);
- } else {
- draw_texture(type_icon, ofs);
- }
+
+ draw_texture(icon_to_draw, ofs);
}
//helper
@@ -1764,6 +1769,27 @@ void AnimationTrackEdit::_path_entered(const String &p_text) {
undo_redo->commit_action();
}
+bool AnimationTrackEdit::_is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const {
+
+ RES res;
+ Vector<StringName> leftover_path;
+ Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path);
+
+ Object *obj = NULL;
+ if (res.is_valid()) {
+ obj = res.ptr();
+ } else if (node) {
+ obj = node;
+ }
+
+ bool prop_exists = false;
+ if (obj) {
+ r_valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
+ }
+
+ return (!prop_exists || Variant::can_convert(p_key_value.get_type(), r_valid_type));
+}
+
String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
if (check_rect.has_point(p_pos)) {
@@ -1834,29 +1860,10 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
} break;
case Animation::TYPE_VALUE: {
- Variant v = animation->track_get_key_value(track, key_idx);
- //text+="value: "+String(v)+"\n";
-
- bool prop_exists = false;
- Variant::Type valid_type = Variant::NIL;
- Object *obj = NULL;
-
- RES res;
- Vector<StringName> leftover_path;
- Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path);
-
- if (res.is_valid()) {
- obj = res.ptr();
- } else if (node) {
- obj = node;
- }
-
- if (obj) {
- valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
- }
-
+ const Variant &v = animation->track_get_key_value(track, key_idx);
text += "Type: " + Variant::get_type_name(v.get_type()) + "\n";
- if (prop_exists && !Variant::can_convert(v.get_type(), valid_type)) {
+ Variant::Type valid_type = Variant::NIL;
+ if (!_is_value_key_valid(v, valid_type)) {
text += "Value: " + String(v) + " (Invalid, expected type: " + Variant::get_type_name(valid_type) + ")\n";
} else {
text += "Value: " + String(v) + "\n";
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 1452d5519c..5f05c1de8c 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -31,6 +31,11 @@
#ifndef ANIMATION_TRACK_EDITOR_H
#define ANIMATION_TRACK_EDITOR_H
+#include "editor/editor_data.h"
+#include "editor/editor_spin_slider.h"
+#include "editor/property_editor.h"
+#include "editor/property_selector.h"
+#include "scene/animation/animation_cache.h"
#include "scene/gui/control.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/menu_button.h"
@@ -40,12 +45,6 @@
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
-
-#include "editor/property_selector.h"
-#include "editor_data.h"
-#include "editor_spin_slider.h"
-#include "property_editor.h"
-#include "scene/animation/animation_cache.h"
#include "scene/resources/animation.h"
#include "scene_tree_editor.h"
@@ -175,8 +174,9 @@ class AnimationTrackEdit : public Control {
void _path_entered(const String &p_text);
void _play_position_draw();
- mutable int dropping_at;
+ bool _is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const;
+ mutable int dropping_at;
float insert_at_pos;
bool moving_selection_attempt;
int select_single_attempt;
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 8b3c537fe3..848921d870 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -1217,6 +1217,11 @@ void CodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
text_editor->select(p_line, p_begin, p_line, p_end);
}
+void CodeTextEditor::goto_line_centered(int p_line) {
+ goto_line(p_line);
+ text_editor->call_deferred("center_viewport_to_cursor");
+}
+
void CodeTextEditor::set_executing_line(int p_line) {
text_editor->set_executing_line(p_line);
}
diff --git a/editor/code_editor.h b/editor/code_editor.h
index ce219f340c..c0989f9704 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -219,6 +219,7 @@ public:
void goto_line(int p_line);
void goto_line_selection(int p_line, int p_begin, int p_end);
+ void goto_line_centered(int p_line);
void set_executing_line(int p_line);
void clear_executing_line();
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 913eb35f8a..9f0b4250a3 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -789,7 +789,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
}
}
- if (!info.is_singleton && !info.in_editor) {
+ if (!info.is_singleton && !info.in_editor && info.node != NULL) {
memdelete(info.node);
info.node = NULL;
}
diff --git a/editor/editor_name_dialog.cpp b/editor/editor_layouts_dialog.cpp
index 63a91a594c..01e4762196 100644
--- a/editor/editor_name_dialog.cpp
+++ b/editor/editor_layouts_dialog.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_name_dialog.cpp */
+/* editor_layouts_dialog.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,13 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "editor_name_dialog.h"
-
+#include "editor_layouts_dialog.h"
#include "core/class_db.h"
+#include "core/io/config_file.h"
#include "core/os/keyboard.h"
+#include "editor/editor_settings.h"
+#include "scene/gui/item_list.h"
+#include "scene/gui/line_edit.h"
-void EditorNameDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
-
+void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
if (k.is_valid()) {
@@ -60,34 +62,77 @@ void EditorNameDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
}
}
-void EditorNameDialog::_post_popup() {
+void EditorLayoutsDialog::_bind_methods() {
+ ClassDB::bind_method("_line_gui_input", &EditorLayoutsDialog::_line_gui_input);
- ConfirmationDialog::_post_popup();
- name->clear();
- name->grab_focus();
+ ADD_SIGNAL(MethodInfo("name_confirmed", PropertyInfo(Variant::STRING, "name")));
}
-void EditorNameDialog::ok_pressed() {
+void EditorLayoutsDialog::ok_pressed() {
+
+ if (layout_names->is_anything_selected()) {
+
+ Vector<int> const selected_items = layout_names->get_selected_items();
+ for (int i = 0; i < selected_items.size(); ++i) {
+
+ emit_signal("name_confirmed", layout_names->get_item_text(selected_items[i]));
+ }
+ } else if (name->is_visible() && name->get_text() != "") {
- if (name->get_text() != "") {
emit_signal("name_confirmed", name->get_text());
}
}
-void EditorNameDialog::_bind_methods() {
+void EditorLayoutsDialog::_post_popup() {
- ClassDB::bind_method("_line_gui_input", &EditorNameDialog::_line_gui_input);
+ ConfirmationDialog::_post_popup();
+ name->clear();
+ layout_names->clear();
- ADD_SIGNAL(MethodInfo("name_confirmed", PropertyInfo(Variant::STRING, "name")));
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(EditorSettings::get_singleton()->get_editor_layouts_config());
+ if (err != OK) {
+
+ return;
+ }
+
+ List<String> layouts;
+ config.ptr()->get_sections(&layouts);
+
+ for (List<String>::Element *E = layouts.front(); E; E = E->next()) {
+
+ layout_names->add_item(**E);
+ }
}
-EditorNameDialog::EditorNameDialog() {
+EditorLayoutsDialog::EditorLayoutsDialog() {
+
makevb = memnew(VBoxContainer);
add_child(makevb);
+ makevb->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
+ makevb->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
+
+ layout_names = memnew(ItemList);
+ makevb->add_child(layout_names);
+ layout_names->set_visible(true);
+ layout_names->set_margin(MARGIN_TOP, 5);
+ layout_names->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
+ layout_names->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
+ layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ layout_names->set_select_mode(ItemList::SelectMode::SELECT_MULTI);
+ layout_names->set_allow_rmb_select(true);
+
name = memnew(LineEdit);
makevb->add_child(name);
name->set_margin(MARGIN_TOP, 5);
name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
name->connect("gui_input", this, "_line_gui_input");
+ name->connect("focus_entered", layout_names, "unselect_all");
+}
+
+void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) {
+
+ name->set_visible(p_enabled);
}
diff --git a/editor/editor_name_dialog.h b/editor/editor_layouts_dialog.h
index 314fc27124..5e3a1d5a46 100644
--- a/editor/editor_name_dialog.h
+++ b/editor/editor_layouts_dialog.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_name_dialog.h */
+/* editor_layouts_dialog.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,18 +28,21 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITOR_NAME_DIALOG_H
-#define EDITOR_NAME_DIALOG_H
+#ifndef EDITOR_LAYOUTS_DIALOG_H
+#define EDITOR_LAYOUTS_DIALOG_H
#include "scene/gui/dialogs.h"
-#include "scene/gui/line_edit.h"
-class EditorNameDialog : public ConfirmationDialog {
+class LineEdit;
+class ItemList;
- GDCLASS(EditorNameDialog, ConfirmationDialog);
+class EditorLayoutsDialog : public ConfirmationDialog {
+
+ GDCLASS(EditorLayoutsDialog, ConfirmationDialog);
- VBoxContainer *makevb;
LineEdit *name;
+ ItemList *layout_names;
+ VBoxContainer *makevb;
void _line_gui_input(const Ref<InputEvent> &p_event);
@@ -49,9 +52,9 @@ protected:
virtual void _post_popup();
public:
- LineEdit *get_line_edit() { return name; }
+ EditorLayoutsDialog();
- EditorNameDialog();
+ void set_name_line_enabled(bool p_enabled);
};
-#endif // EDITOR_NAME_DIALOG_H
+#endif // EDITOR_LAYOUTS_DIALOG_H
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 21ed478159..1f08f3d787 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4256,6 +4256,7 @@ void EditorNode::_layout_menu_option(int p_id) {
layout_dialog->set_title(TTR("Save Layout"));
layout_dialog->get_ok()->set_text(TTR("Save"));
layout_dialog->popup_centered();
+ layout_dialog->set_name_line_enabled(true);
} break;
case SETTINGS_LAYOUT_DELETE: {
@@ -4263,6 +4264,7 @@ void EditorNode::_layout_menu_option(int p_id) {
layout_dialog->set_title(TTR("Delete Layout"));
layout_dialog->get_ok()->set_text(TTR("Delete"));
layout_dialog->popup_centered();
+ layout_dialog->set_name_line_enabled(false);
} break;
case SETTINGS_LAYOUT_DEFAULT: {
@@ -6029,10 +6031,10 @@ EditorNode::EditorNode() {
progress_hb = memnew(BackgroundProgress);
- layout_dialog = memnew(EditorNameDialog);
+ layout_dialog = memnew(EditorLayoutsDialog);
gui_base->add_child(layout_dialog);
layout_dialog->set_hide_on_ok(false);
- layout_dialog->set_size(Size2(175, 70) * EDSCALE);
+ layout_dialog->set_size(Size2(225, 270) * EDSCALE);
layout_dialog->connect("name_confirmed", this, "_dialog_action");
update_menu = memnew(MenuButton);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 366d9c2770..46b9befcd6 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -41,8 +41,8 @@
#include "editor/editor_feature_profile.h"
#include "editor/editor_folding.h"
#include "editor/editor_inspector.h"
+#include "editor/editor_layouts_dialog.h"
#include "editor/editor_log.h"
-#include "editor/editor_name_dialog.h"
#include "editor/editor_plugin.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_run.h"
@@ -85,6 +85,7 @@
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "scene/gui/viewport_container.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -308,7 +309,7 @@ private:
int overridden_default_layout;
Ref<ConfigFile> default_layout;
PopupMenu *editor_layouts;
- EditorNameDialog *layout_dialog;
+ EditorLayoutsDialog *layout_dialog;
ConfirmationDialog *custom_build_manage_templates;
ConfirmationDialog *install_android_build_template;
diff --git a/editor/icons/icon_key_valid.svg b/editor/icons/icon_key_valid.svg
deleted file mode 100644
index 4a3fab4754..0000000000
--- a/editor/icons/icon_key_valid.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1044.4)">
-<rect transform="rotate(-45)" x="-741.53" y="741.08" width="6.1027" height="6.1027" ry=".76286" fill="#fff"/>
-</g>
-</svg>
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
index 1622ce17b2..7c2116f06b 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
@@ -75,6 +75,10 @@ void CPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
emission_mask->popup_centered_minsize();
} break;
+ case MENU_RESTART: {
+
+ particles->restart();
+ }
}
}
@@ -265,6 +269,8 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) {
menu = memnew(MenuButton);
menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK);
+ menu->get_popup()->add_separator();
+ menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART);
// menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
menu->set_text(TTR("Particles"));
menu->set_switch_on_hover(true);
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.h b/editor/plugins/cpu_particles_2d_editor_plugin.h
index f715abd87b..84bbfff095 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.h
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.h
@@ -44,7 +44,8 @@ class CPUParticles2DEditorPlugin : public EditorPlugin {
enum {
MENU_LOAD_EMISSION_MASK,
- MENU_CLEAR_EMISSION_MASK
+ MENU_CLEAR_EMISSION_MASK,
+ MENU_RESTART
};
enum EmissionMode {
diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp
index 70be9b95bb..93ffce41fa 100644
--- a/editor/plugins/cpu_particles_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_editor_plugin.cpp
@@ -62,6 +62,12 @@ void CPUParticlesEditor::_menu_option(int p_option) {
emission_tree_dialog->popup_centered_ratio();
} break;
+
+ case MENU_OPTION_RESTART: {
+
+ node->restart();
+
+ } break;
}
}
@@ -108,6 +114,8 @@ CPUParticlesEditor::CPUParticlesEditor() {
options->set_text(TTR("CPUParticles"));
options->get_popup()->add_item(TTR("Create Emission Points From Mesh"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH);
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
+ options->get_popup()->add_separator();
+ options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);
options->get_popup()->connect("id_pressed", this, "_menu_option");
}
diff --git a/editor/plugins/cpu_particles_editor_plugin.h b/editor/plugins/cpu_particles_editor_plugin.h
index 09b0adbe5d..674f00dc9f 100644
--- a/editor/plugins/cpu_particles_editor_plugin.h
+++ b/editor/plugins/cpu_particles_editor_plugin.h
@@ -43,6 +43,7 @@ class CPUParticlesEditor : public ParticlesEditorBase {
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE,
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH,
MENU_OPTION_CLEAR_EMISSION_VOLUME,
+ MENU_OPTION_RESTART
};
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index 6fabdc93c6..e68bca55cb 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -96,12 +96,16 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Convert to CPUParticles"));
ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", particles, cpu_particles, true, false);
- ur->add_do_reference(particles);
+ ur->add_do_reference(cpu_particles);
ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false);
- ur->add_undo_reference(this);
+ ur->add_undo_reference(particles);
ur->commit_action();
} break;
+ case MENU_RESTART: {
+
+ particles->restart();
+ }
}
}
@@ -380,6 +384,8 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
// 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->get_popup()->add_separator();
+ menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART);
menu->set_text(TTR("Particles"));
menu->set_switch_on_hover(true);
toolbar->add_child(menu);
diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h
index 35b874fb25..0f092aaa4f 100644
--- a/editor/plugins/particles_2d_editor_plugin.h
+++ b/editor/plugins/particles_2d_editor_plugin.h
@@ -47,7 +47,8 @@ class Particles2DEditorPlugin : public EditorPlugin {
MENU_GENERATE_VISIBILITY_RECT,
MENU_LOAD_EMISSION_MASK,
MENU_CLEAR_EMISSION_MASK,
- MENU_OPTION_CONVERT_TO_CPU_PARTICLES
+ MENU_OPTION_CONVERT_TO_CPU_PARTICLES,
+ MENU_RESTART
};
enum EmissionMode {
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 3f4f66a26d..f05e7d65d3 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -315,12 +315,17 @@ void ParticlesEditor::_menu_option(int p_option) {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Convert to CPUParticles"));
ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", node, cpu_particles, true, false);
- ur->add_do_reference(node);
+ ur->add_do_reference(cpu_particles);
ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false);
- ur->add_undo_reference(this);
+ ur->add_undo_reference(node);
ur->commit_action();
} break;
+ case MENU_OPTION_RESTART: {
+
+ node->restart();
+
+ } break;
}
}
@@ -471,6 +476,8 @@ ParticlesEditor::ParticlesEditor() {
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);
+ options->get_popup()->add_separator();
+ options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);
options->get_popup()->connect("id_pressed", this, "_menu_option");
diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h
index b1c53dcf94..5d05fbd4ac 100644
--- a/editor/plugins/particles_editor_plugin.h
+++ b/editor/plugins/particles_editor_plugin.h
@@ -86,6 +86,7 @@ class ParticlesEditor : public ParticlesEditorBase {
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH,
MENU_OPTION_CLEAR_EMISSION_VOLUME,
MENU_OPTION_CONVERT_TO_CPU_PARTICLES,
+ MENU_OPTION_RESTART,
};
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d5e21321c3..1b00889e9a 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -306,8 +306,11 @@ void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
editor->push_item(p_script.ptr());
ScriptEditorBase *current = _get_current_editor();
- if (current)
+ if (ScriptTextEditor *script_text_editor = Object::cast_to<ScriptTextEditor>(current)) {
+ script_text_editor->goto_line_centered(p_line);
+ } else if (current) {
current->goto_line(p_line, true);
+ }
}
}
}
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index ce0859a1f6..9bf3a9f0eb 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -237,7 +237,7 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_color_override("safe_line_number_color", safe_line_number_color);
text_edit->add_color_override("caret_color", caret_color);
text_edit->add_color_override("caret_background_color", caret_background_color);
- text_edit->add_color_override("font_selected_color", text_selected_color);
+ text_edit->add_color_override("font_color_selected", text_selected_color);
text_edit->add_color_override("selection_color", selection_color);
text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
text_edit->add_color_override("current_line_color", current_line_color);
@@ -487,6 +487,11 @@ void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
code_editor->goto_line_selection(p_line, p_begin, p_end);
}
+void ScriptTextEditor::goto_line_centered(int p_line) {
+
+ code_editor->goto_line_centered(p_line);
+}
+
void ScriptTextEditor::set_executing_line(int p_line) {
code_editor->set_executing_line(p_line);
}
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 24d40a5eec..89975e061e 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -201,6 +201,7 @@ public:
virtual void goto_line(int p_line, bool p_with_error = false);
void goto_line_selection(int p_line, int p_begin, int p_end);
+ void goto_line_centered(int p_line);
virtual void set_executing_line(int p_line);
virtual void clear_executing_line();
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index f9ca38b919..d02817f6e8 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -124,7 +124,7 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_color_override("line_number_color", line_number_color);
get_text_edit()->add_color_override("caret_color", caret_color);
get_text_edit()->add_color_override("caret_background_color", caret_background_color);
- get_text_edit()->add_color_override("font_selected_color", text_selected_color);
+ get_text_edit()->add_color_override("font_color_selected", text_selected_color);
get_text_edit()->add_color_override("selection_color", selection_color);
get_text_edit()->add_color_override("brace_mismatch_color", brace_mismatch_color);
get_text_edit()->add_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index eeef3397d2..787813336d 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -116,7 +116,7 @@ void TextEditor::_load_theme_settings() {
text_edit->add_color_override("line_number_color", line_number_color);
text_edit->add_color_override("caret_color", caret_color);
text_edit->add_color_override("caret_background_color", caret_background_color);
- text_edit->add_color_override("font_selected_color", text_selected_color);
+ text_edit->add_color_override("font_color_selected", text_selected_color);
text_edit->add_color_override("selection_color", selection_color);
text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
text_edit->add_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index b417414ae0..04e8d65155 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -31,7 +31,6 @@
#ifndef TILE_SET_EDITOR_PLUGIN_H
#define TILE_SET_EDITOR_PLUGIN_H
-#include "editor/editor_name_dialog.h"
#include "editor/editor_node.h"
#include "scene/2d/sprite.h"
#include "scene/resources/concave_polygon_shape_2d.h"