Revert commit that creates an object if not in scene.

Returns object only if present in active scene
This commit is contained in:
QuantumCoderQC 2021-05-01 22:19:29 +02:00
parent ad9c7bfa6b
commit c185882db8
2 changed files with 3 additions and 32 deletions

View file

@ -14,36 +14,7 @@ class GetObjectNode extends LogicNode {
override function get(from: Int): Dynamic {
var objectName: String = inputs[0].get();
if (property0 == null || property0 == iron.Scene.active.raw.name) {
return iron.Scene.active.getChild(objectName);
}
#if arm_json
property0 += ".json";
#elseif arm_compress
property0 += ".lz4";
#end
var outObj: Null<Object> = null;
// Create the object in the active scene if it is from an inactive scene
iron.data.Data.getSceneRaw(property0, (rawScene: TSceneFormat) -> {
var objData: Null<TObj> = null;
for (o in rawScene.objects) {
if (o.name == objectName) {
objData = o;
break;
}
}
if (objData == null) return;
iron.Scene.active.createObject(objData, rawScene, null, null, (newObj: Object) -> {
outObj = newObj;
});
});
return outObj;
return iron.Scene.active.getChild(objectName);
}
}

View file

@ -4,7 +4,7 @@ from arm.logicnode.arm_nodes import *
class GetObjectNode(ArmLogicTreeNode):
"""Searches for a object that uses the given name and returns it."""
"""Searches for a object that uses the given name in the current active scene and returns it."""
bl_idname = 'LNGetObjectNode'
bl_label = 'Get Object by Name'
arm_version = 1