Exemple #1
0
        public virtual void OnDisable()
        {
            ExitBlueprintEditMode();

#if (UNITY_2019_1_OR_NEWER)
            RenderPipelineManager.beginCameraRendering -= renderCallback;
#endif
            Camera.onPreCull -= DrawWithCamera;

            ObiParticleEditorDrawing.DestroyParticlesMesh();

            foreach (var tool in tools)
            {
                tool.OnDisable();
                tool.OnDestroy();
            }

            foreach (var renderMode in renderModes)
            {
                renderMode.OnDestroy();
            }

            properties.Clear();
            renderModes.Clear();
        }
Exemple #2
0
        public virtual void OnDisable()
        {
            ExitBlueprintEditMode();

            Camera.onPreCull -= DrawWithCamera;
            ObiParticleEditorDrawing.DestroyParticlesMesh();

            foreach (var tool in tools)
            {
                tool.OnDisable();
                tool.OnDestroy();
            }

            foreach (var renderMode in renderModes)
            {
                renderMode.OnDestroy();
            }
        }
Exemple #3
0
        public virtual void OnSceneGUI(SceneView sceneView)
        {
            if (!isEditing || sceneView.camera == null)
            {
                return;
            }

            ResizeParticleArrays();

            Event e = Event.current;

            if (e.type == EventType.Repaint)
            {
                // Update camera facing status and world space positions array:
                UpdateParticleVisibility();

                // Generate sorted indices for back-to-front rendering:
                for (int i = 0; i < sortedIndices.Length; i++)
                {
                    sortedIndices[i] = i;
                }
                Array.Sort <int>(sortedIndices, (a, b) => sqrDistanceToCamera[b].CompareTo(sqrDistanceToCamera[a]));

                // render modes OnSceneRepaint:
                for (int i = 0; i < renderModes.Count; ++i)
                {
                    if ((1 << i & renderModeFlags) != 0)
                    {
                        renderModes[i].OnSceneRepaint(sceneView);
                    }
                }

                // property OnSceneRepaint:
                currentProperty.OnSceneRepaint();

                // Draw particle handles:
                ObiParticleEditorDrawing.DrawParticles(sceneView.camera, blueprint, visible, selectionStatus, sortedIndices);
            }

            if (currentTool != null)
            {
                currentTool.OnSceneGUI(sceneView);
            }
        }