コード例 #1
0
        public override void OnNodeGUI()
        {
            bool updatePreview = false;

            GUILayout.Space(EditorGUIUtility.singleLineHeight * 1.2f);
            EditorGUI.BeginChangeCheck();
            Rect pos = EditorGUILayout.GetControlRect(false, 100);

            curve = EditorGUI.CurveField(pos, curve);
            if (EditorGUI.EndChangeCheck())
            {
                updatePreview     = true;
                notifyDataChanged = true;
                UpdateTerrain();
                sCurve.SetAnimationCurve(curve);
            }

            if (inputTerrain != null)
            {
                if (inputTerrain.type == SamplerType.Sampler2D)
                {
                    PWGUI.Sampler2DPreview(outputTerrain as Sampler2D, needUpdate || updatePreview);
                }
                else
                {
                }
            }
        }
コード例 #2
0
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, prop);
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

            if (!curves.ContainsKey(prop.propertyPath))
            {
                var c = prop.GetObject <Curve>();
                curves.Add(prop.propertyPath, new CurveValue()
                {
                    native = c, managed = c.GetCurve()
                });
            }
            var curve = curves[prop.propertyPath];

            EditorGUI.BeginChangeCheck();
            {
                curve.managed = EditorGUI.CurveField(position, curve.managed);
                //EditorGUI.PropertyField(position, prop, GUIContent.none, true);
            }
            if (EditorGUI.EndChangeCheck())
            {
                //Debug.Log(prop.GetObject<Curve>());
                curve.native.SetCurve(curve.managed);
                prop.SetObject(curve.native);
                curves[prop.propertyPath] = curve;
            }

            EditorGUI.EndProperty();
        }
コード例 #3
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);
            EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
            SerializedProperty tweenPosition    = property.FindPropertyRelative("tweenPosition");
            SerializedProperty tweenRotation    = property.FindPropertyRelative("tweenRotation");
            SerializedProperty tweenScale       = property.FindPropertyRelative("tweenScale");
            SerializedProperty curve            = property.FindPropertyRelative("curve");
            SerializedProperty startEulerAngles = property.FindPropertyRelative("startEulerAngles");
            SerializedProperty endEulerAngles   = property.FindPropertyRelative("endEulerAngles");

            EditorGUI.indentLevel++;
            Rect rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);

            rect.y += rect.height;
            EditorGUI.PropertyField(rect, tweenPosition);
            rect.y += rect.height;
            EditorGUI.PropertyField(rect, tweenRotation);
            rect.y += rect.height;
            EditorGUI.PropertyField(rect, tweenScale);
            rect.y += rect.height;
            EditorGUI.PropertyField(rect, startEulerAngles);
            rect.y += rect.height;
            EditorGUI.PropertyField(rect, endEulerAngles);
            rect.y += rect.height;
            EditorGUI.CurveField(rect, curve, Color.green, new Rect(0, 0, 1, 1));
            EditorGUI.EndProperty();
            EditorGUI.indentLevel--;
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (property.propertyType != SerializedPropertyType.AnimationCurve)
            {
                SPEditorGUI.DefaultPropertyField(position, property, label);
                return;
            }


            if (this.attribute is AnimationCurveConstraintAttribute)
            {
                var attrib = this.attribute as AnimationCurveConstraintAttribute;
                var ranges = new Rect(attrib.x, attrib.y, attrib.width, attrib.height);
                property.animationCurveValue = EditorGUI.CurveField(position, label, property.animationCurveValue, attrib.color, ranges);
            }
            else if (this.attribute is AnimationCurveEaseScaleAttribute)
            {
                var attrib = this.attribute as AnimationCurveEaseScaleAttribute;
                var ranges = new Rect(0f, -Mathf.Max(0f, attrib.overscan), 1f, Mathf.Max(1f, 1f + attrib.overscan * 2f));
                property.animationCurveValue = EditorGUI.CurveField(position, label, property.animationCurveValue, attrib.color, ranges);
            }
            else
            {
                SPEditorGUI.DefaultPropertyField(position, property, label);
            }
        }
コード例 #5
0
        public static AnimationCurve CurveField(Rect position, GUIContent label, AnimationCurve value)
        {
            AnimationCurve animationCurve = EditorGUI.CurveField(SubtractPopupWidth(position), label, value);

            AnimationCurvePopupMenu.Show(GetPopupRect(position), animationCurve, null);
            return(animationCurve);
        }
コード例 #6
0
ファイル: EaseDrawer.cs プロジェクト: mmeiburg/juicy
        private void DrawCurve(Rect position, Rect foldoutRect, SerializedProperty property)
        {
            Rect curveRect = new Rect(position)
            {
                x      = position.x + foldoutRect.width,
                y      = foldoutRect.y + StandardSpacing,
                width  = position.width - foldoutRect.width - JuicyStyles.PaneOptionsIcon.width,
                height = property.isExpanded ? ExpandedCurveHeight : SingleLineHeight
            };

            curve.animationCurveValue = EditorGUI.CurveField(curveRect, curve.animationCurveValue);

            Rect menuRect = new Rect(position)
            {
                x      = curveRect.x + curveRect.width,
                y      = curveRect.y,
                width  = JuicyStyles.PaneOptionsIcon.width,
                height = JuicyStyles.PaneOptionsIcon.height,
            };

            if (EditorGUI.DropdownButton(menuRect, new GUIContent(JuicyStyles.PaneOptionsIcon),
                                         FocusType.Passive, JuicyStyles.IconButtonStyle))
            {
                CreateContextMenu();
            }
        }
コード例 #7
0
        /// <summary>
        /// Called for rendering and handling the GUI events for WeightedPrefab
        /// </summary>
        /// <param name="position">The position in the Inspector</param>
        /// <param name="property">The property we're displaying</param>
        /// <param name="label">The GUI label for the property</param>
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            // Location and label of the gui in the editor
            label    = EditorGUI.BeginProperty(position, label, property);
            position = EditorGUI.PrefixLabel(position, label);

            // The properties of WeightedPrefab
            SerializedProperty itemProp   = property.FindPropertyRelative("item");
            SerializedProperty weightProp = property.FindPropertyRelative("weight");

            // Set the percentage of the width the prefab input will take
            const float prefabFieldPercent = 0.6f;
            // The buffer between the two input boxes
            const float bufferValue = 3;

            // Set the size of the input box for the prefab
            var itemPropInput = new Rect(position)
            {
                width = prefabFieldPercent * position.width
            };

            // Set the size of the input box for the weight
            position.xMin += prefabFieldPercent * position.width;
            var weightInputRect = new Rect(position);

            weightInputRect.xMin += bufferValue;

            // Add the fields to the gui
            EditorGUI.PropertyField(itemPropInput, itemProp, GUIContent.none);
            weightProp.animationCurveValue = EditorGUI.CurveField(weightInputRect, weightProp.animationCurveValue);

            EditorGUI.EndProperty();
        }
コード例 #8
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        var curveFieldPos = position;

        curveFieldPos.width -= 18;

        label = EditorGUI.BeginProperty(position, label, property);
        EditorGUI.CurveField(curveFieldPos, property, Color.green, Rect.zero);

        var menuPos = position;

        menuPos.xMin = menuPos.xMax - 13;

        if (GUI.Button(menuPos, GUIContent.none, "ShurikenDropdown"))
        {
            var content1 = new GUIContent("Copy");
            var content2 = new GUIContent("Paste");

            var genericMenu = new GenericMenu();
            genericMenu.AddItem(content1, false, OnCopy, property);
            genericMenu.AddItem(content2, false, OnPaste, property);

            if (m_copiedCurve == null)
            {
                genericMenu.AddDisabledItem(content2);
            }
            genericMenu.DropDown(menuPos);
        }

        EditorGUI.EndProperty();
    }
コード例 #9
0
        protected virtual void DrawSegmentListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            SerializedProperty segment = segments.serializedProperty.GetArrayElementAtIndex(index);

            OnSegmentProperty(rect, segment);

            float originalLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 75f;
            SerializedProperty duration = segment.FindPropertyRelative("m_Duration");
            SerializedProperty curve    = segment.FindPropertyRelative("m_Curve");

            rect.y     += rect.height - singleLineHeight - verticalSpace;
            rect.height = singleLineHeight;
            float margin = 5f;
            float width  = (rect.width - margin) / 2;

            rect.width = width;
            EditorGUI.PropertyField(rect, duration);
            rect.x += width + margin;
            Color curveColor = animation.segmentIndex == index ? Color.red : Color.green;
            Rect  curveRect  = new Rect(0, 0, 1, 1);

            curve.animationCurveValue   = EditorGUI.CurveField(rect, curve.animationCurveValue, curveColor, curveRect);
            EditorGUIUtility.labelWidth = originalLabelWidth;
        }
コード例 #10
0
    private void SetTweenAnimationData()
    {
        Group(new Rect(100, 200, 400, 200), () =>
        {
            DrawBox(new Rect(0, 0, 400, 200), "", 0, FontStyle.Normal, TextAnchor.MiddleCenter);
            DrawLabel(new Rect(5, 0, 390, 30), "编辑曲线动画数据", 20, FontStyle.Bold, TextAnchor.MiddleCenter);

            Group(new Rect(5, 30, 400, 170), () =>
            {
                DrawLabel(new Rect(10, 10, 290, 30), tweenAnimationInfo.tweenTypeData.ToString(), 20, FontStyle.Bold, TextAnchor.MiddleLeft);
                DrawLabel(new Rect(10, 55, 80, 30), "曲线:", 20, FontStyle.Bold, TextAnchor.MiddleLeft);
                tweenAnimationInfo.animationCurve = EditorGUI.CurveField(new Rect(100, 55, 290, 30), tweenAnimationInfo.animationCurve);
            });

            if (DrawButton(new Rect(300, 160, 80, 30), "保存", 16, FontStyle.Bold, TextAnchor.LowerLeft))
            {
                isSetData = false;
            }
            if (DrawButton(new Rect(200, 160, 80, 30), "删除", 16, FontStyle.Bold, TextAnchor.LowerLeft))
            {
                isSetData = false;
                tweenAnimationInfos.Remove(tweenAnimationInfo);
            }
        });
    }
コード例 #11
0
        protected virtual void OnGUICurve(ref Rect contentRect, Interpolator dummyInstance, AnimationCurveUtility.TangentMode mode = AnimationCurveUtility.TangentMode.Smooth)
        {
            if (null == dummyInstance)
            {
                return;
            }

            var count     = 100;
            var keyFrames = new Keyframe[count];

            for (int n = 0; n < count; ++n)
            {
                var t = n / (float)(count - 1);
                var k = new Keyframe(t, dummyInstance.Interpolate(t));
                keyFrames[n] = k;
            }

            var curve = new AnimationCurve(keyFrames);

            AnimationCurveUtility.SetLinear(ref curve, mode);

            contentRect.height = InterpolatorPropertyDrawer.heightCurve;
            EditorGUI.CurveField(contentRect, curve);
            contentRect.y += InterpolatorPropertyDrawer.heightCurve;
        }
コード例 #12
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            CurveAttribute curve = attribute as CurveAttribute;

            if (property.propertyType == SerializedPropertyType.AnimationCurve)
            {
                float currentXMin = GetVariableValue(position, property, curve.XMinVariable, curve.XMinValue, out bool canDrawXMin);
                if (!canDrawXMin)
                {
                    return;
                }
                float currentXMax = GetVariableValue(position, property, curve.XMaxVariable, curve.XMaxValue, out bool canDrawXMax);
                if (!canDrawXMax)
                {
                    return;
                }
                float currentYMin = GetVariableValue(position, property, curve.YMinVariable, curve.YMinValue, out bool canDrawYMin);
                if (!canDrawYMin)
                {
                    return;
                }
                float currentYMax = GetVariableValue(position, property, curve.YMaxVariable, curve.YMaxValue, out bool canDrawYMax);
                if (!canDrawYMax)
                {
                    return;
                }
                float xMax = currentXMax - currentXMin;
                float yMax = currentYMax - currentYMin;
                EditorGUI.CurveField(position, property, Color.cyan, new Rect(currentXMin, currentYMin, xMax, yMax));
            }
        }
コード例 #13
0
 public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
 {
     prop.animationCurveValue = EditorGUI.CurveField(
         new Rect(pos.x, pos.y, pos.width - _buttonWidth * 2, pos.height),
         label,
         prop.animationCurveValue
     );
     // Copy
     if ( GUI.Button(new Rect(pos.x + pos.width - _buttonWidth * 2, pos.y, _buttonWidth, pos.height),""))
     {
         _buffer = prop.animationCurveValue.keys;
         _preWrapMode = prop.animationCurveValue.preWrapMode;
         _postWrapMode = prop.animationCurveValue.postWrapMode;
     }
     GUI.Label(new Rect(pos.x + pos.width - _buttonWidth * 2, pos.y, _buttonWidth, pos.height),"C");
     // Paste
     if (_buffer == null) return;
     if (GUI.Button(new Rect(pos.x + pos.width - _buttonWidth, pos.y, _buttonWidth, pos.height),""))
     {
         AnimationCurve newAnimationCurve = new AnimationCurve(_buffer);
         newAnimationCurve.preWrapMode = _preWrapMode;
         newAnimationCurve.postWrapMode = _postWrapMode;
         prop.animationCurveValue = newAnimationCurve;
     }
     GUI.Label(new Rect(pos.x + pos.width - _buttonWidth, pos.y, _buttonWidth, pos.height),"P");
 } // OnGUI()
コード例 #14
0
        protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(rect, label, property);

            // Check user error
            if (property.propertyType != SerializedPropertyType.AnimationCurve)
            {
                string message = string.Format("Field {0} is not an AnimationCurve", property.name);
                DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning);
                return;
            }

            if (_cachedCurveRangeAttribute == null)
            {
                _cachedCurveRangeAttribute = PropertyUtility.GetAttribute <CurveRangeAttribute>(property);
            }

            var attribute = _cachedCurveRangeAttribute;

            EditorGUI.CurveField(
                rect,
                property,
                attribute.Color == EColor.Clear ? Color.green : attribute.Color.GetColor(),
                new Rect(attribute.Min.x, attribute.Min.y, attribute.Max.x - attribute.Min.x, attribute.Max.y - attribute.Min.y),
                label);

            EditorGUI.EndProperty();
        }
コード例 #15
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            csky_AnimationCurveRange attr = attribute as csky_AnimationCurveRange;

            Color col = Color.black;

            switch (attr.colorIndex)
            {
            case 0: col = Color.white;   break;

            case 1: col = Color.cyan;    break;

            case 2: col = Color.gray;    break;

            case 3: col = Color.green;   break;

            case 4: col = Color.magenta; break;

            case 5: col = Color.red;     break;

            case 6: col = Color.blue;    break;

            case 7: col = Color.yellow;  break;
            }

            if (property.propertyType == SerializedPropertyType.AnimationCurve)
            {
                EditorGUI.CurveField(position, property, col, new Rect(attr.timeStart, attr.valueStart, attr.timeEnd, attr.valueEnd));
            }
            else
            {
                EditorGUI.HelpBox(position, "Only work with AnimationCurve", MessageType.Warning);
            }
        }
コード例 #16
0
        void DisplayFunnelGui()
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(m_FunnelContent, EditorStyles.boldLabel, GUILayout.Width(EditorGUIUtility.labelWidth - 4));

                using (new EditorGUILayout.VerticalScope())
                {
                    AnimationCurve m_Curve = CreateFunnel();
                    EditorGUI.CurveField(EditorGUILayout.GetControlRect(), m_Curve);
                    var _player = HeatmapViewModel.videoPlayer;
                    if (_player != null && _player.isPrepared)
                    {
                        EditorGUI.BeginDisabledGroup(true);
                        float _StandardTime = _player.frame / (float)_player.frameCount;
                        EditorGUILayout.LabelField(string.Format("Total number of players present: {0}", GetPresentPlayer(m_Curve, _StandardTime)), EditorStyles.label);
                        EditorGUI.EndDisabledGroup();
                    }
                }
            }
            if (HeatmapViewModel.GetHeatpointToSessionMapping() == null || HeatmapViewModel.GetHeatpointToSessionMapping().Count() == 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("There is no data currently to display.", MessageType.Warning);
            }
        }
コード例 #17
0
        public override bool DrawEditor(Rect rect, bool isOnSceneObject, plyVar target, plyVar objRefProxy, int objRefProxyIdx)
        {
            plyVar_AnimationCurve plyVar_AnimationCurve = (plyVar_AnimationCurve)target.ValueHandler;

            plyVar_AnimationCurve.storedValue = EditorGUI.CurveField(rect, plyVar_AnimationCurve.storedValue);
            return(false);
        }
コード例 #18
0
        private static void Initialize()
        {
            valueFieldActions = new Dictionary <Type, Func <Rect, GUIContent, object, object> >();

            valueFieldActions.Add(typeof(bool), (rect, label, obj) => EditorGUI.Toggle(rect, label, (bool)obj));
            valueFieldActions.Add(typeof(int), (rect, label, obj) => EditorGUI.IntField(rect, label, (int)obj));
            valueFieldActions.Add(typeof(long), (rect, label, obj) => EditorGUI.LongField(rect, label, (long)obj));
            valueFieldActions.Add(typeof(uint), (rect, label, obj) =>
            {
                var value = EditorGUI.LongField(rect, label, (uint)obj);
                if (value < 0)
                {
                    value = 0;
                }
                if (value > uint.MaxValue)
                {
                    value = uint.MaxValue;
                }
                return((uint)value);
            });
            valueFieldActions.Add(typeof(float), (rect, label, obj) => EditorGUI.FloatField(rect, label, (float)obj));
            valueFieldActions.Add(typeof(double), (rect, label, obj) => EditorGUI.DoubleField(rect, label, (double)obj));
            valueFieldActions.Add(typeof(string), (rect, label, obj) => EditorGUI.TextField(rect, label, (string)obj));
            valueFieldActions.Add(typeof(Vector2), (rect, label, obj) => EditorGUI.Vector2Field(rect, label, (Vector2)obj));
            valueFieldActions.Add(typeof(Vector3), (rect, label, obj) => EditorGUI.Vector3Field(rect, label, (Vector3)obj));
            valueFieldActions.Add(typeof(Vector4), (rect, label, obj) => EditorGUI.Vector4Field(rect, label, (Vector4)obj));
            valueFieldActions.Add(typeof(Vector2Int), (rect, label, obj) => EditorGUI.Vector2IntField(rect, label, (Vector2Int)obj));
            valueFieldActions.Add(typeof(Vector3Int), (rect, label, obj) => EditorGUI.Vector3IntField(rect, label, (Vector3Int)obj));
            valueFieldActions.Add(typeof(Color), (rect, label, obj) => EditorGUI.ColorField(rect, label, (Color)obj));
            valueFieldActions.Add(typeof(AnimationCurve), (rect, label, obj) => EditorGUI.CurveField(rect, label, (AnimationCurve)obj));
            valueFieldActions.Add(typeof(Bounds), (rect, label, obj) => EditorGUI.BoundsField(rect, label, (Bounds)obj));
            valueFieldActions.Add(typeof(Gradient), (rect, label, obj) => EditorGUI.GradientField(rect, label, (Gradient)obj));
            valueFieldActions.Add(typeof(Rect), (rect, label, obj) => EditorGUI.RectField(rect, label, (Rect)obj));
            // Add more when needed
        }
コード例 #19
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        var attr  = attribute as LimitedAnimationCurveAttribute;
        var limit = attr.Limit;

        EditorGUI.CurveField(position, property.animationCurveValue, Color.white, limit);
    }
            private MaterialPerInstanceProperties.IProperty DrawFloatProperty(MaterialPerInstanceProperties.IProperty property, int index, Rect nameRect, Rect sourceRect, Rect valueRect)
            {
                MaterialPerInstanceProperties.FloatProperty floatProperty = (MaterialPerInstanceProperties.FloatProperty)property;

                if (DrawPropertyIdDropdrop(nameRect, ref property))
                {
                    return(property);
                }

                floatProperty._source = (MaterialPerInstanceProperties.FloatProperty.ePropertySource)EditorGUI.EnumPopup(sourceRect, floatProperty._source);

                switch (floatProperty._source)
                {
                case MaterialPerInstanceProperties.FloatProperty.ePropertySource.Constant:
                    floatProperty._value = EditorGUI.FloatField(valueRect, floatProperty._value);
                    break;

                case MaterialPerInstanceProperties.FloatProperty.ePropertySource.RandomRange:
                    floatProperty._valueRange = FloatRangeDrawer.FloatRangeField(valueRect, floatProperty._valueRange);
                    break;

                case MaterialPerInstanceProperties.FloatProperty.ePropertySource.RandomCurve:
                    floatProperty._valueCurve = EditorGUI.CurveField(valueRect, floatProperty._valueCurve);
                    break;
                }

                return(floatProperty);
            }
コード例 #21
0
    //Draw the property inside the given rect
    public override void OnGUI(Rect inRect, SerializedProperty inProperty, GUIContent inLabel)
    {
        var evt = Event.current;

        if (evt.type == EventType.MouseDown && evt.button == 0)
        {
            var mousePos = evt.mousePosition;

            if (inRect.Contains(mousePos))
            {
                inProperty.serializedObject.Update();

                CurveWindow curveEditor = CurveWindow.Init();
                curveEditor.CurveSerialProp = inProperty;
            }
        }
        else
        {
            inLabel = EditorGUI.BeginProperty(inRect, inLabel, inProperty);

            EditorGUI.BeginChangeCheck();
            AnimationCurve newCurve = EditorGUI.CurveField(inRect, inLabel, inProperty.animationCurveValue);

            if (EditorGUI.EndChangeCheck())
            {
                inProperty.animationCurveValue = newCurve;
            }

            EditorGUI.EndProperty();
        }
    }
コード例 #22
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            using (new EditorGUI.PropertyScope(position, label, property)) {
                Initialize(property);

                Rect curveRect = new Rect(position)
                {
                    width  = position.width - JuicyStyles.PaneOptionsIcon.width,
                    height = SingleLineHeight
                };

                curve.animationCurveValue = EditorGUI.CurveField(
                    curveRect, label, curve.animationCurveValue);

                Rect menuRect = new Rect(position)
                {
                    x      = position.x + curveRect.width,
                    y      = position.y + 2,
                    width  = JuicyStyles.PaneOptionsIcon.width,
                    height = JuicyStyles.PaneOptionsIcon.height,
                };

                if (EditorGUI.DropdownButton(menuRect, new GUIContent(JuicyStyles.PaneOptionsIcon),
                                             FocusType.Passive, JuicyStyles.IconButtonStyle))
                {
                    CreateContextMenu();
                }
            }
        }
コード例 #23
0
        private void ConsiderationsListDrawCallback(Rect rect, int index, bool isactive, bool isfocused)
        {
            var consideration = _considerationsDisplay.serializedProperty.GetArrayElementAtIndex(index);
            var quarterW      = EditorGUIUtility.currentViewWidth / 4;

            EditorGUI.BeginChangeCheck();

            EditorGUI.PropertyField(rect, consideration);

            var r = EditorGUI.PrefixLabel(
                new Rect(rect.x + 10, rect.y + 2 * VerticalSpacing, rect.width - quarterW, 2 * EditorGUIUtility.singleLineHeight),
                new GUIContent("Utility Curve"));

            SelectedAction.considerations[index].utilityCurve = EditorGUI.CurveField(
                r,
                SelectedAction.considerations[index].utilityCurve);
            EditorUtility.SetDirty(target);

            SelectedAction.considerations[index].evaluatedContextVariable = (AiContextVariable)EditorGUI.EnumPopup(
                new Rect(rect.x + 10, rect.y + 3.2f * VerticalSpacing, rect.width - quarterW,
                         EditorGUIUtility.singleLineHeight), new GUIContent("Target Variable"),
                SelectedAction.considerations[index].evaluatedContextVariable);
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(target);
            }
        }
コード例 #24
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var curveDisplay = (CurveDisplayAttribute)attribute;

            switch (curveDisplay.Display)
            {
            case CurveDisplayAttribute.CurveDisplay.RectAndColor:
                EditorGUI.CurveField(
                    position,
                    property,
                    curveDisplay.Color,
                    curveDisplay.Rect,
                    label
                    );
                break;

            case CurveDisplayAttribute.CurveDisplay.ColorOnly:
                property.animationCurveValue = EditorGUI.CurveField(
                    position,
                    label,
                    property.animationCurveValue,
                    curveDisplay.Color,
                    new Rect()
                    );
                break;

            default:
                throw new NotImplementedException($"{curveDisplay.Display} is improperly initialised.");
            }
        }
コード例 #25
0
 public static void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     label = EditorGUI.BeginProperty(position, label, property);
     EditorGUI.CurveField(EditorGUI.PrefixLabel(SubtractPopupWidth(position), label), property, Color.green, default(Rect));
     AnimationCurvePopupMenu.Show(GetPopupRect(position), null, property);
     EditorGUI.EndProperty();
 }
コード例 #26
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);

        Rect propertyRect = position;

        propertyRect.height = fieldHeight;

        SerializedProperty rangeProperty = property.serializedObject.FindProperty(property.name + "Range");

        if (rangeProperty == null)
        {
            property.animationCurveValue = EditorGUI.CurveField(propertyRect, label, property.animationCurveValue);

            height = 1;
        }
        else
        {
            property.animationCurveValue = EditorGUI.CurveField(propertyRect, label, property.animationCurveValue, Color.green, rangeProperty.rectValue);

            propertyRect.y += 22;

            EditorGUI.indentLevel = 1;

            rangeProperty.rectValue = EditorGUI.RectField(propertyRect, rangeProperty.displayName, rangeProperty.rectValue);

            height = 3;
        }

        EditorGUI.EndProperty();
    }
コード例 #27
0
ファイル: FilmicCurve.cs プロジェクト: valgoun/LD35_V2
    public void OnGUI(DeluxeTonemapper.Mode mode)
    {
        SetupCurve();

        float denom = m_WhitePoint - m_BlackPoint;

        float co = (m_CrossOverPoint - m_BlackPoint) / denom;

        if (Mathf.Abs(denom) < 0.001f)
        {
            co = 0.5f;
        }


        Rect r  = EditorGUILayout.BeginVertical(GUILayout.MinHeight(60));
        Rect rr = GUILayoutUtility.GetRect(Mathf.Min(r.width, 60), 60);

        EditorGUI.CurveField(rr, m_Curve);
        EditorGUILayout.EndVertical();

        m_BlackPoint       = DoSlider("Minimum Intensity (Black point)", m_BlackPoint, 0.0f, 1.0f);
        m_WhitePoint       = DoSlider("Maximum Intensity (White point)", m_WhitePoint, 0.0f, 6.0f);
        co                 = DoSlider("Mid-value (Crossover)", co, 0.0f, 1.0f);
        m_ToeStrength      = -1.0f * DoSlider("Dark Intensity (Toe)", -1.0f * m_ToeStrength, -0.99f, 0.99f);
        m_ShoulderStrength = DoSlider("Bright Intensity (Shoulder)", m_ShoulderStrength, -0.99f, 0.99f);
        if (mode == DeluxeTonemapper.Mode.ExtendedLuminance)
        {
            m_LuminositySaturationPoint = DoSlider("Luminance Saturation", m_LuminositySaturationPoint, 0, 5.0f);
        }


        m_CrossOverPoint = co * (m_WhitePoint - m_BlackPoint) + m_BlackPoint;
        UpdateCoefficients();
    }
コード例 #28
0
    // Draw the property inside the given rect
    public override void OnGUI(Rect inRect, SerializedProperty inProperty, GUIContent inLabel)
    {
        var evt = Event.current;

        if (evt.type == EventType.ContextClick)
        {
            var mousePos = evt.mousePosition;
            if (inRect.Contains(mousePos))
            {
                _PopupTargetAnimationCurveProperty = inProperty.Copy();
                inProperty.serializedObject.Update();
                EditorUtility.DisplayPopupMenu(new Rect(mousePos.x, mousePos.y, 0, 0), "CONTEXT/AnimationCurve/", null);
            }
        }
        else
        {
            inLabel = EditorGUI.BeginProperty(inRect, inLabel, inProperty);
            EditorGUI.BeginChangeCheck();
            AnimationCurve newCurve = EditorGUI.CurveField(inRect, inLabel, inProperty.animationCurveValue);

            if (EditorGUI.EndChangeCheck())
            {
                inProperty.animationCurveValue = newCurve;
            }

            EditorGUI.EndProperty();
        }
    }
コード例 #29
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        int  lines     = EditorPrefs.GetBool("Curve Data", true) ? 2 : 1;
        Rect curveRect = new Rect(position);

        curveRect.height             = EditorGUIUtility.singleLineHeight * lines;
        property.animationCurveValue = EditorGUI.CurveField(curveRect, label, property.animationCurveValue);
        Rect headerRect = new Rect(curveRect);

        headerRect.y     += EditorGUIUtility.singleLineHeight * lines;
        headerRect.height = EditorGUIUtility.singleLineHeight;
        if (DrawHeader(headerRect, "Curve Data"))
        {
            GUI.changed = false;

            Rect dataRect = new Rect(headerRect);
            dataRect.y     += EditorGUIUtility.singleLineHeight;
            dataRect.height = position.height - EditorGUIUtility.singleLineHeight * 4;
            AnimationCurve curve = DrawCurveData(dataRect, property.animationCurveValue);

            if (GUI.changed)
            {
                property.animationCurveValue = curve;
            }
        }
    }
コード例 #30
0
    public void OnGUI()
    {
        SetupCurve();

        float denom = m_WhitePoint - m_BlackPoint;

        float co = (m_CrossOverPoint - m_BlackPoint) / denom;

        if (Mathf.Abs(denom) < 0.001f)
        {
            co = 0.5f;
        }

        m_BlackPoint       = DoSlider("  Minimum Intensity", m_BlackPoint, 0.0f, 10.0f);
        m_WhitePoint       = DoSlider("  Maximum Intensity", m_WhitePoint, 0.0f, 10.0f);
        co                 = DoSlider("  Mid-value range", co, 0.0f, 1.0f);
        m_ToeStrength      = -1.0f * DoSlider("  Dark Colors Intensity", -1.0f * m_ToeStrength, -0.99f, 0.99f);
        m_ShoulderStrength = DoSlider("  Bright Colors Intensity", m_ShoulderStrength, -0.99f, 0.99f);

        Rect r  = EditorGUILayout.BeginVertical(GUILayout.MinHeight(60));
        Rect rr = GUILayoutUtility.GetRect(Mathf.Min(r.width, 60), 60);

        EditorGUI.CurveField(rr, m_Curve);
        EditorGUILayout.EndVertical();

        m_CrossOverPoint = co * (m_WhitePoint - m_BlackPoint) + m_BlackPoint;
        UpdateCoefficients();
    }