summaryrefslogtreecommitdiffstats
path: root/editor/plugins/sprite_frames_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/sprite_frames_editor_plugin.cpp')
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 9c1170492b..3055e178ba 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -33,6 +33,7 @@
#include "core/config/project_settings.h"
#include "core/io/resource_loader.h"
#include "core/os/keyboard.h"
+#include "editor/editor_command_palette.h"
#include "editor/editor_file_system.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
@@ -525,18 +526,21 @@ void SpriteFramesEditor::_prepare_sprite_sheet(const String &p_file) {
split_sheet_offset_x->set_max(size.x);
split_sheet_offset_y->set_max(size.y);
- // Different texture, reset to 4x4.
- dominant_param = PARAM_FRAME_COUNT;
- updating_split_settings = true;
- split_sheet_h->set_value(4);
- split_sheet_v->set_value(4);
- split_sheet_size_x->set_value(size.x / 4);
- split_sheet_size_y->set_value(size.y / 4);
- split_sheet_sep_x->set_value(0);
- split_sheet_sep_y->set_value(0);
- split_sheet_offset_x->set_value(0);
- split_sheet_offset_y->set_value(0);
- updating_split_settings = false;
+ if (size != previous_texture_size) {
+ // Different texture, reset to 4x4.
+ dominant_param = PARAM_FRAME_COUNT;
+ updating_split_settings = true;
+ split_sheet_h->set_value(4);
+ split_sheet_v->set_value(4);
+ split_sheet_size_x->set_value(size.x / 4);
+ split_sheet_size_y->set_value(size.y / 4);
+ split_sheet_sep_x->set_value(0);
+ split_sheet_sep_y->set_value(0);
+ split_sheet_offset_x->set_value(0);
+ split_sheet_offset_y->set_value(0);
+ updating_split_settings = false;
+ }
+ previous_texture_size = size;
// Reset zoom.
_sheet_zoom_reset();
@@ -2337,7 +2341,7 @@ void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() {
frames_editor = memnew(SpriteFramesEditor);
frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);
- button = EditorNode::get_bottom_panel()->add_item(TTR("SpriteFrames"), frames_editor);
+ button = EditorNode::get_bottom_panel()->add_item(TTR("SpriteFrames"), frames_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTR("Toggle SpriteFrames Bottom Panel")));
button->hide();
}