public static void ExportWholeSelectionToSingle(string fullName, bool includeTextures) { if (!CreateTargetFolder(fullName)) { Debug.LogError("Scene Explorer Exporter failed to create target folder: " + fullName); return; } MeshFilter[] meshes = UnityEngine.Object.FindObjectsOfType <MeshFilter>(); if (meshes.Length == 0) { EditorUtility.DisplayDialog("No meshes found!", "Please add a mesh filter to the scene", ""); return; } int exportedObjects = 0; List <MeshFilter> mfList = new List <MeshFilter>(); CognitiveVR_Preferences prefs = CognitiveVR_EditorPrefs.GetPreferences(); bool staticGeoOnly = prefs.ExportStaticOnly; float minSize = prefs.MinExportGeoSize; for (int i = 0; i < meshes.Length; i++) { if (staticGeoOnly && !meshes[i].gameObject.isStatic) { continue; } Renderer r = meshes[i].GetComponent <Renderer>(); if (r == null || r.bounds.size.magnitude < minSize) { continue; } exportedObjects++; mfList.Add(meshes[i]); } if (exportedObjects > 0) { MeshFilter[] mf = new MeshFilter[mfList.Count]; for (int i = 0; i < mfList.Count; i++) { mf[i] = mfList[i]; } MeshesToFile(mf, "CognitiveVR_SceneExplorerExport/" + fullName, fullName, includeTextures); } else { EditorUtility.DisplayDialog("Objects not exported", "Make sure at least some of your selected objects have mesh filters!", ""); } }
void OnGUI() { CognitiveVR_Preferences prefs = CognitiveVR_EditorPrefs.GetPreferences(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Refresh Scenes")) { loadedScenes = false; //scenes = null; } if (GUILayout.Button("Save")) { EditorUtility.SetDirty(prefs); AssetDatabase.SaveAssets(); } GUILayout.EndHorizontal(); if (!loadedScenes) { ReadNames(); loadedScenes = true; } GUILayout.BeginHorizontal(); GUILayout.Label("Record", GUILayout.Width(toggleWidth)); GUILayout.Label("Scene Name", GUILayout.Width(sceneWidth)); GUILayout.Label("SceneID", GUILayout.Width(keyWidth)); GUILayout.EndHorizontal(); GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); GUILayout.Space(10); canvasPos = GUILayout.BeginScrollView(canvasPos); foreach (var v in prefs.SceneKeySettings) { DisplaySceneKeySettings(v); } GUILayout.EndScrollView(); }