2D space mirror painting

Closes #1579
This commit is contained in:
JannisX11 2022-09-27 22:42:57 +02:00
parent 17c95d812b
commit 4271c7382a
2 changed files with 34 additions and 0 deletions

View File

@ -751,6 +751,31 @@ const Painter = {
}
})
}
// 2D
if (Painter.mirror_painting_options.texture && !Painter.current.element) {
let offset = 0;
if (!Toolbox.selected.brush || Condition(Toolbox.selected.brush.floor_coordinates)) {
offset = BarItems.slider_brush_size.get()%2 == 0 && Toolbox.selected.brush?.offset_even_radius ? 0 : 1;
}
if (Painter.mirror_painting_options.axis.x) {
targets.push({
x: texture.width - x - offset,
y: y
});
}
if (Painter.mirror_painting_options.axis.z) {
targets.push({
x: x,
y: texture.display_height - y - offset
});
}
if (Painter.mirror_painting_options.axis.x && Painter.mirror_painting_options.axis.z) {
targets.push({
x: texture.width - x - offset,
y: texture.display_height - y - offset
});
}
}
// Texture animation
if (Painter.mirror_painting_options.texture_frames && Format.animated_textures && texture && texture.frameCount > 1) {
let spatial_targets = targets.slice();
@ -2117,6 +2142,13 @@ BARS.defineActions(function() {
icon: () => !!Painter.mirror_painting_options.local,
click() {Painter.mirror_painting_options.local = !Painter.mirror_painting_options.local; StateMemory.save('mirror_painting_options')}
},
// Texture
{
name: 'menu.mirror_painting.texture',
description: 'menu.mirror_painting.texture.desc',
icon: () => !!Painter.mirror_painting_options.texture,
click() {Painter.mirror_painting_options.texture = !Painter.mirror_painting_options.texture; StateMemory.save('mirror_painting_options')}
},
// Animated Texture Frames
{
name: 'menu.mirror_painting.texture_frames',

View File

@ -1591,6 +1591,8 @@
"menu.mirror_painting.global.desc": "Enabled mirror painting on the model in global space",
"menu.mirror_painting.local": "Local Symmetry",
"menu.mirror_painting.local.desc": "Enable mirror painting in local space for each element",
"menu.mirror_painting.texture": "2D Editor Symmetry",
"menu.mirror_painting.texture.desc": "Enable mirror painting in 2D space on the image or texture",
"menu.mirror_painting.texture_frames": "Animated Texture Frames",
"menu.mirror_painting.texture_frames.desc": "Mirror paint strokes to every frame of animated textures",