//[MenuItem("Test/Shutdown")] private static void Shutdown() { //Debug.Log("Shutdown"); EditorApplication.update -= Update; EditorApplication.playmodeStateChanged -= PlaymodeStateChanged; EditorApplication.hierarchyWindowChanged -= HierarchyWindowChanged; SceneView.onSceneGUIDelegate -= OnSceneView; Selection.selectionChanged -= SelectionChanged; GameObject.DestroyImmediate(GameObject.Find("<HDO>")); sceneID = 0; started = false; BocsCyclesAPI.Cycles_reset(); BocsCyclesAPI.Cycles_debug(); frameBuffer = null; }
private static void Startup() { if (started) { return; } if (Application.isPlaying) { return; } if (Camera.main == null) { Debug.Log("No MainCamera Found!"); return; } if (SceneView.lastActiveSceneView == null) { Debug.Log("No SceneView Active!"); return; } camera = SceneView.lastActiveSceneView.camera; if (camera == null) { Debug.Log("No SceneView Camera Found!"); return; } cameraSettings = Camera.main.GetComponent <BocsCyclesCamera>(); if (cameraSettings == null) { cameraSettings = Camera.main.gameObject.AddComponent <BocsCyclesCamera>(); } if (fullScreen) { cameraSettings._transparent = true; } else { cameraSettings._transparent = false; } lastPosition = camera.transform.position; lastRotation = camera.transform.rotation; //Debug.Log("Startup..."); StartSync(); EditorApplication.update += Update; EditorApplication.playmodeStateChanged += PlaymodeStateChanged; EditorApplication.hierarchyWindowChanged += HierarchyWindowChanged; SceneView.onSceneGUIDelegate += OnSceneView; Selection.selectionChanged += SelectionChanged; GameObject o = GameObject.Find("<HDO>"); if (o == null) { o = new GameObject("<HDO>"); } o.hideFlags = HideFlags.HideInHierarchy; sceneID = o.GetInstanceID(); started = true; BocsCyclesAPI.Cycles_reset(); BocsCyclesAPI.Cycles_set_active(); BocsCyclesAPI.UpdateSettings(camera, cameraSettings, width, height, samples); }