1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Improve Select Frames dialog of SpriteFrames editor

This commit is contained in:
Haoyu Qiu
2022-04-09 17:30:06 +08:00
parent 33500a1529
commit 32488b46a6
2 changed files with 226 additions and 58 deletions

View File

@@ -43,6 +43,13 @@
class SpriteFramesEditor : public HSplitContainer {
GDCLASS(SpriteFramesEditor, HSplitContainer);
enum {
PARAM_USE_CURRENT, // Used in callbacks to indicate `dominant_param` should be not updated.
PARAM_FRAME_COUNT, // Keep "Horizontal" & "Vertial" values.
PARAM_SIZE, // Keep "Size" values.
};
int dominant_param = PARAM_FRAME_COUNT;
ToolButton *load;
ToolButton *load_sheet;
ToolButton *_delete;
@@ -81,6 +88,12 @@ class SpriteFramesEditor : public HSplitContainer {
TextureRect *split_sheet_preview;
SpinBox *split_sheet_h;
SpinBox *split_sheet_v;
SpinBox *split_sheet_size_x;
SpinBox *split_sheet_size_y;
SpinBox *split_sheet_sep_x;
SpinBox *split_sheet_sep_y;
SpinBox *split_sheet_offset_x;
SpinBox *split_sheet_offset_y;
ToolButton *split_sheet_zoom_out;
ToolButton *split_sheet_zoom_reset;
ToolButton *split_sheet_zoom_in;
@@ -98,6 +111,11 @@ class SpriteFramesEditor : public HSplitContainer {
float max_sheet_zoom;
float min_sheet_zoom;
Size2i _get_frame_count() const;
Size2i _get_frame_size() const;
Size2i _get_offset() const;
Size2i _get_separation() const;
void _load_pressed();
void _file_load_request(const PoolVector<String> &p_path, int p_at_pos = -1);
void _copy_pressed();
@@ -123,6 +141,7 @@ class SpriteFramesEditor : public HSplitContainer {
void _zoom_reset();
bool updating;
bool updating_split_settings = false; // Skip SpinBox/Range callback when setting value by code.
UndoRedo *undo_redo;
@@ -134,7 +153,7 @@ class SpriteFramesEditor : public HSplitContainer {
void _prepare_sprite_sheet(const String &p_file);
int _sheet_preview_position_to_frame_index(const Vector2 &p_position);
void _sheet_preview_draw();
void _sheet_spin_changed(double);
void _sheet_spin_changed(double p_value, int p_dominant_param);
void _sheet_preview_input(const Ref<InputEvent> &p_event);
void _sheet_scroll_input(const Ref<InputEvent> &p_event);
void _sheet_add_frames();