Пример #1
0
        // Looks through history and finds positions and properties that have
        // been changed since the last check.
        //
        // All the history values start null so this will make sure everthing is marked
        // as dirty on the first run.
        private void identifyDirtyValues()
        {
            if (last_minDist != minDist ||
                last_maxDist != maxDist ||
                last_distanceCurve != StarParser.DistanceCurve)
            {
                m_distDirty        = true;
                last_minDist       = minDist;
                last_maxDist       = maxDist;
                last_distanceCurve = StarParser.DistanceCurve;
            }

            if (last_minScale != minScale ||
                last_maxScale != maxScale ||
                last_magnitudeCurve != StarParser.MagnitudeCurve)
            {
                m_scaleDirty        = true;
                last_minScale       = minScale;
                last_maxScale       = maxScale;
                last_magnitudeCurve = StarParser.MagnitudeCurve;
            }

            if (last_blueSaturatedColor != blueColorSaturated ||
                last_redSaturatedColor != redColorSaturated ||
                last_saturationLevel != saturationLevel)
            {
                m_colorDirty            = true;
                last_blueSaturatedColor = blueColorSaturated;
                last_redSaturatedColor  = redColorSaturated;
                last_saturationLevel    = saturationLevel;
            }

            if (last_minLuminosityMod != minLuminosityMod ||
                last_maxLuminosityMod != maxLuminosityMod ||
                last_minLuminance != minLuminance ||
                last_magnitudeCurve != StarParser.MagnitudeCurve ||
                !last_luminanceCurve.Equals(luminanceCurve))
            {
                m_luminosityDirty     = true;
                last_minLuminance     = minLuminance;
                last_minLuminosityMod = minLuminosityMod;
                last_maxLuminosityMod = maxLuminosityMod;
                last_magnitudeCurve   = StarParser.MagnitudeCurve;
                last_luminanceCurve   = luminanceCurve;
            }
        }
Пример #2
0
        public bool Equals(Param other)
        {
            if (other.type != type || other.name != name)
            {
                return(false);
            }
            switch (type)
            {
            case ParamType.AngleLimits:
                return(angleLimitsValue == other.angleLimitsValue);

            case ParamType.Bool:
                return(boolValue == other.boolValue);

            case ParamType.Color:
                return(colorValue == other.colorValue);

            case ParamType.Object:
                return(objectValue == other.objectValue);

            case ParamType.Gradient:
                return(gradientValue.Equals(other.gradientValue));

            case ParamType.Curve:
                return(curveValue.Equals(other.curveValue));

            case ParamType.Float:
                return(floatValue == other.floatValue);

            case ParamType.String:
                return(stringValue == other.stringValue);

            case ParamType.Vector3:
                return(vector3Value == other.vector3Value);

            case ParamType.Rotation:
                return(quaternionValue == other.quaternionValue);

            case ParamType.Integer:
                return(intValue == other.intValue);

            case ParamType.Layer:
                return(layerValue == other.layerValue);
            }
            throw new System.NotImplementedException();
        }
Пример #3
0
        public static bool AnimationCurveField(ref AnimationCurve curValue, string label, params GUILayoutOption[] guiLayout)
        {
            BeginIndentSpaces();
            AnimationCurve newValue = new AnimationCurve(curValue.keys);

            newValue = EditorGUILayout.CurveField(label, newValue, guiLayout);
            EndIndentSpaces();
            FinishedElementDrawingCall();
            if (!newValue.Equals(curValue))
            {
                ShouldBeDirty();
                curValue = newValue;

                return(true);
            }

            return(false);
        }
    private void UpdatePosition()
    {
        if (animCurve.Equals(_nullCurve))
        {
            Debug.LogWarning("Animation Curve was set automatically!");
            animCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
        }

        _currentAnimationTime += Time.deltaTime / timeToMoveInSeconds;
        transform.position     = Vector3.Lerp(_fromGo.transform.position, _targetObject.transform.position,
                                              animCurve.Evaluate(_currentAnimationTime));
        transform.rotation = Quaternion.Slerp(_fromGo.transform.rotation, _targetObject.transform.rotation,
                                              animCurve.Evaluate(_currentAnimationTime));

        if (_currentAnimationTime > 1f)
        {
            _needsUpdate = false;
        }
    }
Пример #5
0
    public override void OnInspectorGUI()
    {
        VTextInterface obj;

        obj = target as VTextInterface;
        if (obj == null)
        {
            Debug.LogError("null object");
            return;
        }

        SerializedProperty param     = serializedObject.FindProperty("parameter"),
                           layout    = serializedObject.FindProperty("layout"),
                           materials = serializedObject.FindProperty("materials");
        // text
        SerializedProperty rtext = serializedObject.FindProperty("RenderText");
        // mesh
        SerializedProperty pDepth        = param.FindPropertyRelative("m_depth");
        SerializedProperty pBevel        = param.FindPropertyRelative("m_bevel");
        SerializedProperty pNeedTangents = param.FindPropertyRelative("m_needTangents");
        SerializedProperty pBackface     = param.FindPropertyRelative("m_backface");

#if CREASE_OK
        SerializedProperty pCrease = param.FindPropertyRelative("m_crease");
#endif
        SerializedProperty pFontname = param.FindPropertyRelative("m_fontname");
        // layout
        SerializedProperty lHorizontal = layout.FindPropertyRelative("m_horizontal");
        SerializedProperty lMajor      = layout.FindPropertyRelative("m_major");
        SerializedProperty lMinor      = layout.FindPropertyRelative("m_minor");
        SerializedProperty lSize       = layout.FindPropertyRelative("m_size");
        SerializedProperty lSpacing    = layout.FindPropertyRelative("m_spacing");
        SerializedProperty curveXZ     = layout.FindPropertyRelative("m_curveXZ");
        SerializedProperty curveXY     = layout.FindPropertyRelative("m_curveXY");
        SerializedProperty orientXZ    = layout.FindPropertyRelative("m_orientXZ");
        SerializedProperty orientXY    = layout.FindPropertyRelative("m_orientXY");

        SerializedProperty isCircular    = layout.FindPropertyRelative("m_isCircular");
        SerializedProperty startRadius   = layout.FindPropertyRelative("m_startRadius");
        SerializedProperty endRadius     = layout.FindPropertyRelative("m_endRadius");
        SerializedProperty circleRadius  = layout.FindPropertyRelative("m_circleRadius");
        SerializedProperty animateRadius = layout.FindPropertyRelative("m_animateRadius");
        SerializedProperty radiusCurve   = layout.FindPropertyRelative("m_curveRadius");

#if UNITY_5
        SerializedProperty pShadowCast = layout.FindPropertyRelative("m_shadowCastMode");
#else
        SerializedProperty pCastShadows = layout.FindPropertyRelative("m_castShadows");
#endif
        SerializedProperty pReceiveShadows = layout.FindPropertyRelative("m_receiveShadows");
        SerializedProperty pUseLightProbes = layout.FindPropertyRelative("m_useLightProbes");

        serializedObject.Update();

        bool updateMesh   = false;
        bool updateLayout = false;

        GUILayout.Label("Text");
        textScroll = EditorGUILayout.BeginScrollView(textScroll, GUILayout.MinHeight(150), GUILayout.MaxHeight(150.0f));
        // the text to show by default
        string rt = EditorGUILayout.TextArea(rtext.stringValue, GUILayout.MinHeight(140));
        if (rt != rtext.stringValue)
        {
            rtext.stringValue = rt;
            updateMesh        = true;
        }
        EditorGUILayout.EndScrollView();

        // Mesh parameter
        showMeshParam = EditorGUILayout.Foldout(showMeshParam, "Mesh Parameter");
        if (showMeshParam)
        {
            float nDepth = EditorGUILayout.FloatField(new GUIContent("Depth", "The size of glyph contour side(s)"), pDepth.floatValue);
            if (nDepth < 0.0f)
            {
                nDepth = 0.0f;
            }
            if (nDepth != pDepth.floatValue)
            {
                pDepth.floatValue = nDepth;
                updateMesh        = true;
            }
            float nBevel = Mathf.Clamp01(EditorGUILayout.FloatField(new GUIContent("Bevel", "Delta of bevel frame"), pBevel.floatValue));
            if (nBevel != pBevel.floatValue)
            {
                pBevel.floatValue = nBevel;
                updateMesh        = true;
            }
#if UNITY_5
            if (EditorGUILayout.PropertyField(pShadowCast, new GUIContent("ShadowCastingMode")))
            {
                updateLayout = true;
            }
#else
            bool nCastShadow = EditorGUILayout.Toggle(new GUIContent("Cast Shadows", "Flag passed to glyph children"), pCastShadows.boolValue);
            if (nCastShadow != pCastShadows.boolValue)
            {
                pCastShadows.boolValue = nCastShadow;
                updateLayout           = true;
            }
#endif
            bool nReceiveShadows = EditorGUILayout.Toggle(new GUIContent("Receive Shadows", "Flag passed to glyph children"), pReceiveShadows.boolValue);
            if (nReceiveShadows != pReceiveShadows.boolValue)
            {
                pReceiveShadows.boolValue = nReceiveShadows;
                updateLayout = true;
            }
            bool nUseLightProbes = EditorGUILayout.Toggle(new GUIContent("Use Light Probes", "Flag passed to glyph children"), pUseLightProbes.boolValue);
            if (nUseLightProbes != pUseLightProbes.boolValue)
            {
                pUseLightProbes.boolValue = nUseLightProbes;
                updateLayout = true;
            }
            bool nNeedTangents = EditorGUILayout.Toggle(new GUIContent("Need Tangents", "Set if shader requires tangents"), pNeedTangents.boolValue);
            if (nNeedTangents != pNeedTangents.boolValue)
            {
                pNeedTangents.boolValue = nNeedTangents;
                updateMesh = true;
            }
            bool nBackface = EditorGUILayout.Toggle(new GUIContent("Backface", "Set if you need a visible backface"), pBackface.boolValue);
            if (nBackface != pBackface.boolValue)
            {
                pBackface.boolValue = nBackface;
                updateMesh          = true;
            }
        }
#if CREASE_OK
        float nCrease = EditorGUILayout.FloatField("Crease Angle", pCrease.floatValue);
        if (nCrease != pCrease.floatValue)
        {
            if (nCrease >= 0f)
            {
                if (nCrease < 90f)
                {
                    pCrease.floatValue = nCrease;
                    updateMesh         = true;
                }
            }
        }
#endif
        // Layout
        showLayoutParam = EditorGUILayout.Foldout(showLayoutParam, "Layout Parameter");
        if (showLayoutParam)
        {
            bool nHorizontal = EditorGUILayout.Toggle(new GUIContent("Horizontal", "Major string direction(Vertical if off)"), lHorizontal.boolValue);
            if (nHorizontal != lHorizontal.boolValue)
            {
                lHorizontal.boolValue = nHorizontal;
                updateLayout          = true;
            }

            int nMajor = (int)(VTextLayout.align)EditorGUILayout.EnumPopup(new GUIContent("Major", "Major layout mode"),
                                                                           (VTextLayout.align)System.Enum.GetValues(typeof(VTextLayout.align)).GetValue(lMajor.enumValueIndex));
            if (lMajor.enumValueIndex != nMajor)
            {
                lMajor.enumValueIndex = nMajor;
                updateLayout          = true;
            }
            int nMinor = (int)(VTextLayout.align)EditorGUILayout.EnumPopup(new GUIContent("Minor", "Minor layout mode"),
                                                                           (VTextLayout.align)System.Enum.GetValues(typeof(VTextLayout.align)).GetValue(lMinor.enumValueIndex));
            if (lMinor.enumValueIndex != nMinor)
            {
                lMinor.enumValueIndex = nMinor;
                updateLayout          = true;
            }
            float nSize = EditorGUILayout.FloatField("Size", lSize.floatValue);
            if (nSize != lSize.floatValue)
            {
                lSize.floatValue = nSize;
                updateLayout     = true;
            }
            float nSpacing = EditorGUILayout.FloatField("Spacing", lSpacing.floatValue);
            if (nSpacing != lSpacing.floatValue)
            {
                lSpacing.floatValue = nSpacing;
                updateLayout        = true;
            }
        }

        /*
         * Materials
         */
        Object faceMat  = materials.GetArrayElementAtIndex(0).objectReferenceValue;
        Object nFaceMat = EditorGUILayout.ObjectField("Face Material", faceMat, typeof(Material), false);
        if (nFaceMat != faceMat)
        {
            Debug.Log("faceMat change " + nFaceMat);
            materials.GetArrayElementAtIndex(0).objectReferenceValue = nFaceMat;
            updateMesh = true;
        }

        Object sideMat  = materials.GetArrayElementAtIndex(1).objectReferenceValue;
        Object nSideMat = EditorGUILayout.ObjectField("Side Material", sideMat, typeof(Material), false);
        if (nSideMat != sideMat)
        {
            Debug.Log("sideMat change " + nSideMat);
            materials.GetArrayElementAtIndex(1).objectReferenceValue = nSideMat;
            updateMesh = true;
        }

        Object frameMat  = materials.GetArrayElementAtIndex(2).objectReferenceValue;
        Object nFrameMat = EditorGUILayout.ObjectField("Frame Material", frameMat, typeof(Material), false);
        if (nFrameMat != frameMat)
        {
            Debug.Log("frameMat change " + nFrameMat);
            materials.GetArrayElementAtIndex(2).objectReferenceValue = nFrameMat;
            updateMesh = true;
        }

        /*
         * Font selector
         */
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label(new GUIContent("Select Font", "from Fonts available in \'StreamingAssets/Fonts\'"));
        fillFonts(obj.parameter.Fontname);
        // Debug.Log(" OnInspectorGUI(): " + fontnames.Length);
        int fc = EditorGUILayout.Popup(fontChoice, fontnames);
        if (fc != fontChoice)
        {
            // Debug.Log("fontChoice " + fc);
            fontChoice = fc;
            if (fc > 0)
            {
                obj.parameter.Fontname = fontnames[fc];
                pFontname.stringValue  = fontnames[fc];
            }
            else
            {
                obj.parameter.Fontname = "";
                pFontname.stringValue  = "";
            }
            updateMesh = true;
        }
        EditorGUILayout.EndHorizontal();

        /*
         * Bend Curves
         */
        showBend = EditorGUILayout.Foldout(showBend, "Curve Bending");
        if (showBend)
        {
            EditorGUILayout.BeginHorizontal();
            AnimationCurve cxz = curveXZ.animationCurveValue;
            GUILayout.Label(new GUIContent("Bend XZ", "bend Z-Axis along max. line width"));
            AnimationCurve ncxz = EditorGUILayout.CurveField(cxz);
            if (!ncxz.Equals(cxz))
            {
                curveXZ.animationCurveValue = ncxz;
                updateLayout = true;
            }
            bool oxz = EditorGUILayout.ToggleLeft(new GUIContent("T.", "Align Tangent Z"), orientXZ.boolValue, GUILayout.MaxWidth(35));
            if (oxz != orientXZ.boolValue)
            {
                orientXZ.boolValue = oxz;
                updateLayout       = true;
            }
            if (GUILayout.Button("Reset"))
            {
                curveXZ.animationCurveValue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 0));
                updateLayout = true;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            AnimationCurve cxy = curveXY.animationCurveValue;
            GUILayout.Label(new GUIContent("Bend XY", "bend Y-Axis along max. line width"));
            AnimationCurve ncxy = EditorGUILayout.CurveField(cxy);
            if (!ncxy.Equals(cxy))
            {
                curveXY.animationCurveValue = ncxy;
                updateLayout = true;
            }
            bool oxy = EditorGUILayout.ToggleLeft(new GUIContent("T.", "Align Tangent Y"), orientXY.boolValue, GUILayout.MaxWidth(35));
            if (oxy != orientXY.boolValue)
            {
                orientXY.boolValue = oxy;
                updateLayout       = true;
            }
            if (GUILayout.Button("Reset"))
            {
                curveXY.animationCurveValue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 0));
                updateLayout = true;
            }
            EditorGUILayout.EndHorizontal();
        }


        /*
         * Circular Bending
         */
        showCircular = EditorGUILayout.Foldout(showCircular, "Circular Bending");
        if (showCircular)
        {
            bool isCircle = EditorGUILayout.ToggleLeft(new GUIContent("Activate", "Should the text align on a circular area?"), isCircular.boolValue);
            if (isCircle != isCircular.boolValue)
            {
                isCircular.boolValue = isCircle;
                updateLayout         = true;
            }
            if (isCircle)
            {
                float start = EditorGUILayout.FloatField(new GUIContent("Start", "The starting radius"), startRadius.floatValue);
                if (start != startRadius.floatValue)
                {
                    startRadius.floatValue = start;
                    updateLayout           = true;
                }
                float end = EditorGUILayout.FloatField(new GUIContent("End", "The ending radius"), endRadius.floatValue);
                if (end != endRadius.floatValue)
                {
                    endRadius.floatValue = end;
                    updateLayout         = true;
                }


                EditorGUILayout.BeginHorizontal();

                float radius = EditorGUILayout.FloatField(new GUIContent("Radius", "The size of the circle"), circleRadius.floatValue);
                if (radius != circleRadius.floatValue)
                {
                    circleRadius.floatValue = radius;
                    updateLayout            = true;
                }



                bool animR = EditorGUILayout.ToggleLeft(new GUIContent("T.", "Animate Radius?"), animateRadius.boolValue, GUILayout.MaxWidth(35));
                if (animR != animateRadius.boolValue)
                {
                    animateRadius.boolValue = animR;
                    updateLayout            = true;
                }
                if (animR)
                {
                    AnimationCurve cR  = radiusCurve.animationCurveValue;
                    AnimationCurve ncR = EditorGUILayout.CurveField(cR);
                    if (!ncR.Equals(cR))
                    {
                        radiusCurve.animationCurveValue = ncR;
                        updateLayout = true;
                    }
                    if (GUILayout.Button("Reset"))
                    {
                        radiusCurve.animationCurveValue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 0));
                        updateLayout = true;
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
        }

        EditorGUILayout.BeginHorizontal();
        // Rebuild mesh when user click the Rebuild button
        if (GUILayout.Button("Rebuild"))
        {
            obj.Rebuild();
        }
        EditorGUILayout.EndHorizontal();

        if (serializedObject.ApplyModifiedProperties())
        {
            // Debug.Log("modified");
            obj.CheckRebuild(updateMesh, updateLayout);
        }
    }
Пример #6
0
    /// <summary>
    /// Draws the circular bending parameters.
    /// </summary>
    public bool DrawCircularBendingParameters()
    {
        #region CIRCULAR BENDING
        EditorGUIUtility.labelWidth = CIRCULAR_BENDING_LABEL_WIDTH;

        bool updateLayout = false;

        GUILayout.BeginHorizontal();
        bool isCircle = EditorGUILayout.Toggle(new GUIContent("Circular bending:", "Enable/Disable circular bending"), _isCircular.boolValue);
        if (isCircle != _isCircular.boolValue)
        {
            _isCircular.boolValue = isCircle;
            updateLayout          = true;
        }

        if (_isCircular.boolValue != _showCircularBendingOptions.value)
        {
            _showCircularBendingOptions.target = _isCircular.boolValue;
        }
        VTextEditorGUIHelper.DrawHelpButton(ref _showCircularBendingInfo);
        GUILayout.EndHorizontal();

        if (EditorGUILayout.BeginFadeGroup(_showCircularBendingOptions.faded))
        {
            EditorGUI.indentLevel++;

            GUILayout.BeginHorizontal();
            float start = EditorGUILayout.FloatField(new GUIContent("Start angle:", "The start angle"), _startAngle.floatValue);
            if (start != _startAngle.floatValue)
            {
                _startAngle.floatValue = start;
                updateLayout           = true;
            }
            GUILayout.Space(VTextEditorGUIHelper.HELP_BUTTON_WIDTH);
            GUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            float end = EditorGUILayout.FloatField(new GUIContent("End angle:", "The end angle"), _endAngle.floatValue);
            if (end != _endAngle.floatValue)
            {
                _endAngle.floatValue = end;
                updateLayout         = true;
            }
            GUILayout.Space(VTextEditorGUIHelper.HELP_BUTTON_WIDTH);
            GUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            float radius = EditorGUILayout.FloatField(new GUIContent("Radius:", "The size of the circle"), _circleRadius.floatValue);
            if (radius != _circleRadius.floatValue)
            {
                _circleRadius.floatValue = radius;
                updateLayout             = true;
            }
            GUILayout.Space(VTextEditorGUIHelper.HELP_BUTTON_WIDTH);
            EditorGUILayout.EndHorizontal();

            bool animR = EditorGUILayout.Toggle(new GUIContent("Animate radius:", "Change the radius along the text."), _animateRadius.boolValue);
            if (animR != _animateRadius.boolValue)
            {
                _animateRadius.boolValue = animR;
                updateLayout             = true;
            }
            if (_animateRadius.boolValue != _showCircularBendingAnimateRadiusOptions.value)
            {
                _showCircularBendingAnimateRadiusOptions.target = _animateRadius.boolValue;
            }
            if (EditorGUILayout.BeginFadeGroup(_showCircularBendingAnimateRadiusOptions.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.BeginHorizontal();
                AnimationCurve cR  = _radiusCurve.animationCurveValue;
                AnimationCurve ncR = EditorGUILayout.CurveField("Radius curve:", cR, GUILayout.MinWidth(ANIMATION_CURVE_EDITOR_MIN_WIDTH));
                if (!ncR.Equals(cR))
                {
                    _radiusCurve.animationCurveValue = ncR;
                    updateLayout = true;
                }
                if (GUILayout.Button(new GUIContent(_resetIcon, "Reset curve"), GUILayout.Width(20), GUILayout.Height(VTextEditorGUIHelper.HELP_BUTTON_HEIGHT)))
                {
                    _radiusCurve.animationCurveValue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 0));
                    updateLayout = true;
                }
                GUILayout.Space(VTextEditorGUIHelper.HELP_BUTTON_WIDTH);
                EditorGUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();


            EditorGUI.indentLevel--;
        }
        EditorGUILayout.EndFadeGroup();

        if (EditorGUILayout.BeginFadeGroup(_showCircularBendingInfo.faded))
        {
            string txt = VTextEditorGUIHelper.ConvertStringToHelpWindowHeader("Circular bending:") + "\n\n" +
                         "This allows you to bend your text perfectly around a circle. The following parameters can be used to change the bending: \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Start angle: ") + "Use this parameter to define the position of the first " +
                         "letter of your text on the circle. This is specified in degree. You can also use values larger than 360 or less then 0 if you want " +
                         "to bend your text more than one time around the circle.\n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("End angle: ") + "This defines the position of the last letter of your text on the circle. " +
                         "It is defined in degree and you can also use values larger than 360 or less then 0 if you want to bend your text more than one time " +
                         "around the circle. \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Radius: ") + "This defines the radius of the circle and therefor how far the letters are " +
                         "away from the center of the circle (esp. the position of the VText object). \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Animate radius: ") + "This section allows you to change the <b>radius of the circle</b> along " +
                         "the text. The <b>curves</b> x values should be between <b>0</b> and <b>1</b> where 0 means the beginning of the text and 1 its ending. \n" +
                         "The <b>curves</b> y values are multiplied by the specified <b>radius</b> of the circle. \n" +
                         "Use the <b>Reset</b> button to reset your curve to its default values which results in a fixed radius (defined by the <b>radius</b> parameter) " +
                         "for the circle. \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowWarning("Tip: ") + "This allows you to bend your text like a spiral for instance. Furthermore you can " +
                         "combine it with the <b>curve bending in XY direction</b> to achieve a tornado-like effect for your text (set the <b>end angle</b> to a value larger " +
                         "than 360 degree (and/or modify the <b>start angle</b> accordingly) to make the text bend a couple of times around the circle.";

            DrawHelpWindow(_circularBendingInfoHelpImage, txt, ref _circularBendingInfoHelpTextScrollPosition, ref _showCircularBendingInfo);
        }
        EditorGUILayout.EndFadeGroup();

        return(updateLayout);

        #endregion // CIRCULAR BENDING
    }
Пример #7
0
    /// <summary>
    /// Draws the bending parameters.
    /// </summary>
    public bool DrawBendingCurves()
    {
        EditorGUIUtility.labelWidth = CURVE_BENDING_LABEL_WIDTH;

        bool updateLayout = false;

        #region CURVE BENDING XZ
        EditorGUILayout.BeginHorizontal();
        AnimationCurve cxz  = _curveXZ.animationCurveValue;
        AnimationCurve ncxz = EditorGUILayout.CurveField(new GUIContent("Bend XZ:", "Bend the text around the Y-axis"), cxz, GUILayout.MinWidth(ANIMATION_CURVE_EDITOR_MIN_WIDTH));
        if (!ncxz.Equals(cxz))
        {
            _curveXZ.animationCurveValue = ncxz;
            updateLayout = true;
        }

        if (GUILayout.Button(new GUIContent("Align to curve", "Align letters to curve"),
                             _orientXZ.boolValue ? VTextEditorGUIHelper.ToggleButtonStyleToggled : VTextEditorGUIHelper.ToggleButtonStyleNormal, GUILayout.Width(ALIGN_TO_CURVE_BUTTON_WIDTH)))
        {
            _orientXZ.boolValue = !_orientXZ.boolValue;
            updateLayout        = true;
        }

        if (GUILayout.Button(new GUIContent(_resetIcon, "Reset curve"), GUILayout.Width(20), GUILayout.Height(VTextEditorGUIHelper.HELP_BUTTON_HEIGHT)))
        {
            _curveXZ.animationCurveValue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 0));
            _orientXZ.boolValue          = false;
            updateLayout = true;
        }
        VTextEditorGUIHelper.DrawHelpButton(ref _showCurveBendingXZInfo);
        EditorGUILayout.EndHorizontal();

        if (EditorGUILayout.BeginFadeGroup(_showCurveBendingXZInfo.faded))
        {
            string txt = VTextEditorGUIHelper.ConvertStringToHelpWindowHeader("Curve bending (in XZ direction):") + "\n\n" +
                         "This bends your text according to the specified curve in xz direction. Your text will stay on the ground (more specific it will not " +
                         "change the y-values of the letters. \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Curve: ") + "The bending curve. The x-values of the <b>curve</b> should be between <b>0</b> " +
                         "and <b>1</b> where 0 is the beginning of the text and 1 is the end of the text. \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Align to curve: ") + "If you enable this option the letters of the text will be " +
                         "rotated accordingly to the curves direction. \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Reset: ") + "This will reset the <b>curve</b> to its original values with no bending at all and " +
                         "sets the <b>Align to curve</b> parameter to false.";
            DrawHelpWindow(_curveBendingXZInfoHelpImage, txt, ref _curveBendingXZInfoHelpTextScrollPosition, ref _showCurveBendingXZInfo);
        }
        EditorGUILayout.EndFadeGroup();
        #endregion // CURVE BENDING XZ

        #region CURVE BENDING XY
        EditorGUILayout.BeginHorizontal();
        AnimationCurve cxy  = _curveXY.animationCurveValue;
        AnimationCurve ncxy = EditorGUILayout.CurveField(new GUIContent("Bend XY:", "Bend the text around the Z-axis"), cxy, GUILayout.MinWidth(ANIMATION_CURVE_EDITOR_MIN_WIDTH));
        if (!ncxy.Equals(cxy))
        {
            _curveXY.animationCurveValue = ncxy;
            updateLayout = true;
        }
        if (GUILayout.Button(new GUIContent("Align to curve", "Align letters to curve"),
                             _orientXY.boolValue ? VTextEditorGUIHelper.ToggleButtonStyleToggled : VTextEditorGUIHelper.ToggleButtonStyleNormal, GUILayout.Width(ALIGN_TO_CURVE_BUTTON_WIDTH)))
        {
            _orientXY.boolValue = !_orientXY.boolValue;
            updateLayout        = true;
        }

        if (GUILayout.Button(new GUIContent(_resetIcon, "Reset curve"), GUILayout.Width(20), GUILayout.Height(VTextEditorGUIHelper.HELP_BUTTON_HEIGHT)))
        {
            _curveXY.animationCurveValue = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 0));
            _orientXY.boolValue          = false;
            updateLayout = true;
        }
        VTextEditorGUIHelper.DrawHelpButton(ref _showCurveBendingXYInfo);
        EditorGUILayout.EndHorizontal();

        if (EditorGUILayout.BeginFadeGroup(_showCurveBendingXYInfo.faded))
        {
            string txt = VTextEditorGUIHelper.ConvertStringToHelpWindowHeader("Curve bending (in XY direction):") + "\n\n" +
                         "This bends your text according to the specified curve in xy direction. The letters of your text will move up and down depending on the " +
                         "specified curve. The z-position of the letters will stay the same. \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Curve: ") + "The bending curve. The x-values of the <b>curve</b> should be between <b>0</b> " +
                         "and <b>1</b> where 0 is the beginning of the text and 1 is the end of the text. \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Align to curve: ") + "If you enable this option the letters of the text will be " +
                         "rotated accordingly to the curves direction. \n\n" +
                         VTextEditorGUIHelper.ConvertStringToHelpWindowListItem("Reset: ") + "This will reset the <b>curve</b> to its original values with no bending at all and " +
                         "sets the <b>Align to curve</b> parameter to false.";

            DrawHelpWindow(_curveBendingXYInfoHelpImage, txt, ref _curveBendingXYInfoHelpTextScrollPosition, ref _showCurveBendingXYInfo);
        }
        EditorGUILayout.EndFadeGroup();
        #endregion // CURVE BENDING XY

        return(updateLayout);
    }