|
39 | 39 | #include "editor/editor_string_names.h" |
40 | 40 | #include "editor/editor_undo_redo_manager.h" |
41 | 41 | #include "editor/file_system/editor_file_system.h" |
42 | | -#include "editor/gui/editor_bottom_panel.h" |
43 | 42 | #include "editor/gui/editor_file_dialog.h" |
44 | 43 | #include "editor/settings/editor_command_palette.h" |
45 | 44 | #include "editor/settings/editor_settings.h" |
|
52 | 51 | #include "scene/gui/option_button.h" |
53 | 52 | #include "scene/gui/panel_container.h" |
54 | 53 | #include "scene/gui/separator.h" |
| 54 | +#include "scene/gui/split_container.h" |
55 | 55 | #include "scene/resources/atlas_texture.h" |
56 | 56 |
|
57 | 57 | static void _draw_shadowed_line(Control *p_control, const Point2 &p_from, const Size2 &p_size, const Size2 &p_shadow_offset, Color p_color, Color p_shadow_color) { |
@@ -2118,9 +2118,20 @@ void SpriteFramesEditor::_node_removed(Node *p_node) { |
2118 | 2118 | } |
2119 | 2119 |
|
2120 | 2120 | SpriteFramesEditor::SpriteFramesEditor() { |
| 2121 | + set_name(TTRC("SpriteFrames")); |
| 2122 | + set_icon_name("SpriteFrames"); |
| 2123 | + set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTRC("Open SpriteFrames Dock"))); |
| 2124 | + set_default_slot(DockConstants::DOCK_SLOT_BOTTOM); |
| 2125 | + set_available_layouts(EditorDock::DOCK_LAYOUT_HORIZONTAL | EditorDock::DOCK_LAYOUT_FLOATING); |
| 2126 | + set_global(false); |
| 2127 | + set_transient(true); |
| 2128 | + |
| 2129 | + HSplitContainer *main_split = memnew(HSplitContainer); |
| 2130 | + add_child(main_split); |
| 2131 | + |
2121 | 2132 | VBoxContainer *vbc_animlist = memnew(VBoxContainer); |
2122 | | - add_child(vbc_animlist); |
2123 | | - vbc_animlist->set_custom_minimum_size(Size2(150, 0) * EDSCALE); |
| 2133 | + main_split->add_child(vbc_animlist); |
| 2134 | + vbc_animlist->set_custom_minimum_size(Size2(150 * EDSCALE, 0)); |
2124 | 2135 |
|
2125 | 2136 | VBoxContainer *sub_vb = memnew(VBoxContainer); |
2126 | 2137 | vbc_animlist->add_margin_child(TTRC("Animations:"), sub_vb, true); |
@@ -2237,10 +2248,10 @@ SpriteFramesEditor::SpriteFramesEditor() { |
2237 | 2248 | missing_anim_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); |
2238 | 2249 | missing_anim_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); |
2239 | 2250 | missing_anim_label->hide(); |
2240 | | - add_child(missing_anim_label); |
| 2251 | + main_split->add_child(missing_anim_label); |
2241 | 2252 |
|
2242 | 2253 | anim_frames_vb = memnew(VBoxContainer); |
2243 | | - add_child(anim_frames_vb); |
| 2254 | + main_split->add_child(anim_frames_vb); |
2244 | 2255 | anim_frames_vb->set_h_size_flags(SIZE_EXPAND_FILL); |
2245 | 2256 | anim_frames_vb->hide(); |
2246 | 2257 |
|
@@ -2731,7 +2742,7 @@ SpriteFramesEditor::SpriteFramesEditor() { |
2731 | 2742 |
|
2732 | 2743 | // Ensure the anim search box is wide enough by default. |
2733 | 2744 | // Not by setting its minimum size so it can still be shrunk if desired. |
2734 | | - set_split_offset(56 * EDSCALE); |
| 2745 | + main_split->set_split_offset(56 * EDSCALE); |
2735 | 2746 | } |
2736 | 2747 |
|
2737 | 2748 | void SpriteFramesEditorPlugin::edit(Object *p_object) { |
@@ -2769,21 +2780,17 @@ bool SpriteFramesEditorPlugin::handles(Object *p_object) const { |
2769 | 2780 |
|
2770 | 2781 | void SpriteFramesEditorPlugin::make_visible(bool p_visible) { |
2771 | 2782 | if (p_visible) { |
2772 | | - button->show(); |
2773 | | - EditorNode::get_bottom_panel()->make_item_visible(frames_editor); |
| 2783 | + frames_editor->make_visible(); |
2774 | 2784 | } else { |
2775 | | - button->hide(); |
2776 | | - if (frames_editor->is_visible_in_tree()) { |
2777 | | - EditorNode::get_bottom_panel()->hide_bottom_panel(); |
2778 | | - } |
| 2785 | + frames_editor->close(); |
2779 | 2786 | } |
2780 | 2787 | } |
2781 | 2788 |
|
2782 | 2789 | SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() { |
2783 | 2790 | frames_editor = memnew(SpriteFramesEditor); |
2784 | 2791 | frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE); |
2785 | | - button = EditorNode::get_bottom_panel()->add_item(TTRC("SpriteFrames"), frames_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTRC("Toggle SpriteFrames Bottom Panel"))); |
2786 | | - button->hide(); |
| 2792 | + EditorDockManager::get_singleton()->add_dock(frames_editor); |
| 2793 | + frames_editor->close(); |
2787 | 2794 | } |
2788 | 2795 |
|
2789 | 2796 | Ref<ClipboardAnimation> ClipboardAnimation::from_sprite_frames(const Ref<SpriteFrames> &p_frames, const String &p_anim) { |
|
0 commit comments