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.wrapMode == TextureWrapMode.Clamp;

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

                if (lut.width != lut.height * lut.height)
                {
                    EditorGUILayout.HelpBox("The Lookup Texture size is invalid. Width should be Height * Height.", MessageType.Error);
                }
            }
        }
        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)
                    {
                        var 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);
            }
        }
Exemple #3
0
        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.wrapMode == TextureWrapMode.Clamp;

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