public void CloseWindows() { HeightFromDiffuseGuiScript.Close(); NormalFromHeightGuiScript.Close(); EdgeFromNormalGuiScript.Close(); AoFromNormalGuiScript.Close(); EditDiffuseGuiScript.Close(); MetallicGuiScript.Close(); SmoothnessGuiScript.Close(); _tilingTextureMakerGuiScript.Close(); AlignmentGuiScript.Close(); MaterialGuiObject.SetActive(false); PostProcessGuiObject.SetActive(false); }
IEnumerator ProcessCommandsCoroutine(string commandString) { //string commandString = ClipboardHelper.clipBoard; var serializer = new XmlSerializer(typeof(CommandList)); var stream = new System.IO.StringReader(commandString); CommandList commandList = serializer.Deserialize(stream) as CommandList; for (int i = 0; i < commandList.commands.Count; i++) { Command thisCommand = commandList.commands[i]; if (thisCommand.commandType == CommandType.Settings) { settingsGui.settings = thisCommand.projectSettings; settingsGui.SetSettings(); } else if (thisCommand.commandType == CommandType.Open) { StartCoroutine(saveLoad.LoadTexture(thisCommand.mapType, thisCommand.filePath)); while (saveLoad.busy) { yield return(new WaitForSeconds(0.1f)); } } else if (thisCommand.commandType == CommandType.Save) { switch (thisCommand.mapType) { case MapType.height: StartCoroutine(saveLoad.SaveTexture(thisCommand.extension, mainGui._HeightMap, thisCommand.filePath)); break; case MapType.diffuse: StartCoroutine(saveLoad.SaveTexture(thisCommand.extension, mainGui._DiffuseMapOriginal, thisCommand.filePath)); break; case MapType.metallic: StartCoroutine(saveLoad.SaveTexture(thisCommand.extension, mainGui._MetallicMap, thisCommand.filePath)); break; case MapType.smoothness: StartCoroutine(saveLoad.SaveTexture(thisCommand.extension, mainGui._SmoothnessMap, thisCommand.filePath)); break; case MapType.edge: StartCoroutine(saveLoad.SaveTexture(thisCommand.extension, mainGui._EdgeMap, thisCommand.filePath)); break; case MapType.ao: StartCoroutine(saveLoad.SaveTexture(thisCommand.extension, mainGui._AOMap, thisCommand.filePath)); break; case MapType.property: mainGui.ProcessPropertyMap(); StartCoroutine(saveLoad.SaveTexture(thisCommand.extension, mainGui._PropertyMap, thisCommand.filePath)); break; default: break; } while (saveLoad.busy) { yield return(new WaitForSeconds(0.1f)); } } else if (thisCommand.commandType == CommandType.FlipNormalMapY) { mainGui.FlipNormalMapY(); } else if (thisCommand.commandType == CommandType.FileFormat) { mainGui.SetFormat(thisCommand.extension); } else if (thisCommand.commandType == CommandType.HeightFromDiffuse) { mainGui.CloseWindows(); heightFromDiffuseGuiObject.SetActive(true); yield return(new WaitForSeconds(0.1f)); heightFromDiffuseGui.InitializeTextures(); yield return(new WaitForSeconds(0.1f)); StartCoroutine(heightFromDiffuseGui.ProcessDiffuse()); while (heightFromDiffuseGui.busy) { yield return(new WaitForSeconds(0.1f)); } StartCoroutine(heightFromDiffuseGui.ProcessHeight()); while (heightFromDiffuseGui.busy) { yield return(new WaitForSeconds(0.1f)); } heightFromDiffuseGui.Close(); } else if (thisCommand.commandType == CommandType.NormalFromHeight) { mainGui.CloseWindows(); normalFromHeightGuiObject.SetActive(true); yield return(new WaitForSeconds(0.1f)); normalFromHeightGui.InitializeTextures(); yield return(new WaitForSeconds(0.1f)); StartCoroutine(normalFromHeightGui.ProcessHeight()); while (normalFromHeightGui.busy) { yield return(new WaitForSeconds(0.1f)); } StartCoroutine(normalFromHeightGui.ProcessNormal()); while (normalFromHeightGui.busy) { yield return(new WaitForSeconds(0.1f)); } normalFromHeightGui.Close(); } else if (thisCommand.commandType == CommandType.Metallic) { mainGui.CloseWindows(); metallicGuiObject.SetActive(true); yield return(new WaitForSeconds(0.1f)); metallicGui.InitializeTextures(); yield return(new WaitForSeconds(0.1f)); StartCoroutine(metallicGui.ProcessBlur()); while (metallicGui.busy) { yield return(new WaitForSeconds(0.1f)); } StartCoroutine(metallicGui.ProcessMetallic()); while (metallicGui.busy) { yield return(new WaitForSeconds(0.1f)); } metallicGui.Close(); } else if (thisCommand.commandType == CommandType.Smoothness) { mainGui.CloseWindows(); smoothnessGuiObject.SetActive(true); yield return(new WaitForSeconds(0.1f)); smoothnessGui.InitializeTextures(); yield return(new WaitForSeconds(0.1f)); StartCoroutine(smoothnessGui.ProcessBlur()); while (smoothnessGui.busy) { yield return(new WaitForSeconds(0.1f)); } StartCoroutine(smoothnessGui.ProcessSmoothness()); while (smoothnessGui.busy) { yield return(new WaitForSeconds(0.1f)); } smoothnessGui.Close(); } else if (thisCommand.commandType == CommandType.AOFromNormal) { mainGui.CloseWindows(); aoFromNormalGuiObject.SetActive(true); yield return(new WaitForSeconds(0.1f)); aoFromNormalGui.InitializeTextures(); yield return(new WaitForSeconds(0.1f)); StartCoroutine(aoFromNormalGui.ProcessNormalDepth()); while (aoFromNormalGui.busy) { yield return(new WaitForSeconds(0.1f)); } StartCoroutine(aoFromNormalGui.ProcessAO()); while (aoFromNormalGui.busy) { yield return(new WaitForSeconds(0.1f)); } aoFromNormalGui.Close(); } else if (thisCommand.commandType == CommandType.EdgeFromNormal) { mainGui.CloseWindows(); edgeFromNormalGuiObject.SetActive(true); yield return(new WaitForSeconds(0.1f)); edgeFromNormalGui.InitializeTextures(); yield return(new WaitForSeconds(0.1f)); StartCoroutine(edgeFromNormalGui.ProcessNormal()); while (edgeFromNormalGui.busy) { yield return(new WaitForSeconds(0.1f)); } StartCoroutine(edgeFromNormalGui.ProcessEdge()); while (edgeFromNormalGui.busy) { yield return(new WaitForSeconds(0.1f)); } edgeFromNormalGui.Close(); } else if (thisCommand.commandType == CommandType.QuickSave) { switch (thisCommand.mapType) { case MapType.height: mainGui.QuicksavePathHeight = thisCommand.filePath; break; case MapType.diffuse: mainGui.QuicksavePathDiffuse = thisCommand.filePath; break; case MapType.normal: mainGui.QuicksavePathNormal = thisCommand.filePath; break; case MapType.metallic: mainGui.QuicksavePathMetallic = thisCommand.filePath; break; case MapType.smoothness: mainGui.QuicksavePathSmoothness = thisCommand.filePath; break; case MapType.edge: mainGui.QuicksavePathEdge = thisCommand.filePath; break; case MapType.ao: mainGui.QuicksavePathAO = thisCommand.filePath; break; case MapType.property: mainGui.QuicksavePathProperty = thisCommand.filePath; break; default: break; } } yield return(new WaitForSeconds(0.1f)); ClipboardHelper.clipBoard = ""; } yield return(new WaitForSeconds(0.1f)); mainGui.CloseWindows(); mainGui.FixSize(); materialGuiObject.SetActive(true); materialGui.Initialize(); }