protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayoutEx.SectionHeader("Hover epsilon");
            var content = new GUIContent();

            content.text    = "Line slider";
            content.tooltip = "Controls the precision used when hovering line sliders.";
            newFloat        = EditorGUILayout.FloatField(content, LineSliderHoverEps);
            if (newFloat != LineSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetLineSliderHoverEps(newFloat);
            }

            content.text    = "Box slider";
            content.tooltip = "Controls the precision used when hovering box sliders.";
            newFloat        = EditorGUILayout.FloatField(content, BoxSliderHoverEps);
            if (newFloat != BoxSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetBoxSliderHoverEps(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Snapping");
            content.text    = "X";
            content.tooltip = "Snap step value used when moving along the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, XSnapStep);
            if (newFloat != XSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetXSnapStep(newFloat);
            }

            content.text    = "Y";
            content.tooltip = "Snap step value used when moving along the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, YSnapStep);
            if (newFloat != YSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetYSnapStep(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Drag sensitivity");
            content.text    = "Sensitivity";
            content.tooltip = "This value allows you to scale the slider drag speed.";
            newFloat        = EditorGUILayout.FloatField(content, DragSensitivity);
            if (newFloat != DragSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetDragSensitivity(newFloat);
            }
        }
Esempio n. 2
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayoutEx.SectionHeader("Snapping");
            var content = new GUIContent();

            content.text    = "X";
            content.tooltip = "The snap step for the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, XSnapStep);
            if (newFloat != XSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetXSnapStep(newFloat);
            }

            content.text    = "Y";
            content.tooltip = "The snap step for the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, YSnapStep);
            if (newFloat != YSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetYSnapStep(newFloat);
            }

            content.text    = "Z";
            content.tooltip = "The snap step for the Z axis.";
            newFloat        = EditorGUILayout.FloatField(content, ZSnapStep);
            if (newFloat != ZSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetZSnapStep(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Drag sensitivity");
            content.text    = "Sensitivity";
            content.tooltip = "This value allows you to scale the drag speed.";
            newFloat        = EditorGUILayout.FloatField(content, DragSensitivity);
            if (newFloat != DragSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetDragSensitivity(newFloat);
            }
        }
Esempio n. 3
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float           newFloat; bool newBool;  Color newColor;
            GizmoShadeMode  newShadeMode;
            GizmoFillMode3D newFillMode3D;
            GizmoCap3DType  newCap3DType;

            EditorGUILayoutEx.SectionHeader("Scale");
            var content = new GUIContent();

            content.text    = "Use zoom factor";
            content.tooltip = "If this is checked, the drag handles will maintain a constant size regardless of their distance from the camera.";
            newBool         = EditorGUILayout.ToggleLeft(content, UseZoomFactor);
            if (newBool != UseZoomFactor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetUseZoomFactor(newBool);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Cap shape");
            content.text    = "Cap type";
            content.tooltip = "The type of shape which is used to draw the extrude caps.";
            newCap3DType    = (GizmoCap3DType)EditorGUILayout.EnumPopup(content, SliderCapType);
            if (newCap3DType != SliderCapType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderCapType(newCap3DType);
            }

            if (SliderCapType == GizmoCap3DType.Box)
            {
                content.text    = "Box width";
                content.tooltip = "Extrude caps box width when the cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderBoxCapWidth);
                if (newFloat != SliderBoxCapWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderBoxCapWidth(newFloat);
                }

                content.text    = "Box height";
                content.tooltip = "Extrude caps box height when the cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderBoxCapHeight);
                if (newFloat != SliderBoxCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderBoxCapHeight(newFloat);
                }

                content.text    = "Box depth";
                content.tooltip = "Extrude caps box depth when the cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderBoxCapDepth);
                if (newFloat != SliderBoxCapDepth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderBoxCapDepth(newFloat);
                }
            }
            else
            if (SliderCapType == GizmoCap3DType.Cone)
            {
                content.text    = "Cone height";
                content.tooltip = "Extrude caps cone height when the cap type is set to \'Cone\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderConeCapHeight);
                if (newFloat != SliderConeCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderConeCapHeight(newFloat);
                }

                content.text    = "Cone radius";
                content.tooltip = "Extrude caps cone radius when the cap type is set to \'Cone\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderConeCapBaseRadius);
                if (newFloat != SliderConeCapBaseRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderConeCapBaseRadius(newFloat);
                }
            }
            else
            if (SliderCapType == GizmoCap3DType.Pyramid)
            {
                content.text    = "Pyramid width";
                content.tooltip = "Extrude caps pyramid width when the cap type is set to \'Pyramid\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderPyramidCapWidth);
                if (newFloat != SliderPyramidCapWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderPyramidCapWidth(newFloat);
                }

                content.text    = "Pyramid height";
                content.tooltip = "Extrude caps pyramid height when the cap type is set to \'Pyramid\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderPyramidCapHeight);
                if (newFloat != SliderPyramidCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderPyramidCapHeight(newFloat);
                }

                content.text    = "Pyramid depth";
                content.tooltip = "Extrude caps pyramid depth when the cap type is set to \'Pyramid\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderPyramidCapDepth);
                if (newFloat != SliderPyramidCapDepth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderPyramidCapDepth(newFloat);
                }
            }
            else
            if (SliderCapType == GizmoCap3DType.TriangPrism)
            {
                content.text    = "Triang prism width";
                content.tooltip = "Extrude caps prism width when the cap type is set to \'TriangPrism\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderTriPrismCapWidth);
                if (newFloat != SliderTriPrismCapWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderTriPrismCapWidth(newFloat);
                }

                content.text    = "Triang prism height";
                content.tooltip = "Extrude caps prism height when the cap type is set to \'TriangPrism\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderTriPrismCapHeight);
                if (newFloat != SliderTriPrismCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderTriPrismCapHeight(newFloat);
                }

                content.text    = "Triang prism depth";
                content.tooltip = "Extrude caps prism depth when the cap type is set to \'TriangPrism\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderTriPrismCapDepth);
                if (newFloat != SliderTriPrismCapDepth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderTriPrismCapDepth(newFloat);
                }
            }
            else
            if (SliderCapType == GizmoCap3DType.Sphere)
            {
                content.text    = "Sphere radius";
                content.tooltip = "Extrude caps sphere radius when the cap type is set to \'Sphere\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderSphereCapRadius);
                if (newFloat != SliderSphereCapRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderSphereCapRadius(newFloat);
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Colors");
            content.text    = "Box wire color";
            content.tooltip = "The color used to draw the box wireframe.";
            newColor        = EditorGUILayout.ColorField(content, BoxWireColor);
            if (newColor != BoxWireColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetBoxWireColor(newColor);
            }

            string[] axesLabels = new string[] { "X", "Y", "Z" };
            for (int axisIndex = 0; axisIndex < 3; ++axisIndex)
            {
                GizmoLineSlider3DLookAndFeel sliderLookAndFeel = GetSglSliderLookAndFeel(axisIndex, AxisSign.Positive);

                content.text    = axesLabels[axisIndex];
                content.tooltip = "The color of the " + axesLabels[axisIndex] + " axis when it is not hovered.";
                newColor        = EditorGUILayout.ColorField(content, sliderLookAndFeel.Color);
                if (newColor != sliderLookAndFeel.Color)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetAxisColor(axisIndex, newColor);
                }
            }

            content.text    = "Hovered";
            content.tooltip = "The gizmo hovered color.";
            newColor        = EditorGUILayout.ColorField(content, HoveredColor);
            if (newColor != HoveredColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetHoveredColor(newColor);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Shading");
            content.text    = "Extrude caps";
            content.tooltip = "The type of shading that is applied to the extrude caps.";
            newShadeMode    = (GizmoShadeMode)EditorGUILayout.EnumPopup(content, SliderCapShadeMode);
            if (newShadeMode != SliderCapShadeMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderCapShadeMode(newShadeMode);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Fill");
            content.text    = "Extrude caps";
            content.tooltip = "Fill mode for extrude caps.";
            newFillMode3D   = (GizmoFillMode3D)EditorGUILayout.EnumPopup(content, SliderCapFillMode);
            if (newFillMode3D != SliderCapFillMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderCapFillMode(newFillMode3D);
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float         newFloat; bool newBool;
            GizmoSnapMode newSnapMode;

            EditorGUILayoutEx.SectionHeader("Hover epsilon/misc");
            GUIContent content = new GUIContent();

            content.text    = "Axis line eps";
            content.tooltip = "Controls the precision used when hovering the axes rotation circles.";
            newFloat        = EditorGUILayout.FloatField(content, AxisLineHoverEps);
            if (newFloat != AxisLineHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisLineHoverEps(newFloat);
            }

            content.text    = "Axis torus eps";
            content.tooltip = "Controls the precision used when hovering the axes rotation tori.";
            newFloat        = EditorGUILayout.FloatField(content, AxisTorusHoverEps);
            if (newFloat != AxisTorusHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisTorusHoverEps(newFloat);
            }

            content.text    = "Cam look line eps";
            content.tooltip = "Controls the precision used when hovering the THIN border of the circle that rotates around the camera look axis.";
            newFloat        = EditorGUILayout.FloatField(content, CamLookLineHoverEps);
            if (newFloat != CamLookLineHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamLookLineHoverEps(newFloat);
            }

            content.text    = "Cam look thick eps";
            content.tooltip = "Controls the precision used when hovering the THICK border of the circle that rotates around the camera look axis.";
            newFloat        = EditorGUILayout.FloatField(content, CamLookThickHoverEps);
            if (newFloat != CamLookThickHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamLookThickHoverEps(newFloat);
            }

            content.text    = "Can hover culled pixels";
            content.tooltip = "If this is checked, you will be able to hover the culled areas/pixels (i.e. the pixels hiden behind the rotation sphere) of the axes sliders.";
            newBool         = EditorGUILayout.ToggleLeft(content, CanHoverCulledPixels);
            if (newBool != CanHoverCulledPixels)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCanHoverCulledPixels(newBool);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Snapping");
            content.text    = "Snap mode";
            content.tooltip = "The rotation snap mode. Relative rotation counts from the current rotation angle. Absolute rotation counts from 0.";
            newSnapMode     = (GizmoSnapMode)EditorGUILayout.EnumPopup(content, SnapMode);
            if (newSnapMode != SnapMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSnapMode(newSnapMode);
            }

            content.text    = "X";
            content.tooltip = "Snap step value used when rotating around the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, XSnapStep);
            if (newFloat != XSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisSnapStep(0, newFloat);
            }

            content.text    = "Y";
            content.tooltip = "Snap step value used when rotating around the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, YSnapStep);
            if (newFloat != YSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisSnapStep(1, newFloat);
            }

            content.text    = "Z";
            content.tooltip = "Snap step value used when rotating around the Z axis.";
            newFloat        = EditorGUILayout.FloatField(content, ZSnapStep);
            if (newFloat != ZSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisSnapStep(2, newFloat);
            }

            content.text    = "Camera right";
            content.tooltip = "Snap step value used when rotating around the camera right axis.";
            newFloat        = EditorGUILayout.FloatField(content, CamRightSnapStep);
            if (newFloat != CamRightSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamRightSnapStep(newFloat);
            }

            content.text    = "Camera up";
            content.tooltip = "Snap step value used when rotating around the camera up axis.";
            newFloat        = EditorGUILayout.FloatField(content, CamUpSnapStep);
            if (newFloat != CamUpSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamUpSnapStep(newFloat);
            }

            content.text    = "Camera look";
            content.tooltip = "Snap step value used when rotating around the camera look axis.";
            newFloat        = EditorGUILayout.FloatField(content, CamLookSnapStep);
            if (newFloat != CamLookSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamLookSnapStep(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Drag sensitivity");
            content.text    = "Sensitivity";
            content.tooltip = "This value allows you to scale the slider drag speed.";
            newFloat        = EditorGUILayout.FloatField(content, DragSensitivity);
            if (newFloat != DragSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetDragSensitivity(newFloat);
            }
        }
Esempio n. 5
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            Color          newColor; float newFloat;
            GizmoCap2DType newTickType;

            var content = new GUIContent();

            EditorGUILayoutEx.SectionHeader("Tick shape");
            content.text    = "Tick type";
            content.tooltip = "The type of shape which is used to draw the ticks.";
            newTickType     = (GizmoCap2DType)EditorGUILayoutEx.SelectiveEnumPopup(content, TickType, GetAllowedTickTypes());
            if (newTickType != TickType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetTickType(newTickType);
            }

            if (TickType == GizmoCap2DType.Quad)
            {
                content.text    = "Quad width";
                content.tooltip = "The tick quad width.";
                newFloat        = EditorGUILayout.FloatField(content, TickQuadWidth);
                if (newFloat != TickQuadWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetTickQuadWidth(newFloat);
                }

                content.text    = "Quad height";
                content.tooltip = "The tick quad height.";
                newFloat        = EditorGUILayout.FloatField(content, TickQuadHeight);
                if (newFloat != TickQuadHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetTickQuadHeight(newFloat);
                }
            }
            else
            if (TickType == GizmoCap2DType.Circle)
            {
                content.text    = "Circle radius";
                content.tooltip = "The tick circle radius.";
                newFloat        = EditorGUILayout.FloatField(content, TickCircleRadius);
                if (newFloat != TickCircleRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetTickCircleRadius(newFloat);
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Colors");
            content.text    = "Box wire color";
            content.tooltip = "The color used to draw the box wireframe.";
            newColor        = EditorGUILayout.ColorField(content, BoxWireColor);
            if (newColor != BoxWireColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetBoxWireColor(newColor);
            }

            content.text    = "X ticks";
            content.tooltip = "The color of the ticks which are associated with the X axis.";
            newColor        = EditorGUILayout.ColorField(content, XTickColor);
            if (newColor != XTickColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisTickColor(0, newColor);
            }

            content.text    = "Y ticks";
            content.tooltip = "The color of the ticks which are associated with the Y axis.";
            newColor        = EditorGUILayout.ColorField(content, YTickColor);
            if (newColor != YTickColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisTickColor(1, newColor);
            }

            content.text    = "Z ticks";
            content.tooltip = "The color of the ticks which are associated with the Z axis.";
            newColor        = EditorGUILayout.ColorField(content, ZTickColor);
            if (newColor != ZTickColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisTickColor(2, newColor);
            }

            content.text    = "Hovered ticks";
            content.tooltip = "The color used to draw hovered ticks.";
            newColor        = EditorGUILayout.ColorField(content, TickHoveredColor);
            if (newColor != TickHoveredColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetTickHoveredColor(newColor);
            }

            content.text    = "Tick border";
            content.tooltip = "The tick border color.";
            newColor        = EditorGUILayout.ColorField(content, TickBorderColor);
            if (newColor != TickBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetTickBorderColor(newColor);
            }

            content.text    = "Tick hovered border";
            content.tooltip = "The tick hovered border color.";
            newColor        = EditorGUILayout.ColorField(content, TickHoveredBorderColor);
            if (newColor != TickHoveredBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetTickHoveredBorderColor(newColor);
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float                    newFloat; bool newBool; Color newColor; int newInt;
            GizmoShadeMode           newShadeMode;
            GizmoCircle3DBorderType  newCircleBorderType;
            GizmoFillMode3D          newFillMode3D;
            GizmoPolygon2DBorderType newPolyBorder2DType;

            EditorGUILayoutEx.SectionHeader("Scale and size");
            GUIContent content = new GUIContent();

            content.text    = "Use zoom factor";
            content.tooltip = "If this is checked, the gizmo will maintain a constant size regardless of its distance from the camera.";
            newBool         = EditorGUILayout.ToggleLeft(content, UseZoomFactor);
            if (newBool != UseZoomFactor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetUseZoomFactor(newBool);
            }

            content.text    = "Scale";
            content.tooltip = "The gizmo 3D scale. This is useful when you need to make the gizmo bigger or smaller because it maintains the relationship between different size properties.";
            newFloat        = EditorGUILayout.FloatField(content, Scale);
            if (newFloat != Scale)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScale(newFloat);
            }

            content.text    = "Radius";
            content.tooltip = "The radius of the rotation sphere. The final radius of the gizmo is actually: radius * scale * zoomFactor (if \'Use zoom factor\' is true).";
            newFloat        = EditorGUILayout.FloatField(content, Radius);
            if (newFloat != Radius)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetRadius(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Slider border");
            content.text        = "Axis border type";
            content.tooltip     = "The type of shape that is used to draw the axis slider borders.";
            newCircleBorderType = (GizmoCircle3DBorderType)EditorGUILayout.EnumPopup(content, AxisBorderType);
            if (newCircleBorderType != AxisBorderType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisBorderType(newCircleBorderType);
            }

            if (AxisBorderType == GizmoCircle3DBorderType.Torus)
            {
                content.text    = "Torus thickness";
                content.tooltip = "The torus thickness for the axis sliders when the border type is set to \'Torus\'.";
                newFloat        = EditorGUILayout.FloatField(content, AxisTorusThickness);
                if (newFloat != AxisTorusThickness)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetAxisTorusThickness(newFloat);
                }
            }
            else
            if (AxisBorderType == GizmoCircle3DBorderType.CylindricalTorus)
            {
                content.text    = "Torus width";
                content.tooltip = "The torus width for the axis sliders when the border type is set to \'CylindricalTorus\'. The width extends inside the area of the circle.";
                newFloat        = EditorGUILayout.FloatField(content, AxisCylTorusWidth);
                if (newFloat != AxisCylTorusWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetAxisCylTorusWidth(newFloat);
                }

                content.text    = "Torus height";
                content.tooltip = "The torus height for the axis sliders when the border type is set to \'CylindricalTorus\'. The height is perpendicular to the circle area.";
                newFloat        = EditorGUILayout.FloatField(content, AxisCylTorusHeight);
                if (newFloat != AxisCylTorusHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetAxisCylTorusHeight(newFloat);
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Colors");
            content.text    = "X border";
            content.tooltip = "The border color of the X axis slider.";
            newColor        = EditorGUILayout.ColorField(content, XBorderColor);
            if (newColor != XBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisBorderColor(0, newColor);
            }

            content.text    = "Y border";
            content.tooltip = "The border color of the Y axis slider.";
            newColor        = EditorGUILayout.ColorField(content, YBorderColor);
            if (newColor != YBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisBorderColor(1, newColor);
            }

            content.text    = "Z border";
            content.tooltip = "The border color of the Z axis slider.";
            newColor        = EditorGUILayout.ColorField(content, ZBorderColor);
            if (newColor != ZBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisBorderColor(2, newColor);
            }

            content.text    = "Hovered";
            content.tooltip = "The hovered color.";
            newColor        = EditorGUILayout.ColorField(content, HoveredColor);
            if (newColor != HoveredColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetHoveredColor(newColor);
            }

            content.text    = "Mid cap";
            content.tooltip = "The color of middle cap.";
            newColor        = EditorGUILayout.ColorField(content, MidCapColor);
            if (newColor != MidCapColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapColor(newColor);
            }

            content.text    = "Hovered mid cap";
            content.tooltip = "The middle cap hovered color.";
            newColor        = EditorGUILayout.ColorField(content, HoveredMidCapColor);
            if (newColor != HoveredMidCapColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetHoveredMidCapColor(newColor);
            }

            content.text    = "Axis border cull alpha scale";
            content.tooltip = "Allows you to specify an alpha scale value for the axis border pixels which are hidden behind the mid cap.";
            newFloat        = EditorGUILayout.FloatField(content, AxisCullAlphaScale);
            if (newFloat != AxisCullAlphaScale)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisBorderCullAlphaScale(newFloat);
            }

            content.text    = "Shade mode";
            content.tooltip = "The type of shading that is applied to the gizmo handles.";
            newShadeMode    = (GizmoShadeMode)EditorGUILayout.EnumPopup(content, ShadeMode);
            if (newShadeMode != ShadeMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetShadeMode(newShadeMode);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Fill");
            content.text    = "Axis border";
            content.tooltip = "Fill mode for the axes borders.";
            newFillMode3D   = (GizmoFillMode3D)EditorGUILayout.EnumPopup(content, AxisBorderFillMode);
            if (newFillMode3D != AxisBorderFillMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisBorderFillMode(newFillMode3D);
            }

            if (AxisBorderFillMode == GizmoFillMode3D.Wire)
            {
                content.text    = "Num torus axial slices";
                content.tooltip = "If a torus axis border is used, this is the number of axial slices used for wireframe rendering.";
                newInt          = EditorGUILayout.IntField(content, NumAxisTorusWireAxialSlices);
                if (newInt != NumAxisTorusWireAxialSlices)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetNumAxisTorusWireAxialSlices(newInt);
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Rotation arc");
            content.text    = "Is visible";
            content.tooltip = "If this is checked, a rotation arc will appear during rotation. This does not apply to rotations performed with the mid cap.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsRotationArcVisible);
            if (newBool != IsRotationArcVisible)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetRotationArcVisible(newBool);
            }

            content.text    = "Fill color";
            content.tooltip = "The rotation arc fill color.";
            newColor        = EditorGUILayout.ColorField(content, RotationArcColor);
            if (newColor != RotationArcColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetRotationArcColor(newColor);
            }

            content.text    = "Border color";
            content.tooltip = "The rotation arc border color.";
            newColor        = EditorGUILayout.ColorField(content, RotationArcBorderColor);
            if (newColor != RotationArcBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetRotationArcBorderColor(newColor);
            }

            content.text    = "Use shortest arc";
            content.tooltip = "If this is checked, the rotation arc will never exceed 180 degrees and it will always choose the shortest rotation angle.";
            newBool         = EditorGUILayout.ToggleLeft(content, UseShortestRotationArc);
            if (newBool != UseShortestRotationArc)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetUseShortestRotationArc(newBool);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Camera look slider");
            content.text        = "Border type";
            content.tooltip     = "The type of border which is used to draw the circle that rotates around the camera look axis.";
            newPolyBorder2DType = (GizmoPolygon2DBorderType)EditorGUILayout.EnumPopup(content, CamLookSliderPolyBorderType);
            if (newPolyBorder2DType != CamLookSliderPolyBorderType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamLookSliderPolyBorderType(newPolyBorder2DType);
            }

            if (CamLookSliderPolyBorderType == GizmoPolygon2DBorderType.Thick)
            {
                content.text    = "Border thickness";
                content.tooltip = "When a thick border is used, this property represents the border thickness.";
                newFloat        = EditorGUILayout.FloatField(content, CamLookSliderPolyBorderThickness);
                if (newFloat != CamLookSliderPolyBorderThickness)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetCamLookSliderPolyBorderThickness(newFloat);
                }
            }

            content.text    = "Radius offset";
            content.tooltip = "This value is added to the \'Radius\' property to calculate the radius of the circle which can be used to rotate around the camera look axis.";
            newFloat        = EditorGUILayout.FloatField(content, CamLookSliderRadiusOffset);
            if (newFloat != CamLookSliderRadiusOffset)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamLookSliderRadiusOffset(newFloat);
            }

            content.text    = "Border color";
            content.tooltip = "The border color for the circle which can be used to rotate around the camera look axis.";
            newColor        = EditorGUILayout.ColorField(content, CamLookSliderBorderColor);
            if (newColor != CamLookSliderBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamLookSliderBorderColor(newColor);
            }

            content.text    = "Border hovered color";
            content.tooltip = "The hovered border color for the circle which can be used to rotate around the camera look axis.";
            newColor        = EditorGUILayout.ColorField(content, CamLookSliderHoveredBorderColor);
            if (newColor != CamLookSliderHoveredBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamLookSliderHoveredBorderColor(newColor);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Visibility");
            content.text    = "X axis";
            content.tooltip = "Controls the visibility of the X axis rotation slider.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsAxisVisible(0));
            if (newBool != IsAxisVisible(0))
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisVisible(0, newBool);
            }

            content.text    = "Y axis";
            content.tooltip = "Controls the visibility of the Y axis rotation slider.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsAxisVisible(1));
            if (newBool != IsAxisVisible(1))
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisVisible(1, newBool);
            }

            content.text    = "Z axis";
            content.tooltip = "Controls the visibility of the Z axis rotation slider.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsAxisVisible(2));
            if (newBool != IsAxisVisible(2))
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisVisible(2, newBool);
            }

            content.text    = "Camera look slider";
            content.tooltip = "Controls the visibility of the circle slider which can be used to rotate aroudn the camera look vector.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsCamLookSliderVisible);
            if (newBool != IsCamLookSliderVisible)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCamLookSliderVisible(newBool);
            }

            content.text    = "Mid cap";
            content.tooltip = "Controls the visibility of the mid cap.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsMidCapVisible);
            if (newBool != IsMidCapVisible)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapVisible(newBool);
            }

            content.text    = "Mid cap border";
            content.tooltip = "Controls the visibility of the mid cap border.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsMidCapBorderVisible);
            if (newBool != IsMidCapBorderVisible)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapBorderVisible(newBool);
            }
        }
Esempio n. 7
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            bool newBool; Color newColor; float newFloat;

            EditorGUILayoutEx.SectionHeader("Anchor lines");
            GUIContent content = new GUIContent();

            content.text    = "Visible";
            content.tooltip = "If this is checked, a line will be drawn between each object's position and the anchor position.";
            newBool         = EditorGUILayout.ToggleLeft(content, DrawAnchorLines);
            if (newBool != DrawAnchorLines)
            {
                EditorUndoEx.Record(undoRecordObject);
                DrawAnchorLines = newBool;
            }

            content.text    = "Anchor line color";
            content.tooltip = "Allows you to change the color of the anchor lines.";
            newColor        = EditorGUILayout.ColorField(content, AnchorLineColor);
            if (newColor != AnchorLineColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                AnchorLineColor = newColor;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Object position ticks");
            content.text    = "Visible";
            content.tooltip = "If this is checked, ticks will be drawn at the position of each object that is controlled by the grab session.";
            newBool         = EditorGUILayout.ToggleLeft(content, DrawObjectPosTicks);
            if (newBool != DrawObjectPosTicks)
            {
                EditorUndoEx.Record(undoRecordObject);
                DrawObjectPosTicks = newBool;
            }

            content.text    = "Tick color";
            content.tooltip = "The color which is used to draw the object position ticks.";
            newColor        = EditorGUILayout.ColorField(content, ObjectPosTickColor);
            if (newColor != ObjectPosTickColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                ObjectPosTickColor = newColor;
            }

            content.text    = "Tick size";
            content.tooltip = "The size of the object ticks.";
            newFloat        = EditorGUILayout.FloatField(content, ObjectPosTickSize);
            if (newFloat != ObjectPosTickSize)
            {
                EditorUndoEx.Record(undoRecordObject);
                ObjectPosTickSize = newFloat;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Anchor position ticks");
            content.text    = "Visible";
            content.tooltip = "If this is checked, a tick will be drawn at the anchor position.";
            newBool         = EditorGUILayout.ToggleLeft(content, DrawAnchorPosTick);
            if (newBool != DrawAnchorPosTick)
            {
                EditorUndoEx.Record(undoRecordObject);
                DrawAnchorPosTick = newBool;
            }

            content.text    = "Tick color";
            content.tooltip = "The color which is used to draw the anchor position tick.";
            newColor        = EditorGUILayout.ColorField(content, AnchorPosTickColor);
            if (newColor != AnchorPosTickColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                AnchorPosTickColor = newColor;
            }

            content.text    = "Tick size";
            content.tooltip = "The size of the anchor position tick.";
            newFloat        = EditorGUILayout.FloatField(content, AnchorPosTickSize);
            if (newFloat != AnchorPosTickSize)
            {
                EditorUndoEx.Record(undoRecordObject);
                AnchorPosTickSize = newFloat;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Object boxes");
            content.text    = "Visible";
            content.tooltip = "If this is checked, a box will be drawn for each object that is controlled by the grab session.";
            newBool         = EditorGUILayout.ToggleLeft(content, DrawObjectBoxes);
            if (newBool != DrawObjectBoxes)
            {
                EditorUndoEx.Record(undoRecordObject);
                DrawObjectBoxes = newBool;
            }

            content.text    = "Wire color";
            content.tooltip = "The color which is used to draw the object wire boxes.";
            newColor        = EditorGUILayout.ColorField(content, ObjectBoxWireColor);
            if (newColor != ObjectBoxWireColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                ObjectBoxWireColor = newColor;
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float           newFloat; bool newBool; Color newColor;
            GizmoLine3DType newLineType;
            GizmoShadeMode  newShadeMode;
            GizmoFillMode3D newFillMode3D;
            GizmoCap3DType  newCap3DType;

            EditorGUILayoutEx.SectionHeader("Scale");
            GUIContent content = new GUIContent();

            content.text    = "Use zoom factor";
            content.tooltip = "If this is checked, the gizmo will maintain a constant size regardless of its distance from the camera.";
            newBool         = EditorGUILayout.ToggleLeft(content, UseZoomFactor);
            if (newBool != UseZoomFactor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetUseZoomFactor(newBool);
            }

            content.text    = "Scale";
            content.tooltip = "The gizmo 3D scale. This is useful when you need to make the gizmo bigger or smaller because it maintains the relationship between different size properties.";
            newFloat        = EditorGUILayout.FloatField(content, Scale);
            if (newFloat != Scale)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScale(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Slider shape");
            content.text    = "Slider type";
            content.tooltip = "The type of shape which is used to draw the single-axis sliders.";
            newLineType     = (GizmoLine3DType)EditorGUILayout.EnumPopup(content, SliderLineType);
            if (newLineType != SliderLineType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderLineType(newLineType);
            }

            content.text    = "Slider length";
            content.tooltip = "The single-axis slider length.";
            newFloat        = EditorGUILayout.FloatField(content, SliderLength);
            if (newFloat != SliderLength)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderLength(newFloat);
            }

            if (SliderLineType == GizmoLine3DType.Box)
            {
                content.text    = "Box height";
                content.tooltip = "The box height for single-axis sliders when the slider type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, BoxSliderHeight);
                if (newFloat != BoxSliderHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetBoxSliderHeight(newFloat);
                }

                content.text    = "Box depth";
                content.tooltip = "The box depth for single-axis sliders when the slider type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, BoxSliderDepth);
                if (newFloat != BoxSliderDepth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetBoxSliderDepth(newFloat);
                }
            }
            else
            if (SliderLineType == GizmoLine3DType.Cylinder)
            {
                content.text    = "Cylinder radius";
                content.tooltip = "The cylinder radius for single-axis sliders when the slider type is set to \'Cylinder\'.";
                newFloat        = EditorGUILayout.FloatField(content, CylinderSliderRadius);
                if (newFloat != CylinderSliderRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetCylinderSliderRadius(newFloat);
                }
            }

            content.text    = "Dbl slider size";
            content.tooltip = "The size of the double-axis sliders. Applies to both dimensions.";
            newFloat        = EditorGUILayout.FloatField(content, DblSliderSize);
            if (newFloat != DblSliderSize)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetDblSliderSize(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Cap shape");
            content.text    = "Slider cap type";
            content.tooltip = "The type of shape which is used to draw the single-axis slider caps.";
            newCap3DType    = (GizmoCap3DType)EditorGUILayout.EnumPopup(content, SliderCapType);
            if (newCap3DType != SliderCapType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderCapType(newCap3DType);
            }

            if (SliderCapType == GizmoCap3DType.Box)
            {
                content.text    = "Box width";
                content.tooltip = "The box width for single-axis slider caps when the cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderBoxCapWidth);
                if (newFloat != SliderBoxCapWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderBoxCapWidth(newFloat);
                }

                content.text    = "Box height";
                content.tooltip = "The box height for single-axis slider caps when the cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderBoxCapHeight);
                if (newFloat != SliderBoxCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderBoxCapHeight(newFloat);
                }

                content.text    = "Box depth";
                content.tooltip = "The box depth for single-axis slider caps when the cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderBoxCapDepth);
                if (newFloat != SliderBoxCapDepth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderBoxCapDepth(newFloat);
                }
            }
            else
            if (SliderCapType == GizmoCap3DType.Cone)
            {
                content.text    = "Cone height";
                content.tooltip = "The cone height for single-axis slider caps when the cap type is set to \'Cone\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderConeCapHeight);
                if (newFloat != SliderConeCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderConeCapHeight(newFloat);
                }

                content.text    = "Cone radius";
                content.tooltip = "The cone radius for single-axis slider caps when the cap type is set to \'Cone\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderConeCapBaseRadius);
                if (newFloat != SliderConeCapBaseRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderConeCapBaseRadius(newFloat);
                }
            }
            else
            if (SliderCapType == GizmoCap3DType.Pyramid)
            {
                content.text    = "Pyramid width";
                content.tooltip = "The pyramid width for single-axis slider caps when the cap type is set to \'Pyramid\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderPyramidCapWidth);
                if (newFloat != SliderPyramidCapWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderPyramidCapWidth(newFloat);
                }

                content.text    = "Pyramid height";
                content.tooltip = "The pyramid height for single-axis slider caps when the cap type is set to \'Pyramid\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderPyramidCapHeight);
                if (newFloat != SliderPyramidCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderPyramidCapHeight(newFloat);
                }

                content.text    = "Pyramid depth";
                content.tooltip = "The pyramid depth for single-axis slider caps when the cap type is set to \'Pyramid\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderPyramidCapDepth);
                if (newFloat != SliderPyramidCapDepth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderPyramidCapDepth(newFloat);
                }
            }
            else
            if (SliderCapType == GizmoCap3DType.TriangPrism)
            {
                content.text    = "Triang prism width";
                content.tooltip = "The prism width for single-axis slider caps when the cap type is set to \'TriangPrism\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderTriPrismCapWidth);
                if (newFloat != SliderTriPrismCapWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderTriPrismCapWidth(newFloat);
                }

                content.text    = "Triang prism height";
                content.tooltip = "The prism height for single-axis slider caps when the cap type is set to \'TriangPrism\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderTriPrismCapHeight);
                if (newFloat != SliderTriPrismCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderTriPrismCapHeight(newFloat);
                }

                content.text    = "Triang prism depth";
                content.tooltip = "The prism depth for single-axis slider caps when the cap type is set to \'TriangPrism\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderTriPrismCapDepth);
                if (newFloat != SliderTriPrismCapDepth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderTriPrismCapDepth(newFloat);
                }
            }
            else
            if (SliderCapType == GizmoCap3DType.Sphere)
            {
                content.text    = "Sphere radius";
                content.tooltip = "The sphere radius for single-axis slider caps when the cap type is set to \'Sphere\'.";
                newFloat        = EditorGUILayout.FloatField(content, SliderSphereCapRadius);
                if (newFloat != SliderSphereCapRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetSliderSphereCapRadius(newFloat);
                }
            }

            content.text    = "Mid cap type";
            content.tooltip = "The type of shape which is used to draw the mid cap.";
            newCap3DType    = (GizmoCap3DType)EditorGUILayoutEx.SelectiveEnumPopup(content, MidCapType, GetAllowedMidCapTypes());
            if (newCap3DType != MidCapType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapType(newCap3DType);
            }

            if (MidCapType == GizmoCap3DType.Sphere)
            {
                content.text    = "Sphere radius";
                content.tooltip = "The mid cap sphere radius when the mid cap type is set to \'Sphere\'.";
                newFloat        = EditorGUILayout.FloatField(content, MidCapSphereRadius);
                if (newFloat != MidCapSphereRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMidCapSphereRadius(newFloat);
                }
            }
            else
            if (MidCapType == GizmoCap3DType.Box)
            {
                content.text    = "Box width";
                content.tooltip = "The mid cap box width when the mid cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, MidCapBoxWidth);
                if (newFloat != MidCapBoxWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMidCapBoxWidth(newFloat);
                }

                content.text    = "Box height";
                content.tooltip = "The mid cap box height when the mid cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, MidCapBoxHeight);
                if (newFloat != MidCapBoxHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMidCapBoxHeight(newFloat);
                }

                content.text    = "Box depth";
                content.tooltip = "The mid cap box depth when the mid cap type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, MidCapBoxDepth);
                if (newFloat != MidCapBoxDepth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMidCapBoxDepth(newFloat);
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Colors");
            string[] axesLabels = new string[] { "X", "Y", "Z" };
            for (int axisIndex = 0; axisIndex < 3; ++axisIndex)
            {
                GizmoLineSlider3DLookAndFeel sliderLookAndFeel = GetSglSliderLookAndFeel(axisIndex, AxisSign.Positive);

                content.text    = axesLabels[axisIndex];
                content.tooltip = "The color of the " + axesLabels[axisIndex] + " axis when it is not hovered.";
                newColor        = EditorGUILayout.ColorField(content, sliderLookAndFeel.Color);
                if (newColor != sliderLookAndFeel.Color)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetAxisColor(axisIndex, newColor);
                }
            }

            content.text    = "Mid cap";
            content.tooltip = "The color of the mid cap.";
            newColor        = EditorGUILayout.ColorField(content, MidCapColor);
            if (newColor != MidCapColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapColor(newColor);
            }

            content.text    = "Hovered";
            content.tooltip = "The gizmo hovered color.";
            newColor        = EditorGUILayout.ColorField(content, HoveredColor);
            if (newColor != HoveredColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetHoveredColor(newColor);
            }

            content.text    = "Dbl slider fill alpha";
            content.tooltip = "The alpha value used to draw the area of the double-axis sliders.";
            newFloat        = EditorGUILayout.FloatField(content, DblSliderFillAlpha);
            if (newFloat != DblSliderFillAlpha)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetDblSliderFillAlpha(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Shading");
            content.text    = "Sliders";
            content.tooltip = "The type of shading that is applied to single-axis sliders. Does not apply to caps. Caps have their own shade property.";
            newShadeMode    = (GizmoShadeMode)EditorGUILayout.EnumPopup(content, SliderShadeMode);
            if (newShadeMode != SliderShadeMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderShadeMode(newShadeMode);
            }

            content.text    = "Slider caps";
            content.tooltip = "The type of shading that is applied to single-axis slider caps.";
            newShadeMode    = (GizmoShadeMode)EditorGUILayout.EnumPopup(content, SliderCapShadeMode);
            if (newShadeMode != SliderCapShadeMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderCapShadeMode(newShadeMode);
            }

            content.text    = "Mid cap";
            content.tooltip = "The type of shading that is applied to the mid cap.";
            newShadeMode    = (GizmoShadeMode)EditorGUILayout.EnumPopup(content, MidCapShadeMode);
            if (newShadeMode != MidCapShadeMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapShadeMode(newShadeMode);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Fill");
            content.text    = "Sliders";
            content.tooltip = "Fill mode for single-axis sliders. Does not apply to caps. Caps have their own fill property.";
            newFillMode3D   = (GizmoFillMode3D)EditorGUILayout.EnumPopup(content, SliderFillMode);
            if (newFillMode3D != SliderFillMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderFillMode(newFillMode3D);
            }

            content.text    = "Slider caps";
            content.tooltip = "Fill mode for slider caps.";
            newFillMode3D   = (GizmoFillMode3D)EditorGUILayout.EnumPopup(content, SliderCapFillMode);
            if (newFillMode3D != SliderCapFillMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetSliderCapFillMode(newFillMode3D);
            }

            content.text    = "Mid cap";
            content.tooltip = "Fill mode for the mid cap.";
            newFillMode3D   = (GizmoFillMode3D)EditorGUILayout.EnumPopup(content, MidCapFillMode);
            if (newFillMode3D != MidCapFillMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapFillMode(newFillMode3D);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Scale guide");
            content.text    = "Is visible";
            content.tooltip = "If this is checked, the gizmo will draw a scale guide for each entity that is being scaled during a scale session. The guide is shown " +
                              "in the form of a collection of coordinate system axes.";
            newBool = EditorGUILayout.ToggleLeft(content, IsScaleGuideVisible);
            if (newBool != IsScaleGuideVisible)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScaleGuideVisible(newBool);
            }

            content.text    = "Axis length";
            content.tooltip = "If the scale guide is visible, this value is used to determine the length of the guide axes.";
            newFloat        = EditorGUILayout.FloatField(content, ScaleGuideAxisLength);
            if (newFloat != ScaleGuideAxisLength)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScaleGuideAxisLength(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Slider visibility");
            DrawSliderVisibilityControls(AxisSign.Positive, undoRecordObject);
            DrawSliderVisibilityControls(AxisSign.Negative, undoRecordObject);
            DrawCheckUncheckAllSlidersVisButtons(false, undoRecordObject);

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Dbl slider visibility");
            DrawDblSliderVisibilityControls(undoRecordObject);
            DrawCheckUncheckAllDblSlidersVisButtons(undoRecordObject);

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Cap visibility");
            DrawSliderCapVisibilityControls(AxisSign.Positive, undoRecordObject);
            DrawSliderCapVisibilityControls(AxisSign.Negative, undoRecordObject);
            DrawCheckUncheckAllSlidersVisButtons(true, undoRecordObject);
        }
Esempio n. 9
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            bool           newBool; Color newColor; Vector2 newVec2;
            GizmoShadeMode newShadeMode; SceneGizmoScreenCorner newScreenCorner;
            GizmoCap3DType newCapType;

            EditorGUILayoutEx.SectionHeader("Placement");
            var content = new GUIContent();

            content.text    = "Screen corner";
            content.tooltip = "Allows you to specify the screen corner in which the gizmo will be rendered.";
            newScreenCorner = (SceneGizmoScreenCorner)EditorGUILayout.EnumPopup(content, ScreenCorner);
            if (newScreenCorner != ScreenCorner)
            {
                EditorUndoEx.Record(undoRecordObject);
                ScreenCorner = newScreenCorner;
            }

            content.text    = "Screen offset";
            content.tooltip = "Allows you to apply an offset to the scene gizmo in screen space to change the location of where the gizmo is drawn on the screen.";
            newVec2         = EditorGUILayout.Vector2Field(content, ScreenOffset);
            if (newVec2 != ScreenOffset)
            {
                EditorUndoEx.Record(undoRecordObject);
                ScreenOffset = newVec2;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Shapes");
            content.text    = "Axes caps";
            content.tooltip = "Allows you to change the shape of the axes caps.";
            newCapType      = (GizmoCap3DType)EditorGUILayoutEx.SelectiveEnumPopup(content, AxisCapLookAndFeel.CapType, GetAllowedAxesCapTypes());
            if (newCapType != AxisCapLookAndFeel.CapType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisCapType(newCapType);
            }

            content.text    = "Mid cap";
            content.tooltip = "Allows you to change the shape of the middle cap.";
            newCapType      = (GizmoCap3DType)EditorGUILayoutEx.SelectiveEnumPopup(content, _midCapLookAndFeel.CapType, GetAllowedMidCapTypes());
            if (newCapType != _midCapLookAndFeel.CapType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapType(newCapType);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Shading");
            content.text    = "Axes caps";
            content.tooltip = "The type of shading that is applied to the axes caps.";
            newShadeMode    = (GizmoShadeMode)EditorGUILayout.EnumPopup(content, AxisCapLookAndFeel.ShadeMode);
            if (newShadeMode != AxisCapLookAndFeel.ShadeMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetAxisCapShadeMode(newShadeMode);
            }

            content.text    = "Mid cap";
            content.tooltip = "The type of shading that is applied to the middle cap.";
            newShadeMode    = (GizmoShadeMode)EditorGUILayout.EnumPopup(content, _midCapLookAndFeel.ShadeMode);
            if (newShadeMode != _midCapLookAndFeel.ShadeMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapShadeMode(newShadeMode);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Colors");
            string[]   axesCapLabels = new string[] { "Positive X", "Positive Y", "Positive Z", "Negative X", "Negative Y", "Negative Z" };
            int[]      axesIndices   = new int[] { 0, 1, 2, 0, 1, 2 };
            AxisSign[] axesSigns     = new AxisSign[] { AxisSign.Positive, AxisSign.Positive, AxisSign.Positive, AxisSign.Negative, AxisSign.Negative, AxisSign.Negative };
            for (int axisIndex = 0; axisIndex < 6; ++axisIndex)
            {
                content.text    = axesCapLabels[axisIndex];
                content.tooltip = "The color of the " + axesCapLabels[axisIndex].ToLower() + ".";

                var lookAndFeel = GetAxisCapLookAndFeel(axesIndices[axisIndex], axesSigns[axisIndex]);
                newColor = EditorGUILayout.ColorField(content, lookAndFeel.Color);
                if (newColor != lookAndFeel.Color)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetAxisCapColor(newColor, axesIndices[axisIndex], axesSigns[axisIndex]);
                }
            }

            content.text    = "Mid cap";
            content.tooltip = "Allows you to change the color of the mid cap.";
            newColor        = EditorGUILayout.ColorField(content, _midCapLookAndFeel.Color);
            if (newColor != _midCapLookAndFeel.Color)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMidCapColor(newColor);
            }

            content.text    = "Hovered color";
            content.tooltip = "Gizmo hovered color.";
            newColor        = EditorGUILayout.ColorField(content, AxisCapLookAndFeel.HoveredColor);
            if (newColor != AxisCapLookAndFeel.HoveredColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetHoveredColor(newColor);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Labels");
            EditorGUILayout.HelpBox("The alpha value of the axes labels is ignored. The alpha component will always have the same value as the corresponding axis.", MessageType.Info);
            content.text    = "Axes label tint";
            content.tooltip = "Allows you to change the color of the labels associated with the gizmo axes. Note: The alpha component is ignored. The alpha value will " +
                              "always be retrieved from the color of the associated axis.";
            newColor = EditorGUILayout.ColorField(content, AxesLabelTint);
            if (newColor != AxesLabelTint)
            {
                EditorUndoEx.Record(undoRecordObject);
                AxesLabelTint = newColor;
            }

            content.text    = "Cam prj switch label tint";
            content.tooltip = "Allows you to change the color of the label that is used to display the current camera projection type (perspective or ortho).";
            newColor        = EditorGUILayout.ColorField(content, CamPrjSwitchLabelTint);
            if (newColor != CamPrjSwitchLabelTint)
            {
                EditorUndoEx.Record(undoRecordObject);
                CamPrjSwitchLabelTint = newColor;
            }

            content.text    = "Show prj switch label";
            content.tooltip = "If this is checked, the gizmo will render a label which indicates the current camera projection type (perspective or ortho). " +
                              "This label can also be used to switch between the 2 camera projection modes.";
            newBool = EditorGUILayout.ToggleLeft(content, IsCamPrjSwitchLabelVisible);
            if (newBool != IsCamPrjSwitchLabelVisible)
            {
                EditorUndoEx.Record(undoRecordObject);
                IsCamPrjSwitchLabelVisible = newBool;
            }
        }
Esempio n. 10
0
        public void RenderEditorGUI(UnityEngine.Object undoRecordObject)
        {
            bool        newBool;
            const float toggleWidth = 65.0f;

            // Shortcut name label
            EditorGUILayout.BeginVertical("Box");
            EditorGUILayoutEx.SectionHeader(Name);

            // Enabled/disabled
            GUIContent content = new GUIContent();

            content.text    = "Is enabled";
            content.tooltip = "Allows you to enable/disable a shortcut key.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsEnabled);
            if (newBool != IsEnabled)
            {
                EditorUndoEx.Record(undoRecordObject);
                IsEnabled = newBool;
            }

            int selectedIndex = _availableKeyNames.IndexOf(Key.ToString());
            int newIndex      = EditorGUILayout.Popup("Key", selectedIndex, _availableKeyNames.ToArray());

            if (newIndex != selectedIndex)
            {
                EditorUndoEx.Record(undoRecordObject);
                Key = _availableKeys[newIndex];
            }

            // Modifiers
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical("Box");
            newBool = EditorGUILayout.ToggleLeft("LCtrl", _lCtrl, GUILayout.Width(toggleWidth));
            if (newBool != _lCtrl)
            {
                EditorUndoEx.Record(undoRecordObject);
                _lCtrl = newBool;
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Box");
            newBool = EditorGUILayout.ToggleLeft("LCmd", _lCmd, GUILayout.Width(toggleWidth));
            if (newBool != _lCmd)
            {
                EditorUndoEx.Record(undoRecordObject);
                _lCmd = newBool;
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Box");
            newBool = EditorGUILayout.ToggleLeft("LAlt", _lAlt, GUILayout.Width(toggleWidth));
            if (newBool != _lAlt)
            {
                EditorUndoEx.Record(undoRecordObject);
                _lAlt = newBool;
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Box");
            newBool = EditorGUILayout.ToggleLeft("LShift", _lShift, GUILayout.Width(toggleWidth));
            if (newBool != _lShift)
            {
                EditorUndoEx.Record(undoRecordObject);
                _lShift = newBool;
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            // Mouse buttons
            if (_staticData.CanHaveMouseButtons)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.BeginVertical("Box");
                newBool = EditorGUILayout.ToggleLeft("LMouse", _lMouseBtn, GUILayout.Width(toggleWidth));
                if (newBool != _lMouseBtn)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    _lMouseBtn = newBool;
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical("Box");
                newBool = EditorGUILayout.ToggleLeft("RMouse", _rMouseBtn, GUILayout.Width(toggleWidth));
                if (newBool != _rMouseBtn)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    _rMouseBtn = newBool;
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical("Box");
                newBool = EditorGUILayout.ToggleLeft("MMouse", _mMouseBtn, GUILayout.Width(toggleWidth));
                if (newBool != _mMouseBtn)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    _mMouseBtn = newBool;
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }
Esempio n. 11
0
        private void RenderMoveContent(UnityEngine.Object undoRecordObject)
        {
            float            newFloat; Color newColor; bool newBool;
            GizmoLine2DType  newLine2DType;
            GizmoCap2DType   newCap2DType;
            GizmoFillMode2D  newFillMode2D;
            GizmoPlane2DType newPlane2DType;

            EditorGUILayoutEx.SectionHeader("Scale");
            var content = new GUIContent();

            content.text    = "Scale";
            content.tooltip = "The gizmo 2D scale. This is useful when you need to make the gizmo bigger or smaller because it maintains the relationship between different size properties.";
            newFloat        = EditorGUILayout.FloatField(content, MvScale);
            if (newFloat != MvScale)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvScale(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Slider shape");
            content.text    = "Slider type";
            content.tooltip = "The type of shape which is used to draw the single-axis sliders.";
            newLine2DType   = (GizmoLine2DType)EditorGUILayout.EnumPopup(content, MvSliderLineType);
            if (newLine2DType != MvSliderLineType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvSliderLineType(newLine2DType);
            }

            content.text    = "Slider length";
            content.tooltip = "The single-axis slider length.";
            newFloat        = EditorGUILayout.FloatField(content, MvSliderLength);
            if (newFloat != MvSliderLength)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvSliderLength(newFloat);
            }

            if (MvSliderLineType == GizmoLine2DType.Box)
            {
                content.text    = "Slider box thickness";
                content.tooltip = "The box thickness for single-axis sliders when the slider type is set to \'Box\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvBoxSliderThickness);
                if (newFloat != MvBoxSliderThickness)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvBoxSliderThickness(newFloat);
                }
            }

            content.text    = "Dbl slider type";
            content.tooltip = "The type of shape which is used to draw the double-axis slider.";
            newPlane2DType  = (GizmoPlane2DType)EditorGUILayout.EnumPopup(content, MvDblSliderPlaneType);
            if (newPlane2DType != MvDblSliderPlaneType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvDblSliderPlaneType(newPlane2DType);
            }

            if (MvDblSliderPlaneType == GizmoPlane2DType.Quad)
            {
                content.text    = "Quad width";
                content.tooltip = "The double-axis slider quad width when the dbl slider type is set to \'Quad\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvDblSliderQuadWidth);
                if (newFloat != MvDblSliderQuadWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvDblSliderQuadWidth(newFloat);
                }

                content.text    = "Quad height";
                content.tooltip = "The double-axis slider quad height when the dbl slider type is set to \'Quad\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvDblSliderQuadHeight);
                if (newFloat != MvDblSliderQuadHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvDblSliderQuadHeight(newFloat);
                }
            }
            else
            if (MvDblSliderPlaneType == GizmoPlane2DType.Circle)
            {
                content.text    = "Circle radius";
                content.tooltip = "The double-axis slider circle radius when the dbl slider type is set to \'Circle\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvDblSliderCircleRadius);
                if (newFloat != MvDblSliderCircleRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvDblSliderCircleRadius(newFloat);
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Cap shape");
            content.text    = "Slider cap type";
            content.tooltip = "The type of shape which is used to draw the single-axis slidre caps.";
            newCap2DType    = (GizmoCap2DType)EditorGUILayout.EnumPopup(content, MvSliderCapType);
            if (newCap2DType != MvSliderCapType)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvSliderCapType(newCap2DType);
            }

            if (MvSliderCapType == GizmoCap2DType.Arrow)
            {
                content.text    = "Arrow height";
                content.tooltip = "The arrow height for slider caps when the cap type is set to \'Arrow\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvSliderArrowCapHeight);
                if (newFloat != MvSliderArrowCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvSliderArrowCapHeight(newFloat);
                }

                content.text    = "Arrow radius";
                content.tooltip = "The arrow radius for slider caps when the cap type is set to \'Arrow\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvSliderArrowCapBaseRadius);
                if (newFloat != MvSliderArrowCapBaseRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvSliderArrowCapBaseRadius(newFloat);
                }
            }
            else
            if (MvSliderCapType == GizmoCap2DType.Quad)
            {
                content.text    = "Quad width";
                content.tooltip = "The quad width for slider caps when the cap type is set to \'Quad\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvSliderQuadCapWidth);
                if (newFloat != MvSliderQuadCapWidth)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvSliderQuadCapWidth(newFloat);
                }

                content.text    = "Quad height";
                content.tooltip = "The quad height for slider caps when the cap type is set to \'Quad\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvSliderQuadCapHeight);
                if (newFloat != MvSliderQuadCapHeight)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvSliderQuadCapHeight(newFloat);
                }
            }
            else
            if (MvSliderCapType == GizmoCap2DType.Circle)
            {
                content.text    = "Circle radius";
                content.tooltip = "The circle radius for slider caps when the cap type is set to \'Circle\'.";
                newFloat        = EditorGUILayout.FloatField(content, MvSliderCircleCapRadius);
                if (newFloat != MvSliderCircleCapRadius)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetMvSliderCircleCapRadius(newFloat);
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Colors");
            content.text    = "X fill";
            content.tooltip = "The X axis fill color. Applies to the X axis slider and its cap.";
            newColor        = EditorGUILayout.ColorField(content, MvXColor);
            if (newColor != MvXColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvAxisColor(0, newColor);
            }

            content.text    = "X border";
            content.tooltip = "The X axis border color. Applies to the X axis slider and its cap.";
            newColor        = EditorGUILayout.ColorField(content, MvXBorderColor);
            if (newColor != MvXBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvAxisBorderColor(0, newColor);
            }

            content.text    = "Y fill";
            content.tooltip = "The Y axis fill color. Applies to the Y axis slider and its cap.";
            newColor        = EditorGUILayout.ColorField(content, MvYColor);
            if (newColor != MvYColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvAxisColor(1, newColor);
            }

            content.text    = "Y border";
            content.tooltip = "The Y axis border color. Applies to the Y axis slider and its cap.";
            newColor        = EditorGUILayout.ColorField(content, MvYBorderColor);
            if (newColor != MvYBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvAxisBorderColor(1, newColor);
            }

            content.text    = "Hovered fill";
            content.tooltip = "The hovered fill color. Applies to single sliders and their caps only. The double slider has its own color properties.";
            newColor        = EditorGUILayout.ColorField(content, MvSliderHoveredColor);
            if (newColor != MvSliderHoveredColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvSliderHoveredFillColor(newColor);
            }

            content.text    = "Hovered border";
            content.tooltip = "The hovered border color. Applies to single sliders and their caps only. The double slider has its own color properties.";
            newColor        = EditorGUILayout.ColorField(content, MvSliderHoveredBorderColor);
            if (newColor != MvSliderHoveredBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvSliderHoveredBorderColor(newColor);
            }

            EditorGUILayout.Separator();
            content.text    = "Dbl slider fill";
            content.tooltip = "The double-axis slider fill color.";
            newColor        = EditorGUILayout.ColorField(content, MvDblSliderColor);
            if (newColor != MvDblSliderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvDblSliderColor(newColor);
            }

            content.text    = "Dbl slider border";
            content.tooltip = "The double-axis slider border color.";
            newColor        = EditorGUILayout.ColorField(content, MvDblSliderBorderColor);
            if (newColor != MvDblSliderBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvDblSliderBorderColor(newColor);
            }

            content.text    = "Hovered dbl slider fill";
            content.tooltip = "The fill color of the double-axis slider when it is hovered.";
            newColor        = EditorGUILayout.ColorField(content, MvDblSliderHoveredColor);
            if (newColor != MvDblSliderHoveredColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvDblSliderHoveredColor(newColor);
            }

            content.text    = "Hovered dbl slider border";
            content.tooltip = "The border color of the double-axis slider when it is hovered.";
            newColor        = EditorGUILayout.ColorField(content, MvDblSliderHoveredBorderColor);
            if (newColor != MvDblSliderHoveredBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvDblSliderHoveredBorderColor(newColor);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Fill");
            content.text    = "Sliders";
            content.tooltip = "The fill mode for single-axis sliders. Does not affet caps. Caps have their own fill property.";
            newFillMode2D   = (GizmoFillMode2D)EditorGUILayout.EnumPopup(content, MvSliderFillMode);
            if (newFillMode2D != MvSliderFillMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvSliderFillMode(newFillMode2D);
            }

            content.text    = "Caps";
            content.tooltip = "The fill mode for single-axis slider caps.";
            newFillMode2D   = (GizmoFillMode2D)EditorGUILayout.EnumPopup(content, MvSliderCapFillMode);
            if (newFillMode2D != MvSliderCapFillMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvSliderCapFillMode(newFillMode2D);
            }

            content.text    = "Dbl slider";
            content.tooltip = "The double-slider fill mode.";
            newFillMode2D   = (GizmoFillMode2D)EditorGUILayout.EnumPopup(content, MvDblSliderFillMode);
            if (newFillMode2D != MvDblSliderFillMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvDblSliderFillMode(newFillMode2D);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Slider visibility");
            DrawMvSliderVisibilityControls(AxisSign.Positive, undoRecordObject);
            DrawMvSliderVisibilityControls(AxisSign.Negative, undoRecordObject);
            DrawMvCheckUncheckAllSlidersVisButtons(false, undoRecordObject);

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Slider cap visibility");
            DrawMvSliderCapVisibilityControls(AxisSign.Positive, undoRecordObject);
            DrawMvSliderCapVisibilityControls(AxisSign.Negative, undoRecordObject);
            DrawMvCheckUncheckAllSlidersVisButtons(true, undoRecordObject);

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Dbl slider visibility");
            content.text    = "Is visible";
            content.tooltip = "Controls the visiblity of the double slider.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsMvDblSliderVisible);
            if (newBool != IsMvDblSliderVisible)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvDblSliderVisible(newBool);
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayoutEx.SectionHeader("Hover epsilon");
            GUIContent content = new GUIContent();

            content.text    = "Line slider";
            content.tooltip = "Controls the precision used when hovering line sliders.";
            newFloat        = EditorGUILayout.FloatField(content, LineSliderHoverEps);
            if (newFloat != LineSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetLineSliderHoverEps(newFloat);
            }

            content.text    = "Box slider";
            content.tooltip = "Controls the precision used when hovering box sliders.";
            newFloat        = EditorGUILayout.FloatField(content, BoxSliderHoverEps);
            if (newFloat != BoxSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetBoxSliderHoverEps(newFloat);
            }

            content.text    = "Cylinder slider";
            content.tooltip = "Controls the precision used when hovering cylinder sliders.";
            newFloat        = EditorGUILayout.FloatField(content, CylinderSliderHoverEps);
            if (newFloat != CylinderSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetCylinderSliderHoverEps(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Snapping");
            content.text    = "X";
            content.tooltip = "The snap step for the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, XSnapStep);
            if (newFloat != XSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetXSnapStep(newFloat);
            }

            content.text    = "Y";
            content.tooltip = "The snap step for the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, YSnapStep);
            if (newFloat != YSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetYSnapStep(newFloat);
            }

            content.text    = "Z";
            content.tooltip = "The snap step for the Z axis.";
            newFloat        = EditorGUILayout.FloatField(content, ZSnapStep);
            if (newFloat != ZSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetZSnapStep(newFloat);
            }

            content.text    = "XY";
            content.tooltip = "The snap step for the XY double-axis slider.";
            newFloat        = EditorGUILayout.FloatField(content, XYSnapStep);
            if (newFloat != XYSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetXYSnapStep(newFloat);
            }

            content.text    = "YZ";
            content.tooltip = "The snap step for the YZ double-axis slider.";
            newFloat        = EditorGUILayout.FloatField(content, YZSnapStep);
            if (newFloat != YZSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetYZSnapStep(newFloat);
            }

            content.text    = "ZX";
            content.tooltip = "The snap step for the ZX double-axis slider.";
            newFloat        = EditorGUILayout.FloatField(content, ZXSnapStep);
            if (newFloat != ZXSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetZXSnapStep(newFloat);
            }

            content.text    = "Uniform";
            content.tooltip = "The snap step value used for uniform scaling.";
            newFloat        = EditorGUILayout.FloatField(content, UniformSnapStep);
            if (newFloat != UniformSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetUniformScaleSnapStep(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Drag sensitivity");
            content.text    = "Sensitivity";
            content.tooltip = "This value allows you to scale the slider drag speed.";
            newFloat        = EditorGUILayout.FloatField(content, DragSensitivity);
            if (newFloat != DragSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetDragSensitivity(newFloat);
            }
        }
Esempio n. 13
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            bool          newBool; float newFloat; int newInt;
            TransformAxis newTransformAxis;

            EditorGUILayoutEx.SectionHeader("Alignment");
            var content = new GUIContent();

            content.text    = "Align axis";
            content.tooltip = "If this is checked, the grabbed objects will have their local axes aligned with the grab surface normal.";
            newBool         = EditorGUILayout.ToggleLeft(content, AlignAxis);
            if (newBool != AlignAxis)
            {
                EditorUndoEx.Record(undoRecordObject);
                AlignAxis = newBool;
            }

            content.text     = "Alignment axis";
            content.tooltip  = "When axis alignment is turned on, this is the axis that will be aligned to the surface normal.";
            newTransformAxis = (TransformAxis)EditorGUILayout.EnumPopup(content, AlignmentAxis);
            if (newTransformAxis != AlignmentAxis)
            {
                EditorUndoEx.Record(undoRecordObject);
                AlignmentAxis = newTransformAxis;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Sensitivity");
            content.text    = "Rotation";
            content.tooltip = "Allows you to control how sensitive object rotation is to the input device.";
            newFloat        = EditorGUILayout.FloatField(content, RotationSensitivity);
            if (newFloat != RotationSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                RotationSensitivity = newFloat;
            }

            content.text    = "Scale";
            content.tooltip = "Allows you to control how sensitive object scaling is to the input device.";
            newFloat        = EditorGUILayout.FloatField(content, ScaleSensitivity);
            if (newFloat != ScaleSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                ScaleSensitivity = newFloat;
            }

            content.text    = "Offset from surface";
            content.tooltip = "Sensitivity value used when offseting objects from the surface on which they are sitting.";
            newFloat        = EditorGUILayout.FloatField(content, OffsetFromSurfaceSensitivity);
            if (newFloat != OffsetFromSurfaceSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                OffsetFromSurfaceSensitivity = newFloat;
            }

            content.text    = "Offset from anchor";
            content.tooltip = "Sensitivity value used when offseting objects from the anchor point.";
            newFloat        = EditorGUILayout.FloatField(content, OffsetFromAnchorSensitivity);
            if (newFloat != OffsetFromAnchorSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                OffsetFromAnchorSensitivity = newFloat;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Surface");
            content.text    = "Default offset";
            content.tooltip = "A default offset value which controls the distance between the objects and the surface they are sitting on. Negative values can be used to embed objects in the surface.";
            newFloat        = EditorGUILayout.FloatField(content, DefaultOffsetFromSurface);
            if (newFloat != DefaultOffsetFromSurface)
            {
                EditorUndoEx.Record(undoRecordObject);
                DefaultOffsetFromSurface = newFloat;
            }

            content.text    = "Surface flags";
            content.tooltip = "Allows you to specify the types of surfaces that can be used during a grab session.";
            newInt          = (int)((ObjectGrabSurfaceFlags)EditorGUILayout.EnumMaskPopup(content, (ObjectGrabSurfaceFlags)SurfaceFlags));
            if (newInt != (int)SurfaceFlags)
            {
                EditorUndoEx.Record(undoRecordObject);
                SurfaceFlags = (ObjectGrabSurfaceFlags)newInt;
            }

            content.text    = "Surface layers";
            content.tooltip = "Allows you to specify which layers can be used as snap surface during a grab session.";
            newInt          = EditorGUILayoutEx.LayerMaskField(content, SurfaceLayers);
            if (newInt != SurfaceLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                SurfaceLayers = newInt;
            }

            content.text    = "Spherical mesh layers";
            content.tooltip = "Objects that belong to these layers will be treated as spherical meshes (spheres). This allows the system to make " +
                              "certain assumptions about the surface geometry in order to produce the correct results.";
            newInt = EditorGUILayoutEx.LayerMaskField(content, SphericalMeshLayers);
            if (newInt != SphericalMeshLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                SphericalMeshLayers = newInt;
            }

            content.text    = "Terrain mesh layers";
            content.tooltip = "Objects that belong to these layers will be treated as terrain meshes (meshes that resemble a terrain but are NOT Unity Terrains). This allows the system to make " +
                              "certain assumptions about the surface geometry in order to produce the correct results.";
            newInt = EditorGUILayoutEx.LayerMaskField(content, TerrainMeshLayers);
            if (newInt != TerrainMeshLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                TerrainMeshLayers = newInt;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Per layer settings");
            EditorGUILayout.BeginHorizontal();
            content.text    = "Add";
            content.tooltip = "Adds grab settings which apply only to the chosen layer. Objects which belong to that layer will use these settings during a grab session.";
            if (GUILayout.Button(content, GUILayout.Width(70.0f)))
            {
                EditorUndoEx.Record(undoRecordObject);
                GetLayerGrabSettings(_newLayer).IsActive = true;
            }

            newInt = EditorGUILayout.LayerField(_newLayer);
            if (newInt != _newLayer)
            {
                EditorUndoEx.Record(undoRecordObject);
                _newLayer = newInt;
            }
            EditorGUILayout.EndHorizontal();

            foreach (var layerGrabSettings in _layerGrabSettings)
            {
                if (layerGrabSettings.IsActive)
                {
                    EditorGUILayout.BeginVertical("Box");
                    EditorGUILayout.HelpBox(LayerMask.LayerToName(layerGrabSettings.Layer), MessageType.None);

                    content.text    = "Align axis";
                    content.tooltip = "If this is checked, the grabbed objects that belong to this layer will have their local axes aligned with the grab surface normal.";
                    newBool         = EditorGUILayout.ToggleLeft(content, layerGrabSettings.AlignAxis);
                    if (newBool != layerGrabSettings.AlignAxis)
                    {
                        EditorUndoEx.Record(undoRecordObject);
                        layerGrabSettings.AlignAxis = newBool;
                    }

                    content.text     = "Alignment axis";
                    content.tooltip  = "When axis alignment is turned on, this is the axis that will be aligned to the surface normal.";
                    newTransformAxis = (TransformAxis)EditorGUILayout.EnumPopup(content, layerGrabSettings.AlignmentAxis);
                    if (newTransformAxis != layerGrabSettings.AlignmentAxis)
                    {
                        EditorUndoEx.Record(undoRecordObject);
                        layerGrabSettings.AlignmentAxis = newTransformAxis;
                    }

                    content.text    = "Default offset from surface";
                    content.tooltip = "A default offset value which controls the distance between the objects and the surface they are sitting on. Negative values can be used to embed objects in the surface.";
                    newFloat        = EditorGUILayout.FloatField(content, layerGrabSettings.DefaultOffsetFromSurface);
                    if (newFloat != layerGrabSettings.DefaultOffsetFromSurface)
                    {
                        EditorUndoEx.Record(undoRecordObject);
                        layerGrabSettings.DefaultOffsetFromSurface = newFloat;
                    }

                    content.text    = "Remove";
                    content.tooltip = "Removes the settings for this layer.";
                    if (GUILayout.Button(content, GUILayout.Width(70.0f)))
                    {
                        EditorUndoEx.Record(undoRecordObject);
                        layerGrabSettings.IsActive = false;
                    }
                    EditorGUILayout.EndVertical();
                }
            }
        }
Esempio n. 14
0
        private void RenderMoveContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayoutEx.SectionHeader("Hover epsilon");
            GUIContent content = new GUIContent();

            content.text    = "Line slider";
            content.tooltip = "Controls the precision used when hovering line sliders.";
            newFloat        = EditorGUILayout.FloatField(content, MvLineSliderHoverEps);
            if (newFloat != MvLineSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvLineSliderHoverEps(newFloat);
            }

            content.text    = "Box slider";
            content.tooltip = "Controls the precision used when hovering box sliders.";
            newFloat        = EditorGUILayout.FloatField(content, MvBoxSliderHoverEps);
            if (newFloat != MvBoxSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvBoxSliderHoverEps(newFloat);
            }

            content.text    = "Cylinder slider";
            content.tooltip = "Controls the precision used when hovering cylinder sliders.";
            newFloat        = EditorGUILayout.FloatField(content, MvCylinderSliderHoverEps);
            if (newFloat != MvCylinderSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvCylinderSliderHoverEps(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Snapping");
            content.text    = "X";
            content.tooltip = "Allows you to specify the snap step for the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, MvXSnapStep);
            if (newFloat != MvXSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvXSnapStep(newFloat);
            }

            content.text    = "Y";
            content.tooltip = "Allows you to specify the snap step for the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, MvYSnapStep);
            if (newFloat != MvYSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvYSnapStep(newFloat);
            }

            content.text    = "Z";
            content.tooltip = "Allows you to specify the snap step for the Z axis.";
            newFloat        = EditorGUILayout.FloatField(content, MvZSnapStep);
            if (newFloat != MvZSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvZSnapStep(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Drag sensitivity");
            content.text    = "Sensitivity";
            content.tooltip = "This value allows you to scale the slider drag speed.";
            newFloat        = EditorGUILayout.FloatField(content, MvDragSensitivity);
            if (newFloat != MvDragSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetMvDragSensitivity(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Vertex snapping");
            _mvVertexSnapSettings.RenderEditorGUI(undoRecordObject);
        }
Esempio n. 15
0
        private void RenderScaleContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayoutEx.SectionHeader("Hover epsilon");
            var content = new GUIContent();

            content.text    = "Line slider";
            content.tooltip = "Controls the precision used when hovering line sliders.";
            newFloat        = EditorGUILayout.FloatField(content, ScLineSliderHoverEps);
            if (newFloat != ScLineSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScLineSliderHoverEps(newFloat);
            }

            content.text    = "Box slider";
            content.tooltip = "Controls the precision used when hovering box sliders.";
            newFloat        = EditorGUILayout.FloatField(content, ScBoxSliderHoverEps);
            if (newFloat != ScBoxSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScBoxSliderHoverEps(newFloat);
            }

            content.text    = "Cylinder slider";
            content.tooltip = "Controls the precision used when hovering cylinder sliders.";
            newFloat        = EditorGUILayout.FloatField(content, ScCylinderSliderHoverEps);
            if (newFloat != ScCylinderSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScCylinderSliderHoverEps(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Snapping");
            content.text    = "X";
            content.tooltip = "The snap step for the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, ScXSnapStep);
            if (newFloat != ScXSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScXSnapStep(newFloat);
            }

            content.text    = "Y";
            content.tooltip = "The snap step for the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, ScYSnapStep);
            if (newFloat != ScYSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScYSnapStep(newFloat);
            }

            content.text    = "Z";
            content.tooltip = "The snap step for the Z axis.";
            newFloat        = EditorGUILayout.FloatField(content, ScZSnapStep);
            if (newFloat != ScZSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScZSnapStep(newFloat);
            }

            content.text    = "XY";
            content.tooltip = "The snap step for the XY double-axis slider.";
            newFloat        = EditorGUILayout.FloatField(content, ScXYSnapStep);
            if (newFloat != ScXYSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScXYSnapStep(newFloat);
            }

            content.text    = "YZ";
            content.tooltip = "The snap step for the YZ double-axis slider.";
            newFloat        = EditorGUILayout.FloatField(content, ScYZSnapStep);
            if (newFloat != ScYZSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScYZSnapStep(newFloat);
            }

            content.text    = "ZX";
            content.tooltip = "The snap step for the ZX double-axis slider.";
            newFloat        = EditorGUILayout.FloatField(content, ScZXSnapStep);
            if (newFloat != ScZXSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScZXSnapStep(newFloat);
            }

            content.text    = "Uniform";
            content.tooltip = "The snap step value used for uniform scaling.";
            newFloat        = EditorGUILayout.FloatField(content, ScUniformSnapStep);
            if (newFloat != ScUniformSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScUniformScaleSnapStep(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Drag sensitivity");
            content.text    = "Sensitivity";
            content.tooltip = "This value allows you to scale the slider drag speed.";
            newFloat        = EditorGUILayout.FloatField(content, ScDragSensitivity);
            if (newFloat != ScDragSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetScDragSensitivity(newFloat);
            }
        }