|
38 | 38 | #include "editor/editor_string_names.h" |
39 | 39 | #include "editor/editor_undo_redo_manager.h" |
40 | 40 | #include "editor/file_system/editor_file_system.h" |
41 | | -#include "editor/gui/editor_bottom_panel.h" |
42 | 41 | #include "editor/gui/editor_file_dialog.h" |
43 | 42 | #include "editor/settings/editor_command_palette.h" |
44 | 43 | #include "editor/settings/editor_settings.h" |
|
51 | 50 | #include "scene/gui/option_button.h" |
52 | 51 | #include "scene/gui/panel_container.h" |
53 | 52 | #include "scene/gui/separator.h" |
| 53 | +#include "scene/gui/split_container.h" |
54 | 54 | #include "scene/resources/atlas_texture.h" |
55 | 55 |
|
56 | 56 | 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) { |
@@ -2067,9 +2067,20 @@ void SpriteFramesEditor::_node_removed(Node *p_node) { |
2067 | 2067 | } |
2068 | 2068 |
|
2069 | 2069 | SpriteFramesEditor::SpriteFramesEditor() { |
| 2070 | + set_name(TTRC("SpriteFrames")); |
| 2071 | + set_icon_name("SpriteFrames"); |
| 2072 | + set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTRC("Open SpriteFrames Dock"))); |
| 2073 | + set_default_slot(DockConstants::DOCK_SLOT_BOTTOM); |
| 2074 | + set_available_layouts(EditorDock::DOCK_LAYOUT_HORIZONTAL | EditorDock::DOCK_LAYOUT_FLOATING); |
| 2075 | + set_global(false); |
| 2076 | + set_transient(true); |
| 2077 | + |
| 2078 | + HSplitContainer *main_split = memnew(HSplitContainer); |
| 2079 | + add_child(main_split); |
| 2080 | + |
2070 | 2081 | VBoxContainer *vbc_animlist = memnew(VBoxContainer); |
2071 | | - add_child(vbc_animlist); |
2072 | | - vbc_animlist->set_custom_minimum_size(Size2(150, 0) * EDSCALE); |
| 2082 | + main_split->add_child(vbc_animlist); |
| 2083 | + vbc_animlist->set_custom_minimum_size(Size2(150 * EDSCALE, 0)); |
2073 | 2084 |
|
2074 | 2085 | VBoxContainer *sub_vb = memnew(VBoxContainer); |
2075 | 2086 | vbc_animlist->add_margin_child(TTRC("Animations:"), sub_vb, true); |
@@ -2186,10 +2197,10 @@ SpriteFramesEditor::SpriteFramesEditor() { |
2186 | 2197 | missing_anim_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); |
2187 | 2198 | missing_anim_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); |
2188 | 2199 | missing_anim_label->hide(); |
2189 | | - add_child(missing_anim_label); |
| 2200 | + main_split->add_child(missing_anim_label); |
2190 | 2201 |
|
2191 | 2202 | anim_frames_vb = memnew(VBoxContainer); |
2192 | | - add_child(anim_frames_vb); |
| 2203 | + main_split->add_child(anim_frames_vb); |
2193 | 2204 | anim_frames_vb->set_h_size_flags(SIZE_EXPAND_FILL); |
2194 | 2205 | anim_frames_vb->hide(); |
2195 | 2206 |
|
@@ -2670,7 +2681,7 @@ SpriteFramesEditor::SpriteFramesEditor() { |
2670 | 2681 |
|
2671 | 2682 | // Ensure the anim search box is wide enough by default. |
2672 | 2683 | // Not by setting its minimum size so it can still be shrunk if desired. |
2673 | | - set_split_offset(56 * EDSCALE); |
| 2684 | + main_split->set_split_offset(56 * EDSCALE); |
2674 | 2685 | } |
2675 | 2686 |
|
2676 | 2687 | void SpriteFramesEditorPlugin::edit(Object *p_object) { |
@@ -2708,21 +2719,17 @@ bool SpriteFramesEditorPlugin::handles(Object *p_object) const { |
2708 | 2719 |
|
2709 | 2720 | void SpriteFramesEditorPlugin::make_visible(bool p_visible) { |
2710 | 2721 | if (p_visible) { |
2711 | | - button->show(); |
2712 | | - EditorNode::get_bottom_panel()->make_item_visible(frames_editor); |
| 2722 | + frames_editor->make_visible(); |
2713 | 2723 | } else { |
2714 | | - button->hide(); |
2715 | | - if (frames_editor->is_visible_in_tree()) { |
2716 | | - EditorNode::get_bottom_panel()->hide_bottom_panel(); |
2717 | | - } |
| 2724 | + frames_editor->close(); |
2718 | 2725 | } |
2719 | 2726 | } |
2720 | 2727 |
|
2721 | 2728 | SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() { |
2722 | 2729 | frames_editor = memnew(SpriteFramesEditor); |
2723 | 2730 | frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE); |
2724 | | - 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"))); |
2725 | | - button->hide(); |
| 2731 | + EditorDockManager::get_singleton()->add_dock(frames_editor); |
| 2732 | + frames_editor->close(); |
2726 | 2733 | } |
2727 | 2734 |
|
2728 | 2735 | Ref<ClipboardAnimation> ClipboardAnimation::from_sprite_frames(const Ref<SpriteFrames> &p_frames, const String &p_anim) { |
|
0 commit comments