예제 #1
0
        public static void Rebuild()
        {
            var startTime = EditorApplication.timeSinceStartup;

            ChiselNodeHierarchyManager.Rebuild();
            var csg_endTime = EditorApplication.timeSinceStartup;

            Debug.Log($"Full CSG rebuild done in {((csg_endTime - startTime) * 1000)} ms. ");
        }
 public static void Rebuild()
 {
     UnityEngine.Profiling.Profiler.BeginSample("Rebuild");
     try
     {
         var startTime = Time.realtimeSinceStartup;
         ChiselNodeHierarchyManager.Rebuild();
         var csg_endTime = Time.realtimeSinceStartup;
         Debug.Log($"Full CSG rebuild done in {((csg_endTime - startTime) * 1000)} ms. ");
     }
     finally
     {
         UnityEngine.Profiling.Profiler.EndSample();
     }
 }
예제 #3
0
        private static void ImportValveMapFormat2006()
        {
            GameObject go = null;

            try
            {
                string path = EditorUtility.OpenFilePanel("Import Source Engine Map", "", "vmf");
                if (path.Length != 0)
                {
                    EditorUtility.DisplayProgressBar("Chisel: Importing Source Engine Map", "Parsing Valve Map Format File (*.vmf)...", 0.0f);
                    var importer = new ValveMapFormat2006.VmfImporter();
                    var map      = importer.Import(path);

                    // create parent game object to store all of the imported content.
                    go = new GameObject("Source Map - " + Path.GetFileNameWithoutExtension(path));
                    go.SetActive(false);

                    // create chisel model and import all of the brushes.
                    EditorUtility.DisplayProgressBar("Chisel: Importing Source Engine Map", "Preparing Material Searcher...", 0.0f);
                    ValveMapFormat2006.VmfWorldConverter.Import(ChiselModelManager.CreateNewModel(go.transform), map);

#if COM_AETERNUMGAMES_CHISEL_DECALS // optional decals package: https://github.com/Henry00IS/Chisel.Decals
                    // rebuild the world as we need the collision mesh for decals.
                    EditorUtility.DisplayProgressBar("Chisel: Importing Source Engine Map", "Rebuilding the world...", 0.5f);
                    go.SetActive(true);
                    ChiselNodeHierarchyManager.Rebuild();
#endif
                    // begin converting hammer entities to unity objects.
                    ValveMapFormat2006.VmfEntityConverter.Import(go.transform, map);
                }
            }
            catch (Exception ex)
            {
                EditorUtility.ClearProgressBar();
                EditorUtility.DisplayDialog("Source Engine Map Import", "An exception occurred while importing the map:\r\n" + ex.Message, "Ohno!");
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                if (go != null)
                {
                    go.SetActive(true);
                }
            }
        }
예제 #4
0
        private void ImportMap()
        {
            var mapImporter = target as Q1MapImporter;

            // Not currently in try catch so I can see Unity errors.

            GameObject go = null;

            string path = EditorUtility.OpenFilePanel("Import Quake 1 Map", "", "map");

            if (path.Length != 0)
            {
                EditorUtility.DisplayProgressBar("RealtimeCSG: Importing Quake 1 Map", "Parsing Quake 1 Map File (*.map)...", 0.0f);
                var importer = new MapImporter();
                //importer.adjustTexturesForValve = mapImporter.adjustTexturesForValve;

                var map = importer.Import(path);

                // create parent game object to store all of the imported content.
                go = new GameObject("Q1-" + Path.GetFileNameWithoutExtension(path));
                go.SetActive(false);

                // create chisel model and import all of the brushes.
                EditorUtility.DisplayProgressBar("Chisel: Importing Source Engine Map", "Preparing Material Searcher...", 0.0f);
                Q1MapWorldConverter.Import(go.transform, map);

#if COM_AETERNUMGAMES_CHISEL_DECALS // optional decals package: https://github.com/Henry00IS/Chisel.Decals
                // rebuild the world as we need the collision mesh for decals.
                EditorUtility.DisplayProgressBar("Chisel: Importing Source Engine Map", "Rebuilding the world...", 0.5f);
                go.SetActive(true);
                ChiselNodeHierarchyManager.Rebuild();
#endif
                // begin converting hammer entities to unity objects.
                //Q1EntityConverter.Import(go.transform, map);
            }

            EditorUtility.ClearProgressBar();
            if (go != null)
            {
                go.transform.SetParent(mapImporter.transform);
                go.SetActive(true);
            }
        }
예제 #5
0
 private void OnClicked()
 {
     UnityEngine.Profiling.Profiler.BeginSample("Rebuild");
     try { ChiselNodeHierarchyManager.Rebuild(); }
     finally { UnityEngine.Profiling.Profiler.EndSample(); }
 }
예제 #6
0
 public static void Rebuild()
 {
     ChiselNodeHierarchyManager.Rebuild();
 }