private void DrawCastButtons()
        {
            GUILayout.BeginVertical(groupsStyle);

            GUILayout.Space(10);

            DrawCustomTransformField();

            GUILayout.BeginHorizontal();
            GUILayout.Space(15);

            if (GUILayout.Button(CastSplineContent, buttonStyle, ToolsButtonsHeight))
            {
                var referenceTransform = EditorWindowState.CustomTransform == null ? EditorState.CurrentSpline.transform : EditorWindowState.CustomTransform;
                var castDirection      = -referenceTransform.up;
                SplineEditor.ScheduleCastSpline(castDirection);
                repaintScene = true;
            }

            if (GUILayout.Button(CastSplineToCameraContent, buttonStyle, ToolsButtonsHeight))
            {
                SplineEditor.ScheduleCastSplineToCameraView();
                repaintScene = true;
            }

            GUILayout.Space(15);
            GUILayout.EndHorizontal();
            GUILayout.Space(10);

            GUILayout.EndVertical();
        }
        private void DrawSplineButtons()
        {
            var isGroupEnabled = GUI.enabled;

            GUILayout.BeginVertical(groupsStyle);
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            GUI.enabled = isGroupEnabled;

            if (GUILayout.Button(CloseLoopButtonContent, buttonStyle, ToolsButtonsMinWidth, ToolsButtonsHeight))
            {
                SplineEditor.ScheduleToggleCloseLoop();
                repaintScene = true;
            }

            if (GUILayout.Button(FactorSplineButtonContent, buttonStyle, ToolsButtonsMinWidth, ToolsButtonsHeight))
            {
                SplineEditor.ScheduleFactorSpline();
                repaintScene = true;
            }

            GUI.enabled = isGroupEnabled && EditorState.CanSplineBeSimplified;
            if (GUILayout.Button(SimplifyButtonContent, buttonStyle, ToolsButtonsMinWidth, ToolsButtonsHeight))
            {
                SplineEditor.ScheduleSimplifySpline();
                repaintScene = true;
            }

            GUILayout.Space(15);
            GUILayout.EndHorizontal();
            GUILayout.Space(10);
            GUILayout.EndVertical();
            GUI.enabled = isGroupEnabled;
        }
예제 #3
0
        private void DrawSplitCurveButton()
        {
            var prevEnabled = GUI.enabled;

            GUI.enabled &= EditorState.IsAnyPointSelected;
            if (GUILayout.Button(SplitCurveButtonContent, buttonStyle, ToolsButtonsHeight))
            {
                SplineEditor.ScheduleSplitCurve(EditorWindowState.SplitCurveValue);
                repaintScene = true;
            }

            GUI.enabled = prevEnabled;
        }
예제 #4
0
        private void DrawRemoveCurveButton()
        {
            var prevEnabled = GUI.enabled;

            GUI.enabled &= EditorState.CanSelectedCurveBeRemoved;
            if (GUILayout.Button(RemoveCurveButtonContent, buttonStyle, ToolsButtonsHeight))
            {
                SplineEditor.ScheduleRemoveSelectedCurve();
                repaintScene = true;
            }

            GUI.enabled = prevEnabled;
        }
예제 #5
0
        private void DrawAddCurveButton()
        {
            var prevEnabled = GUI.enabled;

            GUI.enabled &= EditorState.CanNewCurveBeAdded;
            if (GUILayout.Button(AddCurveButtonContent, buttonStyle, ToolsButtonsHeight))
            {
                SplineEditor.ScheduleAddCurve(EditorWindowState.AddCurveLength);
                repaintScene = true;
            }

            GUI.enabled = prevEnabled;
        }
        private void DrawDrawerToolButton()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);

            GUI.enabled = IsSplineEditorEnabled && !EditorState.CurrentSpline.IsLoop;
            var toggleState = IsSplineEditorEnabled && EditorState.IsDrawerMode;

            if (GUILayout.Toggle(toggleState, DrawCurveButtonContent, toggleButtonStyle, ToolsButtonsHeight))
            {
                SplineEditor.ToggleDrawSplineMode();
                repaintScene = true;
            }

            GUILayout.Space(15);
            GUILayout.EndHorizontal();
        }
예제 #7
0
        private void DrawRotateNormalsButton()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);

            GUI.enabled = IsSplineEditorEnabled;
            var toggleState = IsSplineEditorEnabled && EditorState.IsNormalsEditorMode;

            if (GUILayout.Toggle(toggleState, NormalsEditorButtonContent, toggleButtonStyle, ToolsButtonsHeight))
            {
                SplineEditor.ToggleNormalsEditorMode();
                repaintScene = true;
            }

            GUILayout.Space(15);
            GUILayout.EndHorizontal();
        }
        private void DrawShowMainTransformHandleToggle()
        {
            GUILayout.BeginHorizontal();
            var previousShowTransformHandle = EditorState.ShowTransformHandle;
            var nextLoopState = EditorGUILayout.Toggle(ShowTransformHandleFieldContent, previousShowTransformHandle);

            if (nextLoopState != previousShowTransformHandle)
            {
                Undo.RecordObject(EditorState, "Toggle Show Transform Handle");
                EditorState.ShowTransformHandle = nextLoopState;
                if (!nextLoopState)
                {
                    SplineEditor.HideTools();
                }
                else
                {
                    SplineEditor.ShowTools();
                }

                repaintScene = true;
            }

            GUILayout.EndHorizontal();
        }