Enable picking for material tool

This commit is contained in:
luboslenco
2023-06-08 22:01:20 +02:00
parent d3f963e5cc
commit 93fcf91b18
8 changed files with 11 additions and 10 deletions
@@ -99,7 +99,7 @@ class BrushOutputNode extends LogicNode {
}
// Do not paint over fill layer
var fillLayer = Context.raw.layer.fill_layer != null && Context.raw.tool != ToolPicker && Context.raw.tool != ToolColorId;
var fillLayer = Context.raw.layer.fill_layer != null && Context.raw.tool != ToolPicker && Context.raw.tool != ToolMaterial && Context.raw.tool != ToolColorId;
// Do not paint over groups
var groupLayer = Context.raw.layer.isGroup();
@@ -160,7 +160,7 @@ class RenderPathPaint {
path.drawMeshes("paint");
UIHeader.inst.headerHandle.redraws = 2;
}
else if (Context.raw.tool == ToolPicker) {
else if (Context.raw.tool == ToolPicker || Context.raw.tool == ToolMaterial) {
if (Context.raw.pickPosNorTex) {
if (Context.raw.paint2d) {
path.setTarget("gbuffer0", ["gbuffer1", "gbuffer2"]);
@@ -600,11 +600,11 @@ class RenderPathPaint {
static function paintEnabled(): Bool {
#if is_paint
var fillLayer = Context.raw.layer.fill_layer != null && Context.raw.tool != ToolPicker && Context.raw.tool != ToolColorId;
var fillLayer = Context.raw.layer.fill_layer != null && Context.raw.tool != ToolPicker && Context.raw.tool != ToolMaterial && Context.raw.tool != ToolColorId;
#end
#if is_sculpt
var fillLayer = Context.raw.layer.fill_layer != null && Context.raw.tool != ToolPicker;
var fillLayer = Context.raw.layer.fill_layer != null && Context.raw.tool != ToolPicker && Context.raw.tool != ToolMaterial;
#end
var groupLayer = Context.raw.layer.isGroup();
@@ -27,7 +27,7 @@ class MakeColorIdPicker {
frag.write('vec3 idcol = textureLod(texcolorid, texCoordInp, 0.0).rgb;');
frag.write('fragColor = vec4(idcol, 1.0);');
}
else if (Context.raw.tool == ToolPicker) {
else if (Context.raw.tool == ToolPicker || Context.raw.tool == ToolMaterial) {
if (Context.raw.pickPosNorTex) {
frag.add_out('vec4 fragColor[2]');
frag.add_uniform('sampler2D gbufferD');
+2 -2
View File
@@ -21,7 +21,7 @@ class MakePaint {
color_attachments:
Context.raw.tool == ToolColorId ? ["RGBA32"] :
(Context.raw.tool == ToolPicker && Context.raw.pickPosNorTex) ? ["RGBA128", "RGBA128"] :
Context.raw.tool == ToolPicker ? ["RGBA32", "RGBA32", "RGBA32", "RGBA32"] :
(Context.raw.tool == ToolPicker || Context.raw.tool == ToolMaterial) ? ["RGBA32", "RGBA32", "RGBA32", "RGBA32"] :
["RGBA32", "RGBA32", "RGBA32", "R8"]
});
@@ -50,7 +50,7 @@ class MakePaint {
MakeBake.setColorWrites(con_paint);
}
if (Context.raw.tool == ToolColorId || Context.raw.tool == ToolPicker) {
if (Context.raw.tool == ToolColorId || Context.raw.tool == ToolPicker || Context.raw.tool == ToolMaterial) {
MakeColorIdPicker.run(vert, frag);
con_paint.data.shader_from_source = true;
con_paint.data.vertex_shader = vert.get();
+1 -1
View File
@@ -610,7 +610,7 @@ class App {
handleDropPaths();
var isPicker = Context.raw.tool == ToolPicker;
var isPicker = Context.raw.tool == ToolPicker || Context.raw.tool == ToolMaterial;
#if (is_paint || is_sculpt)
#if krom_windows
+1
View File
@@ -270,6 +270,7 @@ package arm;
var ToolParticle = 8;
var ToolPicker = 9;
var ToolGizmo = 10;
var ToolMaterial = 11;
#end
#if is_lab
var ToolEraser = 0;
+1 -1
View File
@@ -1193,7 +1193,7 @@ class UIBase {
}
#if is_paint
if (Context.raw.brushStencilImage != null && Context.raw.tool != ToolBake && Context.raw.tool != ToolPicker && Context.raw.tool != ToolColorId) {
if (Context.raw.brushStencilImage != null && Context.raw.tool != ToolBake && Context.raw.tool != ToolPicker && Context.raw.tool != ToolMaterial && Context.raw.tool != ToolColorId) {
var r = getBrushStencilRect();
if (!Operator.shortcut(Config.keymap.stencil_hide, ShortcutDown)) {
g.color = 0x88ffffff;
+1 -1
View File
@@ -104,7 +104,7 @@ class UIHeader {
}
ui.enabled = true;
}
else if (Context.raw.tool == ToolPicker) {
else if (Context.raw.tool == ToolPicker || Context.raw.tool == ToolMaterial) {
var baseRPicked = Math.round(Context.raw.pickedColor.base.R * 10) / 10;
var baseGPicked = Math.round(Context.raw.pickedColor.base.G * 10) / 10;
var baseBPicked = Math.round(Context.raw.pickedColor.base.B * 10) / 10;