diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-05 08:12:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-05 08:12:14 +0200 |
commit | 7d5ad99cde20099f62923ecf9c47002c41ce2336 (patch) | |
tree | 880396dc0142646c4e286b5009c61c6b7c568a55 /editor/plugins | |
parent | d9bba94d603c706dfd1443c9e3fb8a13332c5a16 (diff) | |
parent | 653039151a91291eda757f72674b6b968770cf51 (diff) |
Merge pull request #31063 from rzllmr/fix-tilemap-order
Fix row-column-swap in TileMap palette
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 766890242f..b2f06ca41f 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -521,7 +521,13 @@ void TileMapEditor::_update_palette() { for (const Map<Vector2, uint32_t>::Element *E = tiles2.front(); E; E = E->next()) { entries2.push_back(E->key()); } - entries2.sort(); + // Sort tiles in row-major order + struct SwapComparator { + _FORCE_INLINE_ bool operator()(const Vector2 &v_l, const Vector2 &v_r) const { + return v_l.y != v_r.y ? v_l.y < v_r.y : v_l.x < v_r.x; + } + }; + entries2.sort_custom<SwapComparator>(); Ref<Texture> tex = tileset->tile_get_texture(sel_tile); |