diff --git a/js/animations/timeline.js b/js/animations/timeline.js index e36519fe..adc355fb 100644 --- a/js/animations/timeline.js +++ b/js/animations/timeline.js @@ -496,7 +496,6 @@ const Timeline = { Timeline.pause() } else { Timeline.setTime(0) - Timeline.start() } } }, diff --git a/js/texturing/painter.js b/js/texturing/painter.js index d2df7dd8..d4ca1c16 100644 --- a/js/texturing/painter.js +++ b/js/texturing/painter.js @@ -568,7 +568,6 @@ const Painter = { ctx.globalCompositeOperation = 'source-over' }, getMirrorPaintTargets(texture, x, y, uvTag) { - if (!uvTag || !Painter.current.element) return; function getTargetWithOptions(symmetry_axes, local) { let mirror_element = local ? Painter.current.element : Painter.getMirrorElement(Painter.current.element, symmetry_axes); let even_brush_size = BarItems.slider_brush_size.get()%2 == 0 && Toolbox.selected.brush?.offset_even_radius && Condition(Toolbox.selected.brush?.floor_coordinates); @@ -681,36 +680,60 @@ const Painter = { } } } + let targets = []; - let mirror_vectors = [[ - Painter.mirror_painting_options.axis.x?1:0, - Painter.mirror_painting_options.axis.y?1:0, - Painter.mirror_painting_options.axis.z?1:0 - ]]; - if (mirror_vectors[0].filter(v => v).length == 3) { - mirror_vectors = [ - [1,0,0], [0,1,0], [0,0,1], - [1,1,0], [0,1,1], [1,0,1], - [1,1,1] - ] - } else if (mirror_vectors[0].equals([1, 1, 0])) { - mirror_vectors = [[1,0,0], [0,1,0], [1,1,0]]; + if (uvTag & Painter.current.element) { + let mirror_vectors = [[ + Painter.mirror_painting_options.axis.x?1:0, + Painter.mirror_painting_options.axis.y?1:0, + Painter.mirror_painting_options.axis.z?1:0 + ]]; + if (mirror_vectors[0].filter(v => v).length == 3) { + mirror_vectors = [ + [1,0,0], [0,1,0], [0,0,1], + [1,1,0], [0,1,1], [1,0,1], + [1,1,1] + ] + } else if (mirror_vectors[0].equals([1, 1, 0])) { + mirror_vectors = [[1,0,0], [0,1,0], [1,1,0]]; - } else if (mirror_vectors[0].equals([0, 1, 1])) { - mirror_vectors = [[0,1,0], [0,0,1], [0,1,1]]; + } else if (mirror_vectors[0].equals([0, 1, 1])) { + mirror_vectors = [[0,1,0], [0,0,1], [0,1,1]]; - } else if (mirror_vectors[0].equals([1, 0, 1])) { - mirror_vectors = [[1,0,0], [0,0,1], [1,0,1]]; + } else if (mirror_vectors[0].equals([1, 0, 1])) { + mirror_vectors = [[1,0,0], [0,0,1], [1,0,1]]; + } + mirror_vectors.forEach((mirror_vector, i) => { + if (Painter.mirror_painting_options.global) { + targets.push(getTargetWithOptions(mirror_vector, false)); + } + if (Painter.mirror_painting_options.local) { + targets.push(getTargetWithOptions(mirror_vector, true)); + } + }) } - mirror_vectors.forEach((mirror_vector, i) => { - if (Painter.mirror_painting_options.global) { - targets.push(getTargetWithOptions(mirror_vector, false)); - } - if (Painter.mirror_painting_options.local) { - targets.push(getTargetWithOptions(mirror_vector, true)); - } - }) // Texture animation + if (Painter.mirror_painting_options.texture_frames && Format.animated_textures && texture && texture.frameCount > 1) { + let spatial_targets = targets.slice(); + for (let frame = 0; frame < texture.frameCount; frame++) { + if (frame == texture.currentFrame) continue; + + targets.push({ + element: Painter.current.element, + x, + y: y + (frame - texture.currentFrame) * texture.display_height, + face: Painter.current.face + }); + spatial_targets.forEach(spatial => { + targets.push({ + element: spatial.element, + x: spatial.x, + y: spatial.y + (frame - texture.currentFrame) * texture.display_height, + face: spatial.face + }); + }) + } + } return targets.filter(target => !!target); }, drawBrushLine(texture, end_x, end_y, event, new_face, uv) { diff --git a/js/texturing/uv.js b/js/texturing/uv.js index 8f8092f4..5b28768c 100644 --- a/js/texturing/uv.js +++ b/js/texturing/uv.js @@ -1908,6 +1908,8 @@ Interface.definePanels(function() { if (this.texture && this.texture.display_canvas) { Vue.nextTick(() => { let wrapper = this.$refs.texture_canvas_wrapper; + this.texture.canvas.style.objectPosition = `0 ${-this.texture.currentFrame * this.inner_height}px`; + this.texture.canvas.style.objectFit = this.texture.frameCount > 1 ? 'cover' : 'fill'; wrapper.append(this.texture.canvas); }) }