public void LoadPreset(HEU_SessionBase session, HEU_InputPreset inputPreset) { ResetInputNode(session); ChangeInputType(session, inputPreset._inputObjectType); if (inputPreset._inputObjectType == HEU_InputNode.InputObjectType.UNITY_MESH) { int numObjects = inputPreset._inputObjectPresets.Count; for (int i = 0; i < numObjects; ++i) { if (!string.IsNullOrEmpty(inputPreset._inputObjectPresets[i]._gameObjectName)) { GameObject inputGO = null; if (inputPreset._inputObjectPresets[i]._isSceneObject) { inputGO = HEU_GeneralUtility.GetGameObjectByNameInScene(inputPreset._inputObjectPresets[i]._gameObjectName); } else { inputGO = HEU_GeneralUtility.GetGameObjectByNameInProjectOnly(inputPreset._inputObjectPresets[i]._gameObjectName); } if (inputGO != null) { HEU_InputObjectInfo inputObject = AddInputObjectAtEnd(inputGO); inputObject._useTransformOffset = inputPreset._inputObjectPresets[i]._useTransformOffset; inputObject._translateOffset = inputPreset._inputObjectPresets[i]._translateOffset; inputObject._rotateOffset = inputPreset._inputObjectPresets[i]._rotateOffset; inputObject._scaleOffset = inputPreset._inputObjectPresets[i]._scaleOffset; } else { Debug.LogWarningFormat("Gameobject with name {0} not found. Unable to set input object.", inputPreset._inputAssetName); } } } } else if (inputPreset._inputObjectType == HEU_InputNode.InputObjectType.HDA) { if (!string.IsNullOrEmpty(inputPreset._inputAssetName)) { GameObject inputAsset = GameObject.Find(inputPreset._inputAssetName); if (inputAsset != null) { HEU_HoudiniAssetRoot inputAssetRoot = inputAsset != null ? inputAsset.GetComponent<HEU_HoudiniAssetRoot>() : null; if (inputAssetRoot != null && inputAssetRoot._houdiniAsset != null) { // Need to reconnect and make sure connected asset is in this session _inputAsset = inputAsset; if (!inputAssetRoot._houdiniAsset.IsAssetValidInHoudini(session)) { inputAssetRoot._houdiniAsset.RequestCook(true, false, true, true); } _connectedNodeID = inputAssetRoot._houdiniAsset.AssetID; _parentAsset.ConnectToUpstream(inputAssetRoot._houdiniAsset); _connectedInputAsset = _inputAsset; } else { Debug.LogErrorFormat("Input HDA with name {0} is not a valid asset (missing components). Unable to set input asset.", inputPreset._inputAssetName); } } else { Debug.LogWarningFormat("Game with name {0} not found. Unable to set input asset.", inputPreset._inputAssetName); } } } KeepWorldTransform = inputPreset._keepWorldTransform; PackGeometryBeforeMerging = inputPreset._packGeometryBeforeMerging; RequiresUpload = true; ClearUICache(); }