|
@@ -39,7 +39,6 @@
|
|
|
#include "editor/editor_string_names.h"
|
|
#include "editor/editor_string_names.h"
|
|
|
#include "editor/editor_undo_redo_manager.h"
|
|
#include "editor/editor_undo_redo_manager.h"
|
|
|
#include "editor/file_system/editor_file_system.h"
|
|
#include "editor/file_system/editor_file_system.h"
|
|
|
-#include "editor/gui/editor_bottom_panel.h"
|
|
|
|
|
#include "editor/gui/editor_file_dialog.h"
|
|
#include "editor/gui/editor_file_dialog.h"
|
|
|
#include "editor/settings/editor_command_palette.h"
|
|
#include "editor/settings/editor_command_palette.h"
|
|
|
#include "editor/settings/editor_settings.h"
|
|
#include "editor/settings/editor_settings.h"
|
|
@@ -52,6 +51,7 @@
|
|
|
#include "scene/gui/option_button.h"
|
|
#include "scene/gui/option_button.h"
|
|
|
#include "scene/gui/panel_container.h"
|
|
#include "scene/gui/panel_container.h"
|
|
|
#include "scene/gui/separator.h"
|
|
#include "scene/gui/separator.h"
|
|
|
|
|
+#include "scene/gui/split_container.h"
|
|
|
#include "scene/resources/atlas_texture.h"
|
|
#include "scene/resources/atlas_texture.h"
|
|
|
|
|
|
|
|
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) {
|
|
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) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SpriteFramesEditor::SpriteFramesEditor() {
|
|
SpriteFramesEditor::SpriteFramesEditor() {
|
|
|
|
|
+ set_name(TTRC("SpriteFrames"));
|
|
|
|
|
+ set_icon_name("SpriteFrames");
|
|
|
|
|
+ set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTRC("Open SpriteFrames Dock")));
|
|
|
|
|
+ set_default_slot(DockConstants::DOCK_SLOT_BOTTOM);
|
|
|
|
|
+ set_available_layouts(EditorDock::DOCK_LAYOUT_HORIZONTAL | EditorDock::DOCK_LAYOUT_FLOATING);
|
|
|
|
|
+ set_global(false);
|
|
|
|
|
+ set_transient(true);
|
|
|
|
|
+
|
|
|
|
|
+ HSplitContainer *main_split = memnew(HSplitContainer);
|
|
|
|
|
+ add_child(main_split);
|
|
|
|
|
+
|
|
|
VBoxContainer *vbc_animlist = memnew(VBoxContainer);
|
|
VBoxContainer *vbc_animlist = memnew(VBoxContainer);
|
|
|
- add_child(vbc_animlist);
|
|
|
|
|
- vbc_animlist->set_custom_minimum_size(Size2(150, 0) * EDSCALE);
|
|
|
|
|
|
|
+ main_split->add_child(vbc_animlist);
|
|
|
|
|
+ vbc_animlist->set_custom_minimum_size(Size2(150 * EDSCALE, 0));
|
|
|
|
|
|
|
|
VBoxContainer *sub_vb = memnew(VBoxContainer);
|
|
VBoxContainer *sub_vb = memnew(VBoxContainer);
|
|
|
vbc_animlist->add_margin_child(TTRC("Animations:"), sub_vb, true);
|
|
vbc_animlist->add_margin_child(TTRC("Animations:"), sub_vb, true);
|
|
@@ -2237,10 +2248,10 @@ SpriteFramesEditor::SpriteFramesEditor() {
|
|
|
missing_anim_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
|
|
missing_anim_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
|
|
|
missing_anim_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
|
|
missing_anim_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
|
|
|
missing_anim_label->hide();
|
|
missing_anim_label->hide();
|
|
|
- add_child(missing_anim_label);
|
|
|
|
|
|
|
+ main_split->add_child(missing_anim_label);
|
|
|
|
|
|
|
|
anim_frames_vb = memnew(VBoxContainer);
|
|
anim_frames_vb = memnew(VBoxContainer);
|
|
|
- add_child(anim_frames_vb);
|
|
|
|
|
|
|
+ main_split->add_child(anim_frames_vb);
|
|
|
anim_frames_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
anim_frames_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
anim_frames_vb->hide();
|
|
anim_frames_vb->hide();
|
|
|
|
|
|
|
@@ -2731,7 +2742,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
|
|
|
|
|
|
|
|
// Ensure the anim search box is wide enough by default.
|
|
// Ensure the anim search box is wide enough by default.
|
|
|
// Not by setting its minimum size so it can still be shrunk if desired.
|
|
// Not by setting its minimum size so it can still be shrunk if desired.
|
|
|
- set_split_offset(56 * EDSCALE);
|
|
|
|
|
|
|
+ main_split->set_split_offset(56 * EDSCALE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void SpriteFramesEditorPlugin::edit(Object *p_object) {
|
|
void SpriteFramesEditorPlugin::edit(Object *p_object) {
|
|
@@ -2769,21 +2780,17 @@ bool SpriteFramesEditorPlugin::handles(Object *p_object) const {
|
|
|
|
|
|
|
|
void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
|
|
void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
|
|
|
if (p_visible) {
|
|
if (p_visible) {
|
|
|
- button->show();
|
|
|
|
|
- EditorNode::get_bottom_panel()->make_item_visible(frames_editor);
|
|
|
|
|
|
|
+ frames_editor->make_visible();
|
|
|
} else {
|
|
} else {
|
|
|
- button->hide();
|
|
|
|
|
- if (frames_editor->is_visible_in_tree()) {
|
|
|
|
|
- EditorNode::get_bottom_panel()->hide_bottom_panel();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ frames_editor->close();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() {
|
|
SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() {
|
|
|
frames_editor = memnew(SpriteFramesEditor);
|
|
frames_editor = memnew(SpriteFramesEditor);
|
|
|
frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
|
|
frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
|
|
|
- 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")));
|
|
|
|
|
- button->hide();
|
|
|
|
|
|
|
+ EditorDockManager::get_singleton()->add_dock(frames_editor);
|
|
|
|
|
+ frames_editor->close();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Ref<ClipboardAnimation> ClipboardAnimation::from_sprite_frames(const Ref<SpriteFrames> &p_frames, const String &p_anim) {
|
|
Ref<ClipboardAnimation> ClipboardAnimation::from_sprite_frames(const Ref<SpriteFrames> &p_frames, const String &p_anim) {
|