Fix #1130 Convert to mesh ignores cubes inflate value

Fix #1121 Issue with textures with different ratio
Fix issue where material icons starting with "fa" are not recognized
This commit is contained in:
JannisX11 2021-10-23 13:44:43 +02:00
parent def95852b5
commit 16f15b7aad
5 changed files with 20 additions and 15 deletions

View File

@ -1316,7 +1316,7 @@
}
.uv_painter_info span {
margin: 3px 6px;
flex: 1 1 80px;
flex: 1 1 auto;
overflow: hidden;
white-space: nowrap;
text-align: center;

View File

@ -56,7 +56,7 @@ const Blockbench = {
node = document.createElement('i');
node.classList.add('fa_big', 'icon');
} else if (icon.substr(0, 2) === 'fa') {
} else if (icon.match(/^(fa[.-])|(fa[rsb]\.)/)) {
//Font Awesome
node = document.createElement('i');
node.classList.add('fa_big', 'icon');

View File

@ -1114,8 +1114,10 @@ new NodePreviewController(Cube, {
//lines
var height = end[1]-start[1];
var step = Math.abs( height / uv_size[1] );
let tex_height = texture.frameCount ? (texture.height / texture.frameCount) : texture.height;
if (texture) step *= Project.texture_height / tex_height;
if (texture) {
let tex_height = texture.frameCount ? (texture.height / texture.frameCount) : texture.height;
step *= Project.texture_height / tex_height;
}
if (step < epsilon) step = epsilon;
for (var line = start[1] - uv_offset[1]; line <= end[1]; line += step) {

View File

@ -1400,14 +1400,14 @@ BARS.defineActions(function() {
origin: cube.origin,
rotation: cube.rotation,
vertices: [
[cube.to[0] - cube.origin[0], cube.to[1] - cube.origin[1], cube.to[2] - cube.origin[2]],
[cube.to[0] - cube.origin[0], cube.to[1] - cube.origin[1], cube.from[2] - cube.origin[2]],
[cube.to[0] - cube.origin[0], cube.from[1] - cube.origin[1], cube.to[2] - cube.origin[2]],
[cube.to[0] - cube.origin[0], cube.from[1] - cube.origin[1], cube.from[2] - cube.origin[2]],
[cube.from[0] - cube.origin[0], cube.to[1] - cube.origin[1], cube.to[2] - cube.origin[2]],
[cube.from[0] - cube.origin[0], cube.to[1] - cube.origin[1], cube.from[2] - cube.origin[2]],
[cube.from[0] - cube.origin[0], cube.from[1] - cube.origin[1], cube.to[2] - cube.origin[2]],
[cube.from[0] - cube.origin[0], cube.from[1] - cube.origin[1], cube.from[2] - cube.origin[2]],
[cube.to[0] + cube.inflate - cube.origin[0], cube.to[1] + cube.inflate - cube.origin[1], cube.to[2] + cube.inflate - cube.origin[2]],
[cube.to[0] + cube.inflate - cube.origin[0], cube.to[1] + cube.inflate - cube.origin[1], cube.from[2] - cube.inflate - cube.origin[2]],
[cube.to[0] + cube.inflate - cube.origin[0], cube.from[1] - cube.inflate - cube.origin[1], cube.to[2] + cube.inflate - cube.origin[2]],
[cube.to[0] + cube.inflate - cube.origin[0], cube.from[1] - cube.inflate - cube.origin[1], cube.from[2] - cube.inflate - cube.origin[2]],
[cube.from[0] - cube.inflate - cube.origin[0], cube.to[1] + cube.inflate - cube.origin[1], cube.to[2] + cube.inflate - cube.origin[2]],
[cube.from[0] - cube.inflate - cube.origin[0], cube.to[1] + cube.inflate - cube.origin[1], cube.from[2] - cube.inflate - cube.origin[2]],
[cube.from[0] - cube.inflate - cube.origin[0], cube.from[1] - cube.inflate - cube.origin[1], cube.to[2] + cube.inflate - cube.origin[2]],
[cube.from[0] - cube.inflate - cube.origin[0], cube.from[1] - cube.inflate - cube.origin[1], cube.from[2] - cube.inflate - cube.origin[2]],
],
})

View File

@ -56,6 +56,7 @@ const UVEditor = {
result.y = Math.floor(event.offsetY/pixel_size*1 + offset);
}
if (tex.frameCount) result.y += (tex.height / tex.frameCount) * tex.currentFrame;
if (!tex.frameCount && tex.ratio != Project.texture_width / Project.texture_height) result.y /= tex.ratio;
return result;
},
startPaintTool(event) {
@ -1230,6 +1231,8 @@ const UVEditor = {
condition: !(option == 'selected_faces' && Project.box_uv && !Mesh.selected.length),
click() {
Project.display_uv = UVEditor.vue.display_uv = option;
if (option == 'selected_faces') settings.show_only_selected_uv.set(true);
if (option == 'selected_elements') settings.show_only_selected_uv.set(false);
}
}})
}},
@ -1349,7 +1352,7 @@ const UVEditor = {
})
UVEditor.loadData()
UVEditor.message('uv_editor.reset')
Undo.initEdit('texture blank')
Undo.finishEdit('Apply blank texture')
}},
{icon: 'clear', name: 'menu.cube.texture.transparent', condition: () => UVEditor.getReferenceFace() instanceof CubeFace, click: function() {UVEditor.clear(event)}},
]
@ -2535,8 +2538,8 @@ Interface.definePanels(function() {
<div id="uv_brush_outline" v-if="mode == 'paint' && mouse_coords.x >= 0" :style="getBrushOutlineStyle()"></div>
<img style="object-fit: cover;" :style="{objectPosition: \`0 -\${texture.currentFrame * inner_height}px\`}" v-if="texture && texture.error != 1" :src="texture.source">
<img style="object-fit: cover; opacity: 0.02; mix-blend-mode: screen;" v-if="texture == 0 && !box_uv" src="./assets/missing_blend.png">
<img :style="{objectFit: texture.frameCount > 1 ? 'cover' : 'fill', objectPosition: \`0 -\${texture.currentFrame * inner_height}px\`}" v-if="texture && texture.error != 1" :src="texture.source">
<img style="object-fit: fill; opacity: 0.02; mix-blend-mode: screen;" v-if="texture == 0 && !box_uv" src="./assets/missing_blend.png">
</div>
<div class="uv_transparent_face" v-else-if="selected_faces.length">${tl('uv_editor.transparent_face')}</div>