Exemplo n.º 1
0
        public static void Draw(LightingSettings.Profile profile)
        {
            bool foldout = GUIFoldoutHeader.Begin("Quality", profile.qualitySettings);

            if (foldout == false)
            {
                GUIFoldoutHeader.End();
                return;
            }

            EditorGUI.indentLevel++;

            EditorGUILayout.Space();

            profile.qualitySettings.projection = (Projection)EditorGUILayout.EnumPopup("Projection", profile.qualitySettings.projection);

            profile.qualitySettings.coreAxis = (CoreAxis)EditorGUILayout.EnumPopup("Core Axis", profile.qualitySettings.coreAxis);

            profile.qualitySettings.updateMethod = (LightingSettings.UpdateMethod)EditorGUILayout.EnumPopup("Update Method", profile.qualitySettings.updateMethod);

            profile.qualitySettings.lightTextureSize = (LightingSourceTextureSize)EditorGUILayout.Popup("Light Resolution", (int)profile.qualitySettings.lightTextureSize, LightingSettings.QualitySettings.LightingSourceTextureSizeArray);

            profile.qualitySettings.lightEffectTextureSize = (LightingSourceTextureSize)EditorGUILayout.Popup("Light Effect Resolution", (int)profile.qualitySettings.lightEffectTextureSize, LightingSettings.QualitySettings.LightingSourceTextureSizeArray);

            profile.qualitySettings.lightFilterMode = (FilterMode)EditorGUILayout.EnumPopup("Light Filter Mode", profile.qualitySettings.lightFilterMode);

            profile.qualitySettings.HDR = EditorGUILayout.Toggle("Light HDR", profile.qualitySettings.HDR);

            EditorGUI.indentLevel--;

            GUIFoldoutHeader.End();
        }
Exemplo n.º 2
0
        public static void Draw(LightingSettings.Profile profile)
        {
            bool foldout = GUIFoldoutHeader.Begin("Day Lighting", profile.dayLightingSettings);

            if (foldout == false)
            {
                GUIFoldoutHeader.End();
                return;
            }

            EditorGUI.indentLevel++;

            EditorGUILayout.Space();

            profile.dayLightingSettings.alpha = EditorGUILayout.Slider("Alpha", profile.dayLightingSettings.alpha, 0, 1);

            profile.dayLightingSettings.direction = EditorGUILayout.Slider("Direction", profile.dayLightingSettings.direction, 0, 360);

            profile.dayLightingSettings.height = EditorGUILayout.Slider("Height", profile.dayLightingSettings.height, 0.1f, 10);

            SunPenumbra.Draw(profile);

            NormalMap.Draw(profile);

            EditorGUI.indentLevel--;

            GUIFoldoutHeader.End();
        }
Exemplo n.º 3
0
        public static void Draw(LightingSettings.Profile profile)
        {
            bool foldout = GUIFoldoutHeader.Begin("Layers", profile.layers);

            if (foldout == false)
            {
                GUIFoldoutHeader.End();
                return;
            }

            EditorGUI.indentLevel++;

            EditorGUILayout.Space();

            DrawList(profile.layers.lightLayers, "Light Layers", "Light Layer");

            EditorGUILayout.Space();

            DrawList(profile.layers.nightLayers, "Night Layers", "Night Layer");

            EditorGUILayout.Space();

            DrawList(profile.layers.dayLayers, "Day Layers", "Day Layer");

            EditorGUI.indentLevel--;

            GUIFoldoutHeader.End();
        }
Exemplo n.º 4
0
	public void UpdateProfile() {
		if (setProfile == null) {
            setProfile = Lighting2D.ProjectSettings.Profile;
        } 

		if (Application.isPlaying == true) {
			profile = Object.Instantiate(setProfile);
		} else {
			profile = setProfile;
		}
	}
Exemplo n.º 5
0
	public void SetupProfile() {
		if (LightingManager2D.initialized) {
			return;
		}

		LightingManager2D.initialized = true;

		LightingSettings.Profile profile = Lighting2D.Profile;
		Lighting2D.UpdateByProfile(profile);

		AtlasSystem.Manager.Initialize();
		Lighting2D.materials.Reset();
	}
Exemplo n.º 6
0
            public static void Draw(LightingSettings.Profile profile)
            {
                bool foldout = GUIFoldout.Draw("Normal Map", profile.dayLightingSettings.bumpMap);

                if (foldout == false)
                {
                    return;
                }

                EditorGUI.indentLevel++;

                profile.dayLightingSettings.bumpMap.height   = EditorGUILayout.Slider("Height", profile.dayLightingSettings.bumpMap.height, 0, 5);
                profile.dayLightingSettings.bumpMap.strength = EditorGUILayout.Slider("Strength", profile.dayLightingSettings.bumpMap.strength, 0, 5);

                EditorGUI.indentLevel--;
            }
Exemplo n.º 7
0
    public static void Draw()
    {
        LightingSettings.Profile profile = Lighting2D.Profile;

        EditorGUI.BeginDisabledGroup(true);
        EditorGUILayout.ObjectField("Current Profile", profile, typeof(LightingSettings.Profile), true);
        EditorGUI.EndDisabledGroup();

        EditorGUILayout.Space();

        if (profile == null)
        {
            EditorGUILayout.HelpBox("Lighting2D Settings Profile Not Found!", MessageType.Error);

            return;
        }

        DrawProfile(profile);
    }
Exemplo n.º 8
0
            public static void Draw(LightingSettings.Profile profile)
            {
                bool foldout = GUIFoldout.Draw("Softness", profile.dayLightingSettings.softness);

                if (foldout == false)
                {
                    return;
                }

                EditorGUI.indentLevel++;

                profile.dayLightingSettings.softness.enable    = EditorGUILayout.Toggle("Enable", profile.dayLightingSettings.softness.enable);
                profile.dayLightingSettings.softness.intensity = EditorGUILayout.FloatField("Intensity", profile.dayLightingSettings.softness.intensity);

                if (profile.dayLightingSettings.softness.intensity < 0)
                {
                    profile.dayLightingSettings.softness.intensity = 0;
                }
                EditorGUI.indentLevel--;
            }
Exemplo n.º 9
0
    public static void DrawProfile(LightingSettings.Profile profile)
    {
        EditorGUI.BeginChangeCheck();

        // Common Settings

        CommonSettings(profile.bufferPresets.list[0]);

        EditorGUILayout.Space();

        // Sorting Layer

        SortingLayer(profile.bufferPresets.list[0].sortingLayer);

        EditorGUILayout.Space();

        // Quality Settings

        QualitySettings.Draw(profile);

        EditorGUILayout.Space();

        // Layers

        Layers.Draw(profile);

        EditorGUILayout.Space();

        // Day Lighting

        DayLighting.Draw(profile);

        EditorGUILayout.Space();

        // Fog of War

        EditorGUILayout.Space();

        // Buffer Presets

        BufferPresets.Draw(profile.bufferPresets);

        EditorGUILayout.Space();

        // Light Presets

        LightPresets.Draw(profile.lightPresets);

        EditorGUILayout.Space();

        // Event Presets

        EventPresets.Draw(profile.eventPresets);

        EditorGUILayout.Space();

        // Disable

        profile.disable = EditorGUILayout.Toggle("Disable", profile.disable);

        EditorGUI.EndChangeCheck();

        if (GUI.changed)
        {
            if (EditorApplication.isPlaying == false)
            {
                if (Lighting2D.Profile == profile)
                {
                    Light2D.ForceUpdateAll();

                    LightingManager2D.ForceUpdate();

                    foreach (OnRenderMode onRender in OnRenderMode.List)
                    {
                        BufferPreset bufferPreset = onRender.mainBuffer.GetBufferPreset();
                        bufferPreset.sortingLayer.ApplyToMeshRenderer(onRender.meshRenderer);
                    }
                }

                EditorUtility.SetDirty(profile);
            }
        }
    }
    override public void OnInspectorGUI()
    {
        LightingManager2D script = target as LightingManager2D;

        LightingSettings.Profile newProfile = (LightingSettings.Profile)EditorGUILayout.ObjectField("Profile", script.setProfile, typeof(LightingSettings.Profile), true);
        if (newProfile != script.setProfile)
        {
            script.setProfile = newProfile;

            script.UpdateProfile();

            // LightingMainBuffer2D.Clear();
            // Light2D.ForceUpdateAll();
        }

        EditorGUILayout.Space();

        int count = script.cameraSettings.Length;

        count = EditorGUILayout.IntSlider("Camera Count", count, 0, 10);
        if (count != script.cameraSettings.Length)
        {
            System.Array.Resize(ref script.cameraSettings, count);
        }

        EditorGUILayout.Space();

        for (int id = 0; id < script.cameraSettings.Length; id++)
        {
            CameraSettings cameraSetting = script.cameraSettings[id];

            cameraFoldout[id] = EditorGUILayout.Foldout(cameraFoldout[id], "Camera " + (id + 1) + " (" + cameraSetting.GetTypeName() + ")");

            if (cameraFoldout[id] == false)
            {
                EditorGUILayout.Space();
                continue;
            }

            EditorGUI.indentLevel++;

            cameraSetting.cameraType = (CameraSettings.CameraType)EditorGUILayout.EnumPopup("Camera Type", cameraSetting.cameraType);

            if (cameraSetting.cameraType == CameraSettings.CameraType.Custom)
            {
                cameraSetting.customCamera = (Camera)EditorGUILayout.ObjectField(cameraSetting.customCamera, typeof(Camera), true);
            }

            cameraSetting.bufferID = EditorGUILayout.Popup("Buffer Preset", (int)cameraSetting.bufferID, Lighting2D.Profile.bufferPresets.GetBufferLayers());

            cameraSetting.renderMode = (CameraSettings.RenderMode)EditorGUILayout.EnumPopup("Render Mode", cameraSetting.renderMode);

            if (cameraSetting.renderMode == CameraSettings.RenderMode.Draw)
            {
                cameraSetting.renderShader = (CameraSettings.RenderShader)EditorGUILayout.EnumPopup("Render Shader", cameraSetting.renderShader);

                if (cameraSetting.renderShader == CameraSettings.RenderShader.Custom)
                {
                    cameraSetting.customMaterial = (Material)EditorGUILayout.ObjectField(cameraSetting.customMaterial, typeof(Material), true);
                }

                cameraSetting.renderLayerType = (CameraSettings.RenderLayerType)EditorGUILayout.EnumPopup("Render Layer Type", cameraSetting.renderLayerType);

                if (cameraSetting.renderLayerType == CameraSettings.RenderLayerType.Custom)
                {
                    cameraSetting.renderLayerId = EditorGUILayout.LayerField("Render Layer", cameraSetting.renderLayerId);
                }
            }

            cameraMaterialsFoldout[id] = EditorGUILayout.Foldout(cameraMaterialsFoldout[id], "Materials");

            if (cameraMaterialsFoldout[id])
            {
                EditorGUI.indentLevel++;

                CameraMaterials materials = cameraSetting.GetMaterials();


                int matCount = materials.materials.Length;
                matCount = EditorGUILayout.IntField("Count", matCount);
                if (matCount != materials.materials.Length)
                {
                    System.Array.Resize(ref materials.materials, matCount);
                }

                for (int i = 0; i < materials.materials.Length; i++)
                {
                    materials.materials[i] = (Material)EditorGUILayout.ObjectField(materials.materials[i], typeof(Material), true);
                }

                EditorGUI.indentLevel--;
            }



            cameraSetting.id = id;

            script.cameraSettings[id] = cameraSetting;

            EditorGUI.indentLevel--;

            EditorGUILayout.Space();
        }



        /*
         *
         *
         * cameraSetting.renderMode = (CameraSettings.RenderMode)EditorGUILayout.EnumPopup("Render Mode", cameraSetting.renderMode);
         *
         * if (cameraSetting.renderMode == CameraSettings.RenderMode.Draw) {
         *      cameraSetting.renderShader = (CameraSettings.RenderShader)EditorGUILayout.EnumPopup("Render Shader", cameraSetting.renderShader);
         *
         *      if (cameraSetting.renderShader == CameraSettings.RenderShader.Custom) {
         *      cameraSetting.customMaterial = (Material)EditorGUILayout.ObjectField(cameraSetting.customMaterial, typeof(Material), true);
         *      }
         * }*/



        EditorGUILayout.Space();

        EditorGUILayout.LabelField("version " + Lighting2D.VERSION_STRING);

        string buttonName = "";

        if (script.version < Lighting2D.VERSION)
        {
            buttonName         += "Re-Initialize (Outdated)";
            GUI.backgroundColor = Color.red;

            Reinitialize(script);

            return;
        }
        else
        {
            buttonName += "Re-Initialize";
        }

        if (GUILayout.Button(buttonName))
        {
            Reinitialize(script);
        }

        if (GUI.changed)
        {
            Light2D.ForceUpdateAll();

            LightingManager2D.ForceUpdate();

            if (EditorApplication.isPlaying == false)
            {
                EditorUtility.SetDirty(target);
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
            }
        }
    }
Exemplo n.º 11
0
    override public void OnInspectorGUI()
    {
        LightingSettings.Profile profile = target as LightingSettings.Profile;

        ProfileEditor.DrawProfile(profile);
    }