Per texture UV workflow improvements

This commit is contained in:
JannisX11 2023-12-13 14:45:30 +01:00
parent 08d86dfd79
commit 75ba67c84c
2 changed files with 12 additions and 6 deletions

View File

@ -161,6 +161,10 @@ const TextureGenerator = {
let texture = cb(canvas.toDataURL());
texture.uv_width = width;
texture.uv_height = height;
if (Format.per_texture_uv_size) {
Project.texture_width = width;
Project.texture_height = height;
}
return texture;
},
//constructors
@ -1719,10 +1723,10 @@ const TextureGenerator = {
changeUVResolution(width, height, texture) {
let factor_x = width / Project.getUVWidth(texture);
let factor_y = height / Project.getUVHeight(texture);
if (!Format.per_texture_uv_size) {
Project.texture_width = width;
Project.texture_height = height;
}
Project.texture_width = width;
Project.texture_height = height;
if (texture) {
texture.uv_width = width;
texture.uv_height = height;

View File

@ -1279,8 +1279,10 @@ class Texture {
} else if (Format.single_texture || Texture.all.length == 1 || Format.per_texture_uv_size) {
if (Format.per_texture_uv_size) {
scope.uv_width = Project.texture_width * (formResult.size[0] / old_width);
scope.uv_height = Project.texture_height * (formResult.size[1] / old_height);
scope.uv_width = scope.uv_width * (formResult.size[0] / old_width);
scope.uv_height = scope.uv_height * (formResult.size[1] / old_height);
Project.texture_width = scope.uv_width;
Project.texture_height = scope.uv_height;
} else {
Undo.current_save.uv_mode = {
box_uv: Project.box_uv,