Esempio n. 1
0
        public override void OnInspectorGUI()
        {
            if (!sceneGUIEnabled)
            {
                Enable();
            }

            MLPCombinedVolume combinedVolume = (MLPCombinedVolume)target;

            GeneralMethods.MLPCombinedVolumeEditor(combinedVolume);
            EditorUtility.SetDirty(combinedVolume);
        }
Esempio n. 2
0
        private void OnEnable()
        {
            if (Instance == null)
            {
                Instance = this;
            }

#if UNITY_2019_1_OR_NEWER
            SceneView.duringSceneGui -= OnScene;
            SceneView.duringSceneGui += OnScene;
#else
            SceneView.onSceneGUIDelegate -= OnScene;
            SceneView.onSceneGUIDelegate += OnScene;
#endif
        }
Esempio n. 3
0
        private void RecreateCombinedVolumeObject(bool combined)
        {
            MagicLightProbes[] mlpVolumes = FindObjectsOfType <MagicLightProbes>();

            if (mlpVolumes.Length > 0)
            {
                MLPCombinedVolume combinedVolumeComponent = CreateCombinedVolumeObject(combined);

                for (int i = 0; i < mlpVolumes.Length; i++)
                {
                    combinedVolumeComponent.magicLightProbes = mlpVolumes[i];
                    mlpVolumes[i].combinedVolumeComponent    = combinedVolumeComponent;
                }
            }
        }
Esempio n. 4
0
        public static void AddVolume(List <MagicLightProbes> allGroups, Vector3 position = new Vector3(), float avaragedSize = 0)
        {
            GameObject mlpGroupsObject;

            mlpGroupsObject = GameObject.Find("Magic Light Probes");

            if (mlpGroupsObject == null)
            {
                mlpGroupsObject = new GameObject("Magic Light Probes");
            }

            GameObject newProbesVolume = new GameObject("MLP Group " + allGroups.Count, typeof(MagicLightProbes));

            newProbesVolume.transform.parent = mlpGroupsObject.transform;

            if (position != Vector3.zero)
            {
                newProbesVolume.transform.position = position;
            }
            else
            {
                newProbesVolume.transform.position = SceneView.lastActiveSceneView.camera.transform.position + SceneView.lastActiveSceneView.camera.transform.forward * 5;
            }

            GameObject probeVolume = GameObject.CreatePrimitive(PrimitiveType.Cube);

            probeVolume.name = "MLP Group " + allGroups.Count + " Volume";
            probeVolume.AddComponent <MLPVolume>();
            probeVolume.transform.parent = newProbesVolume.transform;
            probeVolume.GetComponent <MeshRenderer>().lightProbeUsage      = UnityEngine.Rendering.LightProbeUsage.Off;
            probeVolume.GetComponent <MeshRenderer>().reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
            probeVolume.GetComponent <MeshRenderer>().enabled = false;
            probeVolume.transform.localPosition = Vector3.zero;

            if (avaragedSize > 0)
            {
                probeVolume.transform.localScale = new Vector3(avaragedSize, avaragedSize, avaragedSize);
            }

            Object.DestroyImmediate(probeVolume.GetComponent <Collider>());

            GameObject lightProbeGroup = new GameObject("Light Probe Group " + allGroups.Count, typeof(MLPQuickEditing));

            lightProbeGroup.transform.parent = newProbesVolume.transform;

            MagicLightProbes mlp          = newProbesVolume.GetComponent <MagicLightProbes>();
            MLPQuickEditing  quickEditing = lightProbeGroup.GetComponent <MLPQuickEditing>();

            quickEditing.parent       = mlp;
            mlp.quickEditingComponent = quickEditing;
            mlp.probesVolume          = probeVolume;


            allGroups.Add(mlp);

            if (MLPCombinedVolume.Instance == null)
            {
                MLPCombinedVolume.CreateCombinedVolumeObject();
            }

            mlp.combinedVolumeComponent = MLPCombinedVolume.Instance;
        }