public void OpenState(State state) { try { if (previewBackendProcess == null || previewBackendProcess.HasExited) { EditorUtility.DisplayDialog("Info", "Please, start preview viewer", "Ok"); Focus(); return; } var resourceFolder = Path.Combine(OutputFolder, "wwwroot"); Directory.CreateDirectory(resourceFolder); var tour = TourExporter.GenerateTour(resourceFolder, TourExporter.GenerateTourOptions.ForPreview()); if (tour == null) { EditorUtility.DisplayDialog("Error", "Can't create tour", "Ok"); return; } tour.firstStateId = state.GetExportedId(); BackgroundTaskInvoker.StartBackgroundTask(LivePreviewProcessHelper.SendCameraRotation(SceneView.lastActiveSceneView.rotation)); BackgroundTaskInvoker.StartBackgroundTask(LivePreviewProcessHelper.OpenTour(tour)); } finally { EditorUtility.ClearProgressBar(); } }
private void DrawInstalledList() { if (GUILayout.Button("Download last viewer version")) { StartBackgroundTask(DownloadViewer(packsLocation)); } GUILayout.BeginHorizontal(); GUILayout.Label("Available viewers", EditorStyles.boldLabel); if (GUILayout.Button("Refresh")) { FindBuildPacks(); } GUILayout.EndHorizontal(); if (buildPacks.Count == 0) { GUILayout.Label("No web viewers", EditorStyles.label); } else { foreach (var pack in buildPacks) { pack.IsFolded = EditorGUILayout.Foldout(pack.IsFolded, pack.Version); if (pack.IsFolded) { RenderPack(pack); } } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Exporting excursion", EditorStyles.boldLabel); selectedbuildTagNum = EditorGUILayout.Popup("Viewer version", selectedbuildTagNum, buildPackTags); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Target path"); outFolderPath = EditorGUILayout.TextField(outFolderPath); if (GUILayout.Button("...")) { outFolderPath = EditorUtility.OpenFolderPanel("Select folder to export", outFolderPath, ""); Repaint(); SceneView.RepaintAll(); } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Export")) { if (!TourExporter.TryGetTargetFolder(outFolderPath)) { return; } TourExporter.ExportTour(buildPacks[selectedbuildTagNum].Location, outFolderPath); } }
private void DrawExportButton(WebViewerBuildPack selectedViewer, DesktopClientBuildPack selectedDesktopClient) { if (GUILayout.Button("Export")) { if (selectedViewer == null || selectedDesktopClient == null) { EditorUtility.DisplayDialog("Error", $"Please, select viewer and desktop client versions", "Ok"); return; } if (!TourExporter.TryGetTargetFolder(outFolderPath)) { return; } TourExporter.ExportTour(new TourExporter.ExportOptions(selectedViewer, selectedDesktopClient, outFolderPath, imageCroppingLevel)); } }
public static void BuildLivePreviewBackend( string projectFolder, string outputFolder, WebViewerBuildPack selectedBuildPack) { try { var systemRuntime = GetSystemRuntime(); var arguments = $"publish {projectFolder} " + $"-r {systemRuntime} " + $"-o {outputFolder} " + $"-c Release " + $"--self-contained true " + $"-p:PublishSingleFile=true " + $"-p:PublishTrimmed=true" + $"-p:DebugType=None" + $"-p:DebugSymbols=False"; var proc = Process.Start(new ProcessStartInfo { FileName = "dotnet", Arguments = arguments, UseShellExecute = true, RedirectStandardOutput = false }); proc.WaitForExit(); if (proc.ExitCode != 0) { throw new Exception("Can't build live preview"); } TourExporter.UnpackViewer(selectedBuildPack, Path.Combine(outputFolder, "wwwroot")); } catch (Exception ex) { Debug.LogError(ex.Message); throw; } }