aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/plugins/tile_map_editor_plugin.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2016-01-25 10:30:47 -0300
committerJuan Linietsky2016-01-25 10:30:47 -0300
commit5245adcf81dd61ddb4eac048f6b004f3f455d7ed (patch)
tree272c46c2ee422d9fe6d4dfaeca51fa52c264ffb3 /tools/editor/plugins/tile_map_editor_plugin.cpp
parent07e79094802a2eb2d7c0cd64cecf673db386ec5a (diff)
parent87517c564b83218871ac53afdad375a9501e6cb8 (diff)
downloadgodot-5245adcf81dd61ddb4eac048f6b004f3f455d7ed.tar.gz
godot-5245adcf81dd61ddb4eac048f6b004f3f455d7ed.tar.zst
godot-5245adcf81dd61ddb4eac048f6b004f3f455d7ed.zip
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'tools/editor/plugins/tile_map_editor_plugin.cpp')
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index 29326a222..acacd37f6 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -533,6 +533,8 @@ void TileMapEditor::_canvas_draw() {
if (node->get_half_offset()!=TileMap::HALF_OFFSET_X) {
+ int max_lines=2000; //avoid crash if size too smal
+
for(int i=(si.pos.x)-1;i<=(si.pos.x+si.size.x);i++) {
Vector2 from = xform.xform(node->map_to_world(Vector2(i,si.pos.y)));
@@ -540,10 +542,12 @@ void TileMapEditor::_canvas_draw() {
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
-
+ if (max_lines--==0)
+ break;
}
} else {
+ int max_lines=10000; //avoid crash if size too smal
for(int i=(si.pos.x)-1;i<=(si.pos.x+si.size.x);i++) {
@@ -558,11 +562,17 @@ void TileMapEditor::_canvas_draw() {
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);
canvas_item_editor->draw_line(from,to,col,1);
+
+ if (max_lines--==0)
+ break;
+
}
}
}
+ int max_lines=10000; //avoid crash if size too smal
+
if (node->get_half_offset()!=TileMap::HALF_OFFSET_Y) {
for(int i=(si.pos.y)-1;i<=(si.pos.y+si.size.y);i++) {
@@ -573,6 +583,9 @@ void TileMapEditor::_canvas_draw() {
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
+ if (max_lines--==0)
+ break;
+
}
} else {
@@ -590,6 +603,10 @@ void TileMapEditor::_canvas_draw() {
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);
canvas_item_editor->draw_line(from,to,col,1);
+
+ if (max_lines--==0)
+ break;
+
}
}