diff options
author | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-12-19 14:20:49 -0200 |
---|---|---|
committer | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2018-12-30 10:54:03 -0200 |
commit | 4a91f94c1339711beaf5c2eff758b17352fed27c (patch) | |
tree | 230ac42afad4ae176fb1137d3fe3affcde2817f7 /scene | |
parent | 8b7028e7b13b7a0ed6b8a4d589ada7c83914242e (diff) |
Add undo-redo to the TileSet editor, and other improvements
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/tile_set.cpp | 26 | ||||
-rw-r--r-- | scene/resources/tile_set.h | 1 |
2 files changed, 25 insertions, 2 deletions
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 8a24d4bab1..089100bf40 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -507,6 +507,13 @@ int TileSet::autotile_get_subtile_priority(int p_id, const Vector2 &p_coord) { return 1; } +const Map<Vector2, int> &TileSet::autotile_get_priority_map(int p_id) const { + + static Map<Vector2, int> dummy; + ERR_FAIL_COND_V(!tile_map.has(p_id), dummy); + return tile_map[p_id].autotile_data.priority_map; +} + void TileSet::autotile_set_z_index(int p_id, const Vector2 &p_coord, int p_z_index) { ERR_FAIL_COND(!tile_map.has(p_id)); @@ -524,11 +531,11 @@ int TileSet::autotile_get_z_index(int p_id, const Vector2 &p_coord) { return 0; } -const Map<Vector2, int> &TileSet::autotile_get_priority_map(int p_id) const { +const Map<Vector2, int> &TileSet::autotile_get_z_index_map(int p_id) const { static Map<Vector2, int> dummy; ERR_FAIL_COND_V(!tile_map.has(p_id), dummy); - return tile_map[p_id].autotile_data.priority_map; + return tile_map[p_id].autotile_data.z_index_map; } void TileSet::autotile_set_bitmask(int p_id, Vector2 p_coord, uint16_t p_flag) { @@ -986,8 +993,23 @@ void TileSet::clear() { void TileSet::_bind_methods() { ClassDB::bind_method(D_METHOD("create_tile", "id"), &TileSet::create_tile); + ClassDB::bind_method(D_METHOD("autotile_clear_bitmask_map", "id"), &TileSet::autotile_clear_bitmask_map); + ClassDB::bind_method(D_METHOD("autotile_set_icon_coordinate", "id", "coord"), &TileSet::autotile_set_icon_coordinate); + ClassDB::bind_method(D_METHOD("autotile_get_icon_coordinate", "id"), &TileSet::autotile_get_icon_coordinate); + ClassDB::bind_method(D_METHOD("autotile_set_subtile_priority", "id", "coord", "priority"), &TileSet::autotile_set_subtile_priority); + ClassDB::bind_method(D_METHOD("autotile_get_subtile_priority", "id", "coord"), &TileSet::autotile_get_subtile_priority); + ClassDB::bind_method(D_METHOD("autotile_set_z_index", "id", "coord", "z_index"), &TileSet::autotile_set_z_index); + ClassDB::bind_method(D_METHOD("autotile_get_z_index", "id", "coord"), &TileSet::autotile_get_z_index); + ClassDB::bind_method(D_METHOD("autotile_set_light_occluder", "id", "light_occluder", "coord"), &TileSet::autotile_set_light_occluder); + ClassDB::bind_method(D_METHOD("autotile_get_light_occluder", "id", "coord"), &TileSet::autotile_get_light_occluder); + ClassDB::bind_method(D_METHOD("autotile_set_navigation_polygon", "id", "navigation_polygon", "coord"), &TileSet::autotile_set_navigation_polygon); + ClassDB::bind_method(D_METHOD("autotile_get_navigation_polygon", "id", "coord"), &TileSet::autotile_get_navigation_polygon); + ClassDB::bind_method(D_METHOD("autotile_set_bitmask", "id", "bitmask", "flag"), &TileSet::autotile_set_bitmask); + ClassDB::bind_method(D_METHOD("autotile_get_bitmask", "id", "coord"), &TileSet::autotile_get_bitmask); ClassDB::bind_method(D_METHOD("autotile_set_bitmask_mode", "id", "mode"), &TileSet::autotile_set_bitmask_mode); ClassDB::bind_method(D_METHOD("autotile_get_bitmask_mode", "id"), &TileSet::autotile_get_bitmask_mode); + ClassDB::bind_method(D_METHOD("autotile_set_spacing", "id", "spacing"), &TileSet::autotile_set_spacing); + ClassDB::bind_method(D_METHOD("autotile_get_spacing", "id"), &TileSet::autotile_get_spacing); ClassDB::bind_method(D_METHOD("autotile_set_size", "id", "size"), &TileSet::autotile_set_size); ClassDB::bind_method(D_METHOD("autotile_get_size", "id"), &TileSet::autotile_get_size); ClassDB::bind_method(D_METHOD("tile_set_name", "id", "name"), &TileSet::tile_set_name); diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 2ab771b1b0..3992c675fd 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -175,6 +175,7 @@ public: void autotile_set_z_index(int p_id, const Vector2 &p_coord, int p_z_index); int autotile_get_z_index(int p_id, const Vector2 &p_coord); + const Map<Vector2, int> &autotile_get_z_index_map(int p_id) const; void autotile_set_bitmask(int p_id, Vector2 p_coord, uint16_t p_flag); uint16_t autotile_get_bitmask(int p_id, Vector2 p_coord); |