add uid nodes
This commit is contained in:
parent
d3b006c873
commit
ec3054cdeb
22
Sources/armory/logicnode/GetObjectByUidNode.hx
Normal file
22
Sources/armory/logicnode/GetObjectByUidNode.hx
Normal 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;
|
||||
|
||||
}
|
||||
}
|
18
Sources/armory/logicnode/GetUidNode.hx
Normal file
18
Sources/armory/logicnode/GetUidNode.hx
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue