示例#1
0
		private void CookCompletedCallback(HEU_HoudiniAsset asset, bool bSuccess, List<GameObject> outputs)
		{
			if (_status == HEU_Task.TaskStatus.STARTED)
			{
				HEU_TaskManager.CompleteTask(this, bSuccess ? TaskResult.SUCCESS : TaskResult.FAILED);
			}
		}
示例#2
0
	public override void DoTask()
	{
	    if (_buildType == BuildType.LOAD)
	    {
		if (string.IsNullOrEmpty(_assetPath))
		{
		    // Bad path so fail		
		    HEU_TaskManager.CompleteTask(this, TaskResult.FAILED);
		}
		else
		{
		    // File-based HDA
		    GameObject newGO = HEU_HAPIUtility.InstantiateHDA(_assetPath, _position, GetTaskSession(), true);
		    if (newGO != null && newGO.GetComponent<HEU_HoudiniAssetRoot>() != null)
		    {
			// Add to post-load callback
			_asset = newGO.GetComponent<HEU_HoudiniAssetRoot>()._houdiniAsset;
			_asset._reloadEvent.AddListener(CookCompletedCallback);
			_asset._reloadDataEvent.AddListener(CookCompletedCallback);
		    }
		    else
		    {
			HEU_TaskManager.CompleteTask(this, TaskResult.FAILED);
		    }
		}
	    }
	    else if (_buildType == BuildType.COOK)
	    {
		_asset._cookedEvent.RemoveListener(CookCompletedCallback);
		_asset._cookedEvent.AddListener(CookCompletedCallback);
		_asset._cookedDataEvent.RemoveListener(CookCompletedCallback);
		_asset._cookedDataEvent.AddListener(CookCompletedCallback);
		_asset.RequestCook(true, true, false, true);
	    }
	    else if (_buildType == BuildType.RELOAD)
	    {
		_asset._reloadEvent.RemoveListener(CookCompletedCallback);
		_asset._reloadEvent.AddListener(CookCompletedCallback);
		_asset._reloadDataEvent.RemoveListener(CookCompletedCallback);
		_asset._reloadDataEvent.AddListener(CookCompletedCallback);
		_asset.RequestReload(true);
	    }
	}