void OnDestroy() { Debug.Log("Destroying..."); GameObject.DestroyImmediate(exporterGO); exporter = null; preset = null; }
void OnGUI() { GUILayout.Label("Export Options"); GlTF_Writer.binary = GUILayout.Toggle(GlTF_Writer.binary, "Binary GlTF"); //buildZip = GUILayout.Toggle(buildZip, "Export Zip"); // Force animation baking for now GlTF_Writer.bakeAnimation = GUILayout.Toggle(true, "Bake animations (forced for now)"); exportAnimation = GUILayout.Toggle(exportAnimation, "Export animations"); convertImages = GUILayout.Toggle(convertImages, "Convert images"); presetAsset = EditorGUILayout.ObjectField("Preset file", presetAsset, typeof(UnityEngine.TextAsset), false) as UnityEngine.TextAsset; if (!exporterGo) { exporterGo = new GameObject("exporter"); } if (!exporter) { exporter = exporterGo.AddComponent <SceneToGlTFWiz>(); } GUI.enabled = (Selection.GetTransforms(SelectionMode.Deep).Length > 0); if (GUILayout.Button("Export to glTF")) { ExportFile(); } GUI.enabled = true; }
void OnDestroy() { if (exporterGo) { DestroyImmediate(exporterGo); exporter = null; } }
private void Awake() { sceneToGlTFWiz = GetComponent <SceneToGlTFWiz>(); if (!sceneToGlTFWiz) { sceneToGlTFWiz = gameObject.AddComponent <SceneToGlTFWiz>(); } }
public void OnEnable() { if (_exporterGo == null) { _exporterGo = new GameObject("Exporter"); _exporter = _exporterGo.AddComponent <SceneToGlTFWiz>(); _exporterGo.hideFlags = HideFlags.HideAndDontSave; } }
// Use this for initialization void Start() { init = true; Debug.Log("SceneSharing Initialization..."); UpdateScene(); exporterGO = new GameObject(); exporter = exporterGO.AddComponent <SceneToGlTFWiz>(); Debug.Log(exporter.ToString()); }
void Awake() { System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/gltf-exports"); exportPath = Application.persistentDataPath + "/gltf-exports/"; exporterGo = new GameObject("Exporter"); exporter = exporterGo.AddComponent <SceneToGlTFWiz>(); exporterGo.hideFlags = HideFlags.HideAndDontSave; this.minSize = new Vector2(300, 150); this.maxSize = new Vector2(600, 300); }
void OnEnable() { this.minSize = new Vector2(400, 250); if (mExporterGo == null) { mExporterGo = new GameObject("Exporter"); mExporter = mExporterGo.AddComponent <SceneToGlTFWiz>(); mExporterGo.hideFlags = HideFlags.HideAndDontSave; } }
private void Awake() { sceneToGlTFWiz = GetComponent <SceneToGlTFWiz>(); if (!sceneToGlTFWiz) { sceneToGlTFWiz = gameObject.AddComponent <SceneToGlTFWiz>(); } m_GroundMaterial = new Material(PrimitiveHelper.GetDefaultMaterial().shader); m_GroundMaterial.color = Color.gray; }
public static void ExportPrefab(GameObject prefab, string path) { GameObject go = Instantiate(prefab); go.name = prefab.name; SceneToGlTFWiz comp = go.AddComponent <SceneToGlTFWiz>(); comp.ExportGameObjectAndChildren(go, Path.Combine(path, go.name + ".gltf"), null, false, true, false, false); DestroyImmediate(go); }
void Initialize() { exporterGo = GameObject.Find("Exporter"); if (exporterGo == null) { exporterGo = new GameObject("Exporter"); exporter = exporterGo.AddComponent <SceneToGlTFWiz>(); } exporter = exporterGo.GetComponent <SceneToGlTFWiz>(); }
private static void CreateWizard() { savedPath = EditorPrefs.GetString(KEY_PATH, "/"); savedFile = EditorPrefs.GetString(KEY_FILE, "test.gltf"); path = savedPath + "/" + savedFile; // ScriptableWizard.DisplayWizard("Export Selected Stuff to glTF", typeof(SceneToGlTFWiz), "Export"); SceneToGlTFWiz window = (SceneToGlTFWiz)EditorWindow.GetWindow(typeof(SceneToGlTFWiz)); window.Show(); }
void OnDestroy() { // if (System.IO.File.Exists(zipPath)) // System.IO.File.Delete(zipPath); if (exporterGo) { DestroyImmediate(exporterGo); exporter = null; publisher = null; } }
//private List<String> tagList; void Awake() { zipPath = Application.temporaryCachePath + "/" + "Unity2Skfb.zip"; exportPath = Application.temporaryCachePath + "/" + "Unity2Skfb.gltf"; exporterGo = new GameObject("Exporter"); publisher = exporterGo.AddComponent <ExporterScript>(); exporter = exporterGo.AddComponent <SceneToGlTFWiz>(); //FIXME: Make sure that object is deleted; exporterGo.hideFlags = HideFlags.HideAndDontSave; //publisher.getCategories(); resizeWindow(loginSize); publisher.checkVersion(); }
//private List<String> tagList; void Awake() { zipPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + Path.DirectorySeparatorChar + "PlattarExport.zip"; exportPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop); exporterGo = new GameObject("Exporter"); publisher = exporterGo.AddComponent <ExporterScript>(); exporter = exporterGo.AddComponent <SceneToGlTFWiz>(); //FIXME: Make sure that object is deleted; exporterGo.hideFlags = HideFlags.HideAndDontSave; //publisher.getCategories(); resizeWindow(fullSize); publisher.checkVersion(); }
public void OnEnable() { if (webServer == null) { string basePath = Directory.GetParent(Application.dataPath).FullName; webServer = new WebServer(9527, basePath + "/Assets/Unity2glTF/Web/"); exportFileServer = new WebServer(9528, basePath + "/export/"); } if (_exporterGo == null) { _exporterGo = new GameObject("Exporter"); _exporter = _exporterGo.AddComponent <SceneToGlTFWiz>(); _exporterGo.hideFlags = HideFlags.HideAndDontSave; } }
static void Init() { #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX var exportPath = Application.temporaryCachePath + "/" + "UnityScene2Webpage.gltf"; var exporter = new SceneToGlTFWiz(); exporter.Export(exportPath, null, /*buildzip*/ false, true, true, true); FileUtil.DeleteFileOrDirectory(Application.temporaryCachePath + "/default.html"); FileUtil.DeleteFileOrDirectory(Application.temporaryCachePath + "/GLTFLoader.js"); var filesPath = "Assets/Editor/Unity-Scene2WebPage/Resources/"; bool haveFilesBeenCopied = false; try { FileUtil.CopyFileOrDirectory(filesPath + "default.html", Application.temporaryCachePath + "/default.html"); // The JS extension has special significance in Unity. Storing the JS file as TXT and renaming it while copying it over to the target folder. FileUtil.CopyFileOrDirectory(filesPath + "GLTFLoaderjs.txt", Application.temporaryCachePath + "/GLTFLoader.js"); haveFilesBeenCopied = true; } catch { haveFilesBeenCopied = false; Debug.LogError("Please make sure the Unity-Scene2WebPage plugin folder is under the Assets/Editor folder!"); } if (haveFilesBeenCopied) { Application.OpenURL("file:///" + Application.temporaryCachePath + "/default.html"); // Wait for some time for the Web page to load before opening the folder. System.Threading.Thread.Sleep(1000); } ShowExplorer(exportPath); #else // and error dialog if not standalone EditorUtility.DisplayDialog("Error", "Your build target must be set to standalone", "Okay"); #endif }
void OnDestroy() { GameObject.DestroyImmediate(exporterGo); exporter = null; }