public static void Render(RenderInfo renderInfo, Action <UploadFiles, string> callBack = null) { var info = new ThumbExportInfo(); info.thumbs = renderInfo.GetExportItems().ToArray(); info.scaleFactor = renderInfo.scale; info.saveFolder = SavePath; PEThumbExporter exporter = GameObject.FindObjectOfType <PEThumbExporter>(); exporter.SetExportInfo(info); GameObject.FindObjectOfType <PEThumbExporter>().StartRender(callBack); }
private void CreateThumbForGroups(List <BlockDataGroup> groups) { previewBlockGroup = null; if (groups.Count == 0) { EditorUtility.DisplayDialog("", "Nothing to export!!!", "OK"); return; } if (string.IsNullOrEmpty(mSavePath)) { EditorUtility.DisplayDialog("", "请指定保存路径!!!", "OK"); return; } if (!string.Equals(SceneManager.GetActiveScene().name, "GenerateThumb")) { bool ok = EditorUtility.DisplayDialog("", "将打开场景:GenerateThumb,当前场景需要保存吗?", "保存", "舍弃"); if (ok) { EditorSceneManager.SaveOpenScenes(); } EditorSceneManager.OpenScene("Assets/BlockEditor/Scenes/GenerateThumb.unity"); } List <ThumbExportElement> elements = new List <ThumbExportElement>(); groups.ForEach(group => PrepareThumbExportElement(group, elements)); ThumbExportInfo info = new ThumbExportInfo(); info.thumbs = elements.ToArray(); info.scaleFactor = screenScaleFactor; info.saveFolder = mSavePath; PEThumbExporter exporter = GameObject.FindObjectOfType <PEThumbExporter>(); exporter.SetExportInfo(info); FindObjectOfType <PEThumbExporter>().StartRender(); }
private void PreviewThumb(BlockDataGroup group) { // string[] selectColors = mColorNames.Where((color, index) => mColorToggles[index]).ToArray(); // if (selectColors.Length != 1 || mColorToggles[0]) // { // EditorUtility.DisplayDialog("", "只能预览一个颜色!", "OK"); // previewBlockGroup = null; // return; // } if (!string.Equals(SceneManager.GetActiveScene().name, "GenerateThumb")) { bool ok = EditorUtility.DisplayDialog("", "将打开场景:GenerateThumb,当前场景需要保存吗?", "保存", "舍弃"); if (ok) { EditorSceneManager.SaveOpenScenes(); } EditorSceneManager.OpenScene("Assets/BlockEditor/Scenes/GenerateThumb.unity"); } List <ThumbExportElement> elements = new List <ThumbExportElement>(); PrepareThumbExportElement(group, elements); ThumbExportInfo info = new ThumbExportInfo(); info.thumbs = elements.ToArray(); info.scaleFactor = screenScaleFactor; info.saveFolder = mSavePath; PEThumbExporter exporter = GameObject.FindObjectOfType <PEThumbExporter>(); exporter.SetExportInfo(info); FindObjectOfType <PEThumbExporter>().StartPreview(); }