Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion editor/docks/editor_dock_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,9 @@ void EditorDockManager::save_docks_to_config(Ref<ConfigFile> p_layout, const Str
window_dump["window_screen_rect"] = DisplayServer::get_singleton()->screen_get_usable_rect(screen);

String name = dock->get_effective_layout_key();
floating_docks_dump[name] = window_dump;
if (!dock->transient) {
floating_docks_dump[name] = window_dump;
}
Comment on lines +616 to +618
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of preventing the window from being saved, we could instead prevent loading it. It can help fix #113259 If you make a dock floating, it should stay floating.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to be addressed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a fix for #113259, but it would add a lot of complexity. Unless you think otherwise, I will probably make it a different PR.


// Append to regular dock section so we know where to restore it to.
int dock_slot_id = dock->dock_slot_index;
Expand Down
35 changes: 21 additions & 14 deletions editor/scene/sprite_frames_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.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/settings/editor_command_palette.h"
#include "editor/settings/editor_settings.h"
Expand All @@ -51,6 +50,7 @@
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/split_container.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) {
Expand Down Expand Up @@ -2067,9 +2067,20 @@ void SpriteFramesEditor::_node_removed(Node *p_node) {
}

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);
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);
vbc_animlist->add_margin_child(TTRC("Animations:"), sub_vb, true);
Expand Down Expand Up @@ -2186,10 +2197,10 @@ SpriteFramesEditor::SpriteFramesEditor() {
missing_anim_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
missing_anim_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
missing_anim_label->hide();
add_child(missing_anim_label);
main_split->add_child(missing_anim_label);

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->hide();

Expand Down Expand Up @@ -2670,7 +2681,7 @@ SpriteFramesEditor::SpriteFramesEditor() {

// Ensure the anim search box is wide enough by default.
// 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) {
Expand Down Expand Up @@ -2708,21 +2719,17 @@ bool SpriteFramesEditorPlugin::handles(Object *p_object) const {

void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
button->show();
EditorNode::get_bottom_panel()->make_item_visible(frames_editor);
frames_editor->make_visible();
} else {
button->hide();
if (frames_editor->is_visible_in_tree()) {
EditorNode::get_bottom_panel()->hide_bottom_panel();
}
frames_editor->close();
}
}

SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() {
frames_editor = memnew(SpriteFramesEditor);
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) {
Expand Down
7 changes: 3 additions & 4 deletions editor/scene/sprite_frames_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@

#pragma once

#include "editor/docks/editor_dock.h"
#include "editor/plugins/editor_plugin.h"
#include "scene/gui/button.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/item_list.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/split_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tree.h"
#include "scene/resources/image_texture.h"
Expand Down Expand Up @@ -69,8 +69,8 @@ class ClipboardAnimation : public Resource {
static Ref<ClipboardAnimation> from_sprite_frames(const Ref<SpriteFrames> &p_frames, const String &p_anim);
};

class SpriteFramesEditor : public HSplitContainer {
GDCLASS(SpriteFramesEditor, HSplitContainer);
class SpriteFramesEditor : public EditorDock {
GDCLASS(SpriteFramesEditor, EditorDock);

Ref<SpriteFrames> frames;
Node *animated_sprite = nullptr;
Expand Down Expand Up @@ -313,7 +313,6 @@ class SpriteFramesEditorPlugin : public EditorPlugin {
GDCLASS(SpriteFramesEditorPlugin, EditorPlugin);

SpriteFramesEditor *frames_editor = nullptr;
Button *button = nullptr;

public:
virtual String get_plugin_name() const override { return "SpriteFrames"; }
Expand Down