diff options
Diffstat (limited to 'editor')
58 files changed, 335 insertions, 225 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..6e47fadb20 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -2083,8 +2083,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 +2324,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 +2337,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 +4343,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 +4375,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 +4569,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 +4963,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 +5016,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 +5299,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..1452d5519c 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -50,7 +50,7 @@ #include "scene_tree_editor.h" class AnimationTimelineEdit : public Range { - GDCLASS(AnimationTimelineEdit, Range) + GDCLASS(AnimationTimelineEdit, Range); Ref<Animation> animation; int name_limit; @@ -123,7 +123,7 @@ class AnimationTrackEditor; class AnimationTrackEdit : public Control { - GDCLASS(AnimationTrackEdit, Control) + GDCLASS(AnimationTrackEdit, Control); enum { MENU_CALL_MODE_CONTINUOUS, @@ -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..8b3c537fe3 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; @@ -1375,6 +1395,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 +1477,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..ce219f340c 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(); 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_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_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_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_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/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.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.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/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_editor_plugin.h b/editor/plugins/particles_editor_plugin.h index b1b3e3c1c0..b1c53dcf94 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; 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.h b/editor/plugins/script_editor_plugin.h index 0d9168261a..4ad2156779 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -50,7 +50,7 @@ class ScriptEditorQuickOpen : public ConfirmationDialog { - GDCLASS(ScriptEditorQuickOpen, ConfirmationDialog) + GDCLASS(ScriptEditorQuickOpen, ConfirmationDialog); LineEdit *search_box; Tree *search_options; @@ -77,7 +77,7 @@ class ScriptEditorDebugger; class ScriptEditorBase : public VBoxContainer { - GDCLASS(ScriptEditorBase, VBoxContainer) + GDCLASS(ScriptEditorBase, VBoxContainer); protected: static void _bind_methods(); 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.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..b417414ae0 100644 --- a/editor/plugins/tile_set_editor_plugin.h +++ b/editor/plugins/tile_set_editor_plugin.h @@ -46,7 +46,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..7d0c67b5ed 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -2350,7 +2350,7 @@ VisualShaderEditorPlugin::~VisualShaderEditorPlugin() { //////////////// class VisualShaderNodePluginInputEditor : public OptionButton { - GDCLASS(VisualShaderNodePluginInputEditor, OptionButton) + GDCLASS(VisualShaderNodePluginInputEditor, OptionButton); Ref<VisualShaderNodeInput> input; @@ -2395,7 +2395,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/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..3167abb745 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1121,10 +1121,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 +1161,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(); |