armory/Sources/armory/logicnode/SetPropertyNode.hx

23 lines
474 B
Haxe
Raw Permalink Normal View History

2017-04-04 23:11:31 +02:00
package armory.logicnode;
2017-11-20 15:16:52 +01:00
import iron.object.Object;
2017-04-04 23:11:31 +02:00
2017-04-08 20:05:35 +02:00
class SetPropertyNode extends LogicNode {
2017-04-04 23:11:31 +02:00
2019-12-19 23:54:08 +01:00
public function new(tree: LogicTree) {
2017-04-04 23:11:31 +02:00
super(tree);
}
2019-12-19 23:54:08 +01:00
override function run(from: Int) {
var object: Object = inputs[1].get();
var property: String = inputs[2].get();
var value: Dynamic = inputs[3].get();
2017-09-20 14:27:45 +02:00
if (object == null) return;
2017-05-06 00:22:15 +02:00
if (object.properties == null) object.properties = new Map();
object.properties.set(property, value);
2017-04-04 23:11:31 +02:00
2018-10-22 10:10:33 +02:00
runOutput(0);
2017-04-04 23:11:31 +02:00
}
}