Show current color id in toolbar
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package arm.node.brush;
|
||||
|
||||
import arm.ui.UIToolbar;
|
||||
import arm.ui.UISidebar;
|
||||
import arm.ui.UIView2D;
|
||||
import arm.Enums;
|
||||
@@ -120,6 +121,7 @@ class BrushOutputNode extends LogicNode {
|
||||
var down = iron.system.Input.getMouse().down() || iron.system.Input.getPen().down();
|
||||
if (down && Context.tool == ToolColorId && Project.assets.length > 0) {
|
||||
Context.colorIdPicked = true;
|
||||
UIToolbar.inst.toolbarHandle.redraws = 1;
|
||||
}
|
||||
|
||||
// Prevent painting the same spot
|
||||
|
||||
@@ -37,7 +37,10 @@ class UIHeader {
|
||||
if (Context.colorIdPicked) {
|
||||
ui.image(RenderPath.active.renderTargets.get("texpaint_colorid").image, 0xffffffff, 64);
|
||||
}
|
||||
if (ui.button(tr("Clear"))) Context.colorIdPicked = false;
|
||||
if (ui.button(tr("Clear"))) {
|
||||
Context.colorIdPicked = false;
|
||||
UIToolbar.inst.toolbarHandle.redraws = 1;
|
||||
}
|
||||
ui.text(tr("Color ID Map"));
|
||||
var cid = ui.combo(Context.colorIdHandle, App.enumTexts("TEX_IMAGE"), tr("Color ID"));
|
||||
if (Context.colorIdHandle.changed) Context.ddirty = 2;
|
||||
|
||||
@@ -3,6 +3,7 @@ package arm.ui;
|
||||
import kha.System;
|
||||
import zui.Zui;
|
||||
import arm.Enums;
|
||||
import iron.RenderPath;
|
||||
import arm.Translator._tr;
|
||||
|
||||
class UIToolbar {
|
||||
@@ -72,7 +73,11 @@ class UIToolbar {
|
||||
ui._x += 2;
|
||||
if (Context.tool == i) ui.fill(-1, 2, 32 + 2, 32 + 2, ui.t.HIGHLIGHT_COL);
|
||||
var rect = Res.tile50(img, i, 0);
|
||||
var _y = ui._y;
|
||||
if (ui.image(img, iconAccent, null, rect.x, rect.y, rect.w, rect.h) == State.Started) Context.selectTool(i);
|
||||
if (i == 8 && Context.colorIdPicked) {
|
||||
ui.g.drawScaledSubImage(RenderPath.active.renderTargets.get("texpaint_colorid").image, 0, 0, 1, 1, 0, _y + 1.5 * ui.SCALE(), 5 * ui.SCALE(), 34 * ui.SCALE());
|
||||
}
|
||||
if (ui.isHovered) ui.tooltip(tr(toolNames[i]) + " " + keys[i]);
|
||||
ui._x -= 2;
|
||||
ui._y += 2;
|
||||
|
||||
Reference in New Issue
Block a user