Exemple #1
0
		protected void DrawFromToAngles()
		{
			if (_formQuaternion != _fromProperty.quaternionValue)
			{
				_formQuaternion = _fromProperty.quaternionValue;
				_fromAngle = _formQuaternion.eulerAngles;
			}

			if (_toQuaternion != _toProperty.quaternionValue)
			{
				_toQuaternion = _toProperty.quaternionValue;
				_toAngle = _toQuaternion.eulerAngles;
			}

			EditorKit.RecordAndSetLabelWidth(EditorGUIUtility.currentViewWidth * 0.2f);
			EditorKit.RecordAndSetWideMode(true);

			EditorGUI.BeginChangeCheck();
			_fromAngle = EditorGUILayout.Vector3Field("From", _fromAngle);
			if (EditorGUI.EndChangeCheck())
			{
				_fromProperty.quaternionValue = _formQuaternion = Quaternion.Euler(_fromAngle);
			}

			EditorGUI.BeginChangeCheck();
			_toAngle = EditorGUILayout.Vector3Field("To", _toAngle);
			if (EditorGUI.EndChangeCheck())
			{
				_toProperty.quaternionValue = _toQuaternion = Quaternion.Euler(_toAngle);
			}

			EditorKit.RestoreLabelWidth();
			EditorKit.RestoreWideMode();
		}
Exemple #2
0
		protected override float DrawKeyValue(float value, Rect rect)
		{
			EditorKit.RecordAndSetLabelWidth(38f);
			value = EditorGUI.FloatField(rect, "Value", value);
			EditorKit.RestoreLabelWidth();
			return value;
		}
        // 绘制选中路径段时的控件
        void DrawSplineUI(Rect rect)
        {
            _lineRect.Set(rect.xMax + _toolBarHorizontalInterval, rect.y + (rect.height - _toolBarLineHeight) * 0.5f, _tensionWidth, _toolBarLineHeight);

            // Tension

            EditorGUI.BeginChangeCheck();
            EditorKit.RecordAndSetLabelWidth(_tensionLabelWidth);
            float tension = EditorGUI.FloatField(_lineRect, "Tension", GetTension(_selectedItem));

            EditorKit.RestoreLabelWidth();
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(this, "Tension");
                SetTension(_selectedItem, tension);
                EditorUtility.SetDirty(this);
            }

            // Insert Node

            rect.Set(_lineRect.xMax + _toolBarHorizontalInterval, rect.y + (rect.height - _toolBarButtonHeight) * 0.5f, _toolBarButtonWidth, _toolBarButtonHeight);

            if (GUI.Button(rect, EditorKit.GlobalContent(null, EditorAssets.insertNodeTexture, "Insert node"), EditorKit.buttonStyle))
            {
                Undo.RecordObject(this, "Insert Node");

                _selectedTool             = 2;
                _selectionType            = SelectionType.MiddleControlPoint;
                InsertNode(_selectedItem += 1);

                EditorUtility.SetDirty(this);

                return;
            }

            // 前一个

            rect.x = rect.xMax + _toolBarHorizontalInterval;

            if (GUI.Button(rect, EditorKit.GlobalContent(null, EditorAssets.prevTexture, "Previous segment"), EditorKit.buttonLeftStyle))
            {
                _selectedItem = (_selectedItem == 0) ? (segmentCount - 1) : (_selectedItem - 1);
            }

            // 后一个

            rect.x = rect.xMax;

            if (GUI.Button(rect, EditorKit.GlobalContent(null, EditorAssets.nextTexture, "Next segment"), EditorKit.buttonRightStyle))
            {
                _selectedItem = (_selectedItem == segmentCount - 1) ? 0 : (_selectedItem + 1);
            }
        }