Skip to content

Commit

Permalink
Fix #2133 issue when generating templates
Browse files Browse the repository at this point in the history
Fix UV resolution changing when converting projects
Fix missing option to disable color when appending to template
  • Loading branch information
JannisX11 committed Dec 4, 2023
1 parent 60162a1 commit fded5cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions js/io/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ class ModelFormat {
})
}

if (!Format.per_texture_uv_size && old_format.per_texture_uv_size) {
let tex = Texture.getDefault();
if (tex) {
Project.texture_width = tex.uv_width;
Project.texture_height = tex.uv_height;
}
}
if (Format.per_texture_uv_size && !old_format.per_texture_uv_size) {
Texture.all.forEach(tex => {
tex.uv_width = Project.texture_width;
tex.uv_height = Project.texture_height;
})
}

//Bone Rig
if (!Format.bone_rig && old_format.bone_rig) {
Group.all.forEach(group => {
Expand Down
4 changes: 2 additions & 2 deletions js/texturing/texture_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const TextureGenerator = {
title: tl('action.append_to_template'),
width: 480,
form: {
color: {label: 'data.color', type: 'color', colorpicker: TextureGenerator.background_color},
color: {label: 'data.color', type: 'color', colorpicker: TextureGenerator.background_color, toggle_enabled: true, toggle_default: false},
box_uv: {label: 'dialog.project.uv_mode.box_uv', type: 'checkbox', value: false, condition: (form) => (!Project.box_uv && Cube.all.length)},
compress: {label: 'dialog.create_texture.compress', description: 'dialog.create_texture.compress.desc', type: 'checkbox', value: true, condition: (form) => Project.box_uv},
power: {label: 'dialog.create_texture.power', description: 'dialog.create_texture.power.desc', type: 'checkbox', value: Math.isPowerOfTwo(texture.width)},
Expand Down Expand Up @@ -1728,7 +1728,7 @@ const TextureGenerator = {
}
let changed_elements = [];

if (!Project.box_uv && !Format.single_texture && (factor_x !== 1 || factor_y !== 1)) {
if (!Project.box_uv && !Format.single_texture && !Format.per_texture_uv_size && (factor_x !== 1 || factor_y !== 1)) {
changed_elements = Outliner.elements.filter(el => el.faces && !el.selected);
Undo.current_save.addElements(changed_elements, {uv_only: true});

Expand Down

1 comment on commit fded5cd

@cyanbug01
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...what am I supposed to do? Did you patch it?

Please sign in to comment.