Exemple #1
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox("Temporary UI for demo purposes.", MessageType.Info);

            PropertyField(m_LogLut);

            var lut = (target as ColorGrading).logLut.value;

            // Checks import settings on the LUT
            if (lut != null)
            {
                var importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(lut)) as TextureImporter;

                // Fails when using an internal texture as you can't change import settings on
                // builtin resources, thus the check for null
                if (importer != null)
                {
                    bool valid = importer.anisoLevel == 0 &&
                                 importer.mipmapEnabled == false &&
                                 importer.sRGBTexture == false &&
                                 (importer.textureCompression == TextureImporterCompression.Uncompressed) &&
                                 importer.filterMode == FilterMode.Bilinear;

                    if (!valid)
                    {
                        EditorUtilities.DrawFixMeBox("Invalid LUT import settings.", () => SetLutImportSettings(importer));
                    }
                }
            }
        }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            PropertyField(m_Mode);
            PropertyField(m_Color);

            if (m_Mode.value.intValue == (int)VignetteMode.Classic)
            {
                PropertyField(m_Center);
                PropertyField(m_Intensity);
                PropertyField(m_Smoothness);
                PropertyField(m_Roundness);
                PropertyField(m_Rounded);
            }
            else
            {
                PropertyField(m_Mask);

                var mask = (target as Vignette).mask.value;

                // Checks import settings on the mask
                if (mask != null)
                {
                    var importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(mask)) as TextureImporter;

                    // Fails when using an internal texture as you can't change import settings on
                    // builtin resources, thus the check for null
                    if (importer != null)
                    {
                        bool valid = importer.anisoLevel == 0 &&
                                     importer.mipmapEnabled == false &&
                                     importer.alphaSource == TextureImporterAlphaSource.FromGrayScale &&
                                     importer.textureCompression == TextureImporterCompression.Uncompressed &&
                                     importer.wrapMode == TextureWrapMode.Clamp;

                        if (!valid)
                        {
                            EditorUtilities.DrawFixMeBox("Invalid mask import settings.", () => SetMaskImportSettings(importer));
                        }
                    }
                }

                PropertyField(m_Opacity);
            }
        }
        void CheckLutImportSettings(Texture lut)
        {
            if (lut != null)
            {
                var importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(lut)) as TextureImporter;

                // Fails when using an internal texture as you can't change import settings on
                // builtin resources, thus the check for null
                if (importer != null)
                {
                    bool valid = importer.anisoLevel == 0 &&
                                 importer.mipmapEnabled == false &&
                                 importer.sRGBTexture == false &&
                                 importer.textureCompression == TextureImporterCompression.Uncompressed &&
                                 importer.filterMode == FilterMode.Bilinear &&
                                 importer.wrapMode == TextureWrapMode.Clamp;

                    if (!valid)
                    {
                        EditorUtilities.DrawFixMeBox("Invalid LUT import settings.", () => SetLutImportSettings(importer));
                    }
                }
            }
        }