From 9b9117b2f1212a32cedb68c58825e7a9049a179e Mon Sep 17 00:00:00 2001 From: luboslenco Date: Tue, 31 Mar 2020 17:39:29 +0200 Subject: [PATCH] Improve brush preview icon --- Sources/arm/Layers.hx | 1 + Sources/arm/io/ImportArm.hx | 16 ++++++++-------- Sources/arm/util/RenderUtil.hx | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Sources/arm/Layers.hx b/Sources/arm/Layers.hx index 5f7777f5..ed8bbd69 100644 --- a/Sources/arm/Layers.hx +++ b/Sources/arm/Layers.hx @@ -103,6 +103,7 @@ class Layers { rts.get("texpaint_blur").raw.height = size; rts.get("texpaint_blur").image = Image.createRenderTarget(size, size); } + if (RenderPathPaint.liveLayer != null) RenderPathPaint.liveLayer.resizeAndSetBits(); #if kha_direct3d12 arm.render.RenderPathRaytrace.ready = false; // Rebuild baketex #end diff --git a/Sources/arm/io/ImportArm.hx b/Sources/arm/io/ImportArm.hx index f736875b..8823e235 100644 --- a/Sources/arm/io/ImportArm.hx +++ b/Sources/arm/io/ImportArm.hx @@ -121,8 +121,15 @@ class ImportArm { } Project.raw = project; - var base = Path.baseDir(path); + var l0 = project.layer_datas[0]; + App.resHandle.position = Config.getTextureResPos(l0.res); + var bitsPos = l0.bpp == 8 ? Bits8 : l0.bpp == 16 ? Bits16 : Bits32; + App.bitsHandle.position = bitsPos; + var bytesPerPixel = Std.int(l0.bpp / 8); + var format = l0.bpp == 8 ? TextureFormat.RGBA32 : l0.bpp == 16 ? TextureFormat.RGBA64 : TextureFormat.RGBA128; + + var base = Path.baseDir(path); for (file in project.assets) { #if krom_windows file = file.replace("/", "\\"); @@ -193,13 +200,6 @@ class ImportArm { Context.paintObject.skip_context = "paint"; Context.mergedObject.visible = true; - var l0 = project.layer_datas[0]; - App.resHandle.position = Config.getTextureResPos(l0.res); - var bitsPos = l0.bpp == 8 ? Bits8 : l0.bpp == 16 ? Bits16 : Bits32; - App.bitsHandle.position = bitsPos; - var bytesPerPixel = Std.int(l0.bpp / 8); - var format = l0.bpp == 8 ? TextureFormat.RGBA32 : l0.bpp == 16 ? TextureFormat.RGBA64 : TextureFormat.RGBA128; - if (Project.layers[0].texpaint.width != Config.getTextureRes()) { for (l in Project.layers) l.resizeAndSetBits(); if (History.undoLayers != null) for (l in History.undoLayers) l.resizeAndSetBits(); diff --git a/Sources/arm/util/RenderUtil.hx b/Sources/arm/util/RenderUtil.hx index 7d0a67b1..fb8995d6 100644 --- a/Sources/arm/util/RenderUtil.hx +++ b/Sources/arm/util/RenderUtil.hx @@ -307,6 +307,7 @@ class RenderUtil { Context.lastPaintVecY = pointsY[i - 1]; Context.paintVec.x = pointsX[i]; Context.paintVec.y = pointsY[i]; + Context.parseBrushInputs(); RenderPathPaint.commandsPaint(); }