Beispiel #1
0
        public static void PrintDebugInfo()
        {
            Debug.Log("--[C++ side]--\n");
            CSGBindings.LogDiagnostics();

            Debug.Log("--[C# side (registered)]--\n");
            Debug.Log(string.Format("models {0} brushes {1} operations {2}\n", InternalCSGModelManager.Models.Length, InternalCSGModelManager.Brushes.Length, InternalCSGModelManager.Operations.Length));
            foreach (var model in InternalCSGModelManager.Models)
            {
                Debug.Log(string.Format("\tmodel \"{0}\" node-id: {1} model-id: {2} \n", model.name, model.nodeID, model.modelID));
            }
            foreach (var operation in InternalCSGModelManager.Operations)
            {
                Debug.Log(string.Format("\toperation \"{0}\" node-id: {1} operation-id: {2} \n", operation.name, operation.nodeID, operation.operationID));
            }
            foreach (var brush in InternalCSGModelManager.Brushes)
            {
                Debug.Log(string.Format("\tbrush \"{0}\" node-id: {1} brush-id: {2} \n", brush.name, brush.nodeID, brush.brushID));
            }

            Debug.Log("--[C# side (unregistered)]--\n");

            var nodes      = SceneQueryUtility.GetAllComponentsInScene <CSGNode>(EditorSceneManager.GetActiveScene());
            var models     = (from node in nodes where node is CSGModel select node as CSGModel).ToArray();
            var operations = (from node in nodes where node is CSGOperation select node as CSGOperation).ToArray();
            var brushes    = (from node in nodes where node is CSGBrush select node as CSGBrush).ToArray();

            Debug.Log(string.Format("models {0} brushes {1} operations {2}\n", models.Length, brushes.Length, operations.Length));
            foreach (var model in models)
            {
                if (InternalCSGModelManager.Models.Contains(model))
                {
                    continue;
                }
                Debug.Log(string.Format("\tmodel \"{0}\" node-id: {1} model-id: {2} \n", model.name, model.nodeID, model.modelID));
            }
            foreach (var operation in operations)
            {
                if (InternalCSGModelManager.Operations.Contains(operation))
                {
                    continue;
                }
                Debug.Log(string.Format("\toperation \"{0}\" node-id: {1} operation-id: {2} \n", operation.name, operation.nodeID, operation.operationID));
            }
            foreach (var brush in brushes)
            {
                if (InternalCSGModelManager.Brushes.Contains(brush))
                {
                    continue;
                }
                Debug.Log(string.Format("\tbrush \"{0}\" node-id: {1} brush-id: {2} \n", brush.name, brush.nodeID, brush.brushID));
            }
        }
Beispiel #2
0
        void RunOnce()
        {
            if (EditorApplication.isPlaying)
            {
                // when you start playing the game in the editor, it'll call
                // RunOnce before playing the game, but not after.
                // so we need to wait until the game has stopped, after which we'll
                // run first update again.
                EditorApplication.update -= OnWaitUntillStoppedPlaying;
                EditorApplication.update += OnWaitUntillStoppedPlaying;
                return;
            }

            SceneView.onSceneGUIDelegate -= OnScene;
            SceneView.onSceneGUIDelegate += OnScene;
            Undo.undoRedoPerformed       -= UndoRedoPerformed;
            Undo.undoRedoPerformed       += UndoRedoPerformed;

            InternalCSGModelManager.UpdateHierarchy();

            var scene = SceneManager.GetActiveScene();
            var allGeneratedMeshes = SceneQueryUtility.GetAllComponentsInScene <GeneratedMeshes>(scene);

            for (int i = 0; i < allGeneratedMeshes.Count; i++)
            {
                if (allGeneratedMeshes[i].owner != true)
                {
                    UnityEngine.Object.DestroyImmediate(allGeneratedMeshes[i].gameObject);
                }
            }


            // we use a co-routine for updates because EditorApplication.update
            // works at a ridiculous rate and the co-routine is only fired in the
            // editor when something has happened.
            ResetUpdateRoutine();
        }