Beispiel #1
0
        public void Export()
        {
            Debug.Log("Three.JS Exporter started, " + DateTime.Now.ToLongTimeString());
            objectTotal   = UnityEngine.Object.FindObjectsOfType <GameObject>().Length;
            objectsParsed = 0;
            parseScene();
            JsonSerializerSettings settings = new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            };
            // Write content
            Formatting jsonFormatting = (options.minifyJSON) ? Formatting.None : Formatting.Indented;
            string     json           = JsonConvert.SerializeObject(content, jsonFormatting, settings);
            string     filename       = SceneManager.GetActiveScene().name + ".json";

            System.IO.File.WriteAllText(options.dir + filename, json);
            // Write tags data if present
            if (tags != null && !tags.isEmpty())
            {
                string tagsJSON     = JsonConvert.SerializeObject(tags, jsonFormatting);
                string tagsFilename = SceneManager.GetActiveScene().name + "Tags.json";
                System.IO.File.WriteAllText(options.dir + tagsFilename, tagsJSON);
            }
            // Write lights data if present
            if (!lights.isEmpty())
            {
                string lightsJSON     = JsonConvert.SerializeObject(lights, jsonFormatting);
                string lightsFilename = SceneManager.GetActiveScene().name + "LightsConfig.json";
                System.IO.File.WriteAllText(options.dir + lightsFilename, lightsJSON);
            }
            Debug.Log("Three.JS Exporter completed, " + DateTime.Now.ToLongTimeString());
            ExporterWindow.ClearProgress();
        }
Beispiel #2
0
        private void updateProgress()
        {
            objectsParsed++;
            float value = objectsParsed / (float)objectTotal;

            ExporterWindow.ReportProgress(value, ("Parsing objects: " + objectsParsed + "/" + objectTotal));
        }
Beispiel #3
0
        static void Init()
        {
            ExporterWindow window = (ExporterWindow)GetWindow(typeof(ExporterWindow));

            window.titleContent = new GUIContent("ThreeJS");
            window.Show();
        }
Beispiel #4
0
        private void updateProgressWithMessage(string message)
        {
            float value = objectsParsed / (float)objectTotal;

            ExporterWindow.ReportProgress(value, message);
        }