summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorLeul Mulugeta <leul.mulugeta@gmail.com>2024-02-12 22:49:49 +0300
committerLeul Mulugeta <leul.mulugeta@gmail.com>2024-03-05 16:50:06 +0300
commiteffad7be0c8dedefcbc12d36f86b331f216a9035 (patch)
treee2ea4a5017b41118549dfdf985624de3eaaad9da /editor
parent7d80635fce1d0c44fa69d4d8cf3da40fa998f9c7 (diff)
downloadredot-engine-effad7be0c8dedefcbc12d36f86b331f216a9035.tar.gz
Remember frames when selecting SpriteFrame frames
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp27
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h2
2 files changed, 17 insertions, 12 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 9c1170492b..d8750db601 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -525,18 +525,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();
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index 730dddade1..2d0e43be1e 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -167,6 +167,8 @@ class SpriteFramesEditor : public HSplitContainer {
bool frames_need_sort = false;
int last_frame_selected = 0;
+ Size2i previous_texture_size;
+
float scale_ratio;
int thumbnail_default_size;
float thumbnail_zoom;