summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-03-27 17:20:56 +0100
committerGitHub <noreply@github.com>2019-03-27 17:20:56 +0100
commit37969e71e484f3de3ca89d5b5fcba3679a95bfc5 (patch)
treeab26cc804f1dfd952c76568ed1727144fa11085e
parentb6fb7b51900b31bfa54c3280c473c79a2890267e (diff)
parent601acdf0e14ae2f966db6f4b885a5d804b1885aa (diff)
Merge pull request #27383 from SpechtMagnus/master
TileMap: Fixed unfinished max_lines draw handling for freeze/crash avoidance.
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 1a367b61dd..b1fc14e88a 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -1463,12 +1463,15 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
Vector2 from = xform.xform(node->map_to_world(Vector2(i, j), true) + ofs);
Vector2 to = xform.xform(node->map_to_world(Vector2(i, j + 1), true) + ofs);
+
Color col = i == 0 ? Color(1, 0.8, 0.2, 0.5) : Color(1, 0.3, 0.1, 0.2);
p_overlay->draw_line(from, to, col, 1);
- if (max_lines-- == 0)
+ if (--max_lines == 0)
break;
}
+ if (max_lines == 0)
+ break;
}
}
@@ -1500,12 +1503,15 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
Vector2 from = xform.xform(node->map_to_world(Vector2(j, i), true) + ofs);
Vector2 to = xform.xform(node->map_to_world(Vector2(j + 1, i), true) + ofs);
+
Color col = i == 0 ? Color(1, 0.8, 0.2, 0.5) : Color(1, 0.3, 0.1, 0.2);
p_overlay->draw_line(from, to, col, 1);
- if (max_lines-- == 0)
+ if (--max_lines == 0)
break;
}
+ if (max_lines == 0)
+ break;
}
}
}