summaryrefslogtreecommitdiffstats
path: root/editor/plugins/tiles/tile_map_editor.h
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-07-31 21:35:17 +0200
committerkobewi <kobewi4e@gmail.com>2023-09-09 00:56:38 +0200
commita9f3154da3be6f5808ee00b4a02372a25a3ec26c (patch)
tree07a9ebdfc2d3cc112e4a345403fd52ec8ec17686 /editor/plugins/tiles/tile_map_editor.h
parentfc99492d3066098e938449b10e02f8e01d07e2d1 (diff)
downloadredot-engine-a9f3154da3be6f5808ee00b4a02372a25a3ec26c.tar.gz
Add per-tile flipping and transposing
Diffstat (limited to 'editor/plugins/tiles/tile_map_editor.h')
-rw-r--r--editor/plugins/tiles/tile_map_editor.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h
index ab5787b78f..0b3d9813c3 100644
--- a/editor/plugins/tiles/tile_map_editor.h
+++ b/editor/plugins/tiles/tile_map_editor.h
@@ -48,6 +48,8 @@
#include "scene/gui/tab_bar.h"
#include "scene/gui/tree.h"
+class TileMapEditor;
+
class TileMapSubEditorPlugin : public Object {
public:
struct TabData {
@@ -68,6 +70,14 @@ public:
class TileMapEditorTilesPlugin : public TileMapSubEditorPlugin {
GDCLASS(TileMapEditorTilesPlugin, TileMapSubEditorPlugin);
+public:
+ enum {
+ TRANSFORM_ROTATE_LEFT,
+ TRANSFORM_ROTATE_RIGHT,
+ TRANSFORM_FLIP_H,
+ TRANSFORM_FLIP_V,
+ };
+
private:
ObjectID tile_map_id;
int tile_map_layer = -1;
@@ -89,6 +99,12 @@ private:
Button *picker_button = nullptr;
Button *erase_button = nullptr;
+ HBoxContainer *transform_toolbar = nullptr;
+ Button *transform_button_rotate_left = nullptr;
+ Button *transform_button_rotate_right = nullptr;
+ Button *transform_button_flip_h = nullptr;
+ Button *transform_button_flip_v = nullptr;
+
VSeparator *tools_settings_vsep_2 = nullptr;
CheckBox *bucket_contiguous_checkbox = nullptr;
Button *random_tile_toggle = nullptr;
@@ -101,6 +117,7 @@ private:
void _on_scattering_spinbox_changed(double p_value);
void _update_toolbar();
+ void _update_transform_buttons();
///// Tilemap editing. /////
bool has_mouse = false;
@@ -129,6 +146,9 @@ private:
HashMap<Vector2i, TileMapCell> _draw_bucket_fill(Vector2i p_coords, bool p_contiguous, bool p_erase);
void _stop_dragging();
+ void _apply_transform(int p_type);
+ int _get_transformed_alternative(int p_alternative_id, int p_transform);
+
///// Selection system. /////
RBSet<Vector2i> tile_map_selection;
Ref<TileMapPattern> tile_map_clipboard;