private static void ButtonBakeAllClicked() { string consoleLog = string.Empty; int bakedAssetsCount = 0; foreach (SceneHoudiniRoot data in HoudiniHDASaver_Data) { if (data.ToogleScene) { string log = string.Empty; int result = data.BakeAll(out log); if (result == -1) { Debug.Log($"Houdini HDA Save Helper : Bake Failed !"); } else { bakedAssetsCount += result; consoleLog += log; } if (data.IsSceneEmpty()) { HoudiniHDASaver_Data.Remove(data); } } } Debug.Log($"Houdini HDA Save Helper : Ball All ({bakedAssetsCount} assets baked) {Environment.NewLine}{consoleLog}"); }
/// <summary> /// Save, bake and delete all toggled Asset Root for the current scene. /// The Houdini Asset Root objects will be replaced by their baked version. /// </summary> /// <param name="console_log">List of baked assets path (log purpose).</param> /// <returns>-1 if it fail, the number of assets baked otherwise</returns> public int BakeAll(out string console_log) { string log = string.Empty; int bakeCount = -1; string folderPath = CheckFolderPathValidity(StaticFolderPath, Scene.name); if (!string.IsNullOrEmpty(folderPath)) { bakeCount = 0; for (int index = 0; index < AssetToggleCollection.Count; index++) { string bakeLog; if (BakeAsset(index, folderPath, out bakeLog)) { log += bakeLog + Environment.NewLine; bakeCount++; } } DeleteTaggedAssetsGamesObject(); if (IsSceneEmpty()) { HoudiniHDASaver_Data.Remove(this); } } else { log += "Folder path not valid."; } console_log = log; return(bakeCount); }
private static void ButtonRefreshListsClicked() { HoudiniHDASaver_Data.Clear(); HEU_HoudiniAssetRoot[] roots = FindObjectsOfType <HEU_HoudiniAssetRoot>(); foreach (HEU_HoudiniAssetRoot root in roots) { GameObject rootGameObject = root.gameObject; Scene currentAssetScene = rootGameObject.scene; bool assetIsInSelection = Selection.Contains(rootGameObject); int index = 0; while (index < HoudiniHDASaver_Data.Count && HoudiniHDASaver_Data[index].Scene != currentAssetScene) { index++; } if (index == HoudiniHDASaver_Data.Count) { HoudiniHDASaver_Data.Add(new SceneHoudiniRoot(currentAssetScene, root, assetIsInSelection)); } else { HoudiniHDASaver_Data[index].AddToSceneRootAssetCollection(root, assetIsInSelection); } } }