add uid nodes

This commit is contained in:
t3du 2021-10-18 17:55:44 -03:00 committed by GitHub
parent d3b006c873
commit ec3054cdeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,22 @@
package armory.logicnode;
import iron.data.SceneFormat;
import iron.object.Object;
class GetObjectByUidNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function get(from: Int): Dynamic {
var objectUid: Int = inputs[0].get();
var obj = iron.Scene.active.getChildren(true);
for (obji in obj) if (obji.uid == objectUid) return obji;
return null;
}
}

View file

@ -0,0 +1,18 @@
package armory.logicnode;
import iron.object.Object;
class GetUidNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function get(from: Int): Dynamic {
var object: Object = inputs[0].get();
if (object == null) return null;
return object.uid;
}
}