Esempio n. 1
0
        /// <summary>
        /// Override this method to make your own IMGUI based GUI for the property.
        /// Draw for one element one the list of SRPLensFlareElement
        /// </summary>
        /// <param name="position">Rectangle on the screen to use for the property GUI</param>
        /// <param name="property">The SerializedProperty to make the custom GUI for.</param>
        /// <param name="label">The label of this property.</param>
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            float originX      = position.x;
            float offsetHeight = 1.75f * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing);

            InitFirstRect(position);

            SerializedProperty intensityProp            = property.FindPropertyRelative("localIntensity");
            SerializedProperty positionProp             = property.FindPropertyRelative("position");
            SerializedProperty positionOffsetProp       = property.FindPropertyRelative("positionOffset");
            SerializedProperty angularOffsetProp        = property.FindPropertyRelative("angularOffset");
            SerializedProperty translationScaleProp     = property.FindPropertyRelative("translationScale");
            SerializedProperty lensFlareProp            = property.FindPropertyRelative("lensFlareTexture");
            SerializedProperty tintProp                 = property.FindPropertyRelative("tint");
            SerializedProperty blendModeProp            = property.FindPropertyRelative("blendMode");
            SerializedProperty countProp                = property.FindPropertyRelative("count");
            SerializedProperty allowMultipleElementProp = property.FindPropertyRelative("allowMultipleElement");
            SerializedProperty rotationProp             = property.FindPropertyRelative("rotation");
            SerializedProperty speedProp                = property.FindPropertyRelative("speed");
            SerializedProperty autoRotateProp           = property.FindPropertyRelative("autoRotate");
            SerializedProperty preserveAspectRatioProp  = property.FindPropertyRelative("preserveAspectRatio");
            SerializedProperty modulateByLightColor     = property.FindPropertyRelative("modulateByLightColor");
            SerializedProperty isFoldOpenedProp         = property.FindPropertyRelative("isFoldOpened");
            SerializedProperty flareTypeProp            = property.FindPropertyRelative("flareType");

            SerializedProperty uniformScaleProp = property.FindPropertyRelative("uniformScale");
            SerializedProperty sizeXYProp       = property.FindPropertyRelative("sizeXY");

            //
            SerializedProperty distributionProp = property.FindPropertyRelative("distribution");

            SerializedProperty lengthSpreadProp  = property.FindPropertyRelative("lengthSpread");
            SerializedProperty colorGradientProp = property.FindPropertyRelative("colorGradient");
            SerializedProperty positionCurveProp = property.FindPropertyRelative("positionCurve");
            SerializedProperty scaleCurveProp    = property.FindPropertyRelative("scaleCurve");

            // Random
            SerializedProperty seedProp = property.FindPropertyRelative("seed");
            SerializedProperty intensityVariationProp = property.FindPropertyRelative("intensityVariation");
            SerializedProperty positionVariationProp  = property.FindPropertyRelative("positionVariation");
            SerializedProperty scaleVariationProp     = property.FindPropertyRelative("scaleVariation");
            SerializedProperty sizeVariationProp      = property.FindPropertyRelative("sizeVariation");
            SerializedProperty rotationVariationProp  = property.FindPropertyRelative("rotationVariation");

            // Distortion
            SerializedProperty enableDistortionProp           = property.FindPropertyRelative("enableRadialDistortion");
            SerializedProperty targetSizeDistortionProp       = property.FindPropertyRelative("targetSizeDistortion");
            SerializedProperty distortionCurveProp            = property.FindPropertyRelative("distortionCurve");
            SerializedProperty distortionRelativeToCenterProp = property.FindPropertyRelative("distortionRelativeToCenter");

            SRPLensFlareType flareType        = (UnityEngine.SRPLensFlareType)flareTypeProp.enumValueIndex;
            Texture          texture          = lensFlareProp.objectReferenceValue ? lensFlareProp.objectReferenceValue as Texture : null;
            float            localAspectRatio = sizeXYProp.vector2Value.x / Mathf.Max(sizeXYProp.vector2Value.y, 1e-6f);
            float            imgWidth         = 1.5f * 35.0f;
            float            usedAspectRatio;

            if (flareType == SRPLensFlareType.Image)
            {
                usedAspectRatio = (lensFlareProp.objectReferenceValue && preserveAspectRatioProp.boolValue) ? (((float)texture.width) / ((float)texture.height)) : localAspectRatio;
            }
            else
            {
                usedAspectRatio = 1.0f;
            }
            if (isFoldOpenedProp.boolValue)
            {
                Rect imgRect = new Rect(m_CurrentRect.x + 0.5f * (position.width - imgWidth), m_CurrentRect.y + GUIStyle.none.lineHeight + 5.0f, imgWidth, imgWidth);
                if (flareType == SRPLensFlareType.Image)
                {
                    EditorGUI.DrawTextureTransparent(imgRect, lensFlareProp.objectReferenceValue as Texture, ScaleMode.ScaleToFit, usedAspectRatio);
                    m_CurrentRect.y += 1.5f * 35.0f;
                }
            }
            else
            {
                float imgOffY = 0.5f * (GetPropertyHeight(property, label) - imgWidth - GUIStyle.none.lineHeight);
                Rect  imgRect = new Rect(position.x - 35.0f + 15.0f, position.y + imgOffY + GUIStyle.none.lineHeight, imgWidth, imgWidth);
                if (flareType == SRPLensFlareType.Image)
                {
                    EditorGUI.DrawTextureTransparent(imgRect, lensFlareProp.objectReferenceValue as Texture, ScaleMode.ScaleToFit, usedAspectRatio);
                }
                else if (flareType == SRPLensFlareType.Circle)
                {
                    EditorGUI.DrawTextureTransparent(imgRect, Styles.circleIcon.image, ScaleMode.ScaleToFit, usedAspectRatio);
                }
                else //if (flareType != SRPLensFlareType.Polygon)
                {
                    EditorGUI.DrawTextureTransparent(imgRect, Styles.polygonIcon.image, ScaleMode.ScaleToFit, usedAspectRatio);
                }
            }
            Rect rect = m_CurrentRect;

            EditorGUI.BeginProperty(new Rect(rect.x, rect.y, rect.width, 2.0f * rect.height), label, property);

            float lineHeight = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;

            Color   tmpCol;
            bool    tmpBool;
            float   tmp;
            int     iTmp;
            Vector2 tmpVec2;
            Rect    localRect = new Rect(position.x, position.y, position.width, GUIStyle.none.lineHeight);

            if (EditorGUI.BeginFoldoutHeaderGroup(localRect, isFoldOpenedProp.boolValue, Styles.lensFlareElement))
            {
                rect = GetNextRect();
                EditorGUI.TextArea(rect, Styles.typeElement.text, style: EditorStyles.boldLabel);
                {
                    rect = GetNextRect();
                    SRPLensFlareType newType;
                    SRPLensFlareType typeValue = (UnityEngine.SRPLensFlareType)flareTypeProp.enumValueIndex;
                    if ((newType = ((SRPLensFlareType)(EditorGUI.EnumPopup(rect, Styles.flareType, typeValue)))) != typeValue)
                    {
                        flareTypeProp.enumValueIndex = (int)newType;
                    }

                    if (newType == SRPLensFlareType.Image)
                    {
                        Texture tmpTex;
                        rect = GetNextRect();
                        if ((tmpTex = (EditorGUI.ObjectField(rect, Styles.flareTexture, lensFlareProp.objectReferenceValue, typeof(Texture), false) as Texture)) != (lensFlareProp.objectReferenceValue as Texture))
                        {
                            lensFlareProp.objectReferenceValue = tmpTex;
                            lensFlareProp.serializedObject.ApplyModifiedProperties();
                        }

                        rect = GetNextRect();
                        if ((tmpBool = EditorGUI.Toggle(rect, Styles.preserveAspectRatio, preserveAspectRatioProp.boolValue)) != preserveAspectRatioProp.boolValue)
                        {
                            preserveAspectRatioProp.boolValue = tmpBool;
                        }
                    }
                    else if (newType == SRPLensFlareType.Circle || newType == SRPLensFlareType.Polygon)
                    {
                        SerializedProperty fallOffProp      = property.FindPropertyRelative("fallOff");
                        SerializedProperty edgeOffsetProp   = property.FindPropertyRelative("edgeOffset");
                        SerializedProperty sdfRoundnessProp = property.FindPropertyRelative("sdfRoundness");
                        SerializedProperty sideCountProp    = property.FindPropertyRelative("sideCount");
                        SerializedProperty inverseSDFProp   = property.FindPropertyRelative("inverseSDF");

                        rect = GetNextRect();
                        if ((tmp = EditorGUI.Slider(rect, Styles.edgeOffset, edgeOffsetProp.floatValue, 0.0f, 1.0f)) != edgeOffsetProp.floatValue)
                        {
                            edgeOffsetProp.floatValue = Mathf.Clamp01(tmp);
                        }

                        rect = GetNextRect();
                        if ((tmp = EditorGUI.Slider(rect, Styles.fallOff, fallOffProp.floatValue, 0.0f, 1.0f)) != fallOffProp.floatValue)
                        {
                            fallOffProp.floatValue = Mathf.Max(tmp, 0.0f);
                        }

                        if (newType == SRPLensFlareType.Polygon)
                        {
                            rect = GetNextRect();
                            if ((tmp = EditorGUI.IntSlider(rect, Styles.sideCount, sideCountProp.intValue, 3, 32)) != sideCountProp.intValue)
                            {
                                sideCountProp.intValue = (int)Mathf.Max(tmp, 0);
                            }

                            rect = GetNextRect();
                            if ((tmp = EditorGUI.Slider(rect, Styles.sdfRoundness, sdfRoundnessProp.floatValue, 0.0f, 1.0f)) != sdfRoundnessProp.floatValue)
                            {
                                sdfRoundnessProp.floatValue = Mathf.Clamp01(tmp);
                            }
                        }

                        rect = GetNextRect();
                        if ((tmpBool = EditorGUI.Toggle(rect, Styles.inverseSDF, inverseSDFProp.boolValue)) != inverseSDFProp.boolValue)
                        {
                            inverseSDFProp.boolValue = tmpBool;
                        }
                    }
                }

                rect = GetNextRect();
                EditorGUI.TextArea(rect, Styles.colorElement.text, EditorStyles.boldLabel);
                {
                    rect = GetNextRect();
                    if ((tmpCol = EditorGUI.ColorField(rect, Styles.tint, tintProp.colorValue)) != tintProp.colorValue)
                    {
                        tintProp.colorValue = tmpCol;
                    }
                    rect = GetNextRect();
                    if ((tmpBool = EditorGUI.Toggle(rect, Styles.modulateByLightColor, modulateByLightColor.boolValue)) != modulateByLightColor.boolValue)
                    {
                        modulateByLightColor.boolValue = tmpBool;
                    }
                    rect = GetNextRect();
                    if ((tmp = EditorGUI.FloatField(rect, Styles.intensity, intensityProp.floatValue)) != intensityProp.floatValue)
                    {
                        intensityProp.floatValue = Mathf.Max(tmp, 0.0f);
                    }
                    rect = GetNextRect();
                    SRPLensFlareBlendMode newBlendMode;
                    SRPLensFlareBlendMode blendModeValue = (UnityEngine.SRPLensFlareBlendMode)blendModeProp.enumValueIndex;
                    if ((newBlendMode = ((SRPLensFlareBlendMode)(EditorGUI.EnumPopup(rect, Styles.blendMode, blendModeValue)))) != blendModeValue)
                    {
                        blendModeProp.enumValueIndex = (int)newBlendMode;
                    }
                }

                rect = GetNextRect();
                EditorGUI.TextArea(rect, Styles.transformElement.text, EditorStyles.boldLabel);
                {
                    rect = GetNextRect();
                    if ((tmpVec2 = EditorGUI.Vector2Field(rect, Styles.positionOffset, positionOffsetProp.vector2Value)) != positionOffsetProp.vector2Value)
                    {
                        positionOffsetProp.vector2Value = tmpVec2;
                    }
                    rect = GetNextRect();
                    if ((tmpBool = EditorGUI.Toggle(rect, Styles.autoRotate, autoRotateProp.boolValue)) != autoRotateProp.boolValue)
                    {
                        autoRotateProp.boolValue = tmpBool;
                    }
                    rect = GetNextRect();
                    if ((tmp = EditorGUI.FloatField(rect, Styles.rotation, rotationProp.floatValue)) != rotationProp.floatValue)
                    {
                        rotationProp.floatValue = tmp;
                    }
                    rect = GetNextRect();
                    if ((tmpVec2 = EditorGUI.Vector2Field(rect, Styles.sizeXY, sizeXYProp.vector2Value)) != sizeXYProp.vector2Value)
                    {
                        sizeXYProp.vector2Value = new Vector2(Mathf.Max(tmpVec2.x, 1e-6f), Mathf.Max(tmpVec2.y, 1e-6f));
                    }
                    rect = GetNextRect();
                    if ((tmp = EditorGUI.FloatField(rect, Styles.uniformScale, uniformScaleProp.floatValue)) != uniformScaleProp.floatValue)
                    {
                        uniformScaleProp.floatValue = Mathf.Max(tmp, 0.0f);
                    }
                }

                rect = GetNextRect();
                EditorGUI.TextArea(rect, Styles.axisTransformElement.text, EditorStyles.boldLabel);
                {
                    rect = GetNextRect();
                    if ((tmp = EditorGUI.FloatField(rect, Styles.position, positionProp.floatValue)) != positionProp.floatValue)
                    {
                        positionProp.floatValue = tmp;
                    }
                    rect = GetNextRect();
                    if ((tmp = EditorGUI.FloatField(rect, Styles.angularOffset, angularOffsetProp.floatValue)) != angularOffsetProp.floatValue)
                    {
                        angularOffsetProp.floatValue = tmp;
                    }
                    rect = GetNextRect();
                    if ((tmpVec2 = EditorGUI.Vector2Field(rect, Styles.translationScale, translationScaleProp.vector2Value)) != translationScaleProp.vector2Value)
                    {
                        translationScaleProp.vector2Value = tmpVec2;
                    }
                }

                rect = GetNextRect();
                EditorGUI.TextArea(rect, Styles.radialDistortionElement.text, EditorStyles.boldLabel);
                {
                    rect = GetNextRect();
                    if ((tmpBool = EditorGUI.Toggle(rect, Styles.enableDistortion, enableDistortionProp.boolValue)) != enableDistortionProp.boolValue)
                    {
                        enableDistortionProp.boolValue = tmpBool;
                    }
                    if (enableDistortionProp.boolValue == true)
                    {
                        rect = GetNextRect();
                        if ((tmpVec2 = EditorGUI.Vector2Field(rect, Styles.targetSizeDistortion, targetSizeDistortionProp.vector2Value)) != targetSizeDistortionProp.vector2Value)
                        {
                            targetSizeDistortionProp.vector2Value = tmpVec2;
                        }
                        rect = GetNextRect();
                        EditorGUI.PropertyField(rect, distortionCurveProp, Styles.distortionCurve);
                        rect = GetNextRect();
                        if ((tmpBool = EditorGUI.Toggle(rect, Styles.distortionRelativeToCenter, distortionRelativeToCenterProp.boolValue)) != distortionRelativeToCenterProp.boolValue)
                        {
                            distortionRelativeToCenterProp.boolValue = tmpBool;
                        }
                    }
                }

                rect = GetNextRect();
                EditorGUI.TextArea(rect, Styles.multipleElementsElement.text, EditorStyles.boldLabel);
                {
                    rect = GetNextRect();
                    if ((tmpBool = EditorGUI.Toggle(rect, Styles.allowMultipleElement, allowMultipleElementProp.boolValue)) != allowMultipleElementProp.boolValue)
                    {
                        allowMultipleElementProp.boolValue = tmpBool;
                    }

                    if (allowMultipleElementProp.boolValue)
                    {
                        rect = GetNextRect();
                        if ((iTmp = EditorGUI.IntField(rect, Styles.count, countProp.intValue)) != countProp.intValue)
                        {
                            countProp.intValue = Mathf.Clamp(iTmp, 2, 4096); // 4096 is large enough for all imaginable use case (I hope)
                        }
                    }
                    if (allowMultipleElementProp.boolValue)
                    {
                        rect = GetNextRect();
                        SRPLensFlareDistribution newDistribution;
                        SRPLensFlareDistribution distributionValue = (UnityEngine.SRPLensFlareDistribution)distributionProp.enumValueIndex;
                        if ((newDistribution = ((SRPLensFlareDistribution)(EditorGUI.EnumPopup(rect, Styles.distribution, distributionValue)))) != distributionValue)
                        {
                            distributionProp.enumValueIndex = (int)newDistribution;
                        }

                        rect = GetNextRect();
                        if ((tmp = EditorGUI.FloatField(rect, Styles.lengthSpread, lengthSpreadProp.floatValue)) != lengthSpreadProp.floatValue)
                        {
                            lengthSpreadProp.floatValue = tmp;
                        }

                        if (newDistribution == SRPLensFlareDistribution.Uniform)
                        {
                            rect = GetNextRect();
                            EditorGUI.PropertyField(rect, colorGradientProp, Styles.colors);
                        }
                        else if (newDistribution == SRPLensFlareDistribution.Random)
                        {
                            rect = GetNextRect();
                            if ((iTmp = EditorGUI.IntField(rect, Styles.seed, seedProp.intValue)) != seedProp.intValue)
                            {
                                seedProp.intValue = Mathf.Max(iTmp, 0);
                            }

                            rect = GetNextRect();
                            if ((tmp = EditorGUI.FloatField(rect, Styles.intensityVariation, intensityVariationProp.floatValue)) != intensityVariationProp.floatValue)
                            {
                                intensityVariationProp.floatValue = Mathf.Clamp01(tmp);
                            }

                            rect = GetNextRect();
                            EditorGUI.PropertyField(rect, colorGradientProp, Styles.colors);

                            rect = GetNextRect();
                            if ((tmpVec2 = EditorGUI.Vector2Field(rect, Styles.positionVariation, positionVariationProp.vector2Value)) != positionVariationProp.vector2Value)
                            {
                                positionVariationProp.vector2Value = tmpVec2;
                            }

                            rect = GetNextRect();
                            if ((tmp = EditorGUI.FloatField(rect, Styles.rotationVariation, rotationVariationProp.floatValue)) != rotationVariationProp.floatValue)
                            {
                                rotationVariationProp.floatValue = Mathf.Max(tmp, 0.0f);
                            }

                            rect = GetNextRect();
                            if ((tmp = EditorGUI.FloatField(rect, Styles.scaleVariation, scaleVariationProp.floatValue)) != scaleVariationProp.floatValue)
                            {
                                scaleVariationProp.floatValue = Mathf.Max(tmp, 0.0f);
                            }
                        }
                        else if (newDistribution == SRPLensFlareDistribution.Curve)
                        {
                            rect = GetNextRect();
                            EditorGUI.PropertyField(rect, colorGradientProp, Styles.colors);
                            rect = GetNextRect();
                            EditorGUI.PropertyField(rect, positionCurveProp, Styles.positionCurve);
                            rect = GetNextRect();
                            EditorGUI.PropertyField(rect, scaleCurveProp, Styles.scaleCurve);
                        }
                    }
                }

                isFoldOpenedProp.boolValue = true;
            }
            else
            {
                rect = GetNextRect(35.0f);
                SRPLensFlareType newType;
                SRPLensFlareType typeValue = (UnityEngine.SRPLensFlareType)flareTypeProp.enumValueIndex;
                if ((newType = ((SRPLensFlareType)(EditorGUI.EnumPopup(rect, Styles.flareType, typeValue)))) != typeValue)
                {
                    flareTypeProp.enumValueIndex = (int)newType;
                }
                rect = GetNextRect();
                if ((tmpCol = EditorGUI.ColorField(rect, Styles.tint, tintProp.colorValue)) != tintProp.colorValue)
                {
                    tintProp.colorValue = tmpCol;
                }

                rect = GetNextRect();
                if ((tmp = EditorGUI.FloatField(rect, Styles.intensity, intensityProp.floatValue)) != intensityProp.floatValue)
                {
                    intensityProp.floatValue = Mathf.Max(tmp, 0.0f);
                }


                if (allowMultipleElementProp.boolValue)
                {
                    rect = GetNextRect();
                    if ((iTmp = EditorGUI.IntField(rect, Styles.count, countProp.intValue)) != countProp.intValue)
                    {
                        countProp.intValue = Mathf.Max(iTmp, 2);
                    }
                }

                isFoldOpenedProp.boolValue = false;
            }
            EditorGUI.EndFoldoutHeaderGroup();
            EditorGUI.EndProperty();
        }
        void DrawTypeCathegory(ref Rect remainingRect, SerializedProperty element)
        {
            SerializedProperty type = element.FindPropertyRelative("flareType");

            IEnumerator <Rect> fieldRect = ReserveCathegory(remainingRect, GetTypeCathegoryLines(type));

            fieldRect.MoveNext();
            EditorGUI.LabelField(fieldRect.Current, Styles.typeCathegory, EditorStyles.boldLabel);

            fieldRect.MoveNext();
            EditorGUI.PropertyField(fieldRect.Current, type, Styles.type);

            SRPLensFlareType flareType = GetEnum <SRPLensFlareType>(type);

            switch (flareType)
            {
            case SRPLensFlareType.Image:
            {
                SerializedProperty flareTexture        = element.FindPropertyRelative("lensFlareTexture");
                SerializedProperty preserveAspectRatio = element.FindPropertyRelative("preserveAspectRatio");

                // display it with texture icon
                fieldRect.MoveNext();
                EditorGUI.BeginChangeCheck();
                Texture newTexture = EditorGUI.ObjectField(fieldRect.Current, Styles.flareTexture, flareTexture.objectReferenceValue, typeof(Texture), false) as Texture;
                if (EditorGUI.EndChangeCheck())
                {
                    flareTexture.objectReferenceValue = newTexture;
                }

                fieldRect.MoveNext();
                EditorGUI.PropertyField(fieldRect.Current, preserveAspectRatio, Styles.preserveAspectRatio);
            }
            break;

            case SRPLensFlareType.Circle:
            case SRPLensFlareType.Polygon:
            {
                SerializedProperty gradient   = element.FindPropertyRelative("m_EdgeOffset");
                SerializedProperty fallOff    = element.FindPropertyRelative("m_FallOff");
                SerializedProperty inverseSDF = element.FindPropertyRelative("inverseSDF");

                fieldRect.MoveNext();
                EditorGUI.PropertyField(fieldRect.Current, gradient, Styles.gradient);

                fieldRect.MoveNext();
                EditorGUI.PropertyField(fieldRect.Current, fallOff, Styles.fallOff);

                if (flareType == SRPLensFlareType.Polygon)
                {
                    SerializedProperty sideCount    = element.FindPropertyRelative("m_SideCount");
                    SerializedProperty sdfRoundness = element.FindPropertyRelative("m_SdfRoundness");

                    fieldRect.MoveNext();
                    EditorGUI.PropertyField(fieldRect.Current, sideCount, Styles.sideCount);

                    fieldRect.MoveNext();
                    EditorGUI.PropertyField(fieldRect.Current, sdfRoundness, Styles.sdfRoundness);
                }

                fieldRect.MoveNext();
                EditorGUI.PropertyField(fieldRect.Current, inverseSDF, Styles.inverseSDF);
            }
            break;
            }

            // update remaining
            fieldRect.MoveNext();
            remainingRect = fieldRect.Current;
        }
Esempio n. 3
0
        /// <summary>
        /// Override this method to specify how tall the GUI for this field is in pixels
        /// </summary>
        /// <param name="property">The SerializedProperty to make the custom GUI for.</param>
        /// <param name="label">The label of this property.</param>
        /// <returns>The height in pixels.</returns>
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            SerializedProperty isFoldOpened             = property.FindPropertyRelative("isFoldOpened");
            SerializedProperty distributionProp         = property.FindPropertyRelative("distribution");
            SerializedProperty flareTypeProp            = property.FindPropertyRelative("flareType");
            SerializedProperty enableDistortionProp     = property.FindPropertyRelative("enableRadialDistortion");
            SerializedProperty allowMultipleElementProp = property.FindPropertyRelative("allowMultipleElement");

            SRPLensFlareType flareType = (SRPLensFlareType)flareTypeProp.enumValueIndex;

            float coef;
            float offset = 0.0f;

            if (isFoldOpened.boolValue)
            {
                if (flareType == SRPLensFlareType.Polygon || flareType == SRPLensFlareType.Circle)
                {
                    coef = 26.0f;
                }
                else
                {
                    coef = 27.0f;
                }

                if (flareType == SRPLensFlareType.Polygon || flareType == SRPLensFlareType.Circle)
                {
                    coef -= 0.5f;

                    if (flareType == SRPLensFlareType.Polygon)
                    {
                        coef += 2.0f;
                    }
                }

                if (enableDistortionProp.boolValue == false)
                {
                    coef -= 3.0f;
                }

                if (allowMultipleElementProp.boolValue)
                {
                    coef += 3.0f;
                    if ((SRPLensFlareDistribution)distributionProp.enumValueIndex == SRPLensFlareDistribution.Uniform)
                    {
                        coef += 1.0f;
                    }
                    else if ((SRPLensFlareDistribution)distributionProp.enumValueIndex == SRPLensFlareDistribution.Random)
                    {
                        coef += 6.0f;
                    }
                    else if ((SRPLensFlareDistribution)distributionProp.enumValueIndex == SRPLensFlareDistribution.Curve)
                    {
                        coef += 3.0f;
                    }
                }

                offset = 1.5f * 35.0f;
            }
            else
            {
                coef = 5.0f;
                if (!allowMultipleElementProp.boolValue)
                {
                    coef -= 1.0f;
                }
            }

            return(coef * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) + offset);
        }