From d3fb9e930d01f4ab2618bcfb84a6ad5f6fdf42d3 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Tue, 10 Mar 2020 14:51:37 +0100 Subject: [PATCH] Improve brush preview --- Sources/arm/render/RenderPathPaint.hx | 95 ++++++++++++++------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/Sources/arm/render/RenderPathPaint.hx b/Sources/arm/render/RenderPathPaint.hx index 204bfb7e..67c69fc5 100644 --- a/Sources/arm/render/RenderPathPaint.hx +++ b/Sources/arm/render/RenderPathPaint.hx @@ -330,6 +330,7 @@ class RenderPathPaint { UITrait.inst.lastPaintVecY = UITrait.inst.lastPaintY; } + commandsSymetry(); commandsPaint(); useLiveLayer(false); @@ -393,6 +394,53 @@ class RenderPathPaint { path.end(); } + static function commandsSymetry() { + if (UITrait.inst.symX || UITrait.inst.symY || UITrait.inst.symZ) { + Context.ddirty = 2; + var t = Context.paintObject.transform; + var sx = t.scale.x; + var sy = t.scale.y; + var sz = t.scale.z; + if (UITrait.inst.symX) { + t.scale.set(-sx, sy, sz); + t.buildMatrix(); + commandsPaint(); + } + if (UITrait.inst.symY) { + t.scale.set(sx, -sy, sz); + t.buildMatrix(); + commandsPaint(); + } + if (UITrait.inst.symZ) { + t.scale.set(sx, sy, -sz); + t.buildMatrix(); + commandsPaint(); + } + if (UITrait.inst.symX && UITrait.inst.symY) { + t.scale.set(-sx, -sy, sz); + t.buildMatrix(); + commandsPaint(); + } + if (UITrait.inst.symX && UITrait.inst.symZ) { + t.scale.set(-sx, sy, -sz); + t.buildMatrix(); + commandsPaint(); + } + if (UITrait.inst.symY && UITrait.inst.symZ) { + t.scale.set(sx, -sy, -sz); + t.buildMatrix(); + commandsPaint(); + } + if (UITrait.inst.symX && UITrait.inst.symY && UITrait.inst.symZ) { + t.scale.set(-sx, -sy, -sz); + t.buildMatrix(); + commandsPaint(); + } + t.scale.set(sx, sy, sz); + t.buildMatrix(); + } + } + public static function begin() { pushUndoLast = History.pushUndo; if (History.pushUndo && History.undoLayers != null) { @@ -469,51 +517,8 @@ class RenderPathPaint { } if (History.undoLayers != null) { - // Symmetry - if (UITrait.inst.symX || UITrait.inst.symY || UITrait.inst.symZ) { - Context.ddirty = 2; - var t = Context.paintObject.transform; - var sx = t.scale.x; - var sy = t.scale.y; - var sz = t.scale.z; - if (UITrait.inst.symX) { - t.scale.set(-sx, sy, sz); - t.buildMatrix(); - commandsPaint(); - } - if (UITrait.inst.symY) { - t.scale.set(sx, -sy, sz); - t.buildMatrix(); - commandsPaint(); - } - if (UITrait.inst.symZ) { - t.scale.set(sx, sy, -sz); - t.buildMatrix(); - commandsPaint(); - } - if (UITrait.inst.symX && UITrait.inst.symY) { - t.scale.set(-sx, -sy, sz); - t.buildMatrix(); - commandsPaint(); - } - if (UITrait.inst.symX && UITrait.inst.symZ) { - t.scale.set(-sx, sy, -sz); - t.buildMatrix(); - commandsPaint(); - } - if (UITrait.inst.symY && UITrait.inst.symZ) { - t.scale.set(sx, -sy, -sz); - t.buildMatrix(); - commandsPaint(); - } - if (UITrait.inst.symX && UITrait.inst.symY && UITrait.inst.symZ) { - t.scale.set(-sx, -sy, -sz); - t.buildMatrix(); - commandsPaint(); - } - t.scale.set(sx, sy, sz); - t.buildMatrix(); - } + + commandsSymetry(); if (Context.tool == ToolBake) { if (Context.pdirty > 0) dilated = false;