Fix UV editor not using texture transform

(cherry picked from commit d7e5c25e4a)
This commit is contained in:
aXu-AP 2024-01-23 20:20:18 +01:00 committed by Yuri Sizov
parent 98cfa8bcf2
commit 8a395124e6
1 changed files with 4 additions and 1 deletions

View File

@ -980,7 +980,10 @@ void Polygon2DEditor::_uv_draw() {
mtx.columns[2] = -uv_draw_ofs; mtx.columns[2] = -uv_draw_ofs;
mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom)); mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom));
RS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(), mtx); Transform2D texture_transform = Transform2D(node->get_texture_rotation(), node->get_texture_offset());
texture_transform.scale(node->get_texture_scale());
texture_transform.affine_invert();
RS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(), mtx * texture_transform);
uv_edit_draw->draw_texture(base_tex, Point2()); uv_edit_draw->draw_texture(base_tex, Point2());
RS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(), Transform2D()); RS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(), Transform2D());