Fix #1611 Issue with mirror painting on meshes

Fix block model texture import issue
Fix cube size restriction box not updating between formats
This commit is contained in:
JannisX11 2022-10-18 17:41:47 +02:00
parent 5bd0ebbfc3
commit d4f72bc6df
4 changed files with 12 additions and 7 deletions

View File

@ -1275,6 +1275,7 @@ var block_format = new ModelFormat({
texture_meshes: true,
cube_size_limiter: {
rotation_affected: true,
box_marker_size: [30, 30, 30],
updateBoxMarker() {
let center = Format.cube_size_limiter.getModelCenter();
three_grid.size_limit_box.position.set(center[0] + center[3], center[1] + center[4], center[2] + center[5]).divideScalar(2);

View File

@ -303,7 +303,7 @@ var codec = new Codec('java_block', {
link = texture_arr[link.substring(1)];
}
let texture = new Texture({id: key}).fromJavaLink(texture_arr[key], path_arr.slice()).add();
texture_paths[texture_arr[key]] = texture_ids[key] = texture;
texture_paths[texture_arr[key].replace(/^minecraft:/, '')] = texture_ids[key] = texture;
new_textures.push(texture);
}
}
@ -312,11 +312,11 @@ var codec = new Codec('java_block', {
if (link.startsWith('#') && texture_arr[link.substring(1)]) {
link = texture_arr[link.substring(1)];
}
if (texture_paths[link]) {
texture_paths[link].enableParticle()
if (texture_paths[link.replace(/^minecraft:/, '')]) {
texture_paths[link.replace(/^minecraft:/, '')].enableParticle()
} else {
let texture = new Texture({id: 'particle'}).fromJavaLink(link, path_arr.slice()).enableParticle().add();
texture_paths[link] = texture_ids.particle = texture;
texture_paths[link.replace(/^minecraft:/, '')] = texture_ids.particle = texture;
new_textures.push(texture);
}
}

View File

@ -524,7 +524,8 @@ const Canvas = {
}
}
if (settings.large_box.value === true) {
var geometry_box = new THREE.EdgesGeometry(new THREE.BoxBufferGeometry(30, 30, 30));
let size = Format.cube_size_limiter?.box_marker_size || [48, 48, 48];
var geometry_box = new THREE.EdgesGeometry(new THREE.BoxBufferGeometry(...size));
var line_material = new THREE.LineBasicMaterial({color: gizmo_colors.grid});
var large_box = new THREE.LineSegments( geometry_box, line_material);

View File

@ -666,8 +666,8 @@ const Painter = {
if (!face) return;
let source_uv = [
even_brush_size ? x : x + 0.5,
even_brush_size ? y : y + 0.5
(even_brush_size ? x : x + 0.5) * (Project.texture_width / texture.width),
(even_brush_size ? y : y + 0.5) * (Project.texture_height / texture.height)
];
let point_on_uv;
@ -700,6 +700,9 @@ const Painter = {
point_on_uv = face.localToUV(world_coord);
}
point_on_uv[0] /= Project.texture_width / texture.width;
point_on_uv[1] /= Project.texture_height / texture.height;
if (Condition(Toolbox.selected.brush?.floor_coordinates)) {
if (even_brush_size) {
point_on_uv = point_on_uv.map(v => Math.round(v))