Brush preview fixes

This commit is contained in:
Lubos Lenco
2022-01-27 21:57:13 +01:00
parent eb6c1ea131
commit 8b43e2f7f2
4 changed files with 22 additions and 6 deletions
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

+15 -3
View File
@@ -107,9 +107,21 @@ class TabBrushes {
}
}, 3 + add);
}
if (ui.isHovered && imgFull != null) {
ui.tooltipImage(imgFull);
ui.tooltip(Project.brushes[i].canvas.name);
if (ui.isHovered) {
if (imgFull == null) {
iron.App.notifyOnInit(function() {
var _brush = Context.brush;
Context.brush = Project.brushes[i];
MakeMaterial.parseBrush();
RenderUtil.makeBrushPreview();
Context.brush = _brush;
});
}
else {
ui.tooltipImage(imgFull);
ui.tooltip(Project.brushes[i].canvas.name);
}
}
if (Config.raw.show_asset_names) {
+7 -3
View File
@@ -229,6 +229,7 @@ class RenderUtil {
public static function makeBrushPreview() {
if (RenderPathPaint.liveLayerLocked) return;
Context.materialPreview = true;
var current = @:privateAccess kha.graphics2.Graphics.current;
if (current != null) current.end();
@@ -337,11 +338,13 @@ class RenderUtil {
RenderPathPaint.liveLayerDrawn = 0;
RenderPathDeferred.drawGbuffer();
// Paint brush preview
var _brushRadius = Context.brushRadius;
var _brushOpacity = Context.brushOpacity;
var _brushHardness = Context.brushHardness;
Context.brushRadius = 0.25;
Context.brushRadius = 0.33;
Context.brushOpacity = 1.0;
Context.brushHardness = 0.8;
var _x = Context.paintVec.x;
@@ -352,9 +355,9 @@ class RenderUtil {
Context.pdirty = 2;
// var pointsX = [0.2, 0.5, 0.5, 0.8, 0.8];
// var pointsY = [0.5, 0.2, 0.6, 0.3, 0.7];
// var pointsY = [0.5, 0.2 - 0.08, 0.6 + 0.03, 0.3 - 0.05, 0.7 + 0.05];
var pointsX = [0.2, 0.2, 0.35, 0.5, 0.5, 0.5, 0.65, 0.8, 0.8, 0.8];
var pointsY = [0.5, 0.5, 0.35, 0.2, 0.4, 0.6, 0.45, 0.3, 0.5, 0.7];
var pointsY = [0.5, 0.5, 0.35 - 0.04, 0.2 - 0.08, 0.4 + 0.015, 0.6 + 0.03, 0.45 - 0.025, 0.3 - 0.05, 0.5 + 0.025, 0.7 + 0.05];
for (i in 1...pointsX.length) {
Context.lastPaintVecX = pointsX[i - 1];
Context.lastPaintVecY = pointsY[i - 1];
@@ -386,6 +389,7 @@ class RenderUtil {
iron.App.notifyOnInit(_init);
// Restore paint mesh
Context.materialPreview = false;
planeo.visible = false;
for (i in 0...Project.paintObjects.length) {
Project.paintObjects[i].visible = visibles[i];