From 951cc71ac43989dc2aaca570227a8adcb9bc9510 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sat, 11 Jan 2020 10:39:14 +0100 Subject: [PATCH] Draw grayscale mask --- Sources/arm/ui/TabLayers.hx | 5 +++++ Sources/arm/ui/UIView2D.hx | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Sources/arm/ui/TabLayers.hx b/Sources/arm/ui/TabLayers.hx index 474244a4..54b23657 100644 --- a/Sources/arm/ui/TabLayers.hx +++ b/Sources/arm/ui/TabLayers.hx @@ -133,7 +133,12 @@ class TabLayers { var uiy = ui._y; ui._x += Std.int(4 * ui.SCALE()); ui._y += 3; + + ui.g.pipeline = UIView2D.inst.pipe; + ui.currentWindow.texture.g4.setInt(UIView2D.inst.channelLocation, 1); var state = ui.image(l.texpaint_mask_preview, 0xffffffff, (ui.ELEMENT_H() - 3) * 2); + ui.g.pipeline = null; + ui._x -= Std.int(4 * ui.SCALE()); ui._y -= 3; if (ui.isHovered) { diff --git a/Sources/arm/ui/UIView2D.hx b/Sources/arm/ui/UIView2D.hx index b7f9df2f..0e017d77 100644 --- a/Sources/arm/ui/UIView2D.hx +++ b/Sources/arm/ui/UIView2D.hx @@ -28,8 +28,8 @@ class UIView2D { public var panX = 0.0; public var panY = 0.0; public var panScale = 1.0; - var pipe: PipelineState; - var channelLocation: ConstantLocation; + public var pipe: PipelineState; + public var channelLocation: ConstantLocation; var texType = TexBase; var uvmapShow = false; @@ -107,6 +107,7 @@ class UIView2D { l.texpaint_pack; channel = + Context.layerIsMask ? 1 : texType == TexOcclusion ? 1 : texType == TexRoughness ? 2 : texType == TexMetallic ? 3 : @@ -182,9 +183,13 @@ class UIView2D { ui._x = 2; ui._y = 2; ui._w = ew; - texType = ui.combo(Id.handle({position: texType}), ["Base Color", "Normal Map", "Occlusion", "Roughness", "Metallic"], "Texture"); - ui._x += ew + 3; - ui._y = 2; + + if (!Context.layerIsMask) { + texType = ui.combo(Id.handle({position: texType}), ["Base Color", "Normal Map", "Occlusion", "Roughness", "Metallic"], "Texture"); + ui._x += ew + 3; + ui._y = 2; + } + uvmapShow = ui.check(Id.handle({selected: uvmapShow}), "UV Map"); ui._x += ew + 3; ui._y = 2;