mirror of
https://github.com/godotengine/godot.git
synced 2025-10-24 18:33:36 +00:00
Make tilemap texture origin point top-left.
Fix https://github.com/godotengine/godot/issues/29487. In this commit: https://github.com/godotengine/godot/pull/28896 bad offset of textures and shapes was fixed, but a center of texture was added too, and this seems not dessired by default because breaks too much compatibility with demos and user projects. A future Check box for center texture can be added
This commit is contained in:
parent
197b65f32a
commit
f26e9daab5
2 changed files with 8 additions and 5 deletions
|
|
@ -780,7 +780,8 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p
|
||||||
r.position += (r.size + Vector2(spacing, spacing)) * offset;
|
r.position += (r.size + Vector2(spacing, spacing)) * offset;
|
||||||
}
|
}
|
||||||
Size2 sc = p_xform.get_scale();
|
Size2 sc = p_xform.get_scale();
|
||||||
Size2 cell_size = node->get_cell_size();
|
/* For a future CheckBox to Center Texture:
|
||||||
|
Size2 cell_size = node->get_cell_size(); */
|
||||||
Rect2 rect = Rect2();
|
Rect2 rect = Rect2();
|
||||||
rect.position = node->map_to_world(p_point) + node->get_cell_draw_offset();
|
rect.position = node->map_to_world(p_point) + node->get_cell_draw_offset();
|
||||||
|
|
||||||
|
|
@ -792,10 +793,11 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p
|
||||||
|
|
||||||
if (p_transpose) {
|
if (p_transpose) {
|
||||||
SWAP(tile_ofs.x, tile_ofs.y);
|
SWAP(tile_ofs.x, tile_ofs.y);
|
||||||
|
/* For a future CheckBox to Center Texture:
|
||||||
rect.position.x += cell_size.x / 2 - rect.size.y / 2;
|
rect.position.x += cell_size.x / 2 - rect.size.y / 2;
|
||||||
rect.position.y += cell_size.y / 2 - rect.size.x / 2;
|
rect.position.y += cell_size.y / 2 - rect.size.x / 2;
|
||||||
} else {
|
} else {
|
||||||
rect.position += cell_size / 2 - rect.size / 2;
|
rect.position += cell_size / 2 - rect.size / 2; */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_flip_h) {
|
if (p_flip_h) {
|
||||||
|
|
|
||||||
|
|
@ -220,8 +220,8 @@ void TileMap::_fix_cell_transform(Transform2D &xform, const Cell &p_cell, const
|
||||||
xform.elements[1].y = -xform.elements[1].y;
|
xform.elements[1].y = -xform.elements[1].y;
|
||||||
offset.y = s.y - offset.y;
|
offset.y = s.y - offset.y;
|
||||||
}
|
}
|
||||||
|
/* For a future CheckBox to Center Texture:
|
||||||
offset += cell_size / 2 - s / 2;
|
offset += cell_size / 2 - s / 2; */
|
||||||
xform.elements[2] += offset;
|
xform.elements[2] += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -372,10 +372,11 @@ void TileMap::update_dirty_quadrants() {
|
||||||
|
|
||||||
if (c.transpose) {
|
if (c.transpose) {
|
||||||
SWAP(tile_ofs.x, tile_ofs.y);
|
SWAP(tile_ofs.x, tile_ofs.y);
|
||||||
|
/* For a future CheckBox to Center Texture:
|
||||||
rect.position.x += cell_size.x / 2 - rect.size.y / 2;
|
rect.position.x += cell_size.x / 2 - rect.size.y / 2;
|
||||||
rect.position.y += cell_size.y / 2 - rect.size.x / 2;
|
rect.position.y += cell_size.y / 2 - rect.size.x / 2;
|
||||||
} else {
|
} else {
|
||||||
rect.position += cell_size / 2 - rect.size / 2;
|
rect.position += cell_size / 2 - rect.size / 2; */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.flip_h) {
|
if (c.flip_h) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue