Global brush uniforms
This commit is contained in:
@@ -1 +1 @@
|
||||
{"nodes":[{"id":3,"name":"Input","type":"InputNode","x":83,"y":192,"color":-11959648,"inputs":[],"outputs":[{"id":3,"node_id":3,"name":"Position","type":"VECTOR","color":-10238109,"default_value":null}],"buttons":[]},{"id":5,"name":"Brush Output","type":"BrushOutputNode","x":311,"y":192,"color":-11959648,"inputs":[{"id":5,"node_id":5,"name":"Position","type":"VECTOR","color":-10238109,"default_value":[0,0,0]},{"id":5,"node_id":5,"name":"Radius","type":"VALUE","color":-6184543,"default_value":0.5,"min":0,"max":2},{"id":5,"node_id":5,"name":"Opacity","type":"VALUE","color":-6184543,"default_value":1},{"id":5,"node_id":5,"name":"Strength","type":"VALUE","color":-6184543,"default_value":1},{"id":5,"node_id":5,"name":"Scale","type":"VALUE","color":-6184543,"default_value":0.5,"min":0,"max":2}],"outputs":[],"buttons":[]}],"links":[{"id":0,"from_id":3,"from_socket":0,"to_id":5,"to_socket":0}]}
|
||||
{"nodes":[{"id":3,"name":"Input","type":"InputNode","x":83,"y":192,"color":-11959648,"inputs":[],"outputs":[{"id":3,"node_id":3,"name":"Position","type":"VECTOR","color":-10238109,"default_value":null}],"buttons":[]},{"id":5,"name":"Brush Output","type":"BrushOutputNode","x":311,"y":192,"color":-11959648,"inputs":[{"id":5,"node_id":5,"name":"Position","type":"VECTOR","color":-10238109,"default_value":[0,0,0]},{"id":5,"node_id":5,"name":"Radius","type":"VALUE","color":-6184543,"default_value":1.0},{"id":5,"node_id":5,"name":"Opacity","type":"VALUE","color":-6184543,"default_value":1},{"id":5,"node_id":5,"name":"Strength","type":"VALUE","color":-6184543,"default_value":1},{"id":5,"node_id":5,"name":"UV Scale","type":"VALUE","color":-6184543,"default_value":1.0}],"outputs":[],"buttons":[]}],"links":[{"id":0,"from_id":3,"from_socket":0,"to_id":5,"to_socket":0}]}
|
||||
@@ -70,9 +70,7 @@ class NodeCreatorBrush {
|
||||
name: "Radius",
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 0.5,
|
||||
min: 0.0,
|
||||
max: 2.0
|
||||
default_value: 1.0
|
||||
},
|
||||
{
|
||||
id: nodes.getSocketId(canvas.nodes),
|
||||
@@ -93,12 +91,10 @@ class NodeCreatorBrush {
|
||||
{
|
||||
id: nodes.getSocketId(canvas.nodes),
|
||||
node_id: node_id,
|
||||
name: "Scale",
|
||||
name: "UV Scale",
|
||||
type: "VALUE",
|
||||
color: 0xffa1a1a1,
|
||||
default_value: 0.5,
|
||||
min: 0.0,
|
||||
max: 2.0
|
||||
default_value: 1.0
|
||||
}
|
||||
],
|
||||
outputs: [],
|
||||
|
||||
+23
-21
@@ -103,7 +103,11 @@ class UITrait extends armory.Trait {
|
||||
return paint;
|
||||
}
|
||||
|
||||
// TODO: Recompile mat instead of uniforms?
|
||||
public static var brushNodesRadius = 1.0;
|
||||
public static var brushNodesOpacity = 1.0;
|
||||
public static var brushNodesScale = 1.0;
|
||||
public static var brushNodesStrength = 1.0;
|
||||
|
||||
public static var brushRadius = 0.5;
|
||||
public static var brushOpacity = 1.0;
|
||||
public static var brushScale = 0.5;
|
||||
@@ -122,20 +126,18 @@ class UITrait extends armory.Trait {
|
||||
function linkFloat(link:String):Null<Float> {
|
||||
|
||||
if (link == '_brushRadius') {
|
||||
return brushRadius / 15.0;
|
||||
return (brushRadius * brushNodesRadius) / 15.0;
|
||||
}
|
||||
else if (link == '_brushOpacity') {
|
||||
return brushOpacity;
|
||||
return brushOpacity * brushNodesOpacity;
|
||||
}
|
||||
else if (link == '_brushScale') {
|
||||
return brushScale * 2.0;
|
||||
return (brushScale * brushNodesScale) * 2.0;
|
||||
}
|
||||
else if (link == '_brushStrength') {
|
||||
return brushStrength * brushStrength * 100;
|
||||
var f = brushStrength * brushNodesStrength;
|
||||
return f * f * 100;
|
||||
}
|
||||
// else if (link == '_brushPaint') {
|
||||
// return brushPaint;
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -520,7 +522,7 @@ class UITrait extends armory.Trait {
|
||||
|
||||
// Brush
|
||||
if (UITrait.uienabled) {
|
||||
var psize = Std.int(cursorImg.width * brushRadius);
|
||||
var psize = Std.int(cursorImg.width * (brushRadius * brushNodesRadius));
|
||||
// g.imageScaleQuality = kha.graphics2.ImageScaleQuality.High;
|
||||
g.drawScaledImage(cursorImg, mouse.x - psize / 2, mouse.y - psize / 2, psize, psize);
|
||||
}
|
||||
@@ -776,6 +778,13 @@ class UITrait extends armory.Trait {
|
||||
}
|
||||
}
|
||||
|
||||
ui.row([1/2, 1/2]);
|
||||
var typeHandle = Id.handle();
|
||||
brushType = ui.combo(typeHandle, ["Draw", "Fill"], "Type");
|
||||
if (typeHandle.changed) {
|
||||
UINodes.inst.parseMaterial();
|
||||
}
|
||||
ui.combo(Id.handle(), ["Add"], "Blending");
|
||||
ui.row([1/2, 1/2]);
|
||||
var paintHandle = Id.handle();
|
||||
brushPaint = ui.combo(paintHandle, ["UV", "Project"], "Paint");
|
||||
@@ -784,18 +793,11 @@ class UITrait extends armory.Trait {
|
||||
}
|
||||
brushBias = ui.slider(Id.handle({value: brushBias}), "Bias", 0.0, 4.0, true);
|
||||
ui.row([1/2, 1/2]);
|
||||
var typeHandle = Id.handle();
|
||||
brushType = ui.combo(typeHandle, ["Draw", "Fill"], "Type");
|
||||
if (typeHandle.changed) {
|
||||
UINodes.inst.parseMaterial();
|
||||
}
|
||||
ui.combo(Id.handle(), ["Add"], "Blending");
|
||||
// ui.row([1/2, 1/2]);
|
||||
// brushRadius = ui.slider(Id.handle({value: brushRadius}), "Radius", 0.0, 2.0, true);
|
||||
// brushOpacity = ui.slider(Id.handle({value: brushOpacity}), "Opacity", 0.0, 1.0, true);
|
||||
// ui.row([1/2, 1/2]);
|
||||
// brushStrength = ui.slider(Id.handle({value: brushStrength}), "Strength", 0.0, 1.0, true);
|
||||
// brushScale = ui.slider(Id.handle({value: brushScale}), "Scale", 0.0, 2.0, true);
|
||||
brushRadius = ui.slider(Id.handle({value: brushRadius}), "Radius", 0.0, 2.0, true);
|
||||
brushOpacity = ui.slider(Id.handle({value: brushOpacity}), "Opacity", 0.0, 1.0, true);
|
||||
ui.row([1/2, 1/2]);
|
||||
brushScale = ui.slider(Id.handle({value: brushScale}), "UV Scale", 0.0, 2.0, true);
|
||||
brushStrength = ui.slider(Id.handle({value: brushStrength}), "Strength", 0.0, 1.0, true);
|
||||
|
||||
ui.row([1/3,1/3,1/3]);
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ class BrushOutputNode extends LogicNode {
|
||||
override function run() {
|
||||
arm.UITrait.paint = true;
|
||||
arm.UITrait.paintVec = inputs[0].get();
|
||||
arm.UITrait.brushRadius = inputs[1].get();
|
||||
arm.UITrait.brushOpacity = inputs[2].get();
|
||||
arm.UITrait.brushStrength = inputs[3].get();
|
||||
arm.UITrait.brushScale = inputs[4].get();
|
||||
arm.UITrait.brushNodesRadius = inputs[1].get();
|
||||
arm.UITrait.brushNodesOpacity = inputs[2].get();
|
||||
arm.UITrait.brushNodesStrength = inputs[3].get();
|
||||
arm.UITrait.brushNodesScale = inputs[4].get();
|
||||
|
||||
super.run();
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user