Esempio n. 1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            label.text = "Direction";
            EditorGUI.BeginProperty(position, label, property);
            var indent = EditorGUI.indentLevel;

            showPosition          = EditorGUILayout.Foldout(showPosition, label);
            EditorGUI.indentLevel = 1;

            if (showPosition)
            {
                spAngleStart = property.FindPropertyRelative("angleStart");
                spAngleEnd   = property.FindPropertyRelative("angleEnd");
                spInvert     = property.FindPropertyRelative("invertSprites");
                spSprite     = property.FindPropertyRelative("sprites");
                angleStart   = spAngleStart.floatValue;
                angleEnd     = spAngleEnd.floatValue;

                EditorGUILayout.LabelField("Angles:");
                EditorGUILayout.BeginHorizontal();
                angleStart = EditorGUILayout.FloatField(angleStart);
                angleStart = Mathf.Clamp(angleStart, -180, angleEnd);
                EditorGUILayout.MinMaxSlider(ref angleStart, ref angleEnd, -180, 180);
                angleEnd = EditorGUILayout.FloatField(angleEnd);
                angleEnd = Mathf.Clamp(angleEnd, angleStart, 180);
                EditorGUILayout.EndHorizontal();


                EditorGUILayout.PropertyField(spInvert);
                spAngleStart.floatValue = angleStart;
                spAngleEnd.floatValue   = angleEnd;
                EditorGUILayout.PropertyField(spSprite);
            }

            EditorGUI.indentLevel = indent;
            EditorGUI.EndProperty();
        }
        void MipMapGUI()
        {
            ToggleFromInt(m_EnableMipMap, s_Styles.generateMipMaps);

            if (m_EnableMipMap.boolValue && !m_EnableMipMap.hasMultipleDifferentValues)
            {
                EditorGUI.indentLevel++;
                ToggleFromInt(m_BorderMipMap, s_Styles.borderMipMaps);
                EditorGUILayout.Popup(s_Styles.mipMapFilter, m_MipMapMode.intValue, s_Styles.mipMapFilterOptions);

                ToggleFromInt(m_MipMapsPreserveCoverage, s_Styles.mipMapsPreserveCoverage);
                if (m_MipMapsPreserveCoverage.intValue != 0 && !m_MipMapsPreserveCoverage.hasMultipleDifferentValues)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(m_AlphaTestReferenceValue, s_Styles.alphaTestReferenceValue);
                    EditorGUI.indentLevel--;
                }

                // Mipmap fadeout
                ToggleFromInt(m_FadeOut, s_Styles.mipmapFadeOutToggle);
                if (m_FadeOut.intValue > 0)
                {
                    EditorGUI.indentLevel++;
                    EditorGUI.BeginChangeCheck();
                    float min = m_MipMapFadeDistanceStart.intValue;
                    float max = m_MipMapFadeDistanceEnd.intValue;
                    EditorGUILayout.MinMaxSlider(s_Styles.mipmapFadeOut, ref min, ref max, 0, 10);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_MipMapFadeDistanceStart.intValue = Mathf.RoundToInt(min);
                        m_MipMapFadeDistanceEnd.intValue   = Mathf.RoundToInt(max);
                    }
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }
        }
Esempio n. 3
0
    void OnGUI()
    {
        go = EditorGUILayout.ObjectField("Terrain game object", go, typeof(GameObject), true) as GameObject;
        if (!go)
        {
            return;
        }
        Terrain terrainObject;

        terrainObject = go.GetComponent(typeof(Terrain)) as Terrain;
        if (!terrainObject)
        {
            return;
        }
        terrain    = terrainObject.terrainData;
        terrainPos = terrainObject.transform.position;

        saveFormat     = (SaveFormatRTPtweaked)EditorGUILayout.EnumPopup("Export Format", saveFormat);
        saveResolution = (SaveResolutionRTPtweaked)EditorGUILayout.EnumPopup("Resolution", saveResolution);

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Slope range (" + Mathf.RoundToInt(loAngle) + "\u00B0 - " + Mathf.RoundToInt(hiAngle) + "\u00B0)");
        if (saveFormat == SaveFormatRTPtweaked.Triangles)
        {
            EditorGUILayout.MinMaxSlider(ref loAngle, ref hiAngle, 0, 90);
        }
        EditorGUILayout.EndHorizontal();

        AnchorOffset = EditorGUILayout.Toggle("Anchor Offset", AnchorOffset);



        if (GUILayout.Button("Export"))
        {
            Export();
        }
    }
Esempio n. 4
0
    void drawAnimationInspector(int index)
    {
        var animation = serializedObject.FindProperty("animations").GetArrayElementAtIndex(index);

        if (animation.FindPropertyRelative("animation").objectReferenceValue == null)
        {
            return;
        }

        var name = animation.FindPropertyRelative("animation").objectReferenceValue.GetType().Name;

        animation.FindPropertyRelative("enabled").boolValue = EditorGUILayout.BeginToggleGroup(name, animation.FindPropertyRelative("enabled").boolValue);

        if (animation.FindPropertyRelative("enabled").boolValue)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(8);
            EditorGUILayout.BeginVertical();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Interval");

            var min = animation.FindPropertyRelative("startTime").floatValue;
            var max = animation.FindPropertyRelative("endTime").floatValue;
            EditorGUILayout.MinMaxSlider(ref min, ref max, 0, 1);
            animation.FindPropertyRelative("startTime").floatValue = min;
            animation.FindPropertyRelative("endTime").floatValue   = max;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
        }

        EditorGUILayout.EndToggleGroup();
    }
Esempio n. 5
0
        public override void OnInspectorGUI()
        {
            var attack = (MeleeAnimation)target;

            Undo.RecordObject(attack, "Min Max Slider");

            attack.Limb = (Limb)EditorGUILayout.EnumPopup("Limb: ", attack.Limb);

            attack.Moment = EditorGUILayout.Slider("Moment: ", attack.Moment, 0, 1);

            if (attack.Moment > attack.End)
            {
                attack.Moment = attack.End;
            }

            EditorGUILayout.LabelField("Scan Start: ", attack.ScanStart.ToString());
            EditorGUILayout.LabelField("Scan End: ", attack.ScanEnd.ToString());
            EditorGUILayout.MinMaxSlider(ref attack.ScanStart, ref attack.ScanEnd, 0, 1);

            if (attack.EnableCombo)
            {
                EditorGUILayout.LabelField("Combo Check: ", attack.ComboCheck.ToString());
                EditorGUILayout.LabelField("End: ", attack.End.ToString());
                EditorGUILayout.MinMaxSlider(ref attack.ComboCheck, ref attack.End, 0, 1);
            }
            else
            {
                attack.End = EditorGUILayout.Slider("End: ", attack.End, 0, 1);
            }

            attack.EnableCombo = EditorGUILayout.Toggle("Enable Combo: ", attack.EnableCombo);

            if (attack.End < attack.ScanEnd)
            {
                attack.End = attack.ScanEnd;
            }
        }
Esempio n. 6
0
        public static void FloatRangeField(string label, ref float minValue, ref float maxValue, float minLimit, float maxLimit)
        {
            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(label, GUILayout.MaxWidth(196));
            minValue = EditorGUILayout.FloatField(minValue);
            EditorGUILayout.MinMaxSlider(ref minValue, ref maxValue, minLimit, maxLimit);
            maxValue = EditorGUILayout.FloatField(maxValue);

            if (minValue < minLimit)
            {
                minValue = minLimit;
            }
            if (maxValue > maxLimit)
            {
                maxValue = maxLimit;
            }
            if (maxValue > maxLimit - 0.02f)
            {
                maxValue = maxLimit;
            }


            GUILayout.EndHorizontal();
        }
        public override void OnBodyGUI()
        {
            serializedObject.Update();

            AISetVariable node = target as AISetVariable;

            GUILayout.BeginHorizontal();
            NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"), GUILayout.MinWidth(0));
            GUILayout.EndHorizontal();

            EditorGUILayout.LabelField(new GUIContent("Wait Range"));
            GUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("waitTimeMin"), new GUIContent(""), GUILayout.MaxWidth(20f));
            float min = serializedObject.FindProperty("waitTimeMin").floatValue;
            float max = serializedObject.FindProperty("waitTimeMax").floatValue;

            EditorGUILayout.MinMaxSlider(ref min, ref max, 0f, 10f);
            serializedObject.FindProperty("waitTimeMin").floatValue = min;
            serializedObject.FindProperty("waitTimeMax").floatValue = max;
            EditorGUILayout.PropertyField(serializedObject.FindProperty("waitTimeMax"), new GUIContent(""), GUILayout.MaxWidth(20f));
            GUILayout.EndHorizontal();

            serializedObject.ApplyModifiedProperties();
        }
        /// <summary>
        /// The BehaviorAction Frame Range List which will be shown under the timeline
        /// </summary>
        void BehaviorActionFrameDetail()
        {
            if (BehaviorEditorWindow.win.selectedBehavior == null || BehaviorEditorWindow.win.selectedBehavior.behaviorActions == null)
            {
                return;
            }
            actionScrollPos = GUILayout.BeginScrollView(actionScrollPos);

            if (BehaviorEditorWindow.win.selectedBehavior.behaviorActions.Count > 0)
            {
                foreach (IBehaviorAction action in BehaviorEditorWindow.win.selectedBehavior.behaviorActions)
                {
                    GUILayout.BeginVertical(GUI.skin.box);
                    GUILayout.BeginHorizontal();

                    GUILayout.Label(action.ToString().Replace("CombatDesigner.", ""));
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("FrameRange");
                    action.startFrame = EditorGUILayout.IntField((int)action.startFrame, GUILayout.Width(30));
                    action.startFrame = Mathf.Max(action.startFrame, 0);
                    GUILayout.Label(" ~ ");
                    action.endFrame = EditorGUILayout.IntField((int)action.endFrame, GUILayout.Width(30));
                    action.endFrame = Mathf.Clamp(action.endFrame, 0, BehaviorEditorWindow.win.timeline.totalStateFrames);


                    GUILayout.EndHorizontal();
                    EditorGUILayout.MinMaxSlider(ref action.startFrame, ref action.endFrame, 0, BehaviorEditorWindow.win.timeline.totalStateFrames);
                    action.startFrame = Mathf.Floor(action.startFrame);
                    action.endFrame   = Mathf.Floor(action.endFrame);
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.Space();
                }
            }

            GUILayout.EndScrollView();
        }
Esempio n. 9
0
        /// <summary>
        /// Draws a float slider with a minimum and a maximum value
        /// </summary>
        /// <param name="min">The related serialized property</param>
        /// <param name="max">The related serialized property</param>
        /// <param name="minimumValue">The minimum possible value</param>
        /// <param name="maximumValue">The maximum possible value</param>
        /// <param name="label">The label to write</param>
        /// <param name="invertMaxValue">One minus value</param>
        public static void DrawMinMaxSlider(ref SerializedProperty min, ref SerializedProperty max, float minimumValue, float maximumValue, string label, bool invertMaxValue = false)
        {
            EditorGUILayout.BeginHorizontal();
            float minimumTmp = min.floatValue;
            float maximumTmp = max.floatValue;

            if (invertMaxValue)
            {
                maximumTmp = 1.0f - maximumTmp;
            }

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PrefixLabel(label);
            minimumTmp = Mathf.Clamp01(EditorGUILayout.DelayedFloatField(minimumTmp, GUILayout.MaxWidth(50), GUILayout.MinWidth(20)));
            EditorGUILayout.MinMaxSlider(ref minimumTmp, ref maximumTmp, minimumValue, maximumValue, GUILayout.MinWidth(5));
            maximumTmp = Mathf.Max(minimumTmp, Mathf.Clamp01(EditorGUILayout.DelayedFloatField(maximumTmp, GUILayout.MaxWidth(50), GUILayout.MinWidth(20))));

            if (EditorGUI.EndChangeCheck())
            {
                Event e = Event.current;
                if (e.control)
                {
                    minimumTmp = minimumTmp.Snap(0.125f);
                    maximumTmp = maximumTmp.Snap(0.125f);
                }

                if (invertMaxValue)
                {
                    maximumTmp = 1.0f - maximumTmp;
                }

                min.floatValue = minimumTmp;
                max.floatValue = maximumTmp;
            }
            EditorGUILayout.EndHorizontal();
        }
Esempio n. 10
0
        public override void OnInspectorGUI()
        {
            var reaction = (Reaction)target;

            DrawDefaultInspector();

            GUILayout.Label("Temperature");
            EditorGUILayout.BeginHorizontal();
            NullableFloat(ref reaction.tempMin, 0, "Min");
            NullableFloat(ref reaction.tempMax, MaxLimit, "Max");
            EditorGUILayout.EndHorizontal();

            var tempMin = reaction.tempMin ?? 0;
            var tempMax = reaction.tempMax ?? MaxLimit;

            EditorGUILayout.MinMaxSlider(
                ref tempMin,
                ref tempMax,
                0,
                MaxLimit);

            reaction.tempMin = reaction.tempMin == null ? null : (float?)tempMin;
            reaction.tempMax = reaction.tempMax == null ? null : (float?)tempMax;
        }
        void El_DrawLimitingAngle()
        {
            if (Get.AngleLimit > 180)
            {
                GUI.color = defaultValC;
            }
            EditorGUILayout.PropertyField(sp_AngleLimit);
            GUI.color = c;

            if (Get.AngleLimit < 181)
            {
                if (Get.AngleLimitAxis == Vector3.zero)
                {
                    GUI.color = c * new Color(1f, 1f, 1f, 0.6f);
                }
                EditorGUILayout.PropertyField(sp_AngleLimitAxis);
                GUI.color = c;

                if (Get.AngleLimitAxis != Vector3.zero)
                {
                    if (Get.LimitAxisRange.x == Get.LimitAxisRange.y)
                    {
                        GUI.color = c * new Color(1f, 1f, 1f, 0.6f);
                    }
                    EditorGUILayout.MinMaxSlider(new GUIContent("Range", "If you want limit axes symmetrically leave this parameter unchanged, if you want limit one direction of axis more than reversed, tweak this parameter"),
                                                 ref Get.LimitAxisRange.x, ref Get.LimitAxisRange.y, -90f, 90f);
                    GUI.color = c;
                }

                EditorGUILayout.PropertyField(sp_LimitSmoothing);

                GUILayout.Space(5f);
            }

            GUI.color = c;
        }
Esempio n. 12
0
        protected virtual void drawLimits()
        {
            var limitPointers    = (minPointers.intValue > 0) || (maxPointers.intValue > 0);
            var newLimitPointers = EditorGUILayout.ToggleLeft(TEXT_LIMIT_POINTERS, limitPointers);

            if (newLimitPointers)
            {
                if (!limitPointers)
                {
                    minPointersFloat = 0;
                    maxPointersFloat = 10;
                }
                else
                {
                    minPointersFloat = (float)minPointers.intValue;
                    maxPointersFloat = (float)maxPointers.intValue;
                }
                //or this values doesn't change from script properly
                EditorGUI.indentLevel++;
                EditorGUILayout.LabelField("Min: " + (int)minPointersFloat + ", Max: " + (int)maxPointersFloat);
                EditorGUILayout.MinMaxSlider(ref minPointersFloat, ref maxPointersFloat, 0, 10, GUILayout.MaxWidth(150));
                EditorGUI.indentLevel--;
                minPointers.intValue = (int)minPointersFloat;
                maxPointers.intValue = (int)maxPointersFloat;
            }
            else
            {
                if (limitPointers)
                {
                    minPointersFloat     = 0;
                    maxPointersFloat     = 0;
                    minPointers.intValue = (int)minPointersFloat;
                    maxPointers.intValue = (int)maxPointersFloat;
                }
            }
        }
Esempio n. 13
0
        // Show CameraShakeSlider
        public static void ShowMinMaxSlider(SerializedProperty minProperty, SerializedProperty maxProperty, float minLimit, float maxLimit, string label, bool intValues = false)
        {
            float minValue = intValues ? ( float )minProperty.intValue : minProperty.floatValue;
            float maxValue = intValues ? ( float )maxProperty.intValue : maxProperty.floatValue;

            GUILayout.BeginHorizontal();
            GUILayout.Label(PropertyLabel(label));
            GUILayout.Space(15f);
            EditorGUILayout.LabelField(minValue.ToString(intValues ? "f0" : "f1"), GUILayout.Width(30f));
            EditorGUILayout.MinMaxSlider(ref minValue, ref maxValue, minLimit, maxLimit);
            EditorGUILayout.LabelField(maxValue.ToString(intValues ? "f0" : "f1"), GUILayout.Width(30f));
            GUILayout.EndHorizontal();

            if (intValues)
            {
                minProperty.intValue = Mathf.RoundToInt(minValue);
                maxProperty.intValue = Mathf.RoundToInt(maxValue);
            }
            else
            {
                minProperty.floatValue = minValue;
                maxProperty.floatValue = maxValue;
            }
        }
    public override void OnInspectorGUI()
    {
        GUIStyle HeaderStyle = new GUIStyle();

        HeaderStyle.fontSize  = 15;
        HeaderStyle.fontStyle = FontStyle.Bold;

        DrawDefaultInspector();
        ScaleObject ScaleObject = (ScaleObject)target;

        GUILayout.Space(10);
        EditorGUILayout.LabelField("Właściwości skalowania:", HeaderStyle, GUILayout.Height(20));
        ScaleObject.ScallingSpeed = EditorGUILayout.Slider("Prędkość skalowania:", ScaleObject.ScallingSpeed, 0, 0.15f);
        EditorGUILayout.LabelField("Minimalna wielkość:", ScaleObject.min.ToString("0.00"));
        EditorGUILayout.LabelField("Maksymalna wielkość:", ScaleObject.max.ToString("0.00"));
        EditorGUILayout.MinMaxSlider(ref ScaleObject.min, ref ScaleObject.max, 0, 2);

        if (GUILayout.Button("Zeruj ustawienia"))
        {
            ScaleObject.min           = 0.8f;
            ScaleObject.max           = 1.2f;
            ScaleObject.ScallingSpeed = 0;
        }
    }
Esempio n. 15
0
    private void RenderCallbackEventProperty()
    {
        RenderSeparator();
        string labelInfo = "Percentage (0f-1f) when callback is fired during the animation";

        EditorGUILayout.LabelField(labelInfo);
        EditorGUILayout.Separator();

        string introEventInfo = string.Format("Left point ({0}) \"StartIntro\" --- Right Point ({1}) \"EndIntro\"", tweenScript.EventProperty.IntroEventPercentage.x, tweenScript.EventProperty.IntroEventPercentage.y);

        EditorGUILayout.LabelField(introEventInfo);
        Vector2 IntroEventPercentage = tweenScript.EventProperty.IntroEventPercentage;

        EditorGUILayout.MinMaxSlider(ref IntroEventPercentage.x, ref IntroEventPercentage.y, 0f, 1f);
        tweenScript.EventProperty.IntroEventPercentage = IntroEventPercentage;

        string exitEventInfo = string.Format("Left point ({0}) \"StartExit\" --- Right Point ({1}) \"EndExit\"", tweenScript.EventProperty.IntroEventPercentage.x, tweenScript.EventProperty.IntroEventPercentage.y);

        EditorGUILayout.LabelField(exitEventInfo);
        Vector2 ExitEventPercentage = tweenScript.EventProperty.ExitEventPercentage;

        EditorGUILayout.MinMaxSlider(ref ExitEventPercentage.x, ref ExitEventPercentage.y, 0f, 1f);
        tweenScript.EventProperty.ExitEventPercentage = ExitEventPercentage;
    }
Esempio n. 16
0
        public override void OnInspectorGUI()
        {
            if (_effect == null)
            {
                return;
            }
            _effect.isDirty = false;

            EditorGUILayout.Separator();
            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
            GUILayout.Label(_headerTexture, GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.MiddleLeft;
            if (!_effect.enabled)
            {
                EditorGUILayout.HelpBox("Beautify disabled.", MessageType.Info);
            }
            EditorGUILayout.Separator();

            EditorGUILayout.BeginHorizontal();
            DrawLabel("General Settings");
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Quality", "The mobile variant is simply less accurate but faster."), GUILayout.Width(90));
            _effect.quality = (BEAUTIFY_QUALITY)EditorGUILayout.EnumPopup(_effect.quality);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Preset", "Quick configurations."), GUILayout.Width(90));
            _effect.preset = (BEAUTIFY_PRESET)EditorGUILayout.EnumPopup(_effect.preset);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Compare Mode", "Shows a side by side comparison."), GUILayout.Width(90));
            _effect.compareMode = EditorGUILayout.Toggle(_effect.compareMode);
            if (GUILayout.Button("Help", GUILayout.Width(50)))
            {
                EditorUtility.DisplayDialog("Help", "Beautify is a full-screen image processing effect that makes your scenes crisp, vivid and intense.\n\nMove the mouse over a setting for a short description or read the provided documentation (PDF) for details and tips.\n\nVisit kronnect.com for support and questions.\n\nPlease rate Beautify on the Asset Store! Thanks.", "Ok");
            }
            EditorGUILayout.EndHorizontal();

            if (_effect.compareMode)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Angle", "Angle of the separator line."), GUILayout.Width(90));
                _effect.compareLineAngle = EditorGUILayout.Slider(_effect.compareLineAngle, -Mathf.PI, Mathf.PI);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Width", "Width of the separator line."), GUILayout.Width(90));
                _effect.compareLineWidth = EditorGUILayout.Slider(_effect.compareLineWidth, 0.0001f, 0.05f);
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.Separator();
            DrawLabel("Image Enhancement");

            if (_effect.cameraEffect != null && !_effect.cameraEffect.allowHDR)
            {
                EditorGUILayout.HelpBox("Some effects, like dither and bloom, works better with HDR enabled. Check your camera setting.", MessageType.Warning);
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Sharpen", "Sharpen intensity."), GUILayout.Width(90));
            _effect.sharpen = EditorGUILayout.Slider(_effect.sharpen, 0f, 12f);
            EditorGUILayout.EndHorizontal();

            if (_effect.cameraEffect != null && !_effect.cameraEffect.orthographic)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Min/Max Depth", "Any pixel outside this depth range won't be affected by sharpen. Reduce range to create a depth-of-field-like effect."), GUILayout.Width(120));
                float minDepth = _effect.sharpenMinDepth;
                float maxDepth = _effect.sharpenMaxDepth;
                EditorGUILayout.MinMaxSlider(ref minDepth, ref maxDepth, 0f, 1.1f);
                _effect.sharpenMinDepth = minDepth;
                _effect.sharpenMaxDepth = maxDepth;
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Depth Threshold", "Reduces sharpen if depth difference around a pixel exceeds this value. Useful to prevent artifacts around wires or thin objects."), GUILayout.Width(120));
                _effect.sharpenDepthThreshold = EditorGUILayout.Slider(_effect.sharpenDepthThreshold, 0f, 0.05f);
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("   Luminance Relax.", "Soften sharpen around a pixel with high contrast. Reduce this value to remove ghosting and protect fine drawings or wires over a flat surface."), GUILayout.Width(120));
            _effect.sharpenRelaxation = EditorGUILayout.Slider(_effect.sharpenRelaxation, 0f, 0.2f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("   Clamp", "Maximum pixel adjustment."), GUILayout.Width(120));
            _effect.sharpenClamp = EditorGUILayout.Slider(_effect.sharpenClamp, 0f, 1f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("   Motion Sensibility", "Increase to reduce sharpen to simulate a cheap motion blur and to reduce flickering when camera rotates or moves. This slider controls the amount of camera movement/rotation that contributes to sharpen reduction. Set this to 0 to disable this feature."), GUILayout.Width(120));
            _effect.sharpenMotionSensibility = EditorGUILayout.Slider(_effect.sharpenMotionSensibility, 0f, 1f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Dither", "Simulates more colors than RGB quantization can produce. Removes banding artifacts in gradients, like skybox. This setting controls the dithering strength."), GUILayout.Width(90));
            _effect.dither = EditorGUILayout.Slider(_effect.dither, 0f, 0.2f);
            EditorGUILayout.EndHorizontal();

            if (_effect.cameraEffect != null && !_effect.cameraEffect.orthographic)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Min Depth", "Will only remove bands on pixels beyond this depth. Useful if you only want to remove sky banding (set this to 0.99)"), GUILayout.Width(120));
                _effect.ditherDepth = EditorGUILayout.Slider(_effect.ditherDepth, 0f, 1f);
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.Separator();
            DrawLabel("Color Grading");

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Vibrance", "Improves pixels color depending on their saturation."), GUILayout.Width(90));
            _effect.saturate = EditorGUILayout.Slider(_effect.saturate, -2f, 3f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Daltonize", "Similar to vibrance but mostly accentuate primary red, green and blue colors to compensate protanomaly (red deficiency), deuteranomaly (green deficiency) and tritanomaly (blue deficiency). This effect does not shift color hue hence it won't help completely red, green or blue color blindness. The effect will vary depending on each subject so this effect should be enabled on user demand."), GUILayout.Width(90));
            _effect.daltonize = EditorGUILayout.Slider(_effect.daltonize, 0f, 2f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Tint", "Blends image with an optional color. Alpha specifies intensity."), GUILayout.Width(90));
            _effect.tintColor = EditorGUILayout.ColorField(_effect.tintColor);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Contrast", "Final image contrast adjustment. Allows you to create more vivid images."), GUILayout.Width(90));
            _effect.contrast = EditorGUILayout.Slider(_effect.contrast, 0.5f, 1.5f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Brightness", "Final image brightness adjustment."), GUILayout.Width(90));
            _effect.brightness = EditorGUILayout.Slider(_effect.brightness, 0f, 2f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Separator();
            DrawLabel("Extra FX");

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Bloom", "Produces fringes of light extending from the borders of bright areas, contributing to the illusion of an extremely bright light overwhelming the camera or eye capturing the scene."), GUILayout.Width(90));
            _effect.bloom = EditorGUILayout.Toggle(_effect.bloom);
            if (_effect.bloom)
            {
                GUILayout.Label(new GUIContent("Debug", "Enable to see bloom/anamorphic channel."));
                _effect.bloomDebug = EditorGUILayout.Toggle(_effect.bloomDebug, GUILayout.Width(40));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Intensity", "Bloom multiplier."), GUILayout.Width(90));
                _effect.bloomIntensity = EditorGUILayout.Slider(_effect.bloomIntensity, 0f, 10f);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Threshold", "Brightness sensibility."), GUILayout.Width(90));
                _effect.bloomThreshold = EditorGUILayout.Slider(_effect.bloomThreshold, 0f, 5f);
                if (_effect.quality == BEAUTIFY_QUALITY.BestQuality)
                {
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(new GUIContent("   Reduce Flicker", "Enables an additional filter to reduce excess of flicker."), GUILayout.Width(90));
                    _effect.bloomAntiflicker = EditorGUILayout.Toggle(_effect.bloomAntiflicker);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(new GUIContent("   Customize", "Edit bloom style parameters."), GUILayout.Width(90));
                    _effect.bloomCustomize = EditorGUILayout.Toggle(_effect.bloomCustomize);
                    if (_effect.bloomCustomize)
                    {
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Label("   Presets", GUILayout.Width(90));
                        if (GUILayout.Button("Focused"))
                        {
                            _effect.SetBloomWeights(1f, 0.9f, 0.75f, 0.6f, 0.35f, 0.1f);
                        }
                        if (GUILayout.Button("Regular"))
                        {
                            _effect.SetBloomWeights(0.85f, 0.95f, 1f, 0.9f, 0.77f, 0.6f);
                        }
                        if (GUILayout.Button("Blurred"))
                        {
                            _effect.SetBloomWeights(0.2f, 0.4f, 0.6f, 0.75f, 0.9f, 1.0f);
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Label(new GUIContent("   Weight 1", "First layer bloom weight."), GUILayout.Width(90));
                        _effect.bloomWeight0 = EditorGUILayout.Slider(_effect.bloomWeight0, 0f, 1f);
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Label(new GUIContent("   Weight 2", "Second layer bloom weight."), GUILayout.Width(90));
                        _effect.bloomWeight1 = EditorGUILayout.Slider(_effect.bloomWeight1, 0f, 1f);
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Label(new GUIContent("   Weight 3", "Third layer bloom weight."), GUILayout.Width(90));
                        _effect.bloomWeight2 = EditorGUILayout.Slider(_effect.bloomWeight2, 0f, 1f);
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Label(new GUIContent("   Weight 4", "Fourth layer bloom weight."), GUILayout.Width(90));
                        _effect.bloomWeight3 = EditorGUILayout.Slider(_effect.bloomWeight3, 0f, 1f);
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Label(new GUIContent("   Weight 5", "Fifth layer bloom weight."), GUILayout.Width(90));
                        _effect.bloomWeight4 = EditorGUILayout.Slider(_effect.bloomWeight4, 0f, 1f);
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Label(new GUIContent("   Weight 6", "Sixth layer bloom weight."), GUILayout.Width(90));
                        _effect.bloomWeight5 = EditorGUILayout.Slider(_effect.bloomWeight5, 0f, 1f);
                    }
                }
            }
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Anamorphic F.", "Also known as JJ Abrams flares, adds spectacular light streaks to your scene."), GUILayout.Width(90));
            if (_effect.quality != BEAUTIFY_QUALITY.BestQuality)
            {
                GUILayout.Label("(only available for 'best quality' setting)");
            }
            else
            {
                _effect.anamorphicFlares = EditorGUILayout.Toggle(_effect.anamorphicFlares);
            }
            if (_effect.anamorphicFlares && _effect.quality == BEAUTIFY_QUALITY.BestQuality)
            {
                if (!_effect.bloom)
                {
                    GUILayout.Label(new GUIContent("Debug", "Enable to see bloom/anamorphic flares channel."));
                    _effect.bloomDebug = EditorGUILayout.Toggle(_effect.bloomDebug, GUILayout.Width(40));
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Intensity", "Flares light multiplier."), GUILayout.Width(90));
                _effect.anamorphicFlaresIntensity = EditorGUILayout.Slider(_effect.anamorphicFlaresIntensity, 0f, 10f);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Threshold", "Brightness sensibility."), GUILayout.Width(90));
                _effect.anamorphicFlaresThreshold = EditorGUILayout.Slider(_effect.anamorphicFlaresThreshold, 0f, 5f);
                EditorGUILayout.EndHorizontal();
                if (_effect.quality == BEAUTIFY_QUALITY.BestQuality)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(new GUIContent("   Reduce Flicker", "Enables an additional filter to reduce excess of flicker."), GUILayout.Width(90));
                    _effect.anamorphicFlaresAntiflicker = EditorGUILayout.Toggle(_effect.anamorphicFlaresAntiflicker);
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Spread", "Amplitude of the flares."), GUILayout.Width(90));
                _effect.anamorphicFlaresSpread = EditorGUILayout.Slider(_effect.anamorphicFlaresSpread, 0.1f, 2f);
                GUILayout.Label("Vertical");
                _effect.anamorphicFlaresVertical = EditorGUILayout.Toggle(_effect.anamorphicFlaresVertical, GUILayout.Width(20));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Tint", "Optional tint color for the anamorphic flares. Use color alpha component to blend between original color and the tint."), GUILayout.Width(90));
                _effect.anamorphicFlaresTint = EditorGUILayout.ColorField(_effect.anamorphicFlaresTint);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Lens Dirt", "Enables lens dirt effect which intensifies when looking to a light (uses the nearest light to camera). You can assign other dirt textures directly to the shader material with name 'Beautify'."), GUILayout.Width(90));
            _effect.lensDirt = EditorGUILayout.Toggle(_effect.lensDirt);
            EditorGUILayout.EndHorizontal();
            if (_effect.lensDirt)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Dirt Texture", "Texture used for the lens dirt effect."), GUILayout.Width(90));
                _effect.lensDirtTexture = (Texture2D)EditorGUILayout.ObjectField(_effect.lensDirtTexture, typeof(Texture2D), false);
                if (GUILayout.Button("?", GUILayout.Width(20)))
                {
                    EditorUtility.DisplayDialog("Lens Dirt Texture", "You can find additional lens dirt textures inside \nBeautify/Resources/Textures folder.", "Ok");
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Threshold", "This slider controls the visibility of lens dirt. A high value will make lens dirt only visible when looking directly towards a light source. A lower value will make lens dirt visible all time."), GUILayout.Width(90));
                _effect.lensDirtThreshold = EditorGUILayout.Slider(_effect.lensDirtThreshold, 0f, 1f);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Intensity", "This slider controls the maximum brightness of lens dirt effect."), GUILayout.Width(90));
                _effect.lensDirtIntensity = EditorGUILayout.Slider(_effect.lensDirtIntensity, 0f, 1f);
                EditorGUILayout.EndHorizontal();
            }

            if (_effect.vignetting || _effect.frame || _effect.outline || _effect.nightVision || _effect.thermalVision)
            {
                EditorGUILayout.HelpBox("Customize the effects below using color picker. Alpha has special meaning depending on effect. Read the tooltip moving the mouse over the effect name.", MessageType.Info);
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Vignetting", "Enables colored vignetting effect. Color alpha specifies intensity of effect."), GUILayout.Width(90));
            _effect.vignetting = EditorGUILayout.Toggle(_effect.vignetting);

            if (_effect.vignetting)
            {
                GUILayout.Label(new GUIContent("Color", "The color for the vignetting effect. Alpha specifies intensity of effect."), GUILayout.Width(40));
                _effect.vignettingColor = EditorGUILayout.ColorField(_effect.vignettingColor);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Circular Shape", "Ignores screen aspect ratio showing a circular shape."), GUILayout.Width(90));
                _effect.vignettingCircularShape = EditorGUILayout.Toggle(_effect.vignettingCircularShape);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Frame", "Enables colored frame effect. Color alpha specifies intensity of effect."), GUILayout.Width(90));
            _effect.frame = EditorGUILayout.Toggle(_effect.frame);

            if (_effect.frame)
            {
                GUILayout.Label(new GUIContent("Color", "The color for the frame effect. Alpha specifies intensity of effect."), GUILayout.Width(40));
                _effect.frameColor = EditorGUILayout.ColorField(_effect.frameColor);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Outline", "Enables outline (edge detection) effect. Color alpha specifies edge detection threshold."), GUILayout.Width(90));
            _effect.outline = EditorGUILayout.Toggle(_effect.outline);

            if (_effect.outline)
            {
                GUILayout.Label(new GUIContent("Color", "The color for the outline. Alpha specifies edge detection threshold."), GUILayout.Width(40));
                _effect.outlineColor = EditorGUILayout.ColorField(_effect.outlineColor);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Sepia", "Enables sepia color effect."), GUILayout.Width(90));
            _effect.sepia = EditorGUILayout.Toggle(_effect.sepia, GUILayout.Width(40));
            if (_effect.sepia)
            {
                GUILayout.Label("Intensity");
                _effect.sepiaIntensity = EditorGUILayout.Slider(_effect.sepiaIntensity, 0f, 1f);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Night Vision", "Enables night vision effect. Color alpha controls intensity. For a better result, enable Vignetting and set its color to (0,0,0,32)."), GUILayout.Width(90));
            _effect.nightVision = EditorGUILayout.Toggle(_effect.nightVision);
            if (_effect.nightVision)
            {
                GUILayout.Label(new GUIContent("Color", "The color for the night vision effect. Alpha controls intensity."), GUILayout.Width(40));
                _effect.nightVisionColor = EditorGUILayout.ColorField(_effect.nightVisionColor);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Thermal Vision", "Enables thermal vision effect."), GUILayout.Width(90));
            _effect.thermalVision = EditorGUILayout.Toggle(_effect.thermalVision);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Separator();
            DrawLabel("Beta FX");


            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("Depth of Field", "Blurs the image based on distance to focus point."), GUILayout.Width(90));
            _effect.depthOfField = EditorGUILayout.Toggle(_effect.depthOfField);
            if (_effect.depthOfField)
            {
                GUILayout.Label(new GUIContent("Debug", "Enable to see depth of field focus area."));
                _effect.depthOfFieldDebug = EditorGUILayout.Toggle(_effect.depthOfFieldDebug, GUILayout.Width(40));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Focus Target", "Dynamically focus target."), GUILayout.Width(90));
                _effect.depthOfFieldTargetFocus = (Transform)EditorGUILayout.ObjectField(_effect.depthOfFieldTargetFocus, typeof(Transform), true);
                EditorGUILayout.EndHorizontal();
                if (_effect.depthOfFieldTargetFocus == null)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Label(new GUIContent("   Focus Distance", "Distance to focus point."), GUILayout.Width(120));
                    _effect.depthOfFieldDistance = EditorGUILayout.Slider(_effect.depthOfFieldDistance, 1f, 100f);
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Focus Speed", "1=immediate focus on distance or target."), GUILayout.Width(_effect.depthOfFieldTargetFocus == null ? 120 : 90));
                _effect.depthOfFieldFocusSpeed = EditorGUILayout.Slider(_effect.depthOfFieldFocusSpeed, 0.001f, 1f);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Focal Length", "Focal length of the virtual lens."), GUILayout.Width(_effect.depthOfFieldTargetFocus == null ? 120 : 90));
                _effect.depthOfFieldFocalLength = EditorGUILayout.Slider(_effect.depthOfFieldFocalLength, 0.005f, 0.5f);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Aperture", "Diameter of the aperture (mm)."), GUILayout.Width(90));
                GUILayout.Label("f/", GUILayout.Width(15));
                _effect.depthOfFieldAperture = EditorGUILayout.FloatField(_effect.depthOfFieldAperture, GUILayout.Width(40));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Foreground Blur", "Enables blur in front of focus object."), GUILayout.Width(120));
                _effect.depthOfFieldForegroundBlur = EditorGUILayout.Toggle(_effect.depthOfFieldForegroundBlur, GUILayout.Width(40));
                if (_effect.depthOfFieldForegroundBlur)
                {
                    GUILayout.Label(new GUIContent("Offset", "Distance from focus plane for foreground blur."), GUILayout.Width(50));
                    _effect.depthOfFieldForegroundDistance = EditorGUILayout.FloatField(_effect.depthOfFieldForegroundDistance, GUILayout.Width(50));
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Bokeh Threshold", "Determines which bright spots will be augmented in defocused areas."), GUILayout.Width(120));
                _effect.depthOfFieldBokehThreshold = EditorGUILayout.Slider(_effect.depthOfFieldBokehThreshold, 0.5f, 3f);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Bokeh Intensity", "Intensity multiplier for bright spots in defocused areas."), GUILayout.Width(120));
                _effect.depthOfFieldBokehIntensity = EditorGUILayout.Slider(_effect.depthOfFieldBokehIntensity, 0f, 8f);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Downsampling", "Reduces screen buffer size to improve performance."), GUILayout.Width(120));
                _effect.depthOfFieldDownsampling = EditorGUILayout.IntSlider(_effect.depthOfFieldDownsampling, 1, 5);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label(new GUIContent("   Sample Count", "Determines the maximum number of samples to be gathered in the effect."), GUILayout.Width(120));
                _effect.depthOfFieldMaxSamples = EditorGUILayout.IntSlider(_effect.depthOfFieldMaxSamples, 2, 16);
                GUILayout.Label("(" + ((_effect.depthOfFieldMaxSamples - 1) * 2 + 1) + " samples)");
            }
            EditorGUILayout.EndHorizontal();

            if (_effect.isDirty)
            {
                EditorUtility.SetDirty(target);
            }
        }
        protected void ShaderSSSAndTransmissionInputGUI(Material material)
        {
            var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;

            if (hdPipeline == null)
            {
                return;
            }

            var diffusionProfileSettings = hdPipeline.diffusionProfileSettings;

            if (hdPipeline.IsInternalDiffusionProfile(diffusionProfileSettings))
            {
                EditorGUILayout.HelpBox("No diffusion profile Settings have been assigned to the render pipeline asset.", MessageType.Warning);
                return;
            }


            // Enable transmission toggle
            m_MaterialEditor.ShaderProperty(enableTransmission, Styles.transmissionToggleText);

            // Subsurface toggle and options
            m_MaterialEditor.ShaderProperty(enableSubsurfaceScattering, Styles.subsurfaceToggleText);
            if (enableSubsurfaceScattering.floatValue == 1.0f)
            {
                m_MaterialEditor.ShaderProperty(subsurfaceMask, Styles.subsurfaceMaskText);
                m_MaterialEditor.TexturePropertySingleLine(Styles.subsurfaceMaskMapText, subsurfaceMaskMap);
            }

            // The thickness sub-menu is toggled if either the transmission or subsurface are requested
            if (enableSubsurfaceScattering.floatValue == 1.0f || enableTransmission.floatValue == 1.0f)
            {
                m_MaterialEditor.TexturePropertySingleLine(Styles.thicknessMapText, thicknessMap);
                if (thicknessMap.textureValue != null)
                {
                    // Display the remap of texture values.
                    Vector2 remap = thicknessRemap.vectorValue;
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.MinMaxSlider(Styles.thicknessRemapText, ref remap.x, ref remap.y, 0.0f, 1.0f);
                    if (EditorGUI.EndChangeCheck())
                    {
                        thicknessRemap.vectorValue = remap;
                    }
                }
                else
                {
                    // Allow the user to set the constant value of thickness if no thickness map is provided.
                    m_MaterialEditor.ShaderProperty(thickness, Styles.thicknessText);
                }
            }

            // We only need to display the diffusion profile if we have either transmission or diffusion
            // TODO: Optimize me
            if (enableSubsurfaceScattering.floatValue == 1.0f || enableTransmission.floatValue == 1.0f)
            {
                var profiles = diffusionProfileSettings.profiles;
                var names    = new GUIContent[profiles.Length + 1];
                names[0] = new GUIContent("None");

                var values = new int[names.Length];
                values[0] = DiffusionProfileConstants.DIFFUSION_PROFILE_NEUTRAL_ID;

                for (int i = 0; i < profiles.Length; i++)
                {
                    names[i + 1]  = new GUIContent(profiles[i].name);
                    values[i + 1] = i + 1;
                }

                using (var scope = new EditorGUI.ChangeCheckScope())
                {
                    int profileID = (int)diffusionProfileID.floatValue;

                    using (new EditorGUILayout.HorizontalScope())
                    {
                        EditorGUILayout.PrefixLabel(Styles.diffusionProfileText);

                        using (new EditorGUILayout.HorizontalScope())
                        {
                            profileID = EditorGUILayout.IntPopup(profileID, names, values);

                            if (GUILayout.Button("Goto", EditorStyles.miniButton, GUILayout.Width(50f)))
                            {
                                Selection.activeObject = diffusionProfileSettings;
                            }
                        }
                    }

                    if (scope.changed)
                    {
                        diffusionProfileID.floatValue = profileID;
                    }
                }
            }
        }
        public override void OnInspectorGUI()
        {
            if (me == null)
            {
                return;
            }
            serializedObject.Update();

            EditorUIUtils.SetupStyles();

            GUILayout.Space(5);

            #region Main Settings

            EditorGUIUtility.labelWidth = 120;

            EditorUIUtils.DrawProperty(operationMode, () => me.OperationMode = (OperationMode)operationMode.enumValueIndex);
            EditorGUILayout.PropertyField(hotKey);

            EditorGUIUtility.labelWidth = 0;

            using (EditorUIUtils.Horizontal())
            {
                GUILayout.FlexibleSpace();

                EditorGUIUtility.labelWidth = 60;
                EditorGUILayout.PropertyField(hotKeyCtrl, new GUIContent("Ctrl / Cmd", hotKeyCtrl.tooltip), GUILayout.Width(85));

                EditorGUIUtility.labelWidth = 20;
                EditorGUILayout.PropertyField(hotKeyAlt, new GUIContent("Alt", hotKeyAlt.tooltip), GUILayout.Width(45));

                EditorGUIUtility.labelWidth = 35;
                EditorGUILayout.PropertyField(hotKeyShift, new GUIContent("Shift", hotKeyShift.tooltip), GUILayout.Width(50));

                EditorGUIUtility.labelWidth = 0;
            }

            EditorGUIUtility.labelWidth = 120;
            EditorGUILayout.PropertyField(circleGesture);

            EditorGUILayout.PropertyField(keepAlive);
            if (me.transform.parent != null)
            {
                EditorGUILayout.LabelField("Keep Alive option will keep alive root level object (" + me.transform.root.name + ")!", EditorStyles.wordWrappedMiniLabel);
            }

            using (EditorUIUtils.Horizontal(GUILayout.ExpandWidth(true)))
            {
                EditorUIUtils.DrawProperty(forceFrameRate, "Force FPS", () => me.ForceFrameRate = forceFrameRate.boolValue, GUILayout.ExpandWidth(false));
                GUILayout.Space(2);
                EditorUIUtils.DrawProperty(forcedFrameRate, GUIContent.none, () => me.ForcedFrameRate = forcedFrameRate.intValue);
            }

            #endregion

            #region Look & Feel

            EditorGUIUtility.labelWidth = 0;

            if (EditorUIUtils.Foldout(lookAndFeelFoldout, "Look & Feel"))
            {
                EditorGUIUtility.labelWidth = 130;

                EditorUIUtils.DrawProperty(autoScale, () => me.AutoScale = autoScale.boolValue);

                if (autoScale.boolValue)
                {
                    GUI.enabled = false;
                }
                EditorUIUtils.DrawProperty(scaleFactor, () => me.ScaleFactor = scaleFactor.floatValue);
                GUI.enabled = true;
                EditorUIUtils.DrawProperty(labelsFont, () => me.LabelsFont           = (Font)labelsFont.objectReferenceValue);
                EditorUIUtils.DrawProperty(fontSize, () => me.FontSize               = fontSize.intValue);
                EditorUIUtils.DrawProperty(lineSpacing, () => me.LineSpacing         = lineSpacing.floatValue);
                EditorUIUtils.DrawProperty(countersSpacing, () => me.CountersSpacing = countersSpacing.intValue);
                EditorUIUtils.DrawProperty(paddingOffset, () => me.PaddingOffset     = paddingOffset.vector2Value);
                EditorUIUtils.DrawProperty(pixelPerfect, () => me.PixelPerfect       = pixelPerfect.boolValue);

                EditorUIUtils.Header("Effects");
                EditorUIUtils.Separator();

                EditorUIUtils.DrawProperty(background, () => me.Background = background.boolValue);
                if (background.boolValue)
                {
                    EditorUIUtils.Indent();
                    EditorUIUtils.DrawProperty(backgroundColor, "Color", () => me.BackgroundColor       = backgroundColor.colorValue);
                    EditorUIUtils.DrawProperty(backgroundPadding, "Padding", () => me.BackgroundPadding = backgroundPadding.intValue);
                    EditorUIUtils.UnIndent();
                }

                EditorUIUtils.DrawProperty(shadow, () => me.Shadow = shadow.boolValue);
                if (shadow.boolValue)
                {
                    EditorUIUtils.Indent();
                    EditorUIUtils.DrawProperty(shadowColor, "Color", () => me.ShadowColor          = shadowColor.colorValue);
                    EditorUIUtils.DrawProperty(shadowDistance, "Distance", () => me.ShadowDistance = shadowDistance.vector2Value);
                    EditorGUILayout.LabelField(new GUIContent("<b>This effect is resource-heavy</b>", "Such effect increases resources usage on each text refresh."), EditorUIUtils.richMiniLabel);
                    EditorUIUtils.UnIndent();
                }

                EditorUIUtils.DrawProperty(outline, () => me.Outline = outline.boolValue);
                if (outline.boolValue)
                {
                    EditorUIUtils.Indent();
                    EditorUIUtils.DrawProperty(outlineColor, "Color", () => me.OutlineColor          = outlineColor.colorValue);
                    EditorUIUtils.DrawProperty(outlineDistance, "Distance", () => me.OutlineDistance = outlineDistance.vector2Value);
                    EditorGUILayout.LabelField(new GUIContent("<b>This effect is <color=#FF4040ff>very</color> resource-heavy!</b>", "Such effect significantly increases resources usage on each text refresh. Use only if really necessary."), EditorUIUtils.richMiniLabel);
                    EditorUIUtils.UnIndent();
                }

                EditorUIUtils.Header("Service Commands");

                using (EditorUIUtils.Horizontal())
                {
                    groupAnchor = (LabelAnchor)EditorGUILayout.EnumPopup(
                        new GUIContent("Move All To", "Use to explicitly move all counters to the specified anchor label.\n" +
                                       "Select anchor and press Apply."), groupAnchor);

                    if (GUILayout.Button(new GUIContent("Apply", "Press to move all counters to the selected anchor label."),
                                         GUILayout.Width(45)))
                    {
                        Undo.RegisterCompleteObjectUndo(target, "Move all counters to anchor");

                        me.fpsCounter.Anchor     = groupAnchor;
                        fpsAnchor.enumValueIndex = (int)groupAnchor;

                        me.memoryCounter.Anchor     = groupAnchor;
                        memoryAnchor.enumValueIndex = (int)groupAnchor;

                        me.deviceInfoCounter.Anchor = groupAnchor;
                        deviceAnchor.enumValueIndex = (int)groupAnchor;
                    }
                }
                EditorGUIUtility.labelWidth = 0;
            }

            #endregion

            #region Advanced Settings

            if (EditorUIUtils.Foldout(advancedFoldout, "Advanced Settings"))
            {
                EditorGUIUtility.labelWidth = 120;
                EditorUIUtils.DrawProperty(sortingOrder, () => me.SortingOrder = sortingOrder.intValue);
                EditorGUIUtility.labelWidth = 0;
            }

            #endregion

            #region FPS Counter

            GUI.enabled           = EditorUIUtils.ToggleFoldout(fpsEnabled, fps, "FPS Counter");
            me.fpsCounter.Enabled = fpsEnabled.boolValue;

            if (fps.isExpanded)
            {
                GUILayout.Space(5);
                EditorGUIUtility.labelWidth = 100;

                EditorUIUtils.DrawProperty(fpsInterval, "Interval", () => me.fpsCounter.UpdateInterval = fpsInterval.floatValue);
                EditorUIUtils.DrawProperty(fpsAnchor, () => me.fpsCounter.Anchor = (LabelAnchor)fpsAnchor.enumValueIndex);

                GUILayout.Space(5);

                float minVal = fpsCriticalLevelValue.intValue;
                float maxVal = fpsWarningLevelValue.intValue;

                EditorGUILayout.MinMaxSlider(new GUIContent("Colors Range",
                                                            "This range will be used to apply colors below on specific FPS:\n" +
                                                            "Critical: 0 - min\n" +
                                                            "Warning: min+1 - max-1\n" +
                                                            "Normal: max+"),
                                             ref minVal, ref maxVal, 1, 60);

                fpsCriticalLevelValue.intValue = (int)minVal;
                fpsWarningLevelValue.intValue  = (int)maxVal;

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(fpsColor, "Normal", () => me.fpsCounter.Color = fpsColor.colorValue);
                    GUILayout.Label(maxVal + "+ FPS", GUILayout.Width(75));
                }

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(fpsColorWarning, "Warning", () => me.fpsCounter.ColorWarning = fpsColorWarning.colorValue);
                    GUILayout.Label(minVal + 1 + " - " + (maxVal - 1) + " FPS", GUILayout.Width(75));
                }

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(fpsColorCritical, "Critical", () => me.fpsCounter.ColorCritical = fpsColorCritical.colorValue);
                    GUILayout.Label("0 - " + minVal + " FPS", GUILayout.Width(75));
                }
                GUILayout.Space(5);
                EditorUIUtils.DrawProperty(fpsStyle, () => me.fpsCounter.Style = (FontStyle)fpsStyle.enumValueIndex);

                EditorUIUtils.Separator(5);
                EditorGUIUtility.labelWidth = 120;

                GUI.enabled = EditorUIUtils.ToggleFoldout(fpsRealtime, realtimeFPSFoldout, "Realtime FPS", false, false, false);
                me.fpsCounter.RealtimeFPS = fpsRealtime.boolValue;

                if (realtimeFPSFoldout.isExpanded)
                {
                    EditorUIUtils.DoubleIndent();
                    EditorUIUtils.DrawProperty(fpsMilliseconds, () => me.fpsCounter.Milliseconds = fpsMilliseconds.boolValue);
                    EditorUIUtils.DoubleUnIndent();
                }
                GUI.enabled = true;

                GUI.enabled           = EditorUIUtils.ToggleFoldout(fpsAverage, averageFoldout, "Average FPS", false, false, false);
                me.fpsCounter.Average = fpsAverage.boolValue;

                if (averageFoldout.isExpanded)
                {
                    EditorUIUtils.DoubleIndent();
                    EditorUIUtils.DrawProperty(fpsAverageSamples, "Samples", () => me.fpsCounter.AverageSamples = fpsAverageSamples.intValue);
                    EditorUIUtils.DrawProperty(fpsAverageMilliseconds, "Milliseconds", () => me.fpsCounter.AverageMilliseconds = fpsAverageMilliseconds.boolValue);
                    EditorUIUtils.DrawProperty(fpsAverageNewLine, "New Line", () => me.fpsCounter.AverageNewLine = fpsAverageNewLine.boolValue);

                    using (EditorUIUtils.Horizontal())
                    {
                        EditorGUILayout.PropertyField(fpsResetAverageOnNewScene, new GUIContent("Auto Reset"), GUILayout.ExpandWidth(false));
                        if (GUILayout.Button("Reset", /*GUILayout.MaxWidth(200),*/ GUILayout.MinWidth(40)))
                        {
                            me.fpsCounter.ResetAverage();
                        }
                    }
                    EditorUIUtils.DoubleUnIndent();
                }
                GUI.enabled = true;

                GUI.enabled          = EditorUIUtils.ToggleFoldout(fpsMinMax, minMaxFoldout, "MinMax FPS", false, false, false);
                me.fpsCounter.MinMax = fpsMinMax.boolValue;

                if (minMaxFoldout.isExpanded)
                {
                    EditorUIUtils.DoubleIndent();
                    EditorGUILayout.PropertyField(fpsMinMaxIntervalsToSkip, new GUIContent("Delay"));
                    EditorUIUtils.DrawProperty(fpsMinMaxMilliseconds, "Milliseconds", () => me.fpsCounter.MinMaxMilliseconds = fpsMinMaxMilliseconds.boolValue);
                    EditorUIUtils.DrawProperty(fpsMinMaxNewLine, "New Line", () => me.fpsCounter.MinMaxNewLine    = fpsMinMaxNewLine.boolValue);
                    EditorUIUtils.DrawProperty(fpsMinMaxTwoLines, "Two Lines", () => me.fpsCounter.MinMaxTwoLines = fpsMinMaxTwoLines.boolValue);
                    using (EditorUIUtils.Horizontal())
                    {
                        EditorGUILayout.PropertyField(fpsResetMinMaxOnNewScene, new GUIContent("Auto Reset"), GUILayout.ExpandWidth(false));
                        if (GUILayout.Button("Reset", /*GUILayout.MaxWidth(200),*/ GUILayout.MinWidth(40)))
                        {
                            me.fpsCounter.ResetMinMax();
                        }
                    }
                    EditorUIUtils.DoubleUnIndent();
                }
                GUI.enabled = true;

                GUI.enabled          = EditorUIUtils.ToggleFoldout(fpsRender, renderFoldout, "Render Time", false, false, false);
                me.fpsCounter.Render = fpsRender.boolValue;

                if (renderFoldout.isExpanded)
                {
                    EditorUIUtils.DoubleIndent();
                    EditorUIUtils.DrawProperty(fpsColorRender, "Color", () => me.fpsCounter.ColorRender        = fpsColorRender.colorValue);
                    EditorUIUtils.DrawProperty(fpsRenderNewLine, "New Line", () => me.fpsCounter.RenderNewLine = fpsRenderNewLine.boolValue);
                    EditorUIUtils.DrawProperty(fpsRenderAutoAdd, "Auto add", () => me.fpsCounter.RenderAutoAdd = fpsRenderAutoAdd.boolValue);
                    EditorUIUtils.DoubleUnIndent();
                }
                GUI.enabled = true;

                EditorGUIUtility.labelWidth = 0;
            }
            GUI.enabled = true;

            #endregion

            #region Memory Counter

            GUI.enabled = EditorUIUtils.ToggleFoldout(memoryEnabled, memory, "Memory Counter");
            me.memoryCounter.Enabled = memoryEnabled.boolValue;
            if (memory.isExpanded)
            {
                GUILayout.Space(5);
                EditorGUIUtility.labelWidth = 100;

                EditorUIUtils.DrawProperty(memoryInterval, "Interval", () => me.memoryCounter.UpdateInterval = memoryInterval.floatValue);
                EditorUIUtils.DrawProperty(memoryAnchor, () => me.memoryCounter.Anchor = (LabelAnchor)memoryAnchor.enumValueIndex);
                EditorUIUtils.DrawProperty(memoryColor, () => me.memoryCounter.Color   = memoryColor.colorValue);
                EditorUIUtils.DrawProperty(memoryStyle, () => me.memoryCounter.Style   = (FontStyle)memoryStyle.enumValueIndex);
                EditorUIUtils.Separator(5);
                EditorUIUtils.DrawProperty(memoryPrecise, () => me.memoryCounter.Precise = memoryPrecise.boolValue);
                EditorUIUtils.Separator(5);
                EditorUIUtils.DrawProperty(memoryTotal, () => me.memoryCounter.Total                 = memoryTotal.boolValue);
                EditorUIUtils.DrawProperty(memoryAllocated, () => me.memoryCounter.Allocated         = memoryAllocated.boolValue);
                EditorUIUtils.DrawProperty(memoryMonoUsage, "Mono", () => me.memoryCounter.MonoUsage = memoryMonoUsage.boolValue);

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(memoryGfx, "GfxDriver", () => me.memoryCounter.Gfx = memoryGfx.boolValue, GUILayout.ExpandWidth(false));
                    GUILayout.Space(0);

                    string extraInfo = null;

                    var color = EditorGUIUtility.isProSkin ? "#FF6060" : "#FF1010";
                    extraInfo = "<color=\"" + color + "\">Unity 2018.1+ required</color>";

                    if (!string.IsNullOrEmpty(extraInfo))
                    {
                        EditorGUILayout.LabelField(
                            new GUIContent(extraInfo),
                            EditorUIUtils.richMiniLabel, GUILayout.ExpandWidth(false));
                    }
                }

                EditorGUIUtility.labelWidth = 0;
            }
            GUI.enabled = true;

            #endregion

            #region Device Information

            var deviceInfoEnabled = EditorUIUtils.ToggleFoldout(deviceEnabled, device, "Device Information");
            GUI.enabled = deviceInfoEnabled;
            me.deviceInfoCounter.Enabled = deviceEnabled.boolValue;
            if (device.isExpanded)
            {
                GUILayout.Space(5);
                EditorGUIUtility.labelWidth = 100;

                EditorUIUtils.DrawProperty(deviceAnchor, () => me.deviceInfoCounter.Anchor = (LabelAnchor)deviceAnchor.intValue);
                EditorUIUtils.DrawProperty(deviceColor, () => me.deviceInfoCounter.Color   = deviceColor.colorValue);
                EditorUIUtils.DrawProperty(deviceStyle, () => me.deviceInfoCounter.Style   = (FontStyle)deviceStyle.enumValueIndex);
                EditorUIUtils.Separator(5);
                EditorUIUtils.DrawProperty(devicePlatform, "Platform", () => me.deviceInfoCounter.Platform = devicePlatform.boolValue);

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(deviceCpuModel, "CPU", () => me.deviceInfoCounter.CpuModel = deviceCpuModel.boolValue, GUILayout.ExpandWidth(false));
                    GUI.enabled = deviceInfoEnabled && deviceCpuModel.boolValue;
                    GUILayout.Space(10);
                    EditorGUIUtility.labelWidth = 60;
                    EditorUIUtils.DrawProperty(deviceCpuModelNewLine, "New Line", () => me.deviceInfoCounter.CpuModelNewLine = deviceCpuModelNewLine.boolValue);
                    EditorGUIUtility.labelWidth = 100;
                    GUI.enabled = deviceInfoEnabled;
                }

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(deviceGpuModel, "GPU Model", () => me.deviceInfoCounter.GpuModel = deviceGpuModel.boolValue, GUILayout.ExpandWidth(false));
                    GUI.enabled = deviceInfoEnabled && deviceGpuModel.boolValue;
                    GUILayout.Space(10);
                    EditorGUIUtility.labelWidth = 60;
                    EditorUIUtils.DrawProperty(deviceGpuModelNewLine, "New Line", () => me.deviceInfoCounter.GpuModelNewLine = deviceGpuModelNewLine.boolValue);
                    EditorGUIUtility.labelWidth = 100;
                    GUI.enabled = deviceInfoEnabled;
                }

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(deviceGpuApi, "GPU API", () => me.deviceInfoCounter.GpuApi = deviceGpuApi.boolValue, GUILayout.ExpandWidth(false));
                    GUI.enabled = deviceInfoEnabled && deviceGpuApi.boolValue;
                    GUILayout.Space(10);
                    EditorGUIUtility.labelWidth = 60;
                    EditorUIUtils.DrawProperty(deviceGpuApiNewLine, "New Line", () => me.deviceInfoCounter.GpuApiNewLine = deviceGpuApiNewLine.boolValue);
                    EditorGUIUtility.labelWidth = 100;
                    GUI.enabled = deviceInfoEnabled;
                }

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(deviceGpuSpec, "GPU Spec", () => me.deviceInfoCounter.GpuSpec = deviceGpuSpec.boolValue, GUILayout.ExpandWidth(false));
                    GUI.enabled = deviceInfoEnabled && deviceGpuSpec.boolValue;
                    GUILayout.Space(10);
                    EditorGUIUtility.labelWidth = 60;
                    EditorUIUtils.DrawProperty(deviceGpuSpecNewLine, "New Line", () => me.deviceInfoCounter.GpuSpecNewLine = deviceGpuSpecNewLine.boolValue);
                    EditorGUIUtility.labelWidth = 100;
                    GUI.enabled = deviceInfoEnabled;
                }

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(deviceRamSize, "RAM", () => me.deviceInfoCounter.RamSize = deviceRamSize.boolValue, GUILayout.ExpandWidth(false));
                    GUI.enabled = deviceInfoEnabled && deviceRamSize.boolValue;
                    GUILayout.Space(10);
                    EditorGUIUtility.labelWidth = 60;
                    EditorUIUtils.DrawProperty(deviceRamSizeNewLine, "New Line", () => me.deviceInfoCounter.RamSizeNewLine = deviceRamSizeNewLine.boolValue);
                    EditorGUIUtility.labelWidth = 100;
                    GUI.enabled = deviceInfoEnabled;
                }

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(deviceScreenData, "Screen", () => me.deviceInfoCounter.ScreenData = deviceScreenData.boolValue, GUILayout.ExpandWidth(false));
                    GUI.enabled = deviceInfoEnabled && deviceScreenData.boolValue;
                    GUILayout.Space(10);
                    EditorGUIUtility.labelWidth = 60;
                    EditorUIUtils.DrawProperty(deviceScreenDataNewLine, "New Line", () => me.deviceInfoCounter.ScreenDataNewLine = deviceScreenDataNewLine.boolValue);
                    EditorGUIUtility.labelWidth = 100;
                    GUI.enabled = deviceInfoEnabled;
                }

                using (EditorUIUtils.Horizontal())
                {
                    EditorUIUtils.DrawProperty(deviceModel, "Model", () => me.deviceInfoCounter.DeviceModel = deviceModel.boolValue, GUILayout.ExpandWidth(false));
                    GUI.enabled = deviceInfoEnabled && deviceModel.boolValue;
                    GUILayout.Space(10);
                    EditorGUIUtility.labelWidth = 60;
                    EditorUIUtils.DrawProperty(deviceModelNewLine, "New Line", () => me.deviceInfoCounter.DeviceModelNewLine = deviceModelNewLine.boolValue);
                    EditorGUIUtility.labelWidth = 100;
                    GUI.enabled = deviceInfoEnabled;
                }

                EditorGUIUtility.labelWidth = 0;
            }
            GUI.enabled = true;

            #endregion

            EditorGUILayout.Space();
            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 19
0
    void OnGUI()
    {
        if (Application.isPlaying)
        {
            return;
        }

        if (ClayxelsPrefsWindow.prefs == null)
        {
            ClayxelsPrefsWindow.prefs = ClayContainer.loadPrefs();
        }

        EditorGUI.BeginChangeCheck();

        Color boundsColor = new Color((float)ClayxelsPrefsWindow.prefs.boundsColor[0] / 255.0f, (float)ClayxelsPrefsWindow.prefs.boundsColor[1] / 255.0f, (float)ClayxelsPrefsWindow.prefs.boundsColor[2] / 255.0f, (float)ClayxelsPrefsWindow.prefs.boundsColor[3] / 255.0f);

        boundsColor = EditorGUILayout.ColorField(new GUIContent("boundsColor", "Color of the bounds indicator in the viewport, enable Gizmos in the viewport to see this."), boundsColor);
        ClayxelsPrefsWindow.prefs.boundsColor[0] = (byte)(boundsColor.r * 255);
        ClayxelsPrefsWindow.prefs.boundsColor[1] = (byte)(boundsColor.g * 255);
        ClayxelsPrefsWindow.prefs.boundsColor[2] = (byte)(boundsColor.b * 255);
        ClayxelsPrefsWindow.prefs.boundsColor[3] = (byte)(boundsColor.a * 255);

        ClayxelsPrefsWindow.prefs.pickingKey         = EditorGUILayout.TextField(new GUIContent("picking shortcut", "Press this shortcut to pick/select containers and clayObjects in scene."), ClayxelsPrefsWindow.prefs.pickingKey);
        ClayxelsPrefsWindow.prefs.mirrorDuplicateKey = EditorGUILayout.TextField(new GUIContent("mirrorDuplicate shortcut", "Press this shortcut to duplicate and mirror a clayObject on the X axis."), ClayxelsPrefsWindow.prefs.mirrorDuplicateKey);

        string[] pointCountPreset = new string[] { "low", "mid", "high" };
        ClayxelsPrefsWindow.prefs.maxPointCount = EditorGUILayout.Popup(new GUIContent("pointCloud memory", "Preset to allocate video ram to handle bigger point clouds."), ClayxelsPrefsWindow.prefs.maxPointCount, pointCountPreset);

        string[] solidsCountPreset = new string[] { "low", "mid", "high" };
        ClayxelsPrefsWindow.prefs.maxSolidsCount = EditorGUILayout.Popup(new GUIContent("clayObjects memory", "Preset to allocate video ram to handle more clayObjects per container."), ClayxelsPrefsWindow.prefs.maxSolidsCount, solidsCountPreset);

        string[] solidsPerVoxelPreset = new string[] { "best performance", "balanced", "max sculpt detail" };
        ClayxelsPrefsWindow.prefs.maxSolidsPerVoxel = EditorGUILayout.Popup(new GUIContent("clayObjects per voxel", "Preset to handle more clayObjects per voxel, it might fix some artifacts caused by having a lot of clayObjects all close to each other."), ClayxelsPrefsWindow.prefs.maxSolidsPerVoxel, solidsPerVoxelPreset);

        int frameSkip = EditorGUILayout.IntField(new GUIContent("frame skip", ""), ClayxelsPrefsWindow.prefs.frameSkip);

        if (frameSkip < 0)
        {
            frameSkip = 0;
        }
        else if (frameSkip > 100)
        {
            frameSkip = 100;
        }
        ClayxelsPrefsWindow.prefs.frameSkip = frameSkip;

        int maxBounds = EditorGUILayout.IntField(new GUIContent("max bounds size", "Smaller bounds use less video memory but give you less space to work with."), ClayxelsPrefsWindow.prefs.maxBounds);

        if (maxBounds < 1)
        {
            maxBounds = 1;
        }
        else if (maxBounds > 4)
        {
            maxBounds = 4;
        }
        ClayxelsPrefsWindow.prefs.maxBounds = maxBounds;

        ClayxelsPrefsWindow.prefs.vramLimitEnabled = EditorGUILayout.Toggle(new GUIContent("video ram limit enabled", "When this limit is enabled you won't be able to exceed your available vram when creating new container."), ClayxelsPrefsWindow.prefs.vramLimitEnabled);

        EditorGUILayout.Space();

        EditorGUILayout.MinMaxSlider(new GUIContent("LOD: " + Mathf.Round(ClayxelsPrefsWindow.prefs.lodNear) + " - " + Mathf.Round(ClayxelsPrefsWindow.prefs.lodFar), "Level Of Detail in scene unit, measures the distance from the camera to automatically reduce the amount of points rendered."),
                                     ref ClayxelsPrefsWindow.prefs.lodNear, ref ClayxelsPrefsWindow.prefs.lodFar, 0.0f, 1000.0f);

        if (EditorGUI.EndChangeCheck())
        {
            ClayContainer.savePrefs(ClayxelsPrefsWindow.prefs);
            ClayContainer.reloadAll();
        }

        EditorGUILayout.Space();

        int[] memStats = ClayContainer.getMemoryStats();
        EditorGUILayout.LabelField("- vram rough usage -");
        EditorGUILayout.LabelField("upfront vram allocated: " + memStats[0] + "MB");
        EditorGUILayout.LabelField("containers in scene: " + memStats[1] + "MB");

        EditorGUILayout.Space();

        if (GUILayout.Button((new GUIContent("reload all", "This is necessary after you make changes to the shaders or to the claySDF file."))))
        {
            ClayContainer.reloadAll();
        }
    }
Esempio n. 20
0
        /// <summary>
        /// Raises the GUI event.
        /// </summary>
        void OnGUI()
        {
            EditorGUILayout.LabelField(new GUIContent(pathMagicLogo), GUILayout.Width(142), GUILayout.Height(28));

            if (_go == null)
            {
                EditorGUILayout.HelpBox("Create a new parameter path by pressing the New button", MessageType.Info);
            }
            else
            {
                EditorGUI.BeginChangeCheck();

                EditorGUILayout.LabelField(new GUIContent("General"));
                EditorGUILayout.BeginVertical("Box");
                _type = (PathTemplateType)EditorGUILayout.EnumPopup(new GUIContent("Path template", "Select a template path"), _type);

                _samples = EditorGUILayout.IntField(new GUIContent("Samples", "Number of samples to generate"), _samples);

                if (_samples < 3)
                {
                    _samples = 3;
                }
                _closed = EditorGUILayout.Toggle(new GUIContent("Closed", "Generate a loop-ed path"), _closed);
                EditorGUILayout.EndVertical();

                EditorGUILayout.LabelField("Prperties");
                EditorGUILayout.BeginVertical("Box");

                if (_type == PathTemplateType.Circular)
                {
                    _sameXYRadius = EditorGUILayout.Toggle(new GUIContent("Same X/Y radius", "Circle have same X/Y radius?"), _sameXYRadius);
                }

                if (_sameXYRadius || _type == PathTemplateType.Linear)
                {
                    _radiusX = _radiusY = EditorGUILayout.FloatField(new GUIContent("Radius", "The radius of the circle"), _radiusX);
                }
                else
                {
                    _radiusX = EditorGUILayout.FloatField(new GUIContent("Radius X", "The X radius of the circle"), _radiusX);
                    _radiusY = EditorGUILayout.FloatField(new GUIContent("Radius Y", "The Y radius of the circle"), _radiusY);
                }

                if (_type == PathTemplateType.Circular)
                {
                    _yAdvance = EditorGUILayout.FloatField(new GUIContent("Y Advance", "Eache waypoint Y is increased by this value (Spiral template)"), _yAdvance);
                    _periods  = EditorGUILayout.FloatField(new GUIContent("Cycles", "Number of cycles around the circle"), _periods);

                    EditorGUILayout.MinMaxSlider(new GUIContent("Min/Max angles", "Start angle and end angle"), ref _startAngle, ref _endAngle, 0f, 360f);
                    _tangentMode = (TangentMode)EditorGUILayout.EnumPopup(new GUIContent("Tangents align", "Type of generated bezier tangents"), _tangentMode);
                }

                _sameTangentRadius = EditorGUILayout.Toggle(new GUIContent("Same tangent radius", "Tangents are symmetric in radius?"), _sameTangentRadius);
                if (_sameTangentRadius)
                {
                    _inTangentRadius = _outTangentRadius = EditorGUILayout.FloatField(new GUIContent("Tangents radius", "In and out tangents radius"), _inTangentRadius);
                }
                else
                {
                    _inTangentRadius  = EditorGUILayout.FloatField(new GUIContent("In tangent radius", "In tangent radius"), _inTangentRadius);
                    _outTangentRadius = EditorGUILayout.FloatField(new GUIContent("Out tangent radius", "Out tangent radius"), _outTangentRadius);
                }
                EditorGUILayout.EndVertical();

                if (EditorGUI.EndChangeCheck())
                {
                    CreateThePath();
                }
            }

            if (GUILayout.Button(new GUIContent("New", "Leaves current generated path (if there is one) and create a new one")))
            {
                InitializePath();
            }
        }
Esempio n. 21
0
    protected void DrawMinMaxProperty(string propertyName, float min, float max)
    {
        PropertyData property;

        if (propertyTable.TryGetValue(propertyName, out property))
        {
            if (_ShouldDraw(property))
            {
                if (property.property.propertyType == SerializedPropertyType.Vector2)
                {
                    GUIStyle labelStyle = new GUIStyle(EditorStyles.label);

                    float propMin = property.property.vector2Value.x;
                    float propMax = property.property.vector2Value.y;
                                        #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(new GUIContent(property.niceName, property.toolTip.TipText));
                    labelStyle.alignment = TextAnchor.MiddleLeft;
                    GUILayout.Label("Min", labelStyle);
                    GUI.SetNextControlName(property.niceName + "_Min");
                    propMin = EditorGUILayout.FloatField(propMin);
                    GUI.SetNextControlName(property.niceName + "_Slider");
                    EditorGUILayout.MinMaxSlider(new GUIContent("", property.toolTip.TipText), ref propMin, ref propMax, min, max);
                    GUI.SetNextControlName(property.niceName + "_Max");
                    propMax = EditorGUILayout.FloatField(propMax);
                    labelStyle.alignment = TextAnchor.MiddleLeft;
                    GUILayout.Label("Max");
                    EditorGUILayout.EndHorizontal();
                                        #else
                    float windowWidth = WidthOverride > 0 ? WidthOverride - 25 : Screen.width;
                    Rect  controlRect;
                    if (WidthOverride > 0)
                    {
                        controlRect = EditorGUILayout.GetControlRect(true, GUILayout.Width(windowWidth));
                    }
                    else
                    {
                        controlRect = EditorGUILayout.GetControlRect(true);
                    }
                    Rect  valueRect   = EditorGUI.PrefixLabel(controlRect, 0, new GUIContent(property.niceName, property.toolTip.TipText));
                    float labelWidth  = 25;
                    float fieldWidth  = 45;
                    float sliderWidth = (valueRect.width) - (labelWidth * 2f) - (fieldWidth * 2f);
                    float insertPos   = valueRect.x - 1;
                    labelStyle.alignment = TextAnchor.MiddleLeft;
                    GUI.Label(new Rect(insertPos, controlRect.y, labelWidth, controlRect.height), "Min", labelStyle);
                    insertPos += labelWidth;
                    GUI.SetNextControlName(property.niceName + "_Min");
                    propMin    = EditorGUI.FloatField(new Rect(insertPos, controlRect.y, fieldWidth, controlRect.height), propMin);
                    insertPos += fieldWidth;
                    if (sliderWidth > 0)
                    {
                        GUI.SetNextControlName(property.niceName + "_Slider");
                                        #if UNITY_5_5_OR_NEWER
                        EditorGUI.MinMaxSlider(new Rect(insertPos, controlRect.y, sliderWidth, controlRect.height), new GUIContent("", property.toolTip.TipText), ref propMin, ref propMax, min, max);
                                        #else
                        EditorGUI.MinMaxSlider(new GUIContent("", property.toolTip.TipText), new Rect(insertPos, controlRect.y, sliderWidth, controlRect.height), ref propMin, ref propMax, min, max);
                                        #endif
                        insertPos += sliderWidth;
                    }
                    GUI.SetNextControlName(property.niceName + "_Max");
                    propMax              = EditorGUI.FloatField(new Rect(insertPos, controlRect.y, fieldWidth, controlRect.height), "", propMax);
                    insertPos           += fieldWidth;
                    labelStyle.alignment = TextAnchor.MiddleLeft;
                    GUI.Label(new Rect(insertPos, controlRect.y, labelWidth, controlRect.height), "Max");
                                        #endif

                    propMin = Mathf.Max(min, propMin);
                    propMax = Mathf.Min(max, propMax);
                    propMax = Mathf.Max(propMin, propMax);
                    propMin = Mathf.Min(propMin, propMax);
                    Vector2 newValue = new Vector2(propMin, propMax);
                    if (newValue != property.property.vector2Value)
                    {
                        property.property.vector2Value = newValue;
                    }
                }
                else
                {
                    _DrawProperty(property);
                }
            }
        }
    }
Esempio n. 22
0
        void OnGUI()
        {
            SetupHorizontalBoxStyle();
            SetupStatusBoxStyle();
            SetupBoxStyle();


            // Row
            GUILayout.BeginHorizontal("", m_HorizontalStyle);
            //GUILayout.Height(175);
            if (GUI.Button(new Rect(10, 10, 25, 25), ButtonIconBrushMode, GUIStyle.none))
            {
                ToggleBrushMode();
                UpdateBrushMode();
            }

            if (GUI.Button(new Rect(40, 10, 25, 25), ButtonIconNormal, GUIStyle.none))
            {
                UseNormalDirection = !UseNormalDirection;
                UpdateBrushNormal();
            }

            if (GUI.Button(new Rect(70, 10, 25, 25), ButtonIconStroke, GUIStyle.none))
            {
                ToggleStrokeMode();
                UpdateBrushStroke();
            }

            if (GUI.Button(new Rect(100, 10, 25, 25), ButtonIconRandomizePosition, GUIStyle.none))
            {
                RandomizePosition = !RandomizePosition;
                UpdateBrushRandomizePosition();
            }

            if (GUI.Button(new Rect(130, 10, 25, 25), ButtonIconRandomizeRotation, GUIStyle.none))
            {
                RandomizeRotation = !RandomizeRotation;
                UpdateBrushRandomizeRotation();
            }

            if (GUI.Button(new Rect(160, 10, 25, 25), ButtonIconRandomizeScale, GUIStyle.none))
            {
                RandomizeScale = !RandomizeScale;
                UpdateBrushRandomizeScale();
            }

            if (GUI.Button(new Rect(190, 10, 25, 25), ButtonIconGrid, GUIStyle.none))
            {
                CUtility.ShowGrid = !CUtility.ShowGrid;
                UpdateGrid();
            }
            if (GUI.Button(new Rect(220, 10, 25, 25), ButtonIconShadow, GUIStyle.none))
            {
                ToggleShadows = !ToggleShadows;
                UpdateShadow();
            }
            if (GUI.Button(new Rect(245, 10, 25, 25), ButtonIconLight, GUIStyle.none))
            {
                ToggleLighting = !ToggleLighting;


                UpdateLighting();
            }

            /*
             * if (GUI.Button(new Rect(270, 10, 25, 25), ButtonIconLightBake, GUIStyle.none))
             * {
             *  Lightmapping.Bake();
             *  //ToggleLighting = !ToggleLighting;
             *  //UpdateLighting();
             * }
             * if (GUI.Button(new Rect(300, 10, 25, 25), ButtonIconLightClear, GUIStyle.none))
             * {
             *  Lightmapping.Clear();
             *  //ToggleLighting = !ToggleLighting;
             *  //UpdateLighting();
             * }*/


            GUILayout.Space(125);
            GUILayout.Space(125);
            GUILayout.Space(125);
            GUILayout.Space(125);
            if (GUILayout.Button("BakeLight"))
            {
                Lightmapping.Bake();
            }
            if (GUILayout.Button("Stop"))
            {
                Lightmapping.ForceStop();
            }
            if (GUILayout.Button("Clear"))
            {
                Lightmapping.Clear();
            }
            if (GUILayout.Button("BakeOcclusion"))
            {
                StaticOcclusionCulling.Compute();
            }
            if (GUILayout.Button("BakeAstar"))
            {
                //StaticOcclusionCulling.Compute();
            }

            /*
             * if (GUILayout.Button("SNewScene"))
             * {
             *  cSceneManagement.NewScene();
             * }
             *
             * if (GUILayout.Button("SReloadWorkingScene"))
             * {
             *  cSceneManagement.ReloadWorkingScene();
             * }
             *
             *
             *
             * GUILayout.Label("MultiObject:", GUILayout.MaxWidth(50));
             * GameObject = (GameObject) EditorGUILayout.ObjectField("", GameObject, typeof(GameObject), true,
             *  GUILayout.MaxWidth(90));
             * if (GUILayout.Button("Add(N)"))//not yet working
             * {
             *  cBrushThumbnailer.CreateThumbnail(GameObject);
             *  //cThumbnailer.CreateThumbnail()
             *  //AssetDatabase.Refresh();
             *  //SaveSettings();
             * }
             *
             * if (GUILayout.Button("LoadSettings(N)")) //not yet working
             * {
             *  LoadSettings();
             * }
             */
            GUILayout.EndHorizontal();

            //
            //

            /******************************************************************************************
             *  New RowNew RowNew RowNew RowNew RowNew RowNew RowNew RowNew RowNew RowNew RowNew RowNew RowNew RowNew RowNew Row
             *******************************************************************************************/
            // Row
            GUILayout.BeginHorizontal("", GUIStyle.none);
            GameObject = (GameObject)EditorGUILayout.ObjectField("", GameObject, typeof(GameObject), true,
                                                                 GUILayout.MaxWidth(90));
            GUILayout.Label("Radius:", GUILayout.MaxWidth(50));
            Radius = EditorGUILayout.Slider("", Radius, 1f, 50f, GUILayout.MaxWidth(120));
            GUILayout.Label("Intensity:", GUILayout.MaxWidth(55));
            PaintIntensity = EditorGUILayout.IntSlider("", PaintIntensity, 1, 100, GUILayout.MaxWidth(120));
            GUILayout.Label("Focal Shift:", GUILayout.MaxWidth(70));
            FocalShift            = EditorGUILayout.Slider("", FocalShift, -1, 1, GUILayout.MaxWidth(120));
            CumulativeProbability = EditorGUILayout.CurveField("", CumulativeProbability, GUILayout.MaxWidth(40));

            GUILayout.Label("Paint surface:", GUILayout.MaxWidth(80));
            m_PaintSurface = (PaintSurfaceType)EditorGUILayout.EnumPopup("", m_PaintSurface, GUILayout.MaxWidth(55));
            GUILayout.Label("Record session", GUILayout.MaxWidth(90));
            RecordSession = EditorGUILayout.Toggle("", RecordSession, GUILayout.MaxWidth(40));

            GUILayout.EndHorizontal();

            /// Row
            GUILayout.BeginHorizontal("", GUIStyle.none);
            GUILayout.Label("Size:", GUILayout.MaxWidth(40));
            MinSize = EditorGUILayout.FloatField("", MinSize, GUILayout.MaxWidth(35));
            EditorGUILayout.MinMaxSlider(ref MinSize, ref MaxSize, MinLimit, MaxLimit, GUILayout.MaxWidth(60));
            MaxSize = EditorGUILayout.FloatField("", MaxSize, GUILayout.MaxWidth(35));

            GUILayout.Space(20);
            GUILayout.Space(20);
            GUILayout.Label("rX:", GUILayout.MaxWidth(20));
            MaxRotationX = EditorGUILayout.FloatField("", MaxRotationX, GUILayout.MaxWidth(30));
            GUILayout.Label("rY:", GUILayout.MaxWidth(20));
            MaxRotationY = EditorGUILayout.FloatField("", MaxRotationY, GUILayout.MaxWidth(30));
            GUILayout.Label("rZ:", GUILayout.MaxWidth(20));
            MaxRotationZ = EditorGUILayout.FloatField("", MaxRotationZ, GUILayout.MaxWidth(30));
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal("", m_StatusBarStyle);
            GUILayout.Label("Status:");
            GUILayout.Label(MyStatus);
            GUILayout.EndHorizontal();
        }
Esempio n. 23
0
    void ShowInstruments()
    {
        if (sampler.instruments != null)
        {
            for (int i = 0; i < sampler.instruments.Length; i++)
            {
                Instrument instrument    = sampler.instruments[i];
                int        noteCounter   = 0;
                int        octaveCounter = 0;

                EditorGUILayout.BeginHorizontal();
                instrument.showing = EditorGUILayout.Foldout(instrument.showing, instrument.name);
                EditorGUI.BeginDisabledGroup(Application.isPlaying);
                if (ShowDeleteElementButton(serializedObject.FindProperty("instruments"), i))
                {
                    break;
                }
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.EndHorizontal();

                if (instrument.showing)
                {
                    EditorGUI.indentLevel += 1;
                    instrument.minNote     = Mathf.Round(instrument.minNote);
                    instrument.maxNote     = Mathf.Round(instrument.maxNote);

                    EditorGUI.BeginDisabledGroup(Application.isPlaying);
                    instrument.name         = EditorGUILayout.TextField(instrument.name);
                    instrument.generateMode = (Instrument.GenerateModes)EditorGUILayout.EnumPopup("Generate Mode", instrument.generateMode);

                    if (instrument.generateMode == Instrument.GenerateModes.GenerateAtRuntime)
                    {
                        EditorGUI.indentLevel += 1;
                        instrument.destroyIdle = EditorGUILayout.Toggle("Destroy Idle", instrument.destroyIdle);
                        if (instrument.destroyIdle)
                        {
                            instrument.idleThreshold = Mathf.Max(EditorGUILayout.FloatField("Idle Threshold", instrument.idleThreshold), 0);
                        }
                        EditorGUI.indentLevel -= 1;
                    }
                    instrument.is3D = EditorGUILayout.Toggle("3D Clips", instrument.is3D);
                    EditorGUI.EndDisabledGroup();

                    instrument.maxVoices = EditorGUILayout.IntSlider("Max Voices", instrument.maxVoices, 1, 64);

                    instrument.velocitySettingsShowing = EditorGUILayout.Foldout(instrument.velocitySettingsShowing, "Velocity");
                    if (instrument.velocitySettingsShowing)
                    {
                        EditorGUI.indentLevel           += 1;
                        instrument.velocityAffectsVolume = EditorGUILayout.Toggle("Affects Volume", instrument.velocityAffectsVolume);
                        instrument.velocityCurve         = EditorGUILayout.CurveField("Curve", instrument.velocityCurve, Color.cyan, new Rect(0, 0, 1, 1), GUILayout.Height(16));
                        EditorGUI.BeginDisabledGroup(Application.isPlaying);
                        instrument.velocityLayers = (int)EditorGUILayout.Slider("Layers", instrument.velocityLayers, 1, 16);
                        EditorGUI.EndDisabledGroup();
                        EditorGUI.indentLevel -= 1;
                    }

                    EditorGUILayout.BeginHorizontal();
                    instrument.notesShowing = EditorGUILayout.Foldout(instrument.notesShowing, "Audio Clips");
                    EditorGUI.BeginDisabledGroup(Application.isPlaying);
                    if (GUILayout.Button("Reset", EditorStyles.miniButton, GUILayout.Width(50)))
                    {
                        instrument.Reset();
                    }
                    EditorGUI.EndDisabledGroup();
                    EditorGUILayout.EndHorizontal();

                    if (instrument.notesShowing)
                    {
                        EditorGUI.indentLevel -= 1;
                        instrument.InitializeClips();

                        EditorGUI.BeginDisabledGroup(Application.isPlaying);
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Space(16);
                        instrument.minNote = EditorGUILayout.FloatField(instrument.minNote, GUILayout.Width(50));
                        EditorGUILayout.MinMaxSlider(ref instrument.minNote, ref instrument.maxNote, 0, 127);
                        instrument.maxNote = EditorGUILayout.FloatField(instrument.maxNote, GUILayout.Width(50));
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.EndDisabledGroup();

                        for (int j = 0; j < 128; j++)
                        {
                            if (j >= instrument.minNote && j <= instrument.maxNote)
                            {
                                EditorGUILayout.BeginHorizontal();
                                GUILayout.Space(16);
                                if (GUILayout.Button(instrument.noteNames[noteCounter].ToString() + octaveCounter.ToString() + " (" + j.ToString() + ")", GUILayout.MinWidth(80), GUILayout.Height(14)))
                                {
                                    if (instrument.GetClipCount() != 0)
                                    {
                                        if (Application.isPlaying)
                                        {
                                            Sampler.Play(instrument.name, j, 127, sampler.gameObject);
                                        }
                                    }
                                }
                                for (int k = 0; k < instrument.velocityLayers; k++)
                                {
                                    EditorGUI.BeginDisabledGroup(Application.isPlaying);
                                    instrument.audioClips[j + (k * 128)] = (AudioClip)EditorGUILayout.ObjectField(instrument.audioClips[j + (k * 128)], typeof(AudioClip), true, GUILayout.Height(14));
                                    EditorGUI.EndDisabledGroup();
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            noteCounter += 1;
                            if (noteCounter == 12)
                            {
                                octaveCounter += 1; noteCounter = 0;
                            }
                        }
                        EditorGUI.indentLevel += 1;
                    }
                    ShowSeparator(false);
                    EditorGUI.indentLevel -= 1;
                }
            }
        }
    }
Esempio n. 24
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        GUILayout.Label("Level settings", EditorStyles.boldLabel);

        GUILayout.BeginVertical("box");

        GUILayout.Label("Sizing Options");
        levelWidth.intValue   = EditorGUILayout.IntSlider("Level width", levelWidth.intValue, 30, 100);
        levelHeight.intValue  = EditorGUILayout.IntSlider("Level height", levelHeight.intValue, 30, 100);
        wallHeight.floatValue = EditorGUILayout.Slider("Wall height", wallHeight.floatValue, -5f, 10f);
        tileSize.floatValue   = EditorGUILayout.Slider("Tile size", tileSize.floatValue, 1f, 10f);

        GUILayout.Space(5);

        GUILayout.Label("Generation Options");
        scale.floatValue       = EditorGUILayout.FloatField("Scale", scale.floatValue);
        octaves.intValue       = EditorGUILayout.IntSlider("Octaves", octaves.intValue, 1, 8);
        lacunarity.floatValue  = EditorGUILayout.Slider("Lacunarity", lacunarity.floatValue, 0f, 4f);
        persistance.floatValue = EditorGUILayout.Slider("Persistance", persistance.floatValue, 0f, 1f);

        GUILayout.Space(5);

        EditorGUILayout.PropertyField(heightMultiplier);

//		wallLimit.floatValue = EditorGUILayout.Slider ("Wall limit", wallLimit.floatValue, 0.1f, 1f);

        GUILayout.Space(5);
        GUILayout.EndVertical();
        GUILayout.Space(10);

        GUILayout.Label("Levels of Terrain", EditorStyles.boldLabel);
        GUILayout.Label("The lowest most field will be impassible (Red)");
        wallMaterial.objectReferenceValue = (Material)EditorGUILayout.ObjectField("Wall Material", wallMaterial.objectReferenceValue, typeof(Material), false);
        GUILayout.Space(5);

        if (possibleTerrain.arraySize > 3)
        {
            terrainScrollPos = EditorGUILayout.BeginScrollView(terrainScrollPos, GUILayout.Height(330));
        }
        for (int i = 0; i < possibleTerrain.arraySize; i++)
        {
            if (i == 0)
            {
                GUI.color = Color.red;
            }

            GUILayout.BeginVertical("box");
            GUI.color = Color.white;
            GUILayout.Space(5);

            SerializedProperty tileInfoStruct = possibleTerrain.GetArrayElementAtIndex(i);
            SerializedProperty terrainColour  = tileInfoStruct.FindPropertyRelative("terrainColour");
            SerializedProperty height         = tileInfoStruct.FindPropertyRelative("height");
            SerializedProperty material       = tileInfoStruct.FindPropertyRelative("terrainMaterial");

            terrainColour.colorValue      = EditorGUILayout.ColorField("Terrain colour", terrainColour.colorValue);
            material.objectReferenceValue = (Material)EditorGUILayout.ObjectField("Terrain Material", material.objectReferenceValue, typeof(Material), false);

            float maxHeight = height.floatValue;
            if (i > 0)
            {
                float minHeight = possibleTerrain.GetArrayElementAtIndex(i - 1).FindPropertyRelative("height").floatValue;
                EditorGUILayout.MinMaxSlider("Height", ref minHeight, ref maxHeight, 0f, 1f);
                possibleTerrain.GetArrayElementAtIndex(i - 1).FindPropertyRelative("height").floatValue = minHeight;
            }
            else
            {
                float minHeight = 0f;
                EditorGUILayout.MinMaxSlider("Height", ref minHeight, ref maxHeight, 0f, 1f);
            }
            height.floatValue = maxHeight;

            GUILayout.Space(10);

            if (GUILayout.Button("Remove Terrain"))
            {
                RemoveColour(i);
            }

            GUILayout.Space(5);
            GUILayout.EndVertical();
        }
        if (possibleTerrain.arraySize > 3)
        {
            EditorGUILayout.EndScrollView();
        }

        GUILayout.Space(5);
        if (GUILayout.Button("Add Terrain"))
        {
            AddColour(possibleTerrain.arraySize);
        }

        GUILayout.Space(10);
        GUILayout.Label("Objects for terrain", EditorStyles.boldLabel);
        objectChance.floatValue = EditorGUILayout.Slider("Object Chance", objectChance.floatValue, 0f, 1f);
        GUILayout.Space(5);
        if (possibleObjects.arraySize > 3)
        {
            objectScrollPos = EditorGUILayout.BeginScrollView(objectScrollPos, GUILayout.Height(330));
        }
        for (int i = 0; i < possibleObjects.arraySize; i++)
        {
            GUILayout.BeginVertical("box");
            GUILayout.Space(10);

            SerializedProperty terrInfoStruct = possibleObjects.GetArrayElementAtIndex(i);
            SerializedProperty terrain        = terrInfoStruct.FindPropertyRelative("terrain");
            SerializedProperty chance         = terrInfoStruct.FindPropertyRelative("chance");
            SerializedProperty height         = terrInfoStruct.FindPropertyRelative("height");

            terrain.objectReferenceValue = EditorGUILayout.ObjectField("Terrain object", terrain.objectReferenceValue, typeof(GameObject), true);
            chance.intValue   = EditorGUILayout.IntSlider("Weight", chance.intValue, 0, 100);
            height.floatValue = EditorGUILayout.Slider("Height", height.floatValue, 0f, 1f);

            GUILayout.Space(15);

            if (GUILayout.Button("Remove object"))
            {
                RemoveObject(i);
            }

            GUILayout.Space(5);
            GUILayout.EndVertical();
        }
        if (possibleObjects.arraySize > 3)
        {
            EditorGUILayout.EndScrollView();
        }

        GUILayout.Space(5);
        if (GUILayout.Button("Add object"))
        {
            AddObject(possibleObjects.arraySize);
        }

        GUILayout.Space(10);

        GUILayout.Label("Light Options", EditorStyles.boldLabel);
        GUILayout.BeginVertical("box");

        SerializedProperty angle     = lightOptions.FindPropertyRelative("angle");
        SerializedProperty intensity = lightOptions.FindPropertyRelative("intensity");
        SerializedProperty colour    = lightOptions.FindPropertyRelative("lightColour");

        angle.vector3Value   = EditorGUILayout.Vector3Field("Light Angle", angle.vector3Value);
        intensity.floatValue = EditorGUILayout.Slider("Light Intensity", intensity.floatValue, 0f, 1f);
        colour.colorValue    = EditorGUILayout.ColorField("Light Colour", colour.colorValue);

        postProcProfile.objectReferenceValue = EditorGUILayout.ObjectField("Post Proccessing Profile", postProcProfile.objectReferenceValue, typeof(PostProcessingProfile), false);

        GUILayout.EndVertical();

        GUILayout.Space(100);

        serializedObject.ApplyModifiedProperties();

//		base.DrawDefaultInspector ();
    }
Esempio n. 25
0
    public void ShaderPropertiesGUI(Material material)
    {
        BlendModePopup();

        Color mainColor = Color.white;

        if ((BlendMode)blendMode.floatValue == BlendMode.Cutout)
        {
            m_MaterialEditor.ShaderProperty(cutoutStrength, "透贴强度", indent);
        }
        else if ((BlendMode)blendMode.floatValue == BlendMode.Transparent ||
                 (BlendMode)blendMode.floatValue == BlendMode.PreMultiply)
        {
            m_MaterialEditor.ShaderProperty(transparent, "透明度", indent);
            m_MaterialEditor.ShaderProperty(transparentZWrite, "Z写入", indent);
            mainColor   = baseColor.colorValue;
            mainColor.a = transparent.floatValue;
        }

        CullModePopup();

        EditorGUILayout.Space();
        m_MaterialEditor.TexturePropertySingleLine(Styles.baseMapText, baseMap, baseColor);
        m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, normalMap, normalScale);
        if (normalMap.textureValue != null)
        {
            m_MaterialEditor.ShaderProperty(normalMapSwitch, "DX/OpenGL切换", indent);
        }
        m_MaterialEditor.TexturePropertySingleLine(Styles.maesMapText, maesMap);

        { // for bake
            material.SetTexture("_MainTex", baseMap.textureValue);
            material.SetColor("_Color", mainColor);
        }

        material.SetKeyword("_NORMALMAP", normalMap.textureValue != null);

        EditorGUILayout.Space();
        m_MaterialEditor.ShaderProperty(emissiveColor, "自发光");

        EditorGUILayout.Space();
        if (maesMap.textureValue != null)
        {
            float sMin = smoothnessMin.floatValue;
            float sMax = smoothnessMax.floatValue;
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.MinMaxSlider(Styles.smoothnessRemapText, ref sMin, ref sMax, 0.0f, 1.0f);
            if (EditorGUI.EndChangeCheck())
            {
                smoothnessMin.floatValue = sMin;
                smoothnessMax.floatValue = sMax;
            }
        }
        else
        {
            m_MaterialEditor.ShaderProperty(smoothnessMax, "光滑度");
            smoothnessMin.floatValue = 0;
        }
        m_MaterialEditor.ShaderProperty(metallic, "金属度");
        m_MaterialEditor.ShaderProperty(fresnelStrength, "菲涅尔强度");
        m_MaterialEditor.ShaderProperty(AOStrength, "AO强度");
        m_MaterialEditor.ShaderProperty(specularTint, "非金属反射着色");

        EditorGUILayout.Space();
        m_MaterialEditor.ShaderProperty(sssToggle, "SSS");
        if (sssToggle.floatValue != 0)
        {
            m_MaterialEditor.ShaderProperty(sssColor, "SSS颜色", indent);
        }

        EditorGUILayout.Space();
        m_MaterialEditor.ShaderProperty(this.rimColor, "边缘光颜色");
        m_MaterialEditor.ShaderProperty(rimPower, "边缘光范围");
        Color rimColor = this.rimColor.colorValue;

        rimColor.a = rimPower.floatValue;
        this.rimColor.colorValue = rimColor;
        material.SetKeyword("_RIM", rimColor.maxColorComponent >= 0.04f);
    }
Esempio n. 26
0
        public override void DrawShaderGUI(MicroSplatShaderGUI shaderGUI, MicroSplatKeywords keywords, Material mat, MaterialEditor materialEditor, MaterialProperty[] props)
        {
            if (snow != SnowMode.None && mat.HasProperty("_SnowParams") && MicroSplatUtilities.DrawRollup("Snow"))
            {
                var snowDiff = shaderGUI.FindProp("_SnowDiff", props);
                var snowNorm = shaderGUI.FindProp("_SnowNormal", props);
                materialEditor.TexturePropertySingleLine(CDiffTex, snowDiff);
                materialEditor.TexturePropertySingleLine(CNormTex, snowNorm);
                MicroSplatUtilities.EnforceDefaultTexture(snowDiff, "microsplat_def_snow_diff");
                MicroSplatUtilities.EnforceDefaultTexture(snowNorm, "microsplat_def_snow_normsao");
                if (mat.HasProperty("_SnowTint"))
                {
                    materialEditor.ColorProperty(shaderGUI.FindProp("_SnowTint", props), "Snow Tint");
                }
                if (mat.HasProperty("_SnowMask"))
                {
                    var maskTex = shaderGUI.FindProp("_SnowMask", props);
                    materialEditor.TexturePropertySingleLine(CSnowTex, maskTex);
                }
                if (mat.HasProperty("_SnowUVScales"))
                {
                    Vector4 snowUV = shaderGUI.FindProp("_SnowUVScales", props).vectorValue;
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("UV Scale");
                    snowUV.x = EditorGUILayout.FloatField(snowUV.x);
                    snowUV.y = EditorGUILayout.FloatField(snowUV.y);
                    EditorGUILayout.EndHorizontal();
                    if (EditorGUI.EndChangeCheck())
                    {
                        shaderGUI.FindProp("_SnowUVScales", props).vectorValue = snowUV;
                        EditorUtility.SetDirty(mat);
                    }
                }
                if (mat.HasProperty("_SnowSSSTint"))
                {
                    var prop = shaderGUI.FindProp("_SnowSSSTint", props);
                    EditorGUI.BeginChangeCheck();
                    Color c = prop.colorValue;
                    c   = EditorGUILayout.ColorField(CSSSTint, c);
                    c.a = EditorGUILayout.Slider(CSSSThickness, c.a, 0, 1);

                    if (EditorGUI.EndChangeCheck())
                    {
                        prop.colorValue = c;
                        EditorUtility.SetDirty(mat);
                    }
                }


                // influence, erosion, crystal, melt
                Vector4 p1 = shaderGUI.FindProp("_SnowParams", props).vectorValue;
                Vector4 hr = shaderGUI.FindProp("_SnowHeightAngleRange", props).vectorValue;

                EditorGUILayout.BeginHorizontal();
                bool oldEnabled = GUI.enabled;
                if (globalLevel)
                {
                    GUI.enabled = false;
                }
                materialEditor.ShaderProperty(shaderGUI.FindProp("_SnowAmount", props), "Amount");
                GUI.enabled = oldEnabled;
                globalLevel = DrawGlobalToggle(GetFeatureName(SnowDefineFeature._USEGLOBALSNOWLEVEL), keywords);
                EditorGUILayout.EndHorizontal();

                EditorGUI.BeginChangeCheck();

                if (snow == SnowMode.Rich)
                {
                    p1.x = EditorGUILayout.Slider(CHeightClear, p1.x, 0, 1);
                }
                p1.y = EditorGUILayout.Slider(CErosionClearing, p1.y, 0, 1);

                EditorGUILayout.BeginHorizontal();
                oldEnabled = GUI.enabled;
                if (globalHeight)
                {
                    GUI.enabled = false;
                }
                EditorGUILayout.PrefixLabel(CHeightRange);
                hr.x         = EditorGUILayout.FloatField(hr.x);
                hr.y         = EditorGUILayout.FloatField(hr.y);
                GUI.enabled  = oldEnabled;
                globalHeight = DrawGlobalToggle(GetFeatureName(SnowDefineFeature._USEGLOBALSNOWHEIGHT), keywords);
                EditorGUILayout.EndHorizontal();


                hr.z = 1.0f - hr.z;
                hr.w = 1.0f - hr.w;
                EditorGUILayout.MinMaxSlider(CAngleRange, ref hr.w, ref hr.z, 0.0f, 1.0f);
                hr.z = 1.0f - hr.z;
                hr.w = 1.0f - hr.w;

                p1.z = EditorGUILayout.FloatField(CCrystals, p1.z);
                p1.w = EditorGUILayout.Slider(CMelt, p1.w, 0, 0.6f);

                if (EditorGUI.EndChangeCheck())
                {
                    shaderGUI.FindProp("_SnowParams", props).vectorValue           = p1;
                    shaderGUI.FindProp("_SnowHeightAngleRange", props).vectorValue = hr;
                }

                Vector4 up = mat.GetVector("_SnowUpVector");
                EditorGUI.BeginChangeCheck();
                Vector3 newUp = EditorGUILayout.Vector3Field(CUpVector, new Vector3(up.x, up.y, up.z));
                if (EditorGUI.EndChangeCheck())
                {
                    newUp.Normalize();
                    mat.SetVector("_SnowUpVector", new Vector4(newUp.x, newUp.y, newUp.z, 0));
                    EditorUtility.SetDirty(mat);
                }

                if (snowRim && mat.HasProperty("_SnowRimPower"))
                {
                    materialEditor.ColorProperty(shaderGUI.FindProp("_SnowRimColor", props), "Rim Light Color");
                    materialEditor.RangeProperty(shaderGUI.FindProp("_SnowRimPower", props), "Rim Light Power");
                }

                if (snowSparkle && mat.HasProperty("_SnowSparkleNoise"))
                {
                    var texProp = shaderGUI.FindProp("_SnowSparkleNoise", props);
                    materialEditor.TexturePropertySingleLine(CSparkleNoise, texProp);
                    MicroSplatUtilities.EnforceDefaultTexture(texProp, "microsplat_def_perlin4");
                    materialEditor.ColorProperty(shaderGUI.FindProp("_SnowSparkleTint", props), "Sparkle Tint");
                    materialEditor.RangeProperty(shaderGUI.FindProp("_SnowSparkleStrength", props), "Sparkle Strength");
                    materialEditor.RangeProperty(shaderGUI.FindProp("_SnowSparkleEmission", props), "Sparkle Emission Strength");
                    materialEditor.FloatProperty(shaderGUI.FindProp("_SnowSparkleSize", props), "Sparkle Size");
                    materialEditor.FloatProperty(shaderGUI.FindProp("_SnowSparkleDensity", props), "Sparkle Density");
                    materialEditor.FloatProperty(shaderGUI.FindProp("_SnowSparkleViewDependency", props), "Sparkle View Dependency");
                    materialEditor.FloatProperty(shaderGUI.FindProp("_SnowSparkleNoiseDensity", props), "Sparkle Noise Density");
                    materialEditor.FloatProperty(shaderGUI.FindProp("_SnowSparkleNoiseAmplitude", props), "Sparkle Noise Amplitude");
                }

                if (snowNormalNoise)
                {
                    if (mat.HasProperty("_SnowNormalNoise"))
                    {
                        var texProp = shaderGUI.FindProp("_SnowNormalNoise", props);
                        materialEditor.TexturePropertySingleLine(CDistanceNoise, texProp);
                        MicroSplatUtilities.EnforceDefaultTexture(texProp, "microsplat_def_snow_normalnoise");


                        Vector4 scaleStr    = shaderGUI.FindProp("_SnowNormalNoiseScaleStrength", props).vectorValue;
                        Vector4 newScaleStr = scaleStr;
                        newScaleStr.x = EditorGUILayout.FloatField("Noise UV Scale", scaleStr.x);
                        newScaleStr.y = EditorGUILayout.FloatField("Noise Strength", scaleStr.y);
                        if (newScaleStr != scaleStr)
                        {
                            shaderGUI.FindProp("_SnowNormalNoiseScaleStrength", props).vectorValue = newScaleStr;
                        }
                    }
                }
                if (snowDistanceResample)
                {
                    if (mat.HasProperty("_SnowDistanceResampleScaleStrengthFade"))
                    {
                        Vector4 scaleStr    = shaderGUI.FindProp("_SnowDistanceResampleScaleStrengthFade", props).vectorValue;
                        Vector4 newScaleStr = scaleStr;
                        newScaleStr.x = EditorGUILayout.FloatField("Resample UV Scale", scaleStr.x);
                        newScaleStr.y = EditorGUILayout.FloatField("Resample Strength", scaleStr.y);
                        newScaleStr.z = EditorGUILayout.FloatField("Resample Fade Start", scaleStr.z);
                        newScaleStr.w = EditorGUILayout.FloatField("Resample Fade End", scaleStr.w);
                        if (newScaleStr != scaleStr)
                        {
                            shaderGUI.FindProp("_SnowDistanceResampleScaleStrengthFade", props).vectorValue = newScaleStr;
                        }
                    }
                }

#if __MICROSPLAT_TEXTURECLUSTERS__
                if (snowStochastic)
                {
                    if (mat.HasProperty("_SnowStochasticScale"))
                    {
                        materialEditor.RangeProperty(shaderGUI.FindProp("_SnowStochasticScale", props), "Stochastic Scale");
                        materialEditor.RangeProperty(shaderGUI.FindProp("_SnowStochasticContrast", props), "Stochastic Contrast");
                    }
                }
#endif

                if (mat.HasProperty("_TessDisplaceSnowMultiplier"))
                {
                    materialEditor.RangeProperty(shaderGUI.FindProp("_TessDisplaceSnowMultiplier", props), "Displacement Multiplier");
                }
            }
        }
    //------------------------------------------------------------------

    void TreesMenu()
    {
        EditorGUILayout.BeginVertical("Box");
        {
            EditorGUILayout.Space();

            SerializedProperty drawTreesAndFoliage = serializedObject.FindProperty("drawTreesAndFoliage");
            EditorGUILayout.PropertyField(drawTreesAndFoliage, new GUIContent("Draw Trees & Foliage"));

            EditorGUILayout.Space();


            SerializedProperty treeDistance     = serializedObject.FindProperty("treeDistance");
            SerializedProperty autoTreeDistance = serializedObject.FindProperty("autoTreeDistance");
            EditorGUILayout.BeginHorizontal();
            {
                GUI.enabled = GUI_Enabled() && !autoTreeDistance.boolValue;
                EditorGUILayout.PropertyField(treeDistance, new GUIContent("Max Tree Distance"));
                GUI.enabled = GUI_Enabled();
                autoTreeDistance.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("auto"), autoTreeDistance.boolValue, GUILayout.MaxWidth(48));
            }
            EditorGUILayout.EndHorizontal();

            SerializedProperty treeBillboardDistance = serializedObject.FindProperty("treeBillboardDistance");
            EditorGUILayout.PropertyField(treeBillboardDistance, new GUIContent("Billboard Distance"));

            SerializedProperty treeCrossFadeLength = serializedObject.FindProperty("treeCrossFadeLength");
            EditorGUILayout.PropertyField(treeCrossFadeLength, new GUIContent("Cross Fade Length"));

            EditorGUILayout.Space();

            SerializedProperty playerStartupFreeRadius = serializedObject.FindProperty("playerStartupFreeRadius");
            EditorGUILayout.PropertyField(playerStartupFreeRadius, new GUIContent("Player Free Radius"));

            EditorGUILayout.Space();

            SerializedProperty treesProperties = serializedObject.FindProperty("treesProperties");
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Prototypes: " + treesProperties.arraySize, EditorStyles.boldLabel, GUILayout.Width(84));

                GUI.enabled = GUI_Enabled() && (treesProperties.arraySize >= 0);
                if (GUILayout.Button("+"))
                {
                    treesProperties.arraySize++;
                    EasyTerrain.PropertiesTree treePropertiesDefault = new EasyTerrain.PropertiesTree();
                    if (treesProperties.arraySize > 1)
                    {
                        treePropertiesDefault.prototype                 = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("prototype").objectReferenceValue as GameObject;
                        treePropertiesDefault.density                   = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("density").floatValue;
                        treePropertiesDefault.useNoiseLayer             = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("useNoiseLayer").boolValue;
                        treePropertiesDefault.noiseSettings.type        = NoiseGenerator.NoiseMethodType.Perlin3D;
                        treePropertiesDefault.noiseSettings.frequency   = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("noiseSettings").FindPropertyRelative("frequency").floatValue;
                        treePropertiesDefault.noiseSettings.octaves     = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("noiseSettings").FindPropertyRelative("octaves").intValue;
                        treePropertiesDefault.noiseSettings.lacunarity  = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("noiseSettings").FindPropertyRelative("lacunarity").floatValue;
                        treePropertiesDefault.noiseSettings.persistence = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("noiseSettings").FindPropertyRelative("persistence").floatValue;
                        treePropertiesDefault.noiseSettings.threshold   = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("noiseSettings").FindPropertyRelative("threshold").floatValue;
                        treePropertiesDefault.noiseSettings.falloff     = treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 2).FindPropertyRelative("noiseSettings").FindPropertyRelative("falloff").floatValue;
                    }
                    else
                    {
                        treePropertiesDefault.noiseSettings.type        = NoiseGenerator.NoiseMethodType.Perlin3D;
                        treePropertiesDefault.noiseSettings.frequency   = 0.002f;
                        treePropertiesDefault.noiseSettings.octaves     = 1;
                        treePropertiesDefault.noiseSettings.lacunarity  = 2f;
                        treePropertiesDefault.noiseSettings.persistence = 0.5f;
                        treePropertiesDefault.noiseSettings.threshold   = 0.5f;
                        treePropertiesDefault.noiseSettings.falloff     = 0.5f;
                    }
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("bendFactor").floatValue          = treePropertiesDefault.bendFactor;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("density").floatValue             = treePropertiesDefault.density;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("preventMeshOverlap").boolValue   = treePropertiesDefault.preventMeshOverlap;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("color1").colorValue              = treePropertiesDefault.color1;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("color2").colorValue              = treePropertiesDefault.color2;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("minScale").floatValue            = treePropertiesDefault.minScale;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("maxScale").floatValue            = treePropertiesDefault.maxScale;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("prototype").objectReferenceValue = treePropertiesDefault.prototype;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("useNoiseLayer").boolValue        = treePropertiesDefault.useNoiseLayer;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("noiseSettings").FindPropertyRelative("type").enumValueIndex    = (int)treePropertiesDefault.noiseSettings.type;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("noiseSettings").FindPropertyRelative("frequency").floatValue   = treePropertiesDefault.noiseSettings.frequency;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("noiseSettings").FindPropertyRelative("octaves").intValue       = treePropertiesDefault.noiseSettings.octaves;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("noiseSettings").FindPropertyRelative("lacunarity").floatValue  = treePropertiesDefault.noiseSettings.lacunarity;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("noiseSettings").FindPropertyRelative("persistence").floatValue = treePropertiesDefault.noiseSettings.persistence;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("noiseSettings").FindPropertyRelative("threshold").floatValue   = treePropertiesDefault.noiseSettings.threshold;
                    treesProperties.GetArrayElementAtIndex(treesProperties.arraySize - 1).FindPropertyRelative("noiseSettings").FindPropertyRelative("falloff").floatValue     = treePropertiesDefault.noiseSettings.falloff;
                    SerializedProperty inspTreeSelectorIndex = serializedObject.FindProperty("inspTreeSelectorIndex");
                    inspTreeSelectorIndex.intValue = treesProperties.arraySize - 1;
                }
                GUI.enabled = GUI_Enabled() && (treesProperties.arraySize > 0);
                if (GUILayout.Button("-"))
                {
                    treesProperties.arraySize--;
                }
                GUI_Enabled();
            }
            EditorGUILayout.EndHorizontal();

            if (treesProperties.arraySize > 0)
            {
                SerializedProperty inspTreeSelectorIndex = serializedObject.FindProperty("inspTreeSelectorIndex");
                inspTreeSelectorIndex.intValue = Mathf.Clamp(inspTreeSelectorIndex.intValue, 0, treesProperties.arraySize - 1);
                string[] menuTexts = new string[treesProperties.arraySize];
                for (int j = 0; j < treesProperties.arraySize; j++)
                {
                    menuTexts[j] = "#" + j;
                }
                EditorGUILayout.Space();
                inspTreeSelectorIndex.intValue = GUILayout.SelectionGrid(inspTreeSelectorIndex.intValue, menuTexts, treesProperties.arraySize);
                EditorGUILayout.Space();

                int i = inspTreeSelectorIndex.intValue;

                SerializedProperty prototype = treesProperties.GetArrayElementAtIndex(i).FindPropertyRelative("prototype");

                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUILayout.BeginVertical();
                    {
                        EditorGUILayout.PropertyField(prototype, GUIContent.none);
                        float labelWidth = 44f;
                        EditorGUILayout.BeginHorizontal();
                        {
                            SerializedProperty density = treesProperties.GetArrayElementAtIndex(i).FindPropertyRelative("density");
                            EditorGUILayout.LabelField("Density", GUILayout.Width(labelWidth));
                            EditorGUILayout.PropertyField(density, GUIContent.none);
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                        {
                            SerializedProperty preventMeshOverlap = treesProperties.GetArrayElementAtIndex(i).FindPropertyRelative("preventMeshOverlap");
                            //EditorGUILayout.LabelField("", GUILayout.Width(labelWidth));
                            preventMeshOverlap.boolValue = EditorGUILayout.ToggleLeft("Prevent Mesh Overlap", preventMeshOverlap.boolValue, GUILayout.MinWidth(0));
                        }
                        EditorGUILayout.EndHorizontal();
                        //EditorGUILayout.BeginHorizontal();
                        //{
                        //    SerializedProperty minDistance = trees.GetArrayElementAtIndex(i).FindPropertyRelative("minDistance");
                        //    EditorGUILayout.LabelField("minDistance", GUILayout.Width(labelWidth*2f));
                        //    GUI.enabled = false;
                        //    EditorGUILayout.FloatField(minDistance.floatValue);
                        //    GUI_Enabled();
                        //}
                        //EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                        EditorGUILayout.BeginHorizontal();
                        {
                            SerializedProperty color1 = treesProperties.GetArrayElementAtIndex(i).FindPropertyRelative("color1");
                            SerializedProperty color2 = treesProperties.GetArrayElementAtIndex(i).FindPropertyRelative("color2");
                            EditorGUILayout.LabelField("Colors", GUILayout.Width(labelWidth));
                            EditorGUILayout.PropertyField(color1, GUIContent.none, GUILayout.MinWidth(32));
                            EditorGUILayout.PropertyField(color2, GUIContent.none, GUILayout.MinWidth(32));
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                        {
                            SerializedProperty minScale = treesProperties.GetArrayElementAtIndex(i).FindPropertyRelative("minScale");
                            SerializedProperty maxScale = treesProperties.GetArrayElementAtIndex(i).FindPropertyRelative("maxScale");
                            float minScaleValue         = minScale.floatValue;
                            float maxScaleValue         = maxScale.floatValue;
                            EditorGUILayout.LabelField("Scale", GUILayout.Width(labelWidth));
                            minScaleValue = EditorGUILayout.FloatField(minScaleValue, GUILayout.MaxWidth(48), GUILayout.MinWidth(32));
                            EditorGUILayout.MinMaxSlider(ref minScaleValue, ref maxScaleValue, 0f, 4f, GUILayout.MinWidth(0));
                            maxScaleValue       = EditorGUILayout.FloatField(maxScaleValue, GUILayout.MaxWidth(48), GUILayout.MinWidth(32));
                            minScale.floatValue = minScaleValue;
                            maxScale.floatValue = maxScaleValue;
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.BeginVertical();
                    {
                        guiRect = EditorGUILayout.GetControlRect(false, GUILayout.Height(100), GUILayout.Width(100));
                        if (prototype.objectReferenceValue == true)
                        {
                            Texture2D pTexture = AssetPreview.GetAssetPreview(prototype.objectReferenceValue as GameObject);
                            if (pTexture != null)
                            {
                                EditorGUI.DrawPreviewTexture(guiRect, pTexture);
                            }
                        }
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Apply to Splat Textures:");
                SerializedProperty applyToSplatTexture = treesProperties.GetArrayElementAtIndex(i).FindPropertyRelative("applyToSplatTexture");
                ApplyToSplatTextures(ref applyToSplatTexture);

                EditorGUILayout.Space();

                SerializedProperty useNoiseLayer = treesProperties.GetArrayElementAtIndex(inspTreeSelectorIndex.intValue).FindPropertyRelative("useNoiseLayer");
                useNoiseLayer.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Use noise layer (Perlin3D)"), useNoiseLayer.boolValue);

                if (useNoiseLayer.boolValue)
                {
                    SerializedProperty noiseSettings      = treesProperties.GetArrayElementAtIndex(inspTreeSelectorIndex.intValue).FindPropertyRelative("noiseSettings");
                    SerializedProperty noiseSettings_type = noiseSettings.FindPropertyRelative("type");
                    noiseSettings_type.enumValueIndex = (int)NoiseGenerator.NoiseMethodType.Perlin3D;
                    //EditorGUILayout.PropertyField (noiseSettings_type, new GUIContent("Type"));

                    SerializedProperty noiseSettings_offsetX = noiseSettings.FindPropertyRelative("offsetX");
                    //EditorGUILayout.PropertyField (noiseSettings_offsetX, new GUIContent("Offset X"));
                    noiseSettings_offsetX.floatValue = 0f;

                    SerializedProperty noiseSettings_offsetY = noiseSettings.FindPropertyRelative("offsetY");
                    //EditorGUILayout.PropertyField (noiseSettings_offsetY, new GUIContent("Offset Y"));
                    EditorGUILayout.PropertyField(noiseSettings_offsetY, new GUIContent("Seed"));

                    SerializedProperty noiseSettings_offsetZ = noiseSettings.FindPropertyRelative("offsetZ");
                    //EditorGUILayout.PropertyField (noiseSettings_offsetZ, new GUIContent("Offset Z"));
                    noiseSettings_offsetZ.floatValue = 0f;

                    SerializedProperty noiseSettings_frequency = noiseSettings.FindPropertyRelative("frequency");
                    //noiseSettings_frequency.floatValue = EditorGUILayout.Slider("Frequency",noiseSettings_frequency.floatValue,0.0005f, 0.1f);
                    float scale = Mathf.RoundToInt(1f / noiseSettings_frequency.floatValue);
                    scale = EditorGUILayout.Slider(new GUIContent("Scale"), scale, 1f, 2000f);
                    noiseSettings_frequency.floatValue = 1f / scale;

                    SerializedProperty threshold = noiseSettings.FindPropertyRelative("threshold");
                    EditorGUILayout.PropertyField(threshold, new GUIContent("Threshold"));
                    SerializedProperty falloff = noiseSettings.FindPropertyRelative("falloff");
                    EditorGUILayout.PropertyField(falloff, new GUIContent("Smoothness"));

                    SerializedProperty noiseSettings_octaves = noiseSettings.FindPropertyRelative("octaves");
                    noiseSettings_octaves.intValue = 1;
                    SerializedProperty noiseSettings_lacunarity = noiseSettings.FindPropertyRelative("lacunarity");
                    noiseSettings_lacunarity.floatValue = 1;
                    SerializedProperty noiseSettings_persistence = noiseSettings.FindPropertyRelative("persistence");
                    noiseSettings_persistence.floatValue = 1;
                    //SerializedProperty noiseSettings_adjustmentCurve = noiseSettings.FindPropertyRelative ("adjustmentCurve");
                    //noiseSettings_adjustmentCurve.animationCurveValue = AnimationCurve.Linear (0f, 0f, 1f, 1f);
                }

                EditorGUILayout.Space();
                EditorGUILayout.Space();

                _applyToSplatTexture = new bool[applyToSplatTexture.arraySize];
                for (int splatindex = 0; splatindex < applyToSplatTexture.arraySize; splatindex++)
                {
                    _applyToSplatTexture[splatindex] = applyToSplatTexture.GetArrayElementAtIndex(splatindex).boolValue;
                }
                _useNoiseLayer  = useNoiseLayer.boolValue;
                _noiseFrequency = treesProperties.GetArrayElementAtIndex(inspTreeSelectorIndex.intValue).FindPropertyRelative("noiseSettings").FindPropertyRelative("frequency").floatValue;
                _noiseOffsetX   = treesProperties.GetArrayElementAtIndex(inspTreeSelectorIndex.intValue).FindPropertyRelative("noiseSettings").FindPropertyRelative("offsetX").floatValue;
                _noiseOffsetY   = treesProperties.GetArrayElementAtIndex(inspTreeSelectorIndex.intValue).FindPropertyRelative("noiseSettings").FindPropertyRelative("offsetY").floatValue;
                _noiseOffsetZ   = treesProperties.GetArrayElementAtIndex(inspTreeSelectorIndex.intValue).FindPropertyRelative("noiseSettings").FindPropertyRelative("offsetZ").floatValue;
                _threshold      = treesProperties.GetArrayElementAtIndex(inspTreeSelectorIndex.intValue).FindPropertyRelative("noiseSettings").FindPropertyRelative("threshold").floatValue;
                _falloff        = treesProperties.GetArrayElementAtIndex(inspTreeSelectorIndex.intValue).FindPropertyRelative("noiseSettings").FindPropertyRelative("falloff").floatValue;

                DrawPreviewTexture();
            } // if (treesProperties.arraySize > 0)

            EditorGUILayout.Space();
        } //        EditorGUILayout.BeginVertical ("Box");
        EditorGUILayout.EndVertical();
    }
Esempio n. 28
0
        void DrawGUISettings()
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Label("World height");
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(lowestPoint != null?((int)lowestPoint).ToString("0"):"-");
            GUILayout.FlexibleSpace();
            GUILayout.Label(highestPoint != null?((int)highestPoint).ToString("0"):"-");
            GUILayout.EndHorizontal();

            GUI.enabled = false;
            GUILayout.BeginHorizontal();
            GUILayout.Label("R", GUILayout.Width(20));
            EditorGUILayout.MinMaxSlider(ref redThresholdMin, ref redThresholdMax, minHeight, maxHeight);
            GUILayout.EndHorizontal();

            redThresholdMin = 0;
            redThresholdMax = greenThresholdMin;

            GUI.enabled = true;
            GUILayout.BeginHorizontal();
            GUILayout.Label("G", GUILayout.Width(20));
            EditorGUILayout.MinMaxSlider(ref greenThresholdMin, ref greenThresholdMax, minHeight, maxHeight);
            GUILayout.EndHorizontal();

            GUI.enabled = false;
            GUILayout.BeginHorizontal();
            GUILayout.Label("B", GUILayout.Width(20));
            EditorGUILayout.MinMaxSlider(ref blueThresholdMin, ref blueThresholdMax, minHeight, maxHeight);
            GUILayout.EndHorizontal();
            blueThresholdMin = greenThresholdMax;
            blueThresholdMax = maxHeight;
            GUI.enabled      = true;

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            //float val = (greenThresholdMax-greenThresholdMin);
            if (lowestPoint != null)
            {
                float val = Mathf.Lerp((float)lowestPoint, (float)highestPoint, greenThresholdMin / 100f);
                GUILayout.Label(((int)val).ToString("0"));
                GUILayout.FlexibleSpace();
                val = Mathf.Lerp((float)lowestPoint, (float)highestPoint, greenThresholdMax / 100f);
                GUILayout.Label(((int)val).ToString("0"));
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Generate Splatmap", GUILayout.Width(200), GUILayout.Height(32)))
            {
                GenerateSplatmap();
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
Esempio n. 29
0
    private void DrawTextureSettings(TextureImporterType textureType)
    {
        if (textureType != oldTextureType)
        {
            Reset();
        }
        switch (textureType)
        {
        case TextureImporterType.Image:
            if ((grayscaleToAlpha = EditorGUILayout.Toggle("Alpha from Grayscale", grayscaleToAlpha)))
            {
                alphaIsTransparency = EditorGUILayout.Toggle("Alpha is Transparency", alphaIsTransparency);
            }
            GUILayout.Space(8f);
            wrapMode = (TextureWrapMode)DrawPopup("Wrap Mode", (int)wrapMode, wrapModeString);
            if ((filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString)) != FilterMode.Point)
            {
                anisoLevel = EditorGUILayout.IntSlider("Aniso Level", anisoLevel, 0, 9);
            }
            break;

        case TextureImporterType.Bump:
            if (createFromGrayscale = EditorGUILayout.Toggle("(Invalid) Create from Grayscale", createFromGrayscale))
            {
                bumpiness = EditorGUILayout.Slider("(Invalid) Bumpiness", bumpiness, 0, 0.3f);
                filtering = DrawPopup("(Invalid) Filtering", filtering, filteringString);
            }
            GUILayout.Space(8f);
            wrapMode = (TextureWrapMode)DrawPopup("Wrap Mode", (int)wrapMode, wrapModeString);
            if ((filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString)) != FilterMode.Point)
            {
                anisoLevel = EditorGUILayout.IntSlider("Aniso Level", anisoLevel, 0, 9);
            }
            break;

        case TextureImporterType.GUI:
            GUILayout.Space(8f);
            filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString);
            break;

        case TextureImporterType.Sprite:
            spriteMode    = (SpriteImportMode)DrawPopup("Sprite Mode", (int)spriteMode, spriteModeString, spriteModeArray);
            packingTag    = EditorGUILayout.TextField("    Packing Tag", packingTag);
            pixelsToUnits = EditorGUILayout.FloatField("    Pixels To Units", pixelsToUnits);
            if (spriteMode == SpriteImportMode.Single)
            {
                if ((pivot = DrawPopup("    Pivot", pivot, pivotString, pivotArray)) == -1)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(EditorGUIUtility.labelWidth);
                    GUILayout.Label("X");
                    pivotX = EditorGUILayout.FloatField(pivotX);
                    GUILayout.Label("Y");
                    pivotY = EditorGUILayout.FloatField(pivotY);
                    GUILayout.EndHorizontal();
                }
            }
            GUILayout.Space(8f);
            filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString);
            break;

        case TextureImporterType.Cursor:
            GUILayout.Space(8f);
            wrapMode   = (TextureWrapMode)DrawPopup("Wrap Mode", (int)wrapMode, wrapModeString);
            filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString);
            break;

        case TextureImporterType.Reflection:
            mapping        = DrawPopup("Mapping", mapping, mappingString);
            fixupEdgeSeams = EditorGUILayout.Toggle("Fixup Edge Seams", fixupEdgeSeams);
            GUILayout.Space(8f);
            if ((filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString)) != FilterMode.Point)
            {
                anisoLevel = EditorGUILayout.IntSlider("Aniso Level", anisoLevel, 0, 9);
            }
            break;

        case TextureImporterType.Cookie:
            if ((lightType = (LightType)DrawPopup("(Invalid) Light Type", (int)lightType, lightTypeString)) == LightType.Point)
            {
                mapping        = DrawPopup("(Invalid) Mapping", mapping, mappingString);
                fixupEdgeSeams = EditorGUILayout.Toggle("(Invalid) Fixup Edge Seams", fixupEdgeSeams);
            }
            grayscaleToAlpha = EditorGUILayout.Toggle("Alpha from Grayscale", grayscaleToAlpha);
            GUILayout.Space(8f);
            if ((filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString)) != FilterMode.Point)
            {
                anisoLevel = EditorGUILayout.IntSlider("Aniso Level", anisoLevel, 0, 9);
            }
            break;

        case TextureImporterType.Lightmap:
            GUILayout.Space(8f);
            if ((filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString)) != FilterMode.Point)
            {
                anisoLevel = EditorGUILayout.IntSlider("Aniso Level", anisoLevel, 0, 9);
            }
            break;

        case TextureImporterType.Advanced:
            nonPowerOf2      = (TextureImporterNPOTScale)DrawPopup("Non Power of 2", (int)nonPowerOf2, nonPowerOf2String);
            generateCubemap  = (TextureImporterGenerateCubemap)DrawPopup("Generate Cubemap", (int)generateCubemap, generateCubemapString);
            readWriteEnabled = EditorGUILayout.Toggle("Read/Write Enabled", readWriteEnabled);
            importType       = (TextureImporterType)DrawPopup("Import Type", (int)importType, importTypeString, importTypeArray);
            if (importType == TextureImporterType.Image)
            {
                grayscaleToAlpha    = EditorGUILayout.Toggle("    Alpha from Grayscale", grayscaleToAlpha);
                alphaIsTransparency = EditorGUILayout.Toggle("    Alpha is Transparency", alphaIsTransparency);
                bypassSRGBSampling  = EditorGUILayout.Toggle("    (Invalid) Bypass sRGB Sampling", bypassSRGBSampling);
                spriteMode          = (SpriteImportMode)DrawPopup("    Sprite Mode", (int)spriteMode, spriteModeStringFull);
                if (spriteMode != SpriteImportMode.None)
                {
                    packingTag    = EditorGUILayout.TextField("        Packing Tag", packingTag);
                    pixelsToUnits = EditorGUILayout.FloatField("        Pixels To Units", pixelsToUnits);
                    meshType      = (SpriteMeshType)DrawPopup("        Mesh Type", (int)meshType, meshTypeString);
                    extrudeEdges  = (uint)EditorGUILayout.IntSlider("        Extrude Edges", (int)extrudeEdges, 0, 32);
                    if (spriteMode == SpriteImportMode.Single)
                    {
                        if ((pivot = DrawPopup("        Pivot", pivot, pivotString, pivotArray)) == -1)
                        {
                            GUILayout.BeginHorizontal();
                            GUILayout.Space(EditorGUIUtility.labelWidth);
                            GUILayout.Label("X");
                            pivotX = EditorGUILayout.FloatField(pivotX);
                            GUILayout.Label("Y");
                            pivotY = EditorGUILayout.FloatField(pivotY);
                            GUILayout.EndHorizontal();
                        }
                    }
                }
            }
            else if (importType == TextureImporterType.Bump)
            {
                if (createFromGrayscale = EditorGUILayout.Toggle("    (Invalid) Create from Grayscale", createFromGrayscale))
                {
                    bumpiness = EditorGUILayout.Slider("    (Invalid) Bumpiness", bumpiness, 0, 0.3f);
                    filtering = DrawPopup("    Filtering", filtering, filteringString);
                }
            }
            GUILayout.Space(8f);
            if (generateMipMaps = EditorGUILayout.Toggle("Generate Mip Maps", generateMipMaps))
            {
                inLinearSpace   = EditorGUILayout.Toggle("    In Linear Space", inLinearSpace);
                borderMipMaps   = EditorGUILayout.Toggle("    Border Mip Maps", borderMipMaps);
                mipMapFiltering = (TextureImporterMipFilter)DrawPopup("    Mip Map Filtering", (int)mipMapFiltering, mipMapFilteringString);
                if (fadeoutMipMaps = EditorGUILayout.Toggle("    Fadeout Mip Maps", fadeoutMipMaps))
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("        Fade Range");
                    GUILayout.Space(43f);
                    EditorGUILayout.MinMaxSlider(ref fadeoutMin, ref fadeoutMax, 0, 10);
                    fadeoutMin = Mathf.RoundToInt(fadeoutMin);
                    fadeoutMax = Mathf.RoundToInt(fadeoutMax);
                    GUILayout.EndHorizontal();
                }
            }
            GUILayout.Space(8f);
            wrapMode = (TextureWrapMode)DrawPopup("Wrap Mode", (int)wrapMode, wrapModeString);
            if ((filterMode = (FilterMode)DrawPopup("Filter Mode", (int)filterMode, filterModeString)) != FilterMode.Point)
            {
                anisoLevel = EditorGUILayout.IntSlider("Aniso Level", anisoLevel, 0, 9);
            }
            break;

        default:
            break;
        }
        GUILayout.Space(8f);
    }
Esempio n. 30
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        HPV_Manager manager = SingletonService <HPV_Manager> .GetSingleton();

        if (!manager)
        {
            return;
        }

        byte m_node_id = ((HPV_Node)target).getID();

        GUILayoutOption[] options = { GUILayout.Width(250), GUILayout.Height(100) };

        // global vertical
        EditorGUILayout.BeginVertical(options);

        EditorGUILayout.Separator();
        // play controls horizontal
        EditorGUILayout.LabelField("Play Controls");
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button(playState_str, GUILayout.MinWidth(75), GUILayout.ExpandWidth(true), GUILayout.MinHeight(40), GUILayout.ExpandHeight(true)))
        {
            playState = !playState;
            if (playState)
            {
                playState_str = "Stop";
                loop_in       = 0;
                loop_out      = manager.getNumberOfFrames(m_node_id);
                rangeMin      = 0.0f;
                rangeMax      = 1.0f;
                speed         = 1.0f;
                prev_speed    = 1.0f;
                seek          = 0.0f;
                prev_seek     = 0.0f;
                manager.startVideo(m_node_id);
            }
            else
            {
                playState_str = "Play";
                manager.stopVideo(m_node_id);
            }
        }
        if (playState)
        {
            if (GUILayout.Button(pauzeState_str, GUILayout.MinWidth(75), GUILayout.ExpandWidth(true), GUILayout.MinHeight(40), GUILayout.ExpandHeight(true)))
            {
                pauzeState = !pauzeState;
                if (pauzeState)
                {
                    pauzeState_str = "Resume";
                    manager.pauseVideo(m_node_id);
                }
                else
                {
                    pauzeState_str = "Pauze";
                    manager.resumeVideo(m_node_id);
                }
            }
        }

        // end play controls horizontal
        EditorGUILayout.EndHorizontal();

        // start pauze controls horizontal
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("<< BWD", GUILayout.MinWidth(75), GUILayout.ExpandWidth(true), GUILayout.MinHeight(40), GUILayout.ExpandHeight(true)))
        {
            manager.setDirection(m_node_id, false);
        }
        if (GUILayout.Button("FWD >>", GUILayout.MinWidth(75), GUILayout.ExpandWidth(true), GUILayout.MinHeight(40), GUILayout.ExpandHeight(true)))
        {
            manager.setDirection(m_node_id, true);
        }

        // end pauze controls horizontal
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Speed");
        speed = EditorGUILayout.Slider(speed, -10, 10);
        if (!isNearlyEqual(speed, prev_speed))
        {
            prev_speed = speed;
            manager.setSpeed(m_node_id, speed);
        }

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Loop");
        loop_index = EditorGUILayout.Popup(loop_index, loop_options);
        if (loop_index != prev_loop_index)
        {
            manager.setLoopState(m_node_id, loop_index);
            prev_loop_index = loop_index;
        }

        EditorGUILayout.IntField(loop_in);
        EditorGUILayout.IntField(loop_out);

        EditorGUILayout.MinMaxSlider(ref rangeMin, ref rangeMax, 0.0f, 1.0f);
        if (GUILayout.Button("Update loop points"))
        {
            loop_in  = (int)(rangeMin * (manager.getNumberOfFrames(m_node_id) - 1));
            loop_out = (int)(rangeMax * (manager.getNumberOfFrames(m_node_id) - 1));

            manager.setLoopIn(m_node_id, loop_in);
            manager.setLoopOut(m_node_id, loop_out);
        }

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Seek");
        seek = EditorGUILayout.Slider(seek, 0.0f, 1.0f);
        if (!isNearlyEqual(seek, prev_seek))
        {
            manager.seekToPos(m_node_id, seek);
            prev_seek = seek;
        }

        bShowStats = EditorGUILayout.Foldout(bShowStats, "Decode stats");
        if (bShowStats)
        {
            if (bShowStats != prevShowStats)
            {
                manager.enableStats(m_node_id, bShowStats);
                prevShowStats = bShowStats;
            }

            IntPtr ptr = manager.getDecodeStatsPtr(m_node_id);
            HPV_Unity_Bridge.HPVDecodeStats decode_stats = (HPV_Unity_Bridge.HPVDecodeStats)Marshal.PtrToStructure(ptr, typeof(HPV_Unity_Bridge.HPVDecodeStats));

            string stats = "HDD: " + (decode_stats.hdd_read_time / (float)1e6).ToString("F") + "ms";
            stats += "\nL4Z: " + (decode_stats.l4z_decompress_time / (float)1e6).ToString("F") + "ms";
            stats += "\nGPU: " + (decode_stats.gpu_upload_time / (float)1e6).ToString("F") + "ms";
            EditorGUILayout.HelpBox(stats, MessageType.Info);
            Repaint();
        }
        else if (!bShowStats && prevShowStats)
        {
            manager.enableStats(m_node_id, bShowStats);
            prevShowStats = bShowStats;
        }

        // end global vertical
        EditorGUILayout.EndVertical();
    }