add new nodes
This commit is contained in:
parent
d5e0208fd6
commit
b8319fe28b
39
Sources/armory/logicnode/CanvasSetProgressBarColorNode.hx
Normal file
39
Sources/armory/logicnode/CanvasSetProgressBarColorNode.hx
Normal file
|
@ -0,0 +1,39 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.Scene;
|
||||
import armory.trait.internal.CanvasScript;
|
||||
import kha.Color;
|
||||
import iron.math.Vec4;
|
||||
|
||||
class CanvasSetProgressBarColorNode extends LogicNode {
|
||||
|
||||
var canvas: CanvasScript;
|
||||
var element: String;
|
||||
var color = new Vec4();
|
||||
|
||||
public function new(tree: LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
#if arm_ui
|
||||
function update() {
|
||||
if (!canvas.ready) return;
|
||||
tree.removeUpdate(update);
|
||||
|
||||
var e = canvas.getElement(element);
|
||||
if (e != null) e.color_progress = Color.fromFloats(color.x, color.y, color.z, color.w);
|
||||
runOutput(0);
|
||||
}
|
||||
|
||||
override function run(from: Int) {
|
||||
element = inputs[1].get();
|
||||
color = inputs[2].get();
|
||||
canvas = Scene.active.getTrait(CanvasScript);
|
||||
if (canvas == null) canvas = Scene.active.camera.getTrait(CanvasScript);
|
||||
|
||||
// Ensure canvas is ready
|
||||
tree.notifyOnUpdate(update);
|
||||
update();
|
||||
}
|
||||
#end
|
||||
}
|
22
Sources/armory/logicnode/GetGlobalCanvasFontSizeNode.hx
Normal file
22
Sources/armory/logicnode/GetGlobalCanvasFontSizeNode.hx
Normal file
|
@ -0,0 +1,22 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.Scene;
|
||||
import armory.trait.internal.CanvasScript;
|
||||
|
||||
class GetGlobalCanvasFontSizeNode extends LogicNode {
|
||||
|
||||
var canvas: CanvasScript;
|
||||
|
||||
public function new(tree: LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
#if arm_ui
|
||||
override function get(from: Int): Dynamic {
|
||||
canvas = Scene.active.getTrait(CanvasScript);
|
||||
if (canvas == null) canvas = Scene.active.camera.getTrait(CanvasScript);
|
||||
|
||||
return canvas.getCanvasFontSize();
|
||||
}
|
||||
#end
|
||||
}
|
25
Sources/armory/logicnode/SetGlobalCanvasFontSizeNode.hx
Normal file
25
Sources/armory/logicnode/SetGlobalCanvasFontSizeNode.hx
Normal file
|
@ -0,0 +1,25 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.Scene;
|
||||
import armory.trait.internal.CanvasScript;
|
||||
|
||||
class SetGlobalCanvasFontSizeNode extends LogicNode {
|
||||
|
||||
var canvas: CanvasScript;
|
||||
var factor: Int;
|
||||
|
||||
public function new(tree: LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
#if arm_ui
|
||||
override function run(from: Int) {
|
||||
factor = inputs[1].get();
|
||||
canvas = Scene.active.getTrait(CanvasScript);
|
||||
if (canvas == null) canvas = Scene.active.camera.getTrait(CanvasScript);
|
||||
|
||||
canvas.setCanvasFontSize(factor);
|
||||
runOutput(0);
|
||||
}
|
||||
#end
|
||||
}
|
Loading…
Reference in a new issue