コード例 #1
0
ファイル: ColorModifierEditor.cs プロジェクト: Wanyea/Galaga
 protected override void KeyGUI(SplineSampleModifier.Key key)
 {
     ColorModifier.ColorKey offsetKey = (ColorModifier.ColorKey)key;
     base.KeyGUI(key);
     offsetKey.color     = EditorGUILayout.ColorField("Color", offsetKey.color);
     offsetKey.blendMode = (ColorModifier.ColorKey.BlendMode)EditorGUILayout.EnumPopup("Blend Mode", offsetKey.blendMode);
 }
コード例 #2
0
        protected virtual void KeyHandles(SplineSampleModifier.Key key, bool edit)
        {
            if (!isOpen)
            {
                return;
            }
            bool   changed = false;
            double value   = 0f;

            value = key.start;
            SplineEditorHandles.Slider(user.spline, ref value, user.spline.editorPathColor, "Start", SplineEditorHandles.SplineSliderGizmo.ForwardTriangle, 0.8f);
            if (key.start != value)
            {
                key.start = value;
                changed   = true;
            }

            value = key.globalCenterStart;
            SplineEditorHandles.Slider(user.spline, ref value, user.spline.editorPathColor, "", SplineEditorHandles.SplineSliderGizmo.Rectangle, 0.6f);
            if (key.globalCenterStart != value)
            {
                key.globalCenterStart = value;
                changed = true;
            }

            value = key.globalCenterEnd;
            SplineEditorHandles.Slider(user.spline, ref value, user.spline.editorPathColor, "", SplineEditorHandles.SplineSliderGizmo.Rectangle, 0.6f);
            if (key.globalCenterEnd != value)
            {
                key.globalCenterEnd = value;
                changed             = true;
            }

            value = key.end;
            SplineEditorHandles.Slider(user.spline, ref value, user.spline.editorPathColor, "End", SplineEditorHandles.SplineSliderGizmo.BackwardTriangle, 0.8f);
            if (key.end != value)
            {
                key.end = value;
                changed = true;
            }


            if (Event.current.control)
            {
                value = key.position;
                double lastValue = value;
                SplineEditorHandles.Slider(user.spline, ref value, user.spline.editorPathColor, "", SplineEditorHandles.SplineSliderGizmo.Circle, 0.4f);
                if (value != lastValue)
                {
                    key.position = value;
                    changed      = true;
                }
            }

            if (changed)
            {
                user.Rebuild();
            }
        }
コード例 #3
0
ファイル: ColorModifierEditor.cs プロジェクト: Wanyea/Galaga
 protected override void KeyHandles(SplineSampleModifier.Key key, bool edit)
 {
     if (!isOpen)
     {
         return;
     }
     base.KeyHandles(key, edit);
 }
コード例 #4
0
 protected override void KeyGUI(SplineSampleModifier.Key key)
 {
     RotationModifier.RotationKey rotationKey = (RotationModifier.RotationKey)key;
     base.KeyGUI(key);
     if (!rotationKey.useLookTarget)
     {
         rotationKey.rotation = EditorGUILayout.Vector3Field("Rotation", rotationKey.rotation);
     }
     rotationKey.useLookTarget = EditorGUILayout.Toggle("Use Look Target", rotationKey.useLookTarget);
     if (rotationKey.useLookTarget)
     {
         rotationKey.target = (Transform)EditorGUILayout.ObjectField("Target", rotationKey.target, typeof(Transform), true);
     }
 }
コード例 #5
0
        protected override void KeyHandles(SplineSampleModifier.Key key, bool edit)
        {
            if (!isOpen)
            {
                return;
            }
            bool         is2D   = user.spline != null && user.spline.is2D;
            SplineSample result = new SplineSample();
            List <SplineSampleModifier.Key> keys = module.GetKeys();

            OffsetModifier.OffsetKey offsetKey = (OffsetModifier.OffsetKey)key;
            user.spline.Evaluate(offsetKey.position, result);
            matrix.SetTRS(result.position, Quaternion.LookRotation(result.direction, result.normal), Vector3.one * result.size);
            Vector3 pos = matrix.MultiplyPoint(offsetKey.offset);

            if (is2D)
            {
                Handles.DrawLine(result.position, result.position + result.right * offsetKey.offset.x * result.size);
                Handles.DrawLine(result.position, result.position - result.right * offsetKey.offset.x * result.size);
            }
            else
            {
                Handles.DrawWireDisc(result.position, result.direction, offsetKey.offset.magnitude * result.size);
            }
            Handles.DrawLine(result.position, pos);

            if (edit)
            {
                Vector3 lastPos = pos;
                pos = SplineEditorHandles.FreeMoveRectangle(pos, HandleUtility.GetHandleSize(pos) * 0.1f);
                if (pos != lastPos)
                {
                    pos   = matrix.inverse.MultiplyPoint(pos);
                    pos.z = 0f;
                    if (is2D)
                    {
                        offsetKey.offset = Vector2.right * pos.x;
                    }
                    else
                    {
                        offsetKey.offset = pos;
                    }
                    user.Rebuild();
                }
            }

            base.KeyHandles(key, edit);
        }
コード例 #6
0
        protected override void KeyHandles(SplineSampleModifier.Key key, bool edit)
        {
            RotationModifier.RotationKey rotationKey = (RotationModifier.RotationKey)key;
            SplineSample result = new SplineSample();

            user.spline.Evaluate(rotationKey.position, result);
            if (rotationKey.useLookTarget)
            {
                if (rotationKey.target != null)
                {
                    Handles.DrawDottedLine(result.position, rotationKey.target.position, 5f);
                    if (edit)
                    {
                        Vector3 lastPos = rotationKey.target.position;
                        rotationKey.target.position = Handles.PositionHandle(rotationKey.target.position, Quaternion.identity);
                        if (lastPos != rotationKey.target.position)
                        {
                            user.Rebuild();
                        }
                    }
                }
            }
            else
            {
                Quaternion directionRot = Quaternion.LookRotation(result.forward, result.up);
                Quaternion rot          = directionRot * Quaternion.Euler(rotationKey.rotation);
                SplineEditorHandles.DrawArrowCap(result.position, rot, HandleUtility.GetHandleSize(result.position));

                if (edit)
                {
                    Vector3 lastEuler = rot.eulerAngles;
                    rot = Handles.RotationHandle(rot, result.position);
                    rot = Quaternion.Inverse(directionRot) * rot;
                    rotationKey.rotation = rot.eulerAngles;
                    if (rot.eulerAngles != lastEuler)
                    {
                        user.Rebuild();
                    }
                }
            }
            base.KeyHandles(key, edit);
        }
コード例 #7
0
        protected virtual void KeyGUI(SplineSampleModifier.Key key)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 50f;
            key.start = EditorGUILayout.Slider("Start", (float)key.start, 0f, 1f);
            key.end   = EditorGUILayout.Slider("End", (float)key.end, 0f, 1f);
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.labelWidth = 0f;
            float centerStart = (float)key.centerStart, centerEnd = (float)key.centerEnd;

            EditorGUILayout.MinMaxSlider("Center", ref centerStart, ref centerEnd, 0f, 1f);
            key.centerStart = centerStart;
            key.centerEnd   = centerEnd;
            if (key.interpolation == null)
            {
                key.interpolation = AnimationCurve.Linear(0f, 0f, 1f, 1f);
            }
            key.interpolation = EditorGUILayout.CurveField("Interpolation", key.interpolation);
            key.blend         = EditorGUILayout.Slider("Blend", key.blend, 0f, 1f);
        }
コード例 #8
0
 protected override void KeyGUI(SplineSampleModifier.Key key)
 {
     OffsetModifier.OffsetKey offsetKey = (OffsetModifier.OffsetKey)key;
     base.KeyGUI(key);
     offsetKey.offset = EditorGUILayout.Vector2Field("Offset", offsetKey.offset);
 }
コード例 #9
0
 protected override void KeyGUI(SplineSampleModifier.Key key)
 {
     FollowerSpeedModifier.SpeedKey offsetKey = (FollowerSpeedModifier.SpeedKey)key;
     base.KeyGUI(key);
     offsetKey.speed = EditorGUILayout.FloatField("Add Speed", offsetKey.speed);
 }
コード例 #10
0
 protected override void KeyGUI(SplineSampleModifier.Key key)
 {
     SizeModifier.SizeKey offsetKey = (SizeModifier.SizeKey)key;
     base.KeyGUI(key);
     offsetKey.size = EditorGUILayout.FloatField("Size", offsetKey.size);
 }
コード例 #11
0
 protected override void KeyGUI(SplineSampleModifier.Key key)
 {
     MeshScaleModifier.ScaleKey scaleKey = (MeshScaleModifier.ScaleKey)key;
     base.KeyGUI(key);
     scaleKey.scale = EditorGUILayout.Vector2Field("Scale", scaleKey.scale);
 }