diff options
Diffstat (limited to 'editor')
87 files changed, 742 insertions, 477 deletions
diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h index 66c818f09d..49aab48719 100644 --- a/editor/animation_bezier_editor.h +++ b/editor/animation_bezier_editor.h @@ -35,7 +35,7 @@ class AnimationBezierTrackEdit : public Control { - GDCLASS(AnimationBezierTrackEdit, Control) + GDCLASS(AnimationBezierTrackEdit, Control); enum HandleMode { HANDLE_MODE_FREE, diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 3295753bda..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"; @@ -2083,8 +2090,6 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { moving_selection_from_ofs = (mb->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale(); } accept_event(); - } else { - emit_signal("clear_selection"); } } @@ -2326,7 +2331,7 @@ void AnimationTrackEdit::set_in_group(bool p_enable) { update(); } -void AnimationTrackEdit::append_to_selection(const Rect2 &p_box) { +void AnimationTrackEdit::append_to_selection(const Rect2 &p_box, bool p_deselection) { Rect2 select_rect(timeline->get_name_limit(), 0, get_size().width - timeline->get_name_limit() - timeline->get_buttons_width(), get_size().height); select_rect = select_rect.clip(p_box); @@ -2339,7 +2344,10 @@ void AnimationTrackEdit::append_to_selection(const Rect2 &p_box) { rect.position.x += offset; if (select_rect.intersects(rect)) { - emit_signal("select_key", i, false); + if (p_deselection) + emit_signal("deselect_key", i); + else + emit_signal("select_key", i, false); } } } @@ -4342,7 +4350,7 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) { Rect2 local_rect = box_select_rect; local_rect.position -= track_edits[i]->get_global_position(); - track_edits[i]->append_to_selection(local_rect); + track_edits[i]->append_to_selection(local_rect, mb->get_command()); } if (_get_track_selected() == -1 && track_edits.size() > 0) { //minimal hack to make shortcuts work @@ -4374,8 +4382,8 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) { } if (!box_selection->is_visible_in_tree()) { - if (!mm->get_shift()) { - _clear_selection(); //only append if shift is pressed + if (!mm->get_command() && !mm->get_shift()) { + _clear_selection(); } box_selection->show(); } @@ -4568,7 +4576,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { it->set_metadata(0, md); } - track_copy_dialog->popup_centered_minsize(Size2(300, 500) * EDSCALE); + track_copy_dialog->popup_centered_minsize(Size2(350, 500) * EDSCALE); } break; case EDIT_COPY_TRACKS_CONFIRM: { @@ -4962,6 +4970,19 @@ void AnimationTrackEditor::_show_imported_anim_warning() const { TTR("Warning: Editing imported animation")); } +void AnimationTrackEditor::_select_all_tracks_for_copy() { + TreeItem *track = track_copy_select->get_root()->get_children(); + while (track) { + track->set_checked(0, selected_all_tracks); + track = track->get_next(); + } + selected_all_tracks = !selected_all_tracks; + if (selected_all_tracks) + select_all_button->set_text(TTR("Select All")); + else + select_all_button->set_text(TTR("Select None")); +} + void AnimationTrackEditor::_bind_methods() { ClassDB::bind_method("_animation_changed", &AnimationTrackEditor::_animation_changed); @@ -5002,6 +5023,7 @@ void AnimationTrackEditor::_bind_methods() { ClassDB::bind_method("_selection_changed", &AnimationTrackEditor::_selection_changed); ClassDB::bind_method("_snap_mode_changed", &AnimationTrackEditor::_snap_mode_changed); ClassDB::bind_method("_show_imported_anim_warning", &AnimationTrackEditor::_show_imported_anim_warning); + ClassDB::bind_method("_select_all_tracks_for_copy", &AnimationTrackEditor::_select_all_tracks_for_copy); ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag"))); ADD_SIGNAL(MethodInfo("keying_changed")); @@ -5284,9 +5306,22 @@ AnimationTrackEditor::AnimationTrackEditor() { track_copy_dialog->set_title(TTR("Select tracks to copy:")); track_copy_dialog->get_ok()->set_text(TTR("Copy")); + VBoxContainer *track_vbox = memnew(VBoxContainer); + track_copy_dialog->add_child(track_vbox); + + selected_all_tracks = true; + track_copy_select = memnew(Tree); + track_copy_select->set_h_size_flags(SIZE_EXPAND_FILL); + track_copy_select->set_v_size_flags(SIZE_EXPAND_FILL); track_copy_select->set_hide_root(true); - track_copy_dialog->add_child(track_copy_select); + track_vbox->add_child(track_copy_select); + track_copy_options = memnew(HBoxContainer); + track_vbox->add_child(track_copy_options); + select_all_button = memnew(Button); + select_all_button->set_text(TTR("Select All")); + select_all_button->connect("pressed", this, "_select_all_tracks_for_copy"); + track_copy_options->add_child(select_all_button); track_copy_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_COPY_TRACKS_CONFIRM)); animation_changing_awaiting_update = false; } diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index c64f663b3b..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,17 +45,11 @@ #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" class AnimationTimelineEdit : public Range { - GDCLASS(AnimationTimelineEdit, Range) + GDCLASS(AnimationTimelineEdit, Range); Ref<Animation> animation; int name_limit; @@ -123,7 +122,7 @@ class AnimationTrackEditor; class AnimationTrackEdit : public Control { - GDCLASS(AnimationTrackEdit, Control) + GDCLASS(AnimationTrackEdit, Control); enum { MENU_CALL_MODE_CONTINUOUS, @@ -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; @@ -231,13 +231,14 @@ public: void cancel_drop(); void set_in_group(bool p_enable); - void append_to_selection(const Rect2 &p_box); + void append_to_selection(const Rect2 &p_box, bool p_deselection); AnimationTrackEdit(); }; class AnimationTrackEditPlugin : public Reference { - GDCLASS(AnimationTrackEditPlugin, Reference) + GDCLASS(AnimationTrackEditPlugin, Reference); + public: virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage); virtual AnimationTrackEdit *create_audio_track_edit(); @@ -248,7 +249,7 @@ class AnimationTrackKeyEdit; class AnimationBezierTrackEdit; class AnimationTrackEditGroup : public Control { - GDCLASS(AnimationTrackEditGroup, Control) + GDCLASS(AnimationTrackEditGroup, Control); Ref<Texture> icon; String node_name; NodePath node; @@ -271,7 +272,7 @@ public: }; class AnimationTrackEditor : public VBoxContainer { - GDCLASS(AnimationTrackEditor, VBoxContainer) + GDCLASS(AnimationTrackEditor, VBoxContainer); enum { EDIT_COPY_TRACKS, @@ -445,6 +446,8 @@ class AnimationTrackEditor : public VBoxContainer { ConfirmationDialog *scale_dialog; SpinBox *scale; + void _select_all_tracks_for_copy(); + void _edit_menu_pressed(int p_option); int last_menu_track_opt; @@ -458,8 +461,12 @@ class AnimationTrackEditor : public VBoxContainer { void _selection_changed(); + bool selected_all_tracks; ConfirmationDialog *track_copy_dialog; Tree *track_copy_select; + HBoxContainer *track_copy_options; + Button *select_all_button; + struct TrackClipboard { NodePath full_path; NodePath base_path; diff --git a/editor/animation_track_editor_plugins.h b/editor/animation_track_editor_plugins.h index a1ea7435b1..5f0ea6196c 100644 --- a/editor/animation_track_editor_plugins.h +++ b/editor/animation_track_editor_plugins.h @@ -34,7 +34,7 @@ #include "editor/animation_track_editor.h" class AnimationTrackEditBool : public AnimationTrackEdit { - GDCLASS(AnimationTrackEditBool, AnimationTrackEdit) + GDCLASS(AnimationTrackEditBool, AnimationTrackEdit); Ref<Texture> icon_checked; Ref<Texture> icon_unchecked; @@ -46,7 +46,7 @@ public: }; class AnimationTrackEditColor : public AnimationTrackEdit { - GDCLASS(AnimationTrackEditColor, AnimationTrackEdit) + GDCLASS(AnimationTrackEditColor, AnimationTrackEdit); public: virtual int get_key_height() const; @@ -57,7 +57,7 @@ public: }; class AnimationTrackEditAudio : public AnimationTrackEdit { - GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit) + GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit); ObjectID id; @@ -78,7 +78,7 @@ public: }; class AnimationTrackEditSpriteFrame : public AnimationTrackEdit { - GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit) + GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit); ObjectID id; @@ -92,7 +92,7 @@ public: }; class AnimationTrackEditSubAnim : public AnimationTrackEdit { - GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit) + GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit); ObjectID id; @@ -106,7 +106,7 @@ public: }; class AnimationTrackEditTypeAudio : public AnimationTrackEdit { - GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit) + GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit); void _preview_changed(ObjectID p_which); @@ -134,7 +134,7 @@ public: }; class AnimationTrackEditTypeAnimation : public AnimationTrackEdit { - GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit) + GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit); ObjectID id; @@ -149,7 +149,7 @@ public: }; class AnimationTrackEditVolumeDB : public AnimationTrackEdit { - GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit) + GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit); public: virtual void draw_bg(int p_clip_left, int p_clip_right); @@ -159,7 +159,8 @@ public: }; class AnimationTrackEditDefaultPlugin : public AnimationTrackEditPlugin { - GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin) + GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin); + public: virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage); virtual AnimationTrackEdit *create_audio_track_edit(); diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h index 3b8975e3aa..fca0aabac1 100644 --- a/editor/audio_stream_preview.h +++ b/editor/audio_stream_preview.h @@ -36,7 +36,7 @@ #include "servers/audio/audio_stream.h" class AudioStreamPreview : public Reference { - GDCLASS(AudioStreamPreview, Reference) + GDCLASS(AudioStreamPreview, Reference); friend class AudioStream; Vector<uint8_t> preview; float length; @@ -52,7 +52,7 @@ public: }; class AudioStreamPreviewGenerator : public Node { - GDCLASS(AudioStreamPreviewGenerator, Node) + GDCLASS(AudioStreamPreviewGenerator, Node); static AudioStreamPreviewGenerator *singleton; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index e471993fc7..848921d870 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -587,6 +587,26 @@ FindReplaceBar::FindReplaceBar() { /*** CODE EDITOR ****/ +// This function should be used to handle shortcuts that could otherwise +// be handled too late if they weren't handled here. +void CodeTextEditor::_input(const Ref<InputEvent> &event) { + + const Ref<InputEventKey> key_event = event; + if (!key_event.is_valid() || !key_event->is_pressed()) + return; + + if (ED_IS_SHORTCUT("script_text_editor/move_up", key_event)) { + move_lines_up(); + accept_event(); + return; + } + if (ED_IS_SHORTCUT("script_text_editor/move_down", key_event)) { + move_lines_down(); + accept_event(); + return; + } +} + void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; @@ -1197,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); } @@ -1375,6 +1400,9 @@ void CodeTextEditor::_notification(int p_what) { warning_button->set_icon(get_icon("NodeWarning", "EditorIcons")); add_constant_override("separation", 4 * EDSCALE); } break; + case NOTIFICATION_VISIBILITY_CHANGED: { + set_process_input(is_visible_in_tree()); + } break; default: break; } @@ -1454,6 +1482,7 @@ void CodeTextEditor::remove_all_bookmarks() { void CodeTextEditor::_bind_methods() { + ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input); ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input); ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed); ClassDB::bind_method("_text_changed", &CodeTextEditor::_text_changed); diff --git a/editor/code_editor.h b/editor/code_editor.h index 0ef8ec7061..c0989f9704 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -165,6 +165,7 @@ class CodeTextEditor : public VBoxContainer { void _font_resize_timeout(); bool _add_font_size(int p_delta); + void _input(const Ref<InputEvent> &event); void _text_editor_gui_input(const Ref<InputEvent> &p_event); void _zoom_in(); void _zoom_out(); @@ -218,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/create_dialog.h b/editor/create_dialog.h index 03c4b25f5c..0eddbc3ceb 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -44,7 +44,7 @@ class CreateDialog : public ConfirmationDialog { - GDCLASS(CreateDialog, ConfirmationDialog) + GDCLASS(CreateDialog, ConfirmationDialog); Vector<String> favorite_list; Tree *favorites; diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h index 20890fd3b5..8781e6ff6c 100644 --- a/editor/editor_audio_buses.h +++ b/editor/editor_audio_buses.h @@ -52,7 +52,7 @@ class EditorAudioBuses; class EditorAudioBus : public PanelContainer { - GDCLASS(EditorAudioBus, PanelContainer) + GDCLASS(EditorAudioBus, PanelContainer); Ref<Texture> disabled_vu; LineEdit *track_name; @@ -155,7 +155,7 @@ public: class EditorAudioBuses : public VBoxContainer { - GDCLASS(EditorAudioBuses, VBoxContainer) + GDCLASS(EditorAudioBuses, VBoxContainer); HBoxContainer *top_hb; 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_export.h b/editor/editor_export.h index bd864c528c..7c01abe0e9 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -44,7 +44,8 @@ struct EditorProgress; class EditorExportPreset : public Reference { - GDCLASS(EditorExportPreset, Reference) + GDCLASS(EditorExportPreset, Reference); + public: enum ExportFilter { EXPORT_ALL_RESOURCES, @@ -152,7 +153,7 @@ struct SharedObject { class EditorExportPlatform : public Reference { - GDCLASS(EditorExportPlatform, Reference) + GDCLASS(EditorExportPlatform, Reference); public: typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total); @@ -272,7 +273,7 @@ public: }; class EditorExportPlugin : public Reference { - GDCLASS(EditorExportPlugin, Reference) + GDCLASS(EditorExportPlugin, Reference); friend class EditorExportPlatform; @@ -388,7 +389,7 @@ public: class EditorExportPlatformPC : public EditorExportPlatform { - GDCLASS(EditorExportPlatformPC, EditorExportPlatform) + GDCLASS(EditorExportPlatformPC, EditorExportPlatform); Ref<ImageTexture> logo; String name; @@ -440,7 +441,7 @@ public: class EditorExportTextSceneToBinaryPlugin : public EditorExportPlugin { - GDCLASS(EditorExportTextSceneToBinaryPlugin, EditorExportPlugin) + GDCLASS(EditorExportTextSceneToBinaryPlugin, EditorExportPlugin); public: virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 36a8772faf..c6646eb28b 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -42,7 +42,7 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = { TTRC("Scene Tree Editing"), TTRC("Import Dock"), TTRC("Node Dock"), - TTRC("Filesystem Dock") + TTRC("FileSystem and Import Docks") }; const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = { @@ -378,18 +378,21 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { switch (p_action) { case PROFILE_CLEAR: { + EditorSettings::get_singleton()->set("_default_feature_profile", ""); EditorSettings::get_singleton()->save(); current_profile = ""; current.unref(); + _update_profile_list(); + _emit_current_profile_changed(); } break; case PROFILE_SET: { String selected = _get_selected_profile(); ERR_FAIL_COND(selected == String()); if (selected == current_profile) { - return; //nothing to do here + return; // Nothing to do here. } EditorSettings::get_singleton()->set("_default_feature_profile", selected); EditorSettings::get_singleton()->save(); @@ -397,7 +400,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { current = edited; _update_profile_list(); - + _emit_current_profile_changed(); } break; case PROFILE_IMPORT: { @@ -415,6 +418,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { new_profile_name->grab_focus(); } break; case PROFILE_ERASE: { + String selected = _get_selected_profile(); ERR_FAIL_COND(selected == String()); @@ -809,7 +813,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { profile_actions[PROFILE_CLEAR]->set_disabled(true); profile_actions[PROFILE_CLEAR]->connect("pressed", this, "_profile_action", varray(PROFILE_CLEAR)); - main_vbc->add_margin_child(TTR("Current Profile"), name_hbc); + main_vbc->add_margin_child(TTR("Current Profile:"), name_hbc); HBoxContainer *profiles_hbc = memnew(HBoxContainer); profile_list = memnew(OptionButton); @@ -844,7 +848,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { profile_actions[PROFILE_EXPORT]->set_disabled(true); profile_actions[PROFILE_EXPORT]->connect("pressed", this, "_profile_action", varray(PROFILE_EXPORT)); - main_vbc->add_margin_child(TTR("Available Profiles"), profiles_hbc); + main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc); h_split = memnew(HSplitContainer); h_split->set_v_size_flags(SIZE_EXPAND_FILL); @@ -855,9 +859,8 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { class_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL); class_list = memnew(Tree); - class_list_vbc->add_margin_child(TTR("Enabled Classes"), class_list, true); + class_list_vbc->add_margin_child(TTR("Enabled Classes:"), class_list, true); class_list->set_hide_root(true); - class_list->set_hide_folding(true); class_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); class_list->connect("cell_selected", this, "_class_list_item_selected"); class_list->connect("item_edited", this, "_class_list_item_edited", varray(), CONNECT_DEFERRED); diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 494e8b5833..0550509ba2 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -48,7 +48,8 @@ public: class EditorProperty : public Container { - GDCLASS(EditorProperty, Container) + GDCLASS(EditorProperty, Container); + private: String label; int text_size; @@ -167,7 +168,7 @@ public: }; class EditorInspectorPlugin : public Reference { - GDCLASS(EditorInspectorPlugin, Reference) + GDCLASS(EditorInspectorPlugin, Reference); friend class EditorInspector; struct AddedEditor { diff --git a/editor/editor_name_dialog.cpp b/editor/editor_layouts_dialog.cpp index 63a91a594c..36f7b30016 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::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 b6d28dce29..1f08f3d787 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2475,6 +2475,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { OS::get_singleton()->set_window_fullscreen(!OS::get_singleton()->is_window_fullscreen()); } break; + case SETTINGS_TOGGLE_CONSOLE: { + + bool was_visible = OS::get_singleton()->is_console_visible(); + OS::get_singleton()->set_console_visible(!was_visible); + EditorSettings::get_singleton()->set_setting("interface/editor/hide_console_window", !was_visible); + + } break; case SETTINGS_PICK_MAIN_SCENE: { file->set_mode(EditorFileDialog::MODE_OPEN_FILE); @@ -4249,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: { @@ -4256,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: { @@ -5044,7 +5053,9 @@ void EditorNode::_feature_profile_changed() { main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D)); main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT)); main_editor_buttons[EDITOR_ASSETLIB]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)); - if (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)) { + if ((profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) && singleton->main_editor_buttons[EDITOR_3D]->is_pressed()) || + (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) && singleton->main_editor_buttons[EDITOR_SCRIPT]->is_pressed()) || + (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) && singleton->main_editor_buttons[EDITOR_ASSETLIB]->is_pressed())) { _editor_select(EDITOR_2D); } } else { @@ -5056,6 +5067,7 @@ void EditorNode::_feature_profile_changed() { node_dock->set_visible(true); filesystem_dock->set_visible(true); main_editor_buttons[EDITOR_3D]->set_visible(true); + main_editor_buttons[EDITOR_SCRIPT]->set_visible(true); main_editor_buttons[EDITOR_ASSETLIB]->set_visible(true); } @@ -5871,6 +5883,9 @@ EditorNode::EditorNode() { #else p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN); #endif +#ifdef WINDOWS_ENABLED + p->add_item(TTR("Toggle System Console"), SETTINGS_TOGGLE_CONSOLE); +#endif p->add_separator(); if (OS::get_singleton()->get_data_path() == OS::get_singleton()->get_config_path()) { @@ -6016,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 f3bc95c409..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> */ @@ -193,6 +194,7 @@ private: SETTINGS_MANAGE_EXPORT_TEMPLATES, SETTINGS_MANAGE_FEATURE_PROFILES, SETTINGS_PICK_MAIN_SCENE, + SETTINGS_TOGGLE_CONSOLE, SETTINGS_TOGGLE_FULLSCREEN, SETTINGS_HELP, SCENE_TAB_CLOSE, @@ -307,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/editor_plugin.h b/editor/editor_plugin.h index c28e607c89..0d700cd9b6 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -60,7 +60,8 @@ class EditorToolAddons; class ScriptEditor; class EditorInterface : public Node { - GDCLASS(EditorInterface, Node) + GDCLASS(EditorInterface, Node); + protected: static void _bind_methods(); static EditorInterface *singleton; diff --git a/editor/editor_profiler.h b/editor/editor_profiler.h index e62213887d..46c13d257a 100644 --- a/editor/editor_profiler.h +++ b/editor/editor_profiler.h @@ -42,7 +42,7 @@ class EditorProfiler : public VBoxContainer { - GDCLASS(EditorProfiler, VBoxContainer) + GDCLASS(EditorProfiler, VBoxContainer); public: struct Metric { diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 45acd1b6d4..d5f4d54e5c 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -599,7 +599,8 @@ EditorPropertyFlags::EditorPropertyFlags() { ///////////////////// LAYERS ///////////////////////// class EditorPropertyLayersGrid : public Control { - GDCLASS(EditorPropertyLayersGrid, Control) + GDCLASS(EditorPropertyLayersGrid, Control); + public: uint32_t value; Vector<Rect2> flag_rects; diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 574767890c..02d9349f2d 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -40,7 +40,7 @@ #include "scene/gui/color_picker.h" class EditorPropertyNil : public EditorProperty { - GDCLASS(EditorPropertyNil, EditorProperty) + GDCLASS(EditorPropertyNil, EditorProperty); LineEdit *text; public: @@ -49,7 +49,7 @@ public: }; class EditorPropertyText : public EditorProperty { - GDCLASS(EditorPropertyText, EditorProperty) + GDCLASS(EditorPropertyText, EditorProperty); LineEdit *text; bool updating; @@ -66,7 +66,7 @@ public: }; class EditorPropertyMultilineText : public EditorProperty { - GDCLASS(EditorPropertyMultilineText, EditorProperty) + GDCLASS(EditorPropertyMultilineText, EditorProperty); TextEdit *text; AcceptDialog *big_text_dialog; @@ -87,7 +87,7 @@ public: }; class EditorPropertyTextEnum : public EditorProperty { - GDCLASS(EditorPropertyTextEnum, EditorProperty) + GDCLASS(EditorPropertyTextEnum, EditorProperty); OptionButton *options; void _option_selected(int p_which); @@ -102,7 +102,7 @@ public: }; class EditorPropertyPath : public EditorProperty { - GDCLASS(EditorPropertyPath, EditorProperty) + GDCLASS(EditorPropertyPath, EditorProperty); Vector<String> extensions; bool folder; bool global; @@ -127,7 +127,8 @@ public: }; class EditorPropertyClassName : public EditorProperty { - GDCLASS(EditorPropertyClassName, EditorProperty) + GDCLASS(EditorPropertyClassName, EditorProperty); + private: CreateDialog *dialog; Button *property; @@ -146,7 +147,8 @@ public: }; class EditorPropertyMember : public EditorProperty { - GDCLASS(EditorPropertyMember, EditorProperty) + GDCLASS(EditorPropertyMember, EditorProperty); + public: enum Type { MEMBER_METHOD_OF_VARIANT_TYPE, ///< a method of a type @@ -179,7 +181,7 @@ public: }; class EditorPropertyCheck : public EditorProperty { - GDCLASS(EditorPropertyCheck, EditorProperty) + GDCLASS(EditorPropertyCheck, EditorProperty); CheckBox *checkbox; void _checkbox_pressed(); @@ -193,7 +195,7 @@ public: }; class EditorPropertyEnum : public EditorProperty { - GDCLASS(EditorPropertyEnum, EditorProperty) + GDCLASS(EditorPropertyEnum, EditorProperty); OptionButton *options; void _option_selected(int p_which); @@ -209,7 +211,7 @@ public: }; class EditorPropertyFlags : public EditorProperty { - GDCLASS(EditorPropertyFlags, EditorProperty) + GDCLASS(EditorPropertyFlags, EditorProperty); VBoxContainer *vbox; Vector<CheckBox *> flags; Vector<int> flag_indices; @@ -228,7 +230,8 @@ public: class EditorPropertyLayersGrid; class EditorPropertyLayers : public EditorProperty { - GDCLASS(EditorPropertyLayers, EditorProperty) + GDCLASS(EditorPropertyLayers, EditorProperty); + public: enum LayerType { LAYER_PHYSICS_2D, @@ -257,7 +260,7 @@ public: }; class EditorPropertyInteger : public EditorProperty { - GDCLASS(EditorPropertyInteger, EditorProperty) + GDCLASS(EditorPropertyInteger, EditorProperty); EditorSpinSlider *spin; bool setting; void _value_changed(double p_val); @@ -272,7 +275,7 @@ public: }; class EditorPropertyObjectID : public EditorProperty { - GDCLASS(EditorPropertyObjectID, EditorProperty) + GDCLASS(EditorPropertyObjectID, EditorProperty); Button *edit; String base_type; void _edit_pressed(); @@ -287,7 +290,7 @@ public: }; class EditorPropertyFloat : public EditorProperty { - GDCLASS(EditorPropertyFloat, EditorProperty) + GDCLASS(EditorPropertyFloat, EditorProperty); EditorSpinSlider *spin; bool setting; void _value_changed(double p_val); @@ -302,7 +305,7 @@ public: }; class EditorPropertyEasing : public EditorProperty { - GDCLASS(EditorPropertyEasing, EditorProperty) + GDCLASS(EditorPropertyEasing, EditorProperty); Control *easing_draw; PopupMenu *preset; bool full; @@ -335,7 +338,7 @@ public: }; class EditorPropertyVector2 : public EditorProperty { - GDCLASS(EditorPropertyVector2, EditorProperty) + GDCLASS(EditorPropertyVector2, EditorProperty); EditorSpinSlider *spin[2]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -351,7 +354,7 @@ public: }; class EditorPropertyRect2 : public EditorProperty { - GDCLASS(EditorPropertyRect2, EditorProperty) + GDCLASS(EditorPropertyRect2, EditorProperty); EditorSpinSlider *spin[4]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -367,7 +370,7 @@ public: }; class EditorPropertyVector3 : public EditorProperty { - GDCLASS(EditorPropertyVector3, EditorProperty) + GDCLASS(EditorPropertyVector3, EditorProperty); EditorSpinSlider *spin[3]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -383,7 +386,7 @@ public: }; class EditorPropertyPlane : public EditorProperty { - GDCLASS(EditorPropertyPlane, EditorProperty) + GDCLASS(EditorPropertyPlane, EditorProperty); EditorSpinSlider *spin[4]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -399,7 +402,7 @@ public: }; class EditorPropertyQuat : public EditorProperty { - GDCLASS(EditorPropertyQuat, EditorProperty) + GDCLASS(EditorPropertyQuat, EditorProperty); EditorSpinSlider *spin[4]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -415,7 +418,7 @@ public: }; class EditorPropertyAABB : public EditorProperty { - GDCLASS(EditorPropertyAABB, EditorProperty) + GDCLASS(EditorPropertyAABB, EditorProperty); EditorSpinSlider *spin[6]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -431,7 +434,7 @@ public: }; class EditorPropertyTransform2D : public EditorProperty { - GDCLASS(EditorPropertyTransform2D, EditorProperty) + GDCLASS(EditorPropertyTransform2D, EditorProperty); EditorSpinSlider *spin[6]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -447,7 +450,7 @@ public: }; class EditorPropertyBasis : public EditorProperty { - GDCLASS(EditorPropertyBasis, EditorProperty) + GDCLASS(EditorPropertyBasis, EditorProperty); EditorSpinSlider *spin[9]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -463,7 +466,7 @@ public: }; class EditorPropertyTransform : public EditorProperty { - GDCLASS(EditorPropertyTransform, EditorProperty) + GDCLASS(EditorPropertyTransform, EditorProperty); EditorSpinSlider *spin[12]; bool setting; void _value_changed(double p_val, const String &p_name); @@ -479,7 +482,7 @@ public: }; class EditorPropertyColor : public EditorProperty { - GDCLASS(EditorPropertyColor, EditorProperty) + GDCLASS(EditorPropertyColor, EditorProperty); ColorPickerButton *picker; void _color_changed(const Color &p_color); void _popup_closed(); @@ -494,7 +497,7 @@ public: }; class EditorPropertyNodePath : public EditorProperty { - GDCLASS(EditorPropertyNodePath, EditorProperty) + GDCLASS(EditorPropertyNodePath, EditorProperty); Button *assign; Button *clear; SceneTreeDialog *scene_tree; @@ -517,7 +520,7 @@ public: }; class EditorPropertyRID : public EditorProperty { - GDCLASS(EditorPropertyRID, EditorProperty) + GDCLASS(EditorPropertyRID, EditorProperty); Label *label; public: @@ -526,7 +529,7 @@ public: }; class EditorPropertyResource : public EditorProperty { - GDCLASS(EditorPropertyResource, EditorProperty) + GDCLASS(EditorPropertyResource, EditorProperty); enum MenuOption { @@ -605,7 +608,7 @@ public: /// \brief The EditorInspectorDefaultPlugin class /// class EditorInspectorDefaultPlugin : public EditorInspectorPlugin { - GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin) + GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin); public: virtual bool can_handle(Object *p_object); diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h index ff759105c3..18519c754a 100644 --- a/editor/editor_properties_array_dict.h +++ b/editor/editor_properties_array_dict.h @@ -78,7 +78,7 @@ public: }; class EditorPropertyArray : public EditorProperty { - GDCLASS(EditorPropertyArray, EditorProperty) + GDCLASS(EditorPropertyArray, EditorProperty); PopupMenu *change_type; bool updating; @@ -117,7 +117,7 @@ public: }; class EditorPropertyDictionary : public EditorProperty { - GDCLASS(EditorPropertyDictionary, EditorProperty) + GDCLASS(EditorPropertyDictionary, EditorProperty); PopupMenu *change_type; bool updating; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 58e3cc6fc1..5e04bf4953 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -345,6 +345,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("interface/editor/unfocused_low_processor_mode_sleep_usec", 50000); // 20 FPS hints["interface/editor/unfocused_low_processor_mode_sleep_usec"] = PropertyInfo(Variant::REAL, "interface/editor/unfocused_low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "1,100000,1", PROPERTY_USAGE_DEFAULT); _initial_set("interface/editor/separate_distraction_mode", false); + _initial_set("interface/editor/hide_console_window", false); _initial_set("interface/editor/save_each_scene_on_quit", true); // Regression _initial_set("interface/editor/quit_confirmation", true); diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h index ceff878e7f..1523c20f48 100644 --- a/editor/editor_spin_slider.h +++ b/editor/editor_spin_slider.h @@ -36,7 +36,7 @@ #include "scene/gui/texture_rect.h" class EditorSpinSlider : public Range { - GDCLASS(EditorSpinSlider, Range) + GDCLASS(EditorSpinSlider, Range); String label; int updown_offset; diff --git a/editor/export_template_manager.h b/editor/export_template_manager.h index 608830c990..ad3ab507b3 100644 --- a/editor/export_template_manager.h +++ b/editor/export_template_manager.h @@ -41,7 +41,7 @@ class ExportTemplateVersion; class ExportTemplateManager : public ConfirmationDialog { - GDCLASS(ExportTemplateManager, ConfirmationDialog) + GDCLASS(ExportTemplateManager, ConfirmationDialog); AcceptDialog *template_downloader; VBoxContainer *template_list; diff --git a/editor/find_in_files.h b/editor/find_in_files.h index 5f728a104b..178b9a2080 100644 --- a/editor/find_in_files.h +++ b/editor/find_in_files.h @@ -36,7 +36,8 @@ // Performs the actual search class FindInFiles : public Node { - GDCLASS(FindInFiles, Node) + GDCLASS(FindInFiles, Node); + public: static const char *SIGNAL_RESULT_FOUND; static const char *SIGNAL_FINISHED; @@ -93,7 +94,8 @@ class HBoxContainer; // Prompts search parameters class FindInFilesDialog : public AcceptDialog { - GDCLASS(FindInFilesDialog, AcceptDialog) + GDCLASS(FindInFilesDialog, AcceptDialog); + public: static const char *SIGNAL_FIND_REQUESTED; static const char *SIGNAL_REPLACE_REQUESTED; @@ -138,7 +140,8 @@ class ProgressBar; // Display search results class FindInFilesPanel : public Control { - GDCLASS(FindInFilesPanel, Control) + GDCLASS(FindInFilesPanel, Control); + public: static const char *SIGNAL_RESULT_SELECTED; static const char *SIGNAL_FILES_MODIFIED; diff --git a/editor/icons/icon_GUI_toggle_off.svg b/editor/icons/icon_GUI_toggle_off.svg index aea0f85f96..928b55b201 100644 --- a/editor/icons/icon_GUI_toggle_off.svg +++ b/editor/icons/icon_GUI_toggle_off.svg @@ -1,5 +1 @@ -<svg width="42" height="26" version="1.1" viewBox="0 0 42 25.999998" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1026.4)"> -<path d="m13 1027.4c-6.6307 0-12 5.3663-12 11.998 0 6.6318 5.3693 12.002 12 12.002h16c6.6307 0 12-5.3702 12-12.002 0-6.6317-5.3693-11.998-12-11.998zm0 2.0003h16c5.5573 0 10 4.4395 10 9.9977 0 5.5583-4.4427 10.002-10 10.002h-16c-5.5573 0-10-4.4434-10-10.002 0-5.5582 4.4427-9.9977 10-9.9977zm7 4.9969a1.0001 1.0003 0 0 0 -1 1.0002v8.0013a1 1.0002 0 0 0 1 1.0002 1 1.0002 0 0 0 1 -1.0002v-3.0005h2a1 1.0002 0 0 0 1 -1.0002 1 1.0002 0 0 0 -1 -1.0001h-2v-2.0003h4a1 1.0002 0 0 0 1 -1.0002 1 1.0002 0 0 0 -1 -1.0002zm9 0a1.0001 1.0003 0 0 0 -1 1.0002v8.0013a1 1.0002 0 0 0 1 1.0002 1 1.0002 0 0 0 1 -1.0002v-3.0005h2a1 1.0002 0 0 0 1 -1.0002 1 1.0002 0 0 0 -1 -1.0001h-2v-2.0003h4a1 1.0002 0 0 0 1 -1.0002 1 1.0002 0 0 0 -1 -1.0002zm-17 0c-2.7496 0-5 2.2508-5 5.0008 0 2.7501 2.2504 5.0009 5 5.0009s5-2.2508 5-5.0009c0-2.75-2.2504-5.0008-5-5.0008zm0 2.0004c1.6687 0 3 1.3315 3 3.0004 0 1.669-1.3313 3.0005-3 3.0005s-3-1.3315-3-3.0005c0-1.6689 1.3313-3.0004 3-3.0004z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".78431" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> -</g> -</svg> +<svg height="26" viewBox="0 0 42 25.999998" width="42" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><rect fill-opacity=".188235" height="16" rx="9" stroke-width="55.8958" width="38" x="2" y="5"/><circle cx="10" cy="13" r="5" stroke-width="97.3613"/></g></svg> diff --git a/editor/icons/icon_GUI_toggle_on.svg b/editor/icons/icon_GUI_toggle_on.svg index c0a11810d4..a79a8290b1 100644 --- a/editor/icons/icon_GUI_toggle_on.svg +++ b/editor/icons/icon_GUI_toggle_on.svg @@ -1,5 +1 @@ -<svg width="42" height="26" version="1.1" viewBox="0 0 42 25.999998" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1026.4)"> -<path d="m13 1027.4c-6.6307 0-12 5.3662-12 11.998s5.3693 12.002 12 12.002h16c6.6307 0 12-5.3702 12-12.002s-5.3693-11.998-12-11.998zm17 6.9972a1 1.0002 0 0 1 1 1.0001v8.0014a1.0001 1.0003 0 0 1 -1.752 0.6623l-5.248-6.001v5.3387a1 1.0002 0 0 1 -1 1.0001 1 1.0002 0 0 1 -1 -1.0001v-8.0014a1.0001 1.0003 0 0 1 1.752 -0.6583l5.248 6.001v-5.3427a1 1.0002 0 0 1 1 -1.0001zm-15 0c2.7496 0 5 2.2507 5 5.0008s-2.2504 5.0008-5 5.0008-5-2.2507-5-5.0008 2.2504-5.0008 5-5.0008zm0 2.0003c-1.6687 0-3 1.3315-3 3.0005s1.3313 3.0005 3 3.0005 3-1.3315 3-3.0005-1.3313-3.0005-3-3.0005z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".78431" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> -</g> -</svg> +<svg height="26" viewBox="0 0 42 25.999998" width="42" xmlns="http://www.w3.org/2000/svg"><path d="m11 5c-4.986 0-9 3.568-9 8s4.014 8 9 8h20c4.986 0 9-3.568 9-8s-4.014-8-9-8zm21 3a5 5 0 0 1 5 5 5 5 0 0 1 -5 5 5 5 0 0 1 -5-5 5 5 0 0 1 5-5z" fill="#e0e0e0" stroke-width="55.8958"/></svg> 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/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h index d396dd6d5b..b3eb7ae83b 100644 --- a/editor/import/editor_import_plugin.h +++ b/editor/import/editor_import_plugin.h @@ -34,7 +34,8 @@ #include "core/io/resource_importer.h" class EditorImportPlugin : public ResourceImporter { - GDCLASS(EditorImportPlugin, Reference) + GDCLASS(EditorImportPlugin, Reference); + protected: static void _bind_methods(); diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index c97021433b..2bfc77325f 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1326,9 +1326,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { if (bct.has("index")) { Ref<Texture> t = _get_texture(state, bct["index"]); material->set_texture(SpatialMaterial::TEXTURE_METALLIC, t); - material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_BLUE); material->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, t); - material->set_roughness_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_GREEN); if (!mr.has("metallicFactor")) { material->set_metallic(1); } @@ -1353,7 +1351,6 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { Dictionary bct = d["occlusionTexture"]; if (bct.has("index")) { material->set_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION, _get_texture(state, bct["index"])); - material->set_ao_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_RED); material->set_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION, true); } } diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h index 166fa998e4..6ae7608ff2 100644 --- a/editor/import/resource_importer_bitmask.h +++ b/editor/import/resource_importer_bitmask.h @@ -37,7 +37,7 @@ class StreamBitMap; class ResourceImporterBitMap : public ResourceImporter { - GDCLASS(ResourceImporterBitMap, ResourceImporter) + GDCLASS(ResourceImporterBitMap, ResourceImporter); public: virtual String get_importer_name() const; diff --git a/editor/import/resource_importer_csv_translation.h b/editor/import/resource_importer_csv_translation.h index 6785b68d87..c2753b326f 100644 --- a/editor/import/resource_importer_csv_translation.h +++ b/editor/import/resource_importer_csv_translation.h @@ -34,7 +34,8 @@ #include "core/io/resource_importer.h" class ResourceImporterCSVTranslation : public ResourceImporter { - GDCLASS(ResourceImporterCSVTranslation, ResourceImporter) + GDCLASS(ResourceImporterCSVTranslation, ResourceImporter); + public: virtual String get_importer_name() const; virtual String get_visible_name() const; diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp index 1259e81be7..ed8ea5497a 100644 --- a/editor/import/resource_importer_image.cpp +++ b/editor/import/resource_importer_image.cpp @@ -77,9 +77,8 @@ void ResourceImporterImage::get_import_options(List<ImportOption> *r_options, in Error ResourceImporterImage::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) { FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ); - if (!f) { - ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); - } + + ERR_FAIL_COND_V(!f, ERR_CANT_OPEN); size_t len = f->get_len(); diff --git a/editor/import/resource_importer_image.h b/editor/import/resource_importer_image.h index 3d5b99db2c..beadf5a8ea 100644 --- a/editor/import/resource_importer_image.h +++ b/editor/import/resource_importer_image.h @@ -35,7 +35,8 @@ #include "core/io/resource_importer.h" class ResourceImporterImage : public ResourceImporter { - GDCLASS(ResourceImporterImage, ResourceImporter) + GDCLASS(ResourceImporterImage, ResourceImporter); + public: virtual String get_importer_name() const; virtual String get_visible_name() const; diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h index 6b393886b7..d6acbbabca 100644 --- a/editor/import/resource_importer_layered_texture.h +++ b/editor/import/resource_importer_layered_texture.h @@ -37,7 +37,7 @@ class StreamTexture; class ResourceImporterLayeredTexture : public ResourceImporter { - GDCLASS(ResourceImporterLayeredTexture, ResourceImporter) + GDCLASS(ResourceImporterLayeredTexture, ResourceImporter); bool is_3d; static const char *compression_formats[]; diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index e950421476..868f67fd77 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -215,7 +215,6 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p bool generate_tangents = p_generate_tangents; Vector3 scale_mesh = p_scale_mesh; - bool flip_faces = false; int mesh_flags = p_optimize ? Mesh::ARRAY_COMPRESS_DEFAULT : 0; Vector<Vector3> vertices; @@ -293,7 +292,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p int idx = j; - if (!flip_faces && idx < 2) { + if (idx < 2) { idx = 1 ^ idx; } diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h index b2a53f582c..b96bc1b656 100644 --- a/editor/import/resource_importer_obj.h +++ b/editor/import/resource_importer_obj.h @@ -47,7 +47,8 @@ public: }; class ResourceImporterOBJ : public ResourceImporter { - GDCLASS(ResourceImporterOBJ, ResourceImporter) + GDCLASS(ResourceImporterOBJ, ResourceImporter); + public: virtual String get_importer_name() const; virtual String get_visible_name() const; diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h index b10c4da2e5..e89f862c1b 100644 --- a/editor/import/resource_importer_scene.h +++ b/editor/import/resource_importer_scene.h @@ -90,7 +90,7 @@ public: }; class ResourceImporterScene : public ResourceImporter { - GDCLASS(ResourceImporterScene, ResourceImporter) + GDCLASS(ResourceImporterScene, ResourceImporter); Set<Ref<EditorSceneImporter> > importers; diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h index ef74e4e41e..da712bf84d 100644 --- a/editor/import/resource_importer_texture.h +++ b/editor/import/resource_importer_texture.h @@ -37,7 +37,7 @@ class StreamTexture; class ResourceImporterTexture : public ResourceImporter { - GDCLASS(ResourceImporterTexture, ResourceImporter) + GDCLASS(ResourceImporterTexture, ResourceImporter); protected: enum { diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h index 042deacfe3..3c6fc343c4 100644 --- a/editor/import/resource_importer_texture_atlas.h +++ b/editor/import/resource_importer_texture_atlas.h @@ -34,7 +34,7 @@ #include "core/image.h" #include "core/io/resource_importer.h" class ResourceImporterTextureAtlas : public ResourceImporter { - GDCLASS(ResourceImporterTextureAtlas, ResourceImporter) + GDCLASS(ResourceImporterTextureAtlas, ResourceImporter); struct PackData { Rect2 region; diff --git a/editor/import/resource_importer_wav.h b/editor/import/resource_importer_wav.h index f993f9e7bc..24481ea46b 100644 --- a/editor/import/resource_importer_wav.h +++ b/editor/import/resource_importer_wav.h @@ -34,7 +34,8 @@ #include "core/io/resource_importer.h" class ResourceImporterWAV : public ResourceImporter { - GDCLASS(ResourceImporterWAV, ResourceImporter) + GDCLASS(ResourceImporterWAV, ResourceImporter); + public: virtual String get_importer_name() const; virtual String get_visible_name() const; diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index b307ec649a..6918fe7977 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -32,7 +32,8 @@ #include "editor_node.h" class ImportDockParameters : public Object { - GDCLASS(ImportDockParameters, Object) + GDCLASS(ImportDockParameters, Object); + public: Map<StringName, Variant> values; List<PropertyInfo> properties; diff --git a/editor/import_dock.h b/editor/import_dock.h index 77a34e80eb..c839e19d67 100644 --- a/editor/import_dock.h +++ b/editor/import_dock.h @@ -43,7 +43,7 @@ class ImportDockParameters; class ImportDock : public VBoxContainer { - GDCLASS(ImportDock, VBoxContainer) + GDCLASS(ImportDock, VBoxContainer); Label *imported; OptionButton *import_as; diff --git a/editor/pane_drag.h b/editor/pane_drag.h index c9631bb870..36c5953d84 100644 --- a/editor/pane_drag.h +++ b/editor/pane_drag.h @@ -35,7 +35,7 @@ class PaneDrag : public Control { - GDCLASS(PaneDrag, Control) + GDCLASS(PaneDrag, Control); bool mouse_over; diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h index ae4db184e4..4a924b46c1 100644 --- a/editor/plugins/animation_blend_space_1d_editor.h +++ b/editor/plugins/animation_blend_space_1d_editor.h @@ -43,7 +43,7 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin { - GDCLASS(AnimationNodeBlendSpace1DEditor, AnimationTreeNodeEditorPlugin) + GDCLASS(AnimationNodeBlendSpace1DEditor, AnimationTreeNodeEditorPlugin); Ref<AnimationNodeBlendSpace1D> blend_space; diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 5204565c06..a8866a1a87 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -58,6 +58,7 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) { } void AnimationPlayerEditor::_notification(int p_what) { + switch (p_what) { case NOTIFICATION_PROCESS: { @@ -84,17 +85,13 @@ void AnimationPlayerEditor::_notification(int p_what) { EditorNode::get_singleton()->get_inspector()->refresh(); } else if (last_active) { - //need the last frame after it stopped - + // Need the last frame after it stopped. frame->set_value(player->get_current_animation_position()); } last_active = player->is_playing(); - //seek->set_val(player->get_position()); updating = false; - } break; - case NOTIFICATION_ENTER_TREE: { tool_anim->get_popup()->connect("id_pressed", this, "_animation_tool_menu"); @@ -107,12 +104,10 @@ void AnimationPlayerEditor::_notification(int p_what) { add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); } break; - case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel")); } break; - case NOTIFICATION_THEME_CHANGED: { autoplay->set_icon(get_icon("AutoPlay", "EditorIcons")); @@ -144,9 +139,6 @@ void AnimationPlayerEditor::_notification(int p_what) { ITEM_ICON(TOOL_EDIT_TRANSITIONS, "Blend"); ITEM_ICON(TOOL_EDIT_RESOURCE, "Edit"); ITEM_ICON(TOOL_REMOVE_ANIM, "Remove"); - //ITEM_ICON(TOOL_COPY_ANIM, "Copy"); - //ITEM_ICON(TOOL_PASTE_ANIM, "Paste"); - } break; } } @@ -197,8 +189,6 @@ void AnimationPlayerEditor::_play_pressed() { //unstop stop->set_pressed(false); - //unpause - //pause->set_pressed(false); } void AnimationPlayerEditor::_play_from_pressed() { @@ -224,8 +214,6 @@ void AnimationPlayerEditor::_play_from_pressed() { //unstop stop->set_pressed(false); - //unpause - //pause->set_pressed(false); } void AnimationPlayerEditor::_play_bw_pressed() { @@ -245,8 +233,6 @@ void AnimationPlayerEditor::_play_bw_pressed() { //unstop stop->set_pressed(false); - //unpause - //pause->set_pressed(false); } void AnimationPlayerEditor::_play_bw_from_pressed() { @@ -269,8 +255,6 @@ void AnimationPlayerEditor::_play_bw_from_pressed() { //unstop stop->set_pressed(false); - //unpause - //pause->set_pressed(false); } void AnimationPlayerEditor::_stop_pressed() { @@ -281,14 +265,8 @@ void AnimationPlayerEditor::_stop_pressed() { player->stop(false); play->set_pressed(false); stop->set_pressed(true); - //pause->set_pressed(false); - //player->set_pause(false); } -void AnimationPlayerEditor::_pause_pressed() { - - //player->set_pause( pause->is_pressed() ); -} void AnimationPlayerEditor::_animation_selected(int p_which) { if (updating) @@ -469,13 +447,17 @@ void AnimationPlayerEditor::_animation_remove_confirmed() { if (player->get_autoplay() == current) { undo_redo->add_do_method(player, "set_autoplay", ""); undo_redo->add_undo_method(player, "set_autoplay", current); - // Avoid having the autoplay icon linger around if there is only one animation in the player + // Avoid having the autoplay icon linger around if there is only one animation in the player. undo_redo->add_do_method(this, "_animation_player_changed", player); } undo_redo->add_do_method(player, "remove_animation", current); undo_redo->add_undo_method(player, "add_animation", current, anim); undo_redo->add_do_method(this, "_animation_player_changed", player); undo_redo->add_undo_method(this, "_animation_player_changed", player); + if (animation->get_item_count() == 1) { + undo_redo->add_do_method(this, "_stop_onion_skinning"); + undo_redo->add_undo_method(this, "_start_onion_skinning"); + } undo_redo->commit_action(); } @@ -545,6 +527,10 @@ void AnimationPlayerEditor::_animation_name_edited() { undo_redo->add_undo_method(player, "remove_animation", new_name); undo_redo->add_do_method(this, "_animation_player_changed", player); undo_redo->add_undo_method(this, "_animation_player_changed", player); + if (animation->get_item_count() == 0) { + undo_redo->add_do_method(this, "_start_onion_skinning"); + undo_redo->add_undo_method(this, "_stop_onion_skinning"); + } undo_redo->commit_action(); _select_anim_by_name(new_name); @@ -844,7 +830,8 @@ void AnimationPlayerEditor::_update_player() { animation->set_disabled(animlist.size() == 0); autoplay->set_disabled(animlist.size() == 0); tool_anim->set_disabled(player == NULL); - onion_skinning->set_disabled(player == NULL); + onion_toggle->set_disabled(animlist.size() == 0); + onion_skinning->set_disabled(animlist.size() == 0); pin->set_disabled(player == NULL); if (!player) { @@ -895,17 +882,25 @@ void AnimationPlayerEditor::_update_player() { void AnimationPlayerEditor::edit(AnimationPlayer *p_player) { - if (onion.enabled) - _start_onion_skinning(); - if (player && pin->is_pressed()) - return; //ignore, pinned + return; // Ignore, pinned. player = p_player; if (player) { _update_player(); + + if (onion.enabled) { + if (animation->get_item_count() > 0) + _start_onion_skinning(); + else + _stop_onion_skinning(); + } + track_editor->show_select_node_warning(false); } else { + if (onion.enabled) + _stop_onion_skinning(); + track_editor->show_select_node_warning(true); } } @@ -915,13 +910,13 @@ void AnimationPlayerEditor::forward_canvas_force_draw_over_viewport(Control *p_o if (!onion.can_overlay) return; - // Can happen on viewport resize, at least + // Can happen on viewport resize, at least. if (!_are_onion_layers_valid()) return; RID ci = p_overlay->get_canvas_item(); Rect2 src_rect = p_overlay->get_global_rect(); - // Re-flip since captures are already flipped + // Re-flip since captures are already flipped. src_rect.position.y = onion.capture_size.y - (src_rect.position.y + src_rect.size.y); src_rect.size.y *= -1; @@ -955,7 +950,7 @@ void AnimationPlayerEditor::forward_canvas_force_draw_over_viewport(Control *p_o } cidx++; - } while (cidx < base_cidx + onion.steps); // In case there's the present capture at the end, skip it + } while (cidx < base_cidx + onion.steps); // In case there's the present capture at the end, skip it. } } @@ -1053,7 +1048,7 @@ void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) { _update_player(); if (blend_editor.dialog->is_visible_in_tree()) - _animation_blend(); //update + _animation_blend(); // Update. } } @@ -1092,8 +1087,6 @@ void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_drag) _seek_value_changed(p_pos, !p_drag); EditorNode::get_singleton()->get_inspector()->refresh(); - - //seekit } void AnimationPlayerEditor::_hide_anim_editors() { @@ -1113,8 +1106,9 @@ void AnimationPlayerEditor::_animation_about_to_show_menu() { void AnimationPlayerEditor::_animation_tool_menu(int p_option) { String current; - if (animation->get_selected() >= 0 && animation->get_selected() < animation->get_item_count()) + if (animation->get_selected() >= 0 && animation->get_selected() < animation->get_item_count()) { current = animation->get_item_text(animation->get_selected()); + } Ref<Animation> anim; if (current != String()) { @@ -1124,33 +1118,39 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) { switch (p_option) { case TOOL_NEW_ANIM: { + _animation_new(); } break; - case TOOL_LOAD_ANIM: { + _animation_load(); - break; } break; case TOOL_SAVE_ANIM: { + if (anim.is_valid()) { _animation_save(anim); } } break; case TOOL_SAVE_AS_ANIM: { + if (anim.is_valid()) { _animation_save_as(anim); } } break; case TOOL_DUPLICATE_ANIM: { + _animation_duplicate(); } break; case TOOL_RENAME_ANIM: { + _animation_rename(); } break; case TOOL_EDIT_TRANSITIONS: { + _animation_blend(); } break; case TOOL_REMOVE_ANIM: { + _animation_remove(); } break; case TOOL_COPY_ANIM: { @@ -1163,9 +1163,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) { String current2 = animation->get_item_text(animation->get_selected()); Ref<Animation> anim2 = player->get_animation(current2); - //editor->edit_resource(anim2); EditorSettings::get_singleton()->set_resource_clipboard(anim2); - } break; case TOOL_PASTE_ANIM: { @@ -1197,7 +1195,6 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) { undo_redo->commit_action(); _select_anim_by_name(name); - } break; case TOOL_EDIT_RESOURCE: { @@ -1210,7 +1207,6 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) { String current2 = animation->get_item_text(animation->get_selected()); Ref<Animation> anim2 = player->get_animation(current2); editor->edit_resource(anim2); - } break; } } @@ -1232,22 +1228,19 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) { _stop_onion_skinning(); } break; - case ONION_SKINNING_PAST: { - // Ensure at least one of past/future is checjed + // Ensure at least one of past/future is checked. onion.past = onion.future ? !onion.past : true; menu->set_item_checked(idx, onion.past); } break; - case ONION_SKINNING_FUTURE: { - // Ensure at least one of past/future is checjed + // Ensure at least one of past/future is checked. onion.future = onion.past ? !onion.future : true; menu->set_item_checked(idx, onion.future); } break; - - case ONION_SKINNING_1_STEP: // Fall-through + case ONION_SKINNING_1_STEP: // Fall-through. case ONION_SKINNING_2_STEPS: case ONION_SKINNING_3_STEPS: { @@ -1257,19 +1250,16 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) { menu->set_item_checked(one_frame_idx + i, onion.steps == i + 1); } } break; - case ONION_SKINNING_DIFFERENCES_ONLY: { onion.differences_only = !onion.differences_only; menu->set_item_checked(idx, onion.differences_only); } break; - case ONION_SKINNING_FORCE_WHITE_MODULATE: { onion.force_white_modulate = !onion.force_white_modulate; menu->set_item_checked(idx, onion.force_white_modulate); } break; - case ONION_SKINNING_INCLUDE_GIZMOS: { onion.include_gizmos = !onion.include_gizmos; @@ -1306,7 +1296,7 @@ void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { void AnimationPlayerEditor::_editor_visibility_changed() { - if (is_visible()) { + if (is_visible() && animation->get_item_count() > 0) { _start_onion_skinning(); } } @@ -1332,7 +1322,7 @@ void AnimationPlayerEditor::_allocate_onion_layers() { for (int i = 0; i < captures; i++) { bool is_present = onion.differences_only && i == captures - 1; - // Each capture is a viewport with a canvas item attached that renders a full-size rect with the contents of the main viewport + // Each capture is a viewport with a canvas item attached that renders a full-size rect with the contents of the main viewport. onion.captures.write[i] = VS::get_singleton()->viewport_create(); VS::get_singleton()->viewport_set_usage(onion.captures[i], VS::VIEWPORT_USAGE_2D); VS::get_singleton()->viewport_set_size(onion.captures[i], capture_size.width, capture_size.height); @@ -1342,7 +1332,7 @@ void AnimationPlayerEditor::_allocate_onion_layers() { VS::get_singleton()->viewport_attach_canvas(onion.captures[i], onion.capture.canvas); } - // Reset the capture canvas item to the current root viewport texture (defensive) + // Reset the capture canvas item to the current root viewport texture (defensive). VS::get_singleton()->canvas_item_clear(onion.capture.canvas_item); VS::get_singleton()->canvas_item_add_texture_rect(onion.capture.canvas_item, Rect2(Point2(), capture_size), get_tree()->get_root()->get_texture()->get_rid()); @@ -1362,7 +1352,7 @@ void AnimationPlayerEditor::_free_onion_layers() { void AnimationPlayerEditor::_prepare_onion_layers_1() { - // This would be called per viewport and we want to act once only + // This would be called per viewport and we want to act once only. int64_t frame = get_tree()->get_frame(); if (frame == onion.last_frame) return; @@ -1374,14 +1364,14 @@ void AnimationPlayerEditor::_prepare_onion_layers_1() { onion.last_frame = frame; - // Refresh viewports with no onion layers overlaid + // Refresh viewports with no onion layers overlaid. onion.can_overlay = false; plugin->update_overlays(); if (player->is_playing()) return; - // And go to next step afterwards + // And go to next step afterwards. call_deferred("_prepare_onion_layers_2"); } @@ -1394,7 +1384,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { if (!_are_onion_layers_valid()) _allocate_onion_layers(); - // Hide superfluous elements that would make the overlay unnecessary cluttered + // Hide superfluous elements that would make the overlay unnecessary cluttered. Dictionary canvas_edit_state; Dictionary spatial_edit_state; if (SpatialEditor::get_singleton()->is_visible()) { @@ -1415,7 +1405,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { vp[i] = d; } new_state["viewports"] = vp; - // TODO: Save/restore only affected entries + // TODO: Save/restore only affected entries. SpatialEditor::get_singleton()->set_state(new_state); } else { // CanvasItemEditor // 2D @@ -1426,11 +1416,11 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { new_state["show_guides"] = false; new_state["show_helpers"] = false; new_state["show_zoom_control"] = false; - // TODO: Save/restore only affected entries + // TODO: Save/restore only affected entries. CanvasItemEditor::get_singleton()->set_state(new_state); } - // Tweak the root viewport to ensure it's rendered before our target + // Tweak the root viewport to ensure it's rendered before our target. RID root_vp = get_tree()->get_root()->get_viewport_rid(); Rect2 root_vp_screen_rect = get_tree()->get_root()->get_attach_to_screen_rect(); VS::get_singleton()->viewport_attach_to_screen(root_vp, Rect2()); @@ -1438,7 +1428,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { RID present_rid; if (onion.differences_only) { - // Capture present scene as it is + // Capture present scene as it is. VS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, RID()); present_rid = onion.captures[onion.captures.size() - 1]; VS::get_singleton()->viewport_set_active(present_rid, true); @@ -1447,11 +1437,11 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { VS::get_singleton()->viewport_set_active(present_rid, false); } - // Backup current animation state + // Backup current animation state. AnimatedValuesBackup values_backup = player->backup_animated_values(); float cpos = player->get_current_animation_position(); - // Render every past/future step with the capture shader + // Render every past/future step with the capture shader. VS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, onion.capture.material->get_rid()); onion.capture.material->set_shader_param("bkg_color", GLOBAL_GET("rendering/environment/default_clear_color")); @@ -1465,7 +1455,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { for (int step_off = step_off_a; step_off <= step_off_b; step_off++) { if (step_off == 0) { - // Skip present step and switch to the color of future + // Skip present step and switch to the color of future. if (!onion.force_white_modulate) onion.capture.material->set_shader_param("dir_color", EDITOR_GET("editors/animation/onion_layers_future_color")); continue; @@ -1477,8 +1467,8 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { onion.captures_valid.write[cidx] = valid; if (valid) { player->seek(pos, true); - get_tree()->flush_transform_notifications(); // Needed for transforms of Spatials - values_backup.update_skeletons(); // Needed for Skeletons (2D & 3D) + get_tree()->flush_transform_notifications(); // Needed for transforms of Spatials. + values_backup.update_skeletons(); // Needed for Skeletons (2D & 3D). VS::get_singleton()->viewport_set_active(onion.captures[cidx], true); VS::get_singleton()->viewport_set_parent_viewport(root_vp, onion.captures[cidx]); @@ -1489,18 +1479,18 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { cidx++; } - // Restore root viewport + // Restore root viewport. VS::get_singleton()->viewport_set_parent_viewport(root_vp, RID()); VS::get_singleton()->viewport_attach_to_screen(root_vp, root_vp_screen_rect); VS::get_singleton()->viewport_set_update_mode(root_vp, VS::VIEWPORT_UPDATE_WHEN_VISIBLE); // Restore animation state // (Seeking with update=true wouldn't do the trick because the current value of the properties - // may not match their value for the current point in the animation) + // may not match their value for the current point in the animation). player->seek(cpos, false); player->restore_animated_values(values_backup); - // Restor state of main editors + // Restor state of main editors. if (SpatialEditor::get_singleton()->is_visible()) { // 3D SpatialEditor::get_singleton()->set_state(spatial_edit_state); @@ -1509,14 +1499,14 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() { CanvasItemEditor::get_singleton()->set_state(canvas_edit_state); } - // Update viewports with skin layers overlaid for the actual engine loop render + // Update viewports with skin layers overlaid for the actual engine loop render. onion.can_overlay = true; plugin->update_overlays(); } void AnimationPlayerEditor::_start_onion_skinning() { - // FIXME: Using "idle_frame" makes onion layers update one frame behind the current + // FIXME: Using "idle_frame" makes onion layers update one frame behind the current. if (!get_tree()->is_connected("idle_frame", this, "call_deferred")) { get_tree()->connect("idle_frame", this, "call_deferred", varray("_prepare_onion_layers_1")); } @@ -1537,6 +1527,7 @@ void AnimationPlayerEditor::_stop_onion_skinning() { } void AnimationPlayerEditor::_pin_pressed() { + EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree(); } @@ -1549,7 +1540,6 @@ void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_play_bw_from_pressed"), &AnimationPlayerEditor::_play_bw_from_pressed); ClassDB::bind_method(D_METHOD("_stop_pressed"), &AnimationPlayerEditor::_stop_pressed); ClassDB::bind_method(D_METHOD("_autoplay_pressed"), &AnimationPlayerEditor::_autoplay_pressed); - ClassDB::bind_method(D_METHOD("_pause_pressed"), &AnimationPlayerEditor::_pause_pressed); ClassDB::bind_method(D_METHOD("_animation_selected"), &AnimationPlayerEditor::_animation_selected); ClassDB::bind_method(D_METHOD("_animation_name_edited"), &AnimationPlayerEditor::_animation_name_edited); ClassDB::bind_method(D_METHOD("_animation_new"), &AnimationPlayerEditor::_animation_new); @@ -1564,10 +1554,7 @@ void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_seek_value_changed"), &AnimationPlayerEditor::_seek_value_changed, DEFVAL(true)); ClassDB::bind_method(D_METHOD("_animation_player_changed"), &AnimationPlayerEditor::_animation_player_changed); ClassDB::bind_method(D_METHOD("_blend_edited"), &AnimationPlayerEditor::_blend_edited); - //ClassDB::bind_method(D_METHOD("_seek_frame_changed"),&AnimationPlayerEditor::_seek_frame_changed); ClassDB::bind_method(D_METHOD("_scale_changed"), &AnimationPlayerEditor::_scale_changed); - //ClassDB::bind_method(D_METHOD("_editor_store_all"),&AnimationPlayerEditor::_editor_store_all); - //ClassDB::bind_method(D_METHOD("_editor_load_all"),&AnimationPlayerEditor::_editor_load_all); ClassDB::bind_method(D_METHOD("_list_changed"), &AnimationPlayerEditor::_list_changed); ClassDB::bind_method(D_METHOD("_animation_key_editor_seek"), &AnimationPlayerEditor::_animation_key_editor_seek); ClassDB::bind_method(D_METHOD("_animation_key_editor_anim_len_changed"), &AnimationPlayerEditor::_animation_key_editor_anim_len_changed); @@ -1582,6 +1569,8 @@ void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_editor_visibility_changed"), &AnimationPlayerEditor::_editor_visibility_changed); ClassDB::bind_method(D_METHOD("_prepare_onion_layers_1"), &AnimationPlayerEditor::_prepare_onion_layers_1); ClassDB::bind_method(D_METHOD("_prepare_onion_layers_2"), &AnimationPlayerEditor::_prepare_onion_layers_2); + ClassDB::bind_method(D_METHOD("_start_onion_skinning"), &AnimationPlayerEditor::_start_onion_skinning); + ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning); ClassDB::bind_method(D_METHOD("_pin_pressed"), &AnimationPlayerEditor::_pin_pressed); } diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index dedce16bbc..398ef6ff14 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -170,7 +170,6 @@ class AnimationPlayerEditor : public VBoxContainer { void _play_bw_from_pressed(); void _autoplay_pressed(); void _stop_pressed(); - void _pause_pressed(); void _animation_selected(int p_which); void _animation_new(); void _animation_rename(); diff --git a/editor/plugins/animation_tree_editor_plugin.h b/editor/plugins/animation_tree_editor_plugin.h index 4a7f933bbf..4ecbf2e05e 100644 --- a/editor/plugins/animation_tree_editor_plugin.h +++ b/editor/plugins/animation_tree_editor_plugin.h @@ -41,7 +41,8 @@ #include "scene/gui/tree.h" class AnimationTreeNodeEditorPlugin : public VBoxContainer { - GDCLASS(AnimationTreeNodeEditorPlugin, VBoxContainer) + GDCLASS(AnimationTreeNodeEditorPlugin, VBoxContainer); + public: virtual bool can_edit(const Ref<AnimationNode> &p_node) = 0; virtual void edit(const Ref<AnimationNode> &p_node) = 0; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index fbf01a9405..3c24fd19b6 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -731,6 +731,8 @@ Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2 ERR_FAIL_COND_V(!p_control, Vector2()); Rect2 parent_rect = p_control->get_parent_anchorable_rect(); + ERR_FAIL_COND_V(parent_rect.size.x == 0, Vector2()); + ERR_FAIL_COND_V(parent_rect.size.y == 0, Vector2()); return (p_control->get_transform().xform(position) - parent_rect.position) / parent_rect.size; } @@ -3348,9 +3350,6 @@ void CanvasItemEditor::_notification(int p_what) { presets_menu->set_visible(true); anchor_mode_button->set_visible(true); - // Set the pressed state of the node - anchor_mode_button->set_pressed(anchors_mode); - // Disable if the selected node is child of a container if (has_container_parents) { presets_menu->set_disabled(true); @@ -3521,6 +3520,7 @@ void CanvasItemEditor::_selection_changed() { } } anchors_mode = (nbValidControls == nbAnchorsMode); + anchor_mode_button->set_pressed(anchors_mode); } void CanvasItemEditor::edit(CanvasItem *p_canvas_item) { @@ -3742,6 +3742,7 @@ void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_p undo_redo->commit_action(); anchors_mode = false; + anchor_mode_button->set_pressed(anchors_mode); } void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() { @@ -3766,6 +3767,7 @@ void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() { undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", use_anchors); anchors_mode = true; + anchor_mode_button->set_pressed(anchors_mode); } } @@ -3912,7 +3914,6 @@ void CanvasItemEditor::_button_toggle_anchor_mode(bool p_status) { } anchors_mode = p_status; - viewport->update(); } 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/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h index b034368b6a..be774a9696 100644 --- a/editor/plugins/curve_editor_plugin.h +++ b/editor/plugins/curve_editor_plugin.h @@ -37,7 +37,8 @@ // Edits a y(x) curve class CurveEditor : public Control { - GDCLASS(CurveEditor, Control) + GDCLASS(CurveEditor, Control); + public: CurveEditor(); @@ -120,14 +121,16 @@ private: }; class EditorInspectorPluginCurve : public EditorInspectorPlugin { - GDCLASS(EditorInspectorPluginCurve, EditorInspectorPlugin) + GDCLASS(EditorInspectorPluginCurve, EditorInspectorPlugin); + public: virtual bool can_handle(Object *p_object); virtual void parse_begin(Object *p_object); }; class CurveEditorPlugin : public EditorPlugin { - GDCLASS(CurveEditorPlugin, EditorPlugin) + GDCLASS(CurveEditorPlugin, EditorPlugin); + public: CurveEditorPlugin(EditorNode *p_node); @@ -135,7 +138,8 @@ public: }; class CurvePreviewGenerator : public EditorResourcePreviewGenerator { - GDCLASS(CurvePreviewGenerator, EditorResourcePreviewGenerator) + GDCLASS(CurvePreviewGenerator, EditorResourcePreviewGenerator); + public: virtual bool handles(const String &p_type) const; virtual Ref<Texture> generate(const Ref<Resource> &p_from, const Size2 p_size) const; diff --git a/editor/plugins/editor_preview_plugins.h b/editor/plugins/editor_preview_plugins.h index 16b1f3082b..12d693b10a 100644 --- a/editor/plugins/editor_preview_plugins.h +++ b/editor/plugins/editor_preview_plugins.h @@ -36,7 +36,8 @@ void post_process_preview(Ref<Image> p_image); class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator { - GDCLASS(EditorTexturePreviewPlugin, EditorResourcePreviewGenerator) + GDCLASS(EditorTexturePreviewPlugin, EditorResourcePreviewGenerator); + public: virtual bool handles(const String &p_type) const; virtual bool generate_small_preview_automatically() const; @@ -46,7 +47,8 @@ public: }; class EditorImagePreviewPlugin : public EditorResourcePreviewGenerator { - GDCLASS(EditorImagePreviewPlugin, EditorResourcePreviewGenerator) + GDCLASS(EditorImagePreviewPlugin, EditorResourcePreviewGenerator); + public: virtual bool handles(const String &p_type) const; virtual bool generate_small_preview_automatically() const; @@ -56,7 +58,8 @@ public: }; class EditorBitmapPreviewPlugin : public EditorResourcePreviewGenerator { - GDCLASS(EditorBitmapPreviewPlugin, EditorResourcePreviewGenerator) + GDCLASS(EditorBitmapPreviewPlugin, EditorResourcePreviewGenerator); + public: virtual bool handles(const String &p_type) const; virtual bool generate_small_preview_automatically() const; @@ -77,7 +80,7 @@ public: class EditorMaterialPreviewPlugin : public EditorResourcePreviewGenerator { - GDCLASS(EditorMaterialPreviewPlugin, EditorResourcePreviewGenerator) + GDCLASS(EditorMaterialPreviewPlugin, EditorResourcePreviewGenerator); RID scenario; RID sphere; @@ -123,7 +126,7 @@ public: class EditorMeshPreviewPlugin : public EditorResourcePreviewGenerator { - GDCLASS(EditorMeshPreviewPlugin, EditorResourcePreviewGenerator) + GDCLASS(EditorMeshPreviewPlugin, EditorResourcePreviewGenerator); RID scenario; RID mesh_instance; @@ -151,7 +154,7 @@ public: class EditorFontPreviewPlugin : public EditorResourcePreviewGenerator { - GDCLASS(EditorFontPreviewPlugin, EditorResourcePreviewGenerator) + GDCLASS(EditorFontPreviewPlugin, EditorResourcePreviewGenerator); RID viewport; RID viewport_texture; diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h index 91790abee8..a87a5fe0ba 100644 --- a/editor/plugins/gradient_editor_plugin.h +++ b/editor/plugins/gradient_editor_plugin.h @@ -36,7 +36,7 @@ #include "scene/gui/gradient_edit.h" class GradientEditor : public GradientEdit { - GDCLASS(GradientEditor, GradientEdit) + GDCLASS(GradientEditor, GradientEdit); bool editing; Ref<Gradient> gradient; @@ -54,7 +54,8 @@ public: }; class EditorInspectorPluginGradient : public EditorInspectorPlugin { - GDCLASS(EditorInspectorPluginGradient, EditorInspectorPlugin) + GDCLASS(EditorInspectorPluginGradient, EditorInspectorPlugin); + public: virtual bool can_handle(Object *p_object); virtual void parse_begin(Object *p_object); diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index c3f14c27e5..1405127ab3 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -78,7 +78,7 @@ public: }; class EditorInspectorPluginMaterial : public EditorInspectorPlugin { - GDCLASS(EditorInspectorPluginMaterial, EditorInspectorPlugin) + GDCLASS(EditorInspectorPluginMaterial, EditorInspectorPlugin); Ref<Environment> env; public: @@ -99,7 +99,8 @@ public: }; class SpatialMaterialConversionPlugin : public EditorResourceConversionPlugin { - GDCLASS(SpatialMaterialConversionPlugin, EditorResourceConversionPlugin) + GDCLASS(SpatialMaterialConversionPlugin, EditorResourceConversionPlugin); + public: virtual String converts_to() const; virtual bool handles(const Ref<Resource> &p_resource) const; @@ -107,7 +108,8 @@ public: }; class ParticlesMaterialConversionPlugin : public EditorResourceConversionPlugin { - GDCLASS(ParticlesMaterialConversionPlugin, EditorResourceConversionPlugin) + GDCLASS(ParticlesMaterialConversionPlugin, EditorResourceConversionPlugin); + public: virtual String converts_to() const; virtual bool handles(const Ref<Resource> &p_resource) const; @@ -115,7 +117,8 @@ public: }; class CanvasItemMaterialConversionPlugin : public EditorResourceConversionPlugin { - GDCLASS(CanvasItemMaterialConversionPlugin, EditorResourceConversionPlugin) + GDCLASS(CanvasItemMaterialConversionPlugin, EditorResourceConversionPlugin); + public: virtual String converts_to() const; virtual bool handles(const Ref<Resource> &p_resource) const; diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h index 8ada2dac90..4c2a81ed70 100644 --- a/editor/plugins/mesh_editor_plugin.h +++ b/editor/plugins/mesh_editor_plugin.h @@ -73,7 +73,8 @@ public: }; class EditorInspectorPluginMesh : public EditorInspectorPlugin { - GDCLASS(EditorInspectorPluginMesh, EditorInspectorPlugin) + GDCLASS(EditorInspectorPluginMesh, EditorInspectorPlugin); + public: virtual bool can_handle(Object *p_object); virtual void parse_begin(Object *p_object); 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 b1b3e3c1c0..5d05fbd4ac 100644 --- a/editor/plugins/particles_editor_plugin.h +++ b/editor/plugins/particles_editor_plugin.h @@ -42,7 +42,7 @@ class ParticlesEditorBase : public Control { - GDCLASS(ParticlesEditorBase, Control) + GDCLASS(ParticlesEditorBase, Control); protected: Spatial *base_node; @@ -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/root_motion_editor_plugin.h b/editor/plugins/root_motion_editor_plugin.h index e7fd597235..af5d8fc122 100644 --- a/editor/plugins/root_motion_editor_plugin.h +++ b/editor/plugins/root_motion_editor_plugin.h @@ -37,7 +37,7 @@ #include "scene/animation/animation_tree.h" class EditorPropertyRootMotion : public EditorProperty { - GDCLASS(EditorPropertyRootMotion, EditorProperty) + GDCLASS(EditorPropertyRootMotion, EditorProperty); Button *assign; Button *clear; NodePath base_hint; @@ -60,7 +60,7 @@ public: }; class EditorInspectorRootMotionPlugin : public EditorInspectorPlugin { - GDCLASS(EditorInspectorRootMotionPlugin, EditorInspectorPlugin) + GDCLASS(EditorInspectorRootMotionPlugin, EditorInspectorPlugin); public: virtual bool can_handle(Object *p_object); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index df9ce73914..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); + } } } } @@ -1249,7 +1252,7 @@ void ScriptEditor::_menu_option(int p_option) { if (p_option >= WINDOW_SELECT_BASE) { tab_container->set_current_tab(p_option - WINDOW_SELECT_BASE); - script_list->select(p_option - WINDOW_SELECT_BASE); + _update_script_names(); } } } @@ -1376,6 +1379,8 @@ void ScriptEditor::_notification(int p_what) { script_forward->set_icon(get_icon("Forward", "EditorIcons")); script_back->set_icon(get_icon("Back", "EditorIcons")); members_overview_alphabeta_sort_button->set_icon(get_icon("Sort", "EditorIcons")); + filter_scripts->set_right_icon(get_icon("Search", "EditorIcons")); + filter_methods->set_right_icon(get_icon("Search", "EditorIcons")); } break; case NOTIFICATION_READY: { @@ -1633,8 +1638,12 @@ void ScriptEditor::_update_members_overview() { } for (int i = 0; i < functions.size(); i++) { - members_overview->add_item(functions[i].get_slice(":", 0)); - members_overview->set_item_metadata(i, functions[i].get_slice(":", 1).to_int() - 1); + String filter = filter_methods->get_text(); + String name = functions[i].get_slice(":", 0); + if (filter == "" || filter.is_subsequence_ofi(name)) { + members_overview->add_item(name); + members_overview->set_item_metadata(members_overview->get_item_count() - 1, functions[i].get_slice(":", 1).to_int() - 1); + } } String path = se->get_edited_resource()->get_path(); @@ -1853,20 +1862,26 @@ void ScriptEditor::_update_script_names() { _sort_list_on_update = false; } + Vector<_ScriptEditorItemData> sedata_filtered; for (int i = 0; i < sedata.size(); i++) { + String filter = filter_scripts->get_text(); + if (filter == "" || filter.is_subsequence_ofi(sedata[i].name)) { + sedata_filtered.push_back(sedata[i]); + } + } - script_list->add_item(sedata[i].name, sedata[i].icon); + for (int i = 0; i < sedata_filtered.size(); i++) { + script_list->add_item(sedata_filtered[i].name, sedata_filtered[i].icon); int index = script_list->get_item_count() - 1; - script_list->set_item_tooltip(index, sedata[i].tooltip); - script_list->set_item_metadata(index, sedata[i].index); - if (sedata[i].used) { - + script_list->set_item_tooltip(index, sedata_filtered[i].tooltip); + script_list->set_item_metadata(index, sedata_filtered[i].index); /* Saving as metadata the script's index in the tab container and not the filtered one */ + if (sedata_filtered[i].used) { script_list->set_item_custom_bg_color(index, Color(88 / 255.0, 88 / 255.0, 60 / 255.0)); } - if (tab_container->get_current_tab() == sedata[i].index) { + if (tab_container->get_current_tab() == sedata_filtered[i].index) { script_list->select(index); - script_name_label->set_text(sedata[i].name); - script_icon->set_texture(sedata[i].icon); + script_name_label->set_text(sedata_filtered[i].name); + script_icon->set_texture(sedata_filtered[i].icon); } } @@ -1903,9 +1918,7 @@ Ref<TextFile> ScriptEditor::_load_text_file(const String &p_path, Error *r_error Ref<TextFile> text_res(text_file); Error err = text_file->load_text(path); - if (err != OK) { - ERR_FAIL_COND_V(err != OK, RES()); - } + ERR_FAIL_COND_V(err != OK, RES()); text_file->set_file_path(local_path); text_file->set_path(local_path, true); @@ -2049,7 +2062,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra if (should_open) { if (tab_container->get_current_tab() != i) { _go_to_tab(i); - script_list->select(script_list->find_metadata(i)); + _update_script_names(); } if (is_visible_in_tree()) se->ensure_focus(); @@ -2427,7 +2440,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node); if (se || eh) { - int new_index = script_list->get_item_at_position(p_point); + int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); _update_script_names(); @@ -2444,7 +2457,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node); EditorHelp *eh = Object::cast_to<EditorHelp>(node); if (se || eh) { - int new_index = script_list->get_item_at_position(p_point); + int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); _update_script_names(); @@ -2455,7 +2468,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co Vector<String> files = d["files"]; - int new_index = script_list->get_item_at_position(p_point); + int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); int num_tabs_before = tab_container->get_child_count(); for (int i = 0; i < files.size(); i++) { String file = files[i]; @@ -2467,7 +2480,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co if (tab_container->get_child_count() > num_tabs_before) { tab_container->move_child(tab_container->get_child(tab_container->get_child_count() - 1), new_index); num_tabs_before = tab_container->get_child_count(); - } else { + } else { /* Maybe script was already open */ tab_container->move_child(tab_container->get_child(tab_container->get_current_tab()), new_index); } } @@ -2962,6 +2975,14 @@ void ScriptEditor::_on_find_in_files_modified_files(PoolStringArray paths) { _update_modified_scripts_for_external_editor(); } +void ScriptEditor::_filter_scripts_text_changed(const String &p_newtext) { + _update_script_names(); +} + +void ScriptEditor::_filter_methods_text_changed(const String &p_newtext) { + _update_members_overview(); +} + void ScriptEditor::_bind_methods() { ClassDB::bind_method("_file_dialog_action", &ScriptEditor::_file_dialog_action); @@ -3013,6 +3034,8 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_toggle_members_overview_alpha_sort", &ScriptEditor::_toggle_members_overview_alpha_sort); ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview); ClassDB::bind_method("_script_changed", &ScriptEditor::_script_changed); + ClassDB::bind_method("_filter_scripts_text_changed", &ScriptEditor::_filter_scripts_text_changed); + ClassDB::bind_method("_filter_methods_text_changed", &ScriptEditor::_filter_methods_text_changed); ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts); ClassDB::bind_method("_on_find_in_files_requested", &ScriptEditor::_on_find_in_files_requested); ClassDB::bind_method("_start_find_in_files", &ScriptEditor::_start_find_in_files); @@ -3059,8 +3082,18 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_split->add_child(list_split); list_split->set_v_size_flags(SIZE_EXPAND_FILL); + scripts_vbox = memnew(VBoxContainer); + scripts_vbox->set_v_size_flags(SIZE_EXPAND_FILL); + list_split->add_child(scripts_vbox); + + filter_scripts = memnew(LineEdit); + filter_scripts->set_placeholder(TTR("Filter scripts")); + filter_scripts->set_clear_button_enabled(true); + filter_scripts->connect("text_changed", this, "_filter_scripts_text_changed"); + scripts_vbox->add_child(filter_scripts); + script_list = memnew(ItemList); - list_split->add_child(script_list); + scripts_vbox->add_child(script_list); script_list->set_custom_minimum_size(Size2(150, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing script_list->set_v_size_flags(SIZE_EXPAND_FILL); script_split->set_split_offset(140); @@ -3096,6 +3129,12 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { buttons_hbox->add_child(members_overview_alphabeta_sort_button); + filter_methods = memnew(LineEdit); + filter_methods->set_placeholder(TTR("Filter methods")); + filter_methods->set_clear_button_enabled(true); + filter_methods->connect("text_changed", this, "_filter_methods_text_changed"); + overview_vbox->add_child(filter_methods); + members_overview = memnew(ItemList); overview_vbox->add_child(members_overview); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 549af1ca31..4ad2156779 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -38,6 +38,7 @@ #include "editor/editor_plugin.h" #include "editor/script_create_dialog.h" #include "scene/gui/item_list.h" +#include "scene/gui/line_edit.h" #include "scene/gui/menu_button.h" #include "scene/gui/split_container.h" #include "scene/gui/tab_container.h" @@ -49,7 +50,7 @@ class ScriptEditorQuickOpen : public ConfirmationDialog { - GDCLASS(ScriptEditorQuickOpen, ConfirmationDialog) + GDCLASS(ScriptEditorQuickOpen, ConfirmationDialog); LineEdit *search_box; Tree *search_options; @@ -76,7 +77,7 @@ class ScriptEditorDebugger; class ScriptEditorBase : public VBoxContainer { - GDCLASS(ScriptEditorBase, VBoxContainer) + GDCLASS(ScriptEditorBase, VBoxContainer); protected: static void _bind_methods(); @@ -213,6 +214,9 @@ class ScriptEditor : public PanelContainer { ItemList *script_list; HSplitContainer *script_split; ItemList *members_overview; + LineEdit *filter_scripts; + LineEdit *filter_methods; + VBoxContainer *scripts_vbox; VBoxContainer *overview_vbox; HBoxContainer *buttons_hbox; Label *filename; @@ -341,6 +345,8 @@ class ScriptEditor : public PanelContainer { void _update_members_overview_visibility(); void _update_members_overview(); void _toggle_members_overview_alpha_sort(bool p_alphabetic_sort); + void _filter_scripts_text_changed(const String &p_newtext); + void _filter_methods_text_changed(const String &p_newtext); void _update_script_names(); void _update_script_connections(); bool _sort_list_on_update; 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/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index a1c0b732fa..7f7ae8f273 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1275,13 +1275,13 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { _edit.mode = TRANSFORM_TRANSLATE; } - if (cursor.region_select && nav_mode == NAVIGATION_NONE) { + if (cursor.region_select) { cursor.region_end = m->get_position(); surface->update(); return; } - if (_edit.mode == TRANSFORM_NONE && nav_mode == NAVIGATION_NONE) + if (_edit.mode == TRANSFORM_NONE) return; Vector3 ray_pos = _get_ray_pos(m->get_position()); diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h index f3a1e657cc..701b9e8144 100644 --- a/editor/plugins/spatial_editor_plugin.h +++ b/editor/plugins/spatial_editor_plugin.h @@ -178,6 +178,12 @@ public: GIZMO_GRID_LAYER = 25 }; + enum NavigationScheme { + NAVIGATION_GODOT, + NAVIGATION_MAYA, + NAVIGATION_MODO, + }; + private: int index; String name; @@ -260,12 +266,6 @@ private: PopupMenu *selection_menu; - enum NavigationScheme { - NAVIGATION_GODOT, - NAVIGATION_MAYA, - NAVIGATION_MODO, - }; - enum NavigationZoomStyle { NAVIGATION_ZOOM_VERTICAL, NAVIGATION_ZOOM_HORIZONTAL @@ -431,7 +431,8 @@ public: class SpatialEditorViewportContainer : public Container { - GDCLASS(SpatialEditorViewportContainer, Container) + GDCLASS(SpatialEditorViewportContainer, Container); + public: enum View { VIEW_USE_1_VIEWPORT, diff --git a/editor/plugins/style_box_editor_plugin.h b/editor/plugins/style_box_editor_plugin.h index 95d21b2c44..d31a28b3e4 100644 --- a/editor/plugins/style_box_editor_plugin.h +++ b/editor/plugins/style_box_editor_plugin.h @@ -56,7 +56,8 @@ public: }; class EditorInspectorPluginStyleBox : public EditorInspectorPlugin { - GDCLASS(EditorInspectorPluginStyleBox, EditorInspectorPlugin) + GDCLASS(EditorInspectorPluginStyleBox, EditorInspectorPlugin); + public: virtual bool can_handle(Object *p_object); virtual void parse_begin(Object *p_object); 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/text_editor.h b/editor/plugins/text_editor.h index e91909e0ea..277e93fd39 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -35,7 +35,7 @@ class TextEditor : public ScriptEditorBase { - GDCLASS(TextEditor, ScriptEditorBase) + GDCLASS(TextEditor, ScriptEditorBase); private: CodeTextEditor *code_editor; diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h index bcbda1fbd7..ed25783303 100644 --- a/editor/plugins/texture_editor_plugin.h +++ b/editor/plugins/texture_editor_plugin.h @@ -54,7 +54,8 @@ public: }; class EditorInspectorPluginTexture : public EditorInspectorPlugin { - GDCLASS(EditorInspectorPluginTexture, EditorInspectorPlugin) + GDCLASS(EditorInspectorPluginTexture, EditorInspectorPlugin); + public: virtual bool can_handle(Object *p_object); virtual void parse_begin(Object *p_object); diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h index 1176e1bb92..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" @@ -46,7 +45,7 @@ class TileSetEditor : public HSplitContainer { friend class TileSetEditorPlugin; friend class TilesetEditorContext; - GDCLASS(TileSetEditor, HSplitContainer) + GDCLASS(TileSetEditor, HSplitContainer); enum TextureToolButtons { TOOL_TILESET_ADD_TEXTURE, diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index a1b903576e..bfb005cd0b 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -573,13 +573,11 @@ void VisualShaderEditor::_update_graph() { name_box->connect("text_entered", this, "_change_input_port_name", varray(name_box, nodes[n_i], i)); name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, false)); - if (is_group) { - Button *remove_btn = memnew(Button); - remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); - remove_btn->set_tooltip(TTR("Remove") + " " + name_left); - remove_btn->connect("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED); - hb->add_child(remove_btn); - } + Button *remove_btn = memnew(Button); + remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons")); + remove_btn->set_tooltip(TTR("Remove") + " " + name_left); + remove_btn->connect("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED); + hb->add_child(remove_btn); } else { Label *label = memnew(Label); @@ -2350,7 +2348,7 @@ VisualShaderEditorPlugin::~VisualShaderEditorPlugin() { //////////////// class VisualShaderNodePluginInputEditor : public OptionButton { - GDCLASS(VisualShaderNodePluginInputEditor, OptionButton) + GDCLASS(VisualShaderNodePluginInputEditor, OptionButton); Ref<VisualShaderNodeInput> input; @@ -2395,7 +2393,8 @@ public: }; class VisualShaderNodePluginDefaultEditor : public VBoxContainer { - GDCLASS(VisualShaderNodePluginDefaultEditor, VBoxContainer) + GDCLASS(VisualShaderNodePluginDefaultEditor, VBoxContainer); + public: void _property_changed(const String &prop, const Variant &p_value, const String &p_field, bool p_changing = false) { diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index 1b009b61d5..567706b808 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -42,7 +42,8 @@ class VisualShaderNodePlugin : public Reference { - GDCLASS(VisualShaderNodePlugin, Reference) + GDCLASS(VisualShaderNodePlugin, Reference); + protected: static void _bind_methods(); @@ -245,14 +246,14 @@ public: class VisualShaderNodePluginDefault : public VisualShaderNodePlugin { - GDCLASS(VisualShaderNodePluginDefault, VisualShaderNodePlugin) + GDCLASS(VisualShaderNodePluginDefault, VisualShaderNodePlugin); public: virtual Control *create_editor(const Ref<VisualShaderNode> &p_node); }; class EditorPropertyShaderMode : public EditorProperty { - GDCLASS(EditorPropertyShaderMode, EditorProperty) + GDCLASS(EditorPropertyShaderMode, EditorProperty); OptionButton *options; void _option_selected(int p_which); @@ -268,7 +269,7 @@ public: }; class EditorInspectorShaderModePlugin : public EditorInspectorPlugin { - GDCLASS(EditorInspectorShaderModePlugin, EditorInspectorPlugin) + GDCLASS(EditorInspectorShaderModePlugin, EditorInspectorPlugin); public: virtual bool can_handle(Object *p_object); @@ -278,7 +279,7 @@ public: }; class VisualShaderNodePortPreview : public Control { - GDCLASS(VisualShaderNodePortPreview, Control) + GDCLASS(VisualShaderNodePortPreview, Control); Ref<VisualShader> shader; VisualShader::Type type; int node; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 9a3991bef1..4b3d468a61 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -919,28 +919,37 @@ public: struct ProjectItem { String project; + String project_name; String path; String conf; - int config_version; + String icon; + String main_scene; uint64_t last_modified; bool favorite; bool grayed; - bool ordered_latest_modification; + ProjectListFilter::FilterOption filter_order_option; ProjectItem() {} - ProjectItem(const String &p_project, const String &p_path, const String &p_conf, int p_config_version, uint64_t p_last_modified, bool p_favorite = false, bool p_grayed = false, const bool p_ordered_latest_modification = true) { + ProjectItem(const String &p_project, const String &p_name, const String &p_path, const String &p_conf, const String &p_icon, const String &p_main_scene, uint64_t p_last_modified, bool p_favorite = false, bool p_grayed = false, const ProjectListFilter::FilterOption p_filter_order_option = ProjectListFilter::FILTER_NAME) { project = p_project; + project_name = p_name; path = p_path; conf = p_conf; - config_version = p_config_version; + icon = p_icon; + main_scene = p_main_scene; last_modified = p_last_modified; favorite = p_favorite; grayed = p_grayed; - ordered_latest_modification = p_ordered_latest_modification; + filter_order_option = p_filter_order_option; } _FORCE_INLINE_ bool operator<(const ProjectItem &l) const { - if (ordered_latest_modification) - return last_modified > l.last_modified; - return project < l.project; + switch (filter_order_option) { + case ProjectListFilter::FILTER_PATH: + return project < l.project; + case ProjectListFilter::FILTER_MODIFIED: + return last_modified > l.last_modified; + default: + return project_name < l.project_name; + } } _FORCE_INLINE_ bool operator==(const ProjectItem &l) const { return project == l.project; } }; @@ -1256,13 +1265,7 @@ void ProjectManager::_load_recent_projects() { Color font_color = gui_base->get_color("font_color", "Tree"); - bool set_ordered_latest_modification; ProjectListFilter::FilterOption filter_order_option = project_order_filter->get_filter_option(); - if (filter_order_option == ProjectListFilter::FILTER_NAME) { - set_ordered_latest_modification = false; - } else { - set_ordered_latest_modification = true; - } EditorSettings::get_singleton()->set("project_manager/sorting_order", (int)filter_order_option); List<ProjectItem> projects; @@ -1280,10 +1283,30 @@ void ProjectManager::_load_recent_projects() { String project = _name.get_slice("/", 1); String conf = path.plus_file("project.godot"); - int config_version = 0; // Assume 0 until we know better bool favorite = (_name.begins_with("favorite_projects/")) ? true : false; bool grayed = false; + Ref<ConfigFile> cf = memnew(ConfigFile); + Error cf_err = cf->load(conf); + + int config_version = 0; + String project_name = TTR("Unnamed Project"); + if (cf_err == OK) { + + String cf_project_name = static_cast<String>(cf->get_value("application", "config/name", "")); + if (cf_project_name != "") + project_name = cf_project_name.xml_unescape(); + config_version = (int)cf->get_value("", "config_version", 0); + } + + if (config_version > ProjectSettings::CONFIG_VERSION) { + // Comes from an incompatible (more recent) Godot version, grey it out + grayed = true; + } + + String icon = cf->get_value("application", "config/icon", ""); + String main_scene = cf->get_value("application", "run/main_scene", ""); + uint64_t last_modified = 0; if (FileAccess::exists(conf)) { last_modified = FileAccess::get_modified_time(conf); @@ -1298,7 +1321,7 @@ void ProjectManager::_load_recent_projects() { grayed = true; } - ProjectItem item(project, path, conf, config_version, last_modified, favorite, grayed, set_ordered_latest_modification); + ProjectItem item(project, project_name, path, conf, icon, main_scene, last_modified, favorite, grayed, filter_order_option); if (favorite) favorite_projects.push_back(item); else @@ -1326,43 +1349,23 @@ void ProjectManager::_load_recent_projects() { String path = item.path; String conf = item.conf; - Ref<ConfigFile> cf = memnew(ConfigFile); - Error cf_err = cf->load(conf); - - String project_name = TTR("Unnamed Project"); - if (cf_err == OK && cf->has_section_key("application", "config/name")) { - project_name = static_cast<String>(cf->get_value("application", "config/name")).xml_unescape(); - } - - if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && project_name.findn(search_term) == -1) + if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && item.project_name.findn(search_term) == -1) continue; Ref<Texture> icon; - String main_scene; - - if (cf_err == OK) { - item.config_version = (int)cf->get_value("", "config_version", 0); - if (item.config_version > ProjectSettings::CONFIG_VERSION) { - // Comes from an incompatible (more recent) Godot version, grey it out - item.grayed = true; - } - String appicon = cf->get_value("application", "config/icon", ""); - if (appicon != "") { - Ref<Image> img; - img.instance(); - Error err = img->load(appicon.replace_first("res://", path + "/")); - if (err == OK) { - - Ref<Texture> default_icon = get_icon("DefaultProjectIcon", "EditorIcons"); - img->resize(default_icon->get_width(), default_icon->get_height()); - Ref<ImageTexture> it = memnew(ImageTexture); - it->create_from_image(img); - icon = it; - } + if (item.icon != "") { + Ref<Image> img; + img.instance(); + Error err = img->load(item.icon.replace_first("res://", path + "/")); + if (err == OK) { + + Ref<Texture> default_icon = get_icon("DefaultProjectIcon", "EditorIcons"); + img->resize(default_icon->get_width(), default_icon->get_height()); + Ref<ImageTexture> it = memnew(ImageTexture); + it->create_from_image(img); + icon = it; } - - main_scene = cf->get_value("application", "run/main_scene", ""); } if (icon.is_null()) { @@ -1376,7 +1379,7 @@ void ProjectManager::_load_recent_projects() { HBoxContainer *hb = memnew(HBoxContainer); hb->set_meta("name", project); - hb->set_meta("main_scene", main_scene); + hb->set_meta("main_scene", item.main_scene); hb->set_meta("favorite", is_favorite); hb->connect("draw", this, "_panel_draw", varray(hb)); hb->connect("gui_input", this, "_panel_input", varray(hb)); @@ -1406,7 +1409,7 @@ void ProjectManager::_load_recent_projects() { ec->set_custom_minimum_size(Size2(0, 1)); ec->set_mouse_filter(MOUSE_FILTER_PASS); vb->add_child(ec); - Label *title = memnew(Label(project_name)); + Label *title = memnew(Label(item.project_name)); title->add_font_override("font", gui_base->get_font("title", "EditorFonts")); title->add_color_override("font_color", font_color); title->set_clip_text(true); @@ -2020,6 +2023,7 @@ ProjectManager::ProjectManager() { sort_filters->add_child(sort_label); Vector<String> sort_filter_titles; sort_filter_titles.push_back("Name"); + sort_filter_titles.push_back("Path"); sort_filter_titles.push_back("Last Modified"); project_order_filter = memnew(ProjectListFilter); project_order_filter->_setup_filters(sort_filter_titles); diff --git a/editor/project_manager.h b/editor/project_manager.h index a7cc6549f5..d75d7164cc 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -131,17 +131,19 @@ class ProjectListFilter : public HBoxContainer { GDCLASS(ProjectListFilter, HBoxContainer); +public: + enum FilterOption { + FILTER_NAME, + FILTER_PATH, + FILTER_MODIFIED, + }; + private: friend class ProjectManager; OptionButton *filter_option; LineEdit *search_box; bool has_search_box; - - enum FilterOption { - FILTER_NAME, - FILTER_PATH, - }; FilterOption _current_filter; void _search_text_changed(const String &p_newtext); diff --git a/editor/property_editor.h b/editor/property_editor.h index 6a709d348b..a8ef1d6fc1 100644 --- a/editor/property_editor.h +++ b/editor/property_editor.h @@ -56,7 +56,7 @@ class PropertySelector; class EditorResourceConversionPlugin : public Reference { - GDCLASS(EditorResourceConversionPlugin, Reference) + GDCLASS(EditorResourceConversionPlugin, Reference); protected: static void _bind_methods(); diff --git a/editor/property_selector.h b/editor/property_selector.h index cc5b1d4884..a6c1ec6498 100644 --- a/editor/property_selector.h +++ b/editor/property_selector.h @@ -36,7 +36,7 @@ #include "scene/gui/rich_text_label.h" class PropertySelector : public ConfirmationDialog { - GDCLASS(PropertySelector, ConfirmationDialog) + GDCLASS(PropertySelector, ConfirmationDialog); LineEdit *search_box; Tree *search_options; diff --git a/editor/quick_open.h b/editor/quick_open.h index 14d857fa1c..b6a2e50e88 100644 --- a/editor/quick_open.h +++ b/editor/quick_open.h @@ -37,7 +37,7 @@ #include "scene/gui/tree.h" class EditorQuickOpen : public ConfirmationDialog { - GDCLASS(EditorQuickOpen, ConfirmationDialog) + GDCLASS(EditorQuickOpen, ConfirmationDialog); LineEdit *search_box; Tree *search_options; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index e8f5139cd5..a15ae2efda 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -269,7 +269,7 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) bool SceneTreeDock::_cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node) { int childCount = p_desired_node->get_child_count(); - if (p_desired_node->get_filename() == p_target_scene_path) { + if (_track_inherit(p_target_scene_path, p_desired_node)) { return true; } @@ -284,6 +284,33 @@ bool SceneTreeDock::_cyclical_dependency_exists(const String &p_target_scene_pat return false; } +bool SceneTreeDock::_track_inherit(const String &p_target_scene_path, Node *p_desired_node) { + Node *p = p_desired_node; + bool result = false; + Vector<Node *> instances; + while (true) { + if (p->get_filename() == p_target_scene_path) { + result = true; + break; + } + Ref<SceneState> ss = p->get_scene_inherited_state(); + if (ss.is_valid()) { + String path = ss->get_path(); + Ref<PackedScene> data = ResourceLoader::load(path); + if (data.is_valid()) { + p = data->instance(PackedScene::GEN_EDIT_STATE_INSTANCE); + instances.push_back(p); + } else + break; + } else + break; + } + for (int i = 0; i < instances.size(); i++) { + memdelete(instances[i]); + } + return result; +} + void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { current_option = p_tool; diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 9f9e93f2df..b645c22295 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -165,6 +165,7 @@ class SceneTreeDock : public VBoxContainer { void _script_open_request(const Ref<Script> &p_script); bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node); + bool _track_inherit(const String &p_target_scene_path, Node *p_desired_node); void _node_selected(); void _node_renamed(); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 3b086c6316..00c8ed6ad3 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -305,49 +305,51 @@ void ScriptEditorDebugger::_scene_tree_rmb_selected(const Vector2 &p_position) { } void ScriptEditorDebugger::_file_selected(const String &p_file) { - if (file_dialog_mode == SAVE_NODE) { - - Array msg; - msg.push_back("save_node"); - msg.push_back(inspected_object_id); - msg.push_back(p_file); - ppeer->put_var(msg); - } else if (file_dialog_mode == SAVE_CSV) { + switch (file_dialog_mode) { + case SAVE_NODE: { + Array msg; + msg.push_back("save_node"); + msg.push_back(inspected_object_id); + msg.push_back(p_file); + ppeer->put_var(msg); + } break; + case SAVE_CSV: { + Error err; + FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err); - Error err; - FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err); + if (err != OK) { + ERR_PRINTS("Failed to open " + p_file); + return; + } + Vector<String> line; + line.resize(Performance::MONITOR_MAX); - if (err != OK) { - ERR_PRINTS("Failed to open " + p_file); - return; - } - Vector<String> line; - line.resize(Performance::MONITOR_MAX); + // signatures + for (int i = 0; i < Performance::MONITOR_MAX; i++) { + line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)); + } + file->store_csv_line(line); - // signatures - for (int i = 0; i < Performance::MONITOR_MAX; i++) { - line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)); - } - file->store_csv_line(line); + // values + List<Vector<float> >::Element *E = perf_history.back(); + while (E) { - // values - List<Vector<float> >::Element *E = perf_history.back(); - while (E) { + Vector<float> &perf_data = E->get(); + for (int i = 0; i < perf_data.size(); i++) { - Vector<float> &perf_data = E->get(); - for (int i = 0; i < perf_data.size(); i++) { + line.write[i] = String::num_real(perf_data[i]); + } + file->store_csv_line(line); + E = E->prev(); + } + file->store_string("\n"); - line.write[i] = String::num_real(perf_data[i]); + Vector<Vector<String> > profiler_data = profiler->get_data_as_csv(); + for (int i = 0; i < profiler_data.size(); i++) { + file->store_csv_line(profiler_data[i]); } - file->store_csv_line(line); - E = E->prev(); - } - file->store_string("\n"); - Vector<Vector<String> > profiler_data = profiler->get_data_as_csv(); - for (int i = 0; i < profiler_data.size(); i++) { - file->store_csv_line(profiler_data[i]); - } + } break; } } @@ -1121,10 +1123,13 @@ void ScriptEditorDebugger::_notification(int p_what) { last_warning_count = warning_count; } - if (connection.is_null()) { - - if (server->is_connection_available()) { - + if (server->is_connection_available()) { + if (connection.is_valid()) { + // We already have a valid connection. Disconnecting any new connecting client to prevent it from hanging. + // (If we don't keep a reference to the connection it will be destroyed and disconnect_from_host will be called internally) + server->take_connection(); + } else { + // We just got the first connection. connection = server->take_connection(); if (connection.is_null()) break; @@ -1158,12 +1163,11 @@ void ScriptEditorDebugger::_notification(int p_what) { if (profiler->is_profiling()) { _profiler_activate(true); } - - } else { - - break; } - }; + } + + if (connection.is_null()) + break; if (!connection->is_connected_to_host()) { stop(); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 67cbcf5de4..c4b8999401 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -1835,12 +1835,12 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { JointSpatialGizmoPlugin::CreateConeTwistJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), - pb ? pb->get_global_transform() : Transform(), - pbp ? pbp->get_global_transform() : Transform(), + pb->get_global_transform(), + pbp->get_global_transform(), cjd->swing_span, cjd->twist_span, - pb ? &points : NULL, - pbp ? &points : NULL); + &points, + &points); } break; case PhysicalBone::JOINT_TYPE_HINGE: { @@ -1848,14 +1848,14 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { JointSpatialGizmoPlugin::CreateHingeJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), - pb ? pb->get_global_transform() : Transform(), - pbp ? pbp->get_global_transform() : Transform(), + pb->get_global_transform(), + pbp->get_global_transform(), hjd->angular_limit_lower, hjd->angular_limit_upper, hjd->angular_limit_enabled, points, - pb ? &points : NULL, - pbp ? &points : NULL); + &points, + &points); } break; case PhysicalBone::JOINT_TYPE_SLIDER: { @@ -1863,15 +1863,15 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { JointSpatialGizmoPlugin::CreateSliderJointGizmo( physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), - pb ? pb->get_global_transform() : Transform(), - pbp ? pbp->get_global_transform() : Transform(), + pb->get_global_transform(), + pbp->get_global_transform(), sjd->angular_limit_lower, sjd->angular_limit_upper, sjd->linear_limit_lower, sjd->linear_limit_upper, points, - pb ? &points : NULL, - pbp ? &points : NULL); + &points, + &points); } break; case PhysicalBone::JOINT_TYPE_6DOF: { @@ -1880,8 +1880,8 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { physical_bone->get_joint_offset(), physical_bone->get_global_transform() * physical_bone->get_joint_offset(), - pb ? pb->get_global_transform() : Transform(), - pbp ? pbp->get_global_transform() : Transform(), + pb->get_global_transform(), + pbp->get_global_transform(), sdofjd->axis_data[0].angular_limit_lower, sdofjd->axis_data[0].angular_limit_upper, @@ -1905,8 +1905,8 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { sdofjd->axis_data[2].linear_limit_enabled, points, - pb ? &points : NULL, - pbp ? &points : NULL); + &points, + &points); } break; default: return; |