summaryrefslogtreecommitdiff
path: root/editor/plugins/tile_set_editor_plugin.cpp
diff options
context:
space:
mode:
authorMariano Suligoy <marianognu.easyrpg@gmail.com>2017-11-30 21:50:09 -0300
committerMariano Suligoy <marianognu.easyrpg@gmail.com>2017-12-02 20:49:01 -0300
commitaf719a90a78687ac3d56367ef84696cc3b1c6434 (patch)
tree1b5e4f2ba4506b0673ead84b10b490e75f2996b6 /editor/plugins/tile_set_editor_plugin.cpp
parent4170e8f3dfefb46fb2309460a8b4a6540b627d2e (diff)
TileMap Fixes
Diffstat (limited to 'editor/plugins/tile_set_editor_plugin.cpp')
-rw-r--r--editor/plugins/tile_set_editor_plugin.cpp56
1 files changed, 41 insertions, 15 deletions
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index bbed7ff98d..eb2faa1ab1 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -1015,21 +1015,47 @@ void AutotileEditor::_on_tool_clicked(int p_tool) {
tile_set->autotile_clear_bitmask_map(get_current_tile());
workspace->update();
} else if (p_tool == SHAPE_DELETE) {
- if (!edited_collision_shape.is_null()) {
- Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile());
- int index;
- for (int i = 0; i < sd.size(); i++) {
- if (sd[i].shape == edited_collision_shape) {
- index = i;
- break;
- }
- }
- if (index >= 0) {
- sd.remove(index);
- tile_set->tile_set_shapes(get_current_tile(), sd);
- edited_collision_shape.unref();
- current_shape.resize(0);
- workspace->update();
+ if (creating_shape) {
+ creating_shape = false;
+ current_shape.resize(0);
+ workspace->update();
+ } else {
+ switch (edit_mode) {
+ case EDITMODE_COLLISION: {
+ if (!edited_collision_shape.is_null()) {
+ Vector<TileSet::ShapeData> sd = tile_set->tile_get_shapes(get_current_tile());
+ int index;
+ for (int i = 0; i < sd.size(); i++) {
+ if (sd[i].shape == edited_collision_shape) {
+ index = i;
+ break;
+ }
+ }
+ if (index >= 0) {
+ sd.remove(index);
+ tile_set->tile_set_shapes(get_current_tile(), sd);
+ edited_collision_shape = Ref<ConcavePolygonShape2D>();
+ current_shape.resize(0);
+ workspace->update();
+ }
+ }
+ } break;
+ case EDITMODE_NAVIGATION: {
+ if (!edited_navigation_shape.is_null()) {
+ tile_set->autotile_set_navigation_polygon(get_current_tile(), Ref<NavigationPolygon>(), edited_shape_coord);
+ edited_navigation_shape = Ref<NavigationPolygon>();
+ current_shape.resize(0);
+ workspace->update();
+ }
+ } break;
+ case EDITMODE_OCCLUSION: {
+ if (!edited_occlusion_shape.is_null()) {
+ tile_set->autotile_set_light_occluder(get_current_tile(), Ref<OccluderPolygon2D>(), edited_shape_coord);
+ edited_occlusion_shape = Ref<OccluderPolygon2D>();
+ current_shape.resize(0);
+ workspace->update();
+ }
+ } break;
}
}
} else if (p_tool == ZOOM_OUT) {