armory/Sources/armory/logicnode/MaterialNode.hx
2019-12-19 23:54:08 +01:00

32 lines
582 B
Haxe

package armory.logicnode;
import iron.data.MaterialData;
class MaterialNode extends LogicNode {
public var property0: String;
public var value: MaterialData = null;
public function new(tree: LogicTree) {
super(tree);
iron.Scene.active.notifyOnInit(function() {
get(0);
});
}
override function get(from: Int): Dynamic {
if (property0 != null) {
iron.data.Data.getMaterial(iron.Scene.active.raw.name, property0, function(mat: MaterialData) {
value = mat;
});
}
return value;
}
override function set(value: Dynamic) {
this.value = value;
}
}