コード例 #1
0
        /// <summary>
        ///     Draws the tangents.
        /// </summary>
        private void DrawTangents(Rect position)
        {
            HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.Vector3Field2Dp(position, s_InLabel, m_InTangentProp));

            position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;

            HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.Vector3Field2Dp(position, s_OutLabel, m_OutTangentProp));
        }
コード例 #2
0
        /// <summary>
        ///     Override this method to make your own GUI for the property
        /// </summary>
        /// <param name="position">Position</param>
        /// <param name="prop">Property</param>
        /// <param name="label">Label</param>
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            label = EditorGUI.BeginProperty(position, label, prop);

            FindProperties(prop);

            position.height = EditorGUIUtility.singleLineHeight;
            position        = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

            float oldLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = LABEL_WIDTH;

            HydraEditorUtils.DrawUnindented(() => HydraEditorUtils.Vector3Field2Dp(position, s_PositionLabel, m_PositionProp));

            position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;

            HydraEditorUtils.DrawUnindented(
                () =>
                HydraEditorUtils.EnumPopupField <TangentMode>(position, s_SmoothingLabel, m_TangentModeProp,
                                                              HydraEditorGUIStyles.enumStyle));

            position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;

            switch (m_TangentModeProp.GetEnumValue <TangentMode>())
            {
            case TangentMode.Auto:
                break;

            case TangentMode.Corner:
                DrawTangents(position);
                break;

            case TangentMode.Smooth:
                DrawTangents(position);
                break;

            case TangentMode.Symmetric:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            EditorGUIUtility.labelWidth = oldLabelWidth;

            EditorGUI.EndProperty();
        }