Repository: godotengine/godot
File: editor/plugins/sprite_frames_editor_plugin.h (C/C++)

Code before:
#include "scene/gui/check_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"

class OptionButton;
class EditorFileDialog;

class EditorSpriteFramesFrame : public Resource {
	GDCLASS(EditorSpriteFramesFrame, Resource);

public:
	Ref<Texture2D> texture;
	float duration;
};

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

	Ref<SpriteFrames> frames;
	Node *animated_sprite = nullptr;

	enum {
		PARAM_USE_CURRENT, // Used in callbacks to indicate `dominant_param` should be not updated.
		PARAM_FRAME_COUNT, // Keep "Horizontal" & "Vertical" values.
		PARAM_SIZE, // Keep "Size" values.
	};
	int dominant_param = PARAM_FRAME_COUNT;

	enum {
		FRAME_ORDER_SELECTION, // Order frames were selected in.

		// By Row.
		FRAME_ORDER_LEFT_RIGHT_TOP_BOTTOM,
		FRAME_ORDER_LEFT_RIGHT_BOTTOM_TOP,
		FRAME_ORDER_RIGHT_LEFT_TOP_BOTTOM,
		FRAME_ORDER_RIGHT_LEFT_BOTTOM_TOP,

		// By Column.
		FRAME_ORDER_TOP_BOTTOM_LEFT_RIGHT,
		FRAME_ORDER_TOP_BOTTOM_RIGHT_LEFT,
		FRAME_ORDER_BOTTOM_TOP_LEFT_RIGHT,
		FRAME_ORDER_BOTTOM_TOP_RIGHT_LEFT,
	};


Review comment (suggestion):
Sorry, I worded it poorly. There is no point in having both `EditorSpriteFrame` and `EditorSpriteFrameArray` since they are not exposed. I meant something like:

```c++
class EditorSpriteFrameArray : public Resource {
    GDCLASS(EditorSpriteFrameArray, Resource);

public:
    struct Frame {
        Ref<Texture2D> texture;
        float duration;
    }
    Vector<Frame> frames;
};
```

Maybe `EditorSpriteFrameArray` should be renamed to `EditorSpriteFrames`, but I'm worried that this will cause confusion with `SpriteFrames`.

Code after:
#include "scene/gui/check_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"

class OptionButton;
class EditorFileDialog;

class ClipboardSpriteFrames : public Resource {
	GDCLASS(ClipboardSpriteFrames, Resource);

public:
	struct Frame {
		Ref<Texture2D> texture;
		float duration;
	};
	Vector<Frame> frames;
};

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

	Ref<SpriteFrames> frames;
	Node *animated_sprite = nullptr;

	enum {
		PARAM_USE_CURRENT, // Used in callbacks to indicate `dominant_param` should be not updated.
		PARAM_FRAME_COUNT, // Keep "Horizontal" & "Vertical" values.
		PARAM_SIZE, // Keep "Size" values.
	};
	int dominant_param = PARAM_FRAME_COUNT;

	enum {
		FRAME_ORDER_SELECTION, // Order frames were selected in.

		// By Row.
		FRAME_ORDER_LEFT_RIGHT_TOP_BOTTOM,
		FRAME_ORDER_LEFT_RIGHT_BOTTOM_TOP,
		FRAME_ORDER_RIGHT_LEFT_TOP_BOTTOM,
		FRAME_ORDER_RIGHT_LEFT_BOTTOM_TOP,

		// By Column.
		FRAME_ORDER_TOP_BOTTOM_LEFT_RIGHT,
		FRAME_ORDER_TOP_BOTTOM_RIGHT_LEFT,
		FRAME_ORDER_BOTTOM_TOP_LEFT_RIGHT,