Improve brush preview

This commit is contained in:
luboslenco
2020-03-10 14:51:37 +01:00
parent bb9a2182a7
commit d3fb9e930d
+50 -45
View File
@@ -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;