Example #1
0
        public override void OnAttached()
        {
            _midCap             = new GizmoCap3D(Gizmo, GizmoHandleId.CamXYRotation);
            _midCap.DragSession = _camXYRotationDrag;
            _camXYRotationDrag.AddTargetTransform(Gizmo.Transform);

            _xSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.XRotationSlider);
            _xSlider.SetDragChannel(GizmoDragChannel.Rotation);
            _xSlider.LocalRotation = Quaternion.Euler(0.0f, 90.0f, 0.0f);
            _xSlider.SetVisible(false);
            _axesSliders.Add(_xSlider);

            _ySlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.YRotationSlider);
            _ySlider.SetDragChannel(GizmoDragChannel.Rotation);
            _ySlider.LocalRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);
            _ySlider.SetVisible(false);
            _axesSliders.Add(_ySlider);

            _zSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.ZRotationSlider);
            _zSlider.SetDragChannel(GizmoDragChannel.Rotation);
            _zSlider.SetVisible(false);
            _axesSliders.Add(_zSlider);

            _axesSliders.Make3DHoverPriorityHigherThan(_midCap.HoverPriority3D);

            _camLookSlider = new GizmoPlaneSlider2D(Gizmo, GizmoHandleId.CamZRotation);
            _camLookSlider.SetDragChannel(GizmoDragChannel.Rotation);
            _camLookSlider.SetVisible(false);

            SetupSharedLookAndFeel();
            SetupSharedSettings();
        }
Example #2
0
        public override void OnGizmoUpdateBegin()
        {
            _unformScaleDrag.Sensitivity = Settings3D.DragSensitivity;

            if (UseSnapEnableHotkey)
            {
                SetSnapEnabled(Hotkeys.EnableSnapping.IsActive());
            }

            if (UseMultiAxisScaleModeHotkey)
            {
                if (Hotkeys.ChangeMultiAxisMode.IsActive())
                {
                    SetMultiAxisScaleMode(GizmoMultiAxisScaleMode.DoubleAxis);
                }
                else
                {
                    SetMultiAxisScaleMode(GizmoMultiAxisScaleMode.Uniform);
                }
            }

            _pstvXSlider.SetVisible(LookAndFeel3D.IsPositiveSliderVisible(0));
            _pstvXSlider.Set3DCapVisible(LookAndFeel3D.IsPositiveSliderCapVisible(0));
            _pstvYSlider.SetVisible(LookAndFeel3D.IsPositiveSliderVisible(1));
            _pstvYSlider.Set3DCapVisible(LookAndFeel3D.IsPositiveSliderCapVisible(1));
            _pstvZSlider.SetVisible(LookAndFeel3D.IsPositiveSliderVisible(2));
            _pstvZSlider.Set3DCapVisible(LookAndFeel3D.IsPositiveSliderCapVisible(2));

            _negXSlider.SetVisible(LookAndFeel3D.IsNegativeSliderVisible(0));
            _negXSlider.Set3DCapVisible(LookAndFeel3D.IsNegativeSliderCapVisible(0));
            _negYSlider.SetVisible(LookAndFeel3D.IsNegativeSliderVisible(1));
            _negYSlider.Set3DCapVisible(LookAndFeel3D.IsNegativeSliderCapVisible(1));
            _negZSlider.SetVisible(LookAndFeel3D.IsNegativeSliderVisible(2));
            _negZSlider.Set3DCapVisible(LookAndFeel3D.IsNegativeSliderCapVisible(2));

            if (_multiAxisScaleMode == GizmoMultiAxisScaleMode.DoubleAxis)
            {
                _xySlider.SetVisible(LookAndFeel3D.IsDblSliderVisible(PlaneId.XY));
                _xySlider.SetBorderVisible(_xySlider.IsVisible);
                _yzSlider.SetVisible(LookAndFeel3D.IsDblSliderVisible(PlaneId.YZ));
                _yzSlider.SetBorderVisible(_yzSlider.IsVisible);
                _zxSlider.SetVisible(LookAndFeel3D.IsDblSliderVisible(PlaneId.ZX));
                _zxSlider.SetBorderVisible(_zxSlider.IsVisible);
                PlaceDblSlidersInSliderPlanes(Gizmo.FocusCamera);
            }
        }
Example #3
0
        public override void OnGizmoUpdateBegin()
        {
            if (UseSnapEnableHotkey)
            {
                SetSnapEnabled(Hotkeys.EnableSnapping.IsActive());
            }

            if (Use2DModeEnableHotkey)
            {
                Set2DModeEnabled(Hotkeys.Enable2DMode.IsActive());
            }

            // Move
            Update2DGizmoPosition();
            if (!_is2DModeEnabled)
            {
                bool vSnapWasEnabled = _isMvVertexSnapEnabled;
                if (!vSnapWasEnabled)
                {
                    _mvPostVSnapPosRestore = Gizmo.Transform.Position3D;
                }
                if (UseVertSnapEnableHotkey)
                {
                    SetMvVertexSnapEnabled(Hotkeys.EnableVertexSnapping.IsActive());
                }
                if (vSnapWasEnabled && !_isMvVertexSnapEnabled)
                {
                    Gizmo.Transform.Position3D = _mvPostVSnapPosRestore;
                }

                if (!Gizmo.IsDragged || IsDraggingMoveHandle())
                {
                    _mvPXSlider.SetVisible(LookAndFeel3D.IsMvPositiveSliderVisible(0));
                    _mvPXSlider.Set3DCapVisible(LookAndFeel3D.IsMvPositiveSliderCapVisible(0));
                    _mvPYSlider.SetVisible(LookAndFeel3D.IsMvPositiveSliderVisible(1));
                    _mvPYSlider.Set3DCapVisible(LookAndFeel3D.IsMvPositiveSliderCapVisible(1));
                    _mvPZSlider.SetVisible(LookAndFeel3D.IsMvPositiveSliderVisible(2));
                    _mvPZSlider.Set3DCapVisible(LookAndFeel3D.IsMvPositiveSliderCapVisible(2));
                    _mvNXSlider.SetVisible(LookAndFeel3D.IsMvNegativeSliderVisible(0));
                    _mvNXSlider.Set3DCapVisible(LookAndFeel3D.IsMvNegativeSliderCapVisible(0));
                    _mvNYSlider.SetVisible(LookAndFeel3D.IsMvNegativeSliderVisible(1));
                    _mvNYSlider.Set3DCapVisible(LookAndFeel3D.IsMvNegativeSliderCapVisible(1));
                    _mvNZSlider.SetVisible(LookAndFeel3D.IsMvNegativeSliderVisible(2));
                    _mvNZSlider.Set3DCapVisible(LookAndFeel3D.IsMvNegativeSliderCapVisible(2));
                }
            }

            if (!_isMvVertexSnapEnabled && !_is2DModeEnabled)
            {
                if (!Gizmo.IsDragged || IsDraggingMoveHandle())
                {
                    _mvXYSlider.SetVisible(LookAndFeel3D.IsMvDblSliderVisible(PlaneId.XY));
                    _mvXYSlider.SetBorderVisible(_mvXYSlider.IsVisible);
                    _mvYZSlider.SetVisible(LookAndFeel3D.IsMvDblSliderVisible(PlaneId.YZ));
                    _mvYZSlider.SetBorderVisible(_mvYZSlider.IsVisible);
                    _mvZXSlider.SetVisible(LookAndFeel3D.IsMvDblSliderVisible(PlaneId.ZX));
                    _mvZXSlider.SetBorderVisible(_mvZXSlider.IsVisible);

                    PlaceMvDblSlidersInSliderPlanes(Gizmo.FocusCamera);
                }
            }
            else
            if (_isMvVertexSnapEnabled)
            {
                if (GetMvVertexSnapState() == MvVertexSnapState.SelectingPivot && _mvVertexSnapDrag.SelectSnapPivotPoint(Gizmo))
                {
                    Gizmo.Transform.Position3D = _mvVertexSnapDrag.SnapPivot;
                }
            }
            else
            if (_is2DModeEnabled)
            {
                if (!Gizmo.IsDragged || IsDraggingMoveHandle())
                {
                    _mvP2DModeXSlider.SetVisible(LookAndFeel2D.IsMvPositiveSliderVisible(0));
                    _mvP2DModeXSlider.Set2DCapVisible(LookAndFeel2D.IsMvPositiveSliderCapVisible(0));
                    _mvP2DModeYSlider.SetVisible(LookAndFeel2D.IsMvPositiveSliderVisible(1));
                    _mvP2DModeYSlider.Set2DCapVisible(LookAndFeel2D.IsMvPositiveSliderCapVisible(1));
                    _mvN2DModeXSlider.SetVisible(LookAndFeel2D.IsMvNegativeSliderVisible(0));
                    _mvN2DModeXSlider.Set2DCapVisible(LookAndFeel2D.IsMvNegativeSliderCapVisible(0));
                    _mvN2DModeYSlider.SetVisible(LookAndFeel2D.IsMvNegativeSliderVisible(1));
                    _mvN2DModeYSlider.Set2DCapVisible(LookAndFeel2D.IsMvNegativeSliderCapVisible(1));

                    bool wasVisible = _mv2DModeDblSlider.IsVisible;
                    _mv2DModeDblSlider.SetVisible(LookAndFeel2D.IsMvDblSliderVisible);
                    _mv2DModeDblSlider.SetBorderVisible(LookAndFeel2D.IsMvDblSliderVisible);
                    if (!wasVisible && _mv2DModeDblSlider.IsVisible)
                    {
                        Update2DModeHandlePositions();
                    }
                }
            }

            // Rotate
            if (!_is2DModeEnabled && !_isMvVertexSnapEnabled)
            {
                if (!Gizmo.IsDragged || IsDraggingRotationHandle())
                {
                    _rtMidCap.SetVisible(LookAndFeel3D.IsRtMidCapVisible);
                    _rtCamXYRotationDrag.Sensitivity = Settings3D.RtDragSensitivity;

                    _rtXSlider.SetBorderVisible(LookAndFeel3D.IsRtAxisVisible(0));
                    _rtYSlider.SetBorderVisible(LookAndFeel3D.IsRtAxisVisible(1));
                    _rtZSlider.SetBorderVisible(LookAndFeel3D.IsRtAxisVisible(2));
                    _rtCamLookSlider.SetBorderVisible(LookAndFeel3D.IsRtCamLookSliderVisible);

                    if (_rtCamLookSlider.IsBorderVisible)
                    {
                        UpdateRtCamLookSlider(Gizmo.FocusCamera);
                    }
                }
            }

            // Scale
            _scMidCap.SetVisible(LookAndFeel3D.IsScMidCapVisible && !_is2DModeEnabled);
            _scUnformScaleDrag.Sensitivity = Settings3D.ScDragSensitivity;
        }
Example #4
0
        public override void OnGizmoUpdateBegin()
        {
            Update2DGizmoPosition();
            if (!_is2DModeEnabled && !_isVertexSnapEnabled)
            {
                _midCap.SetVisible(LookAndFeel3D.IsMidCapVisible);
            }

            if (UseSnapEnableHotkey)
            {
                SetSnapEnabled(Hotkeys.EnableSnapping.IsActive());
            }
            if (Use2DModeEnableHotkey)
            {
                Set2DModeEnabled(Hotkeys.Enable2DMode.IsActive());
            }

            if (!_is2DModeEnabled)
            {
                bool vSnapWasEnabled = _isVertexSnapEnabled;
                if (!vSnapWasEnabled)
                {
                    _postVSnapPosRestore = Gizmo.Transform.Position3D;
                }
                if (UseVertSnapEnableHotkey)
                {
                    SetVertexSnapEnabled(Hotkeys.EnableVertexSnapping.IsActive());
                }
                if (vSnapWasEnabled && !_isVertexSnapEnabled)
                {
                    Gizmo.Transform.Position3D = _postVSnapPosRestore;
                }

                _pXSlider.SetVisible(LookAndFeel3D.IsPositiveSliderVisible(0));
                _pXSlider.Set3DCapVisible(LookAndFeel3D.IsPositiveSliderCapVisible(0));
                _pYSlider.SetVisible(LookAndFeel3D.IsPositiveSliderVisible(1));
                _pYSlider.Set3DCapVisible(LookAndFeel3D.IsPositiveSliderCapVisible(1));
                _pZSlider.SetVisible(LookAndFeel3D.IsPositiveSliderVisible(2));
                _pZSlider.Set3DCapVisible(LookAndFeel3D.IsPositiveSliderCapVisible(2));

                _nXSlider.SetVisible(LookAndFeel3D.IsNegativeSliderVisible(0));
                _nXSlider.Set3DCapVisible(LookAndFeel3D.IsNegativeSliderCapVisible(0));
                _nYSlider.SetVisible(LookAndFeel3D.IsNegativeSliderVisible(1));
                _nYSlider.Set3DCapVisible(LookAndFeel3D.IsNegativeSliderCapVisible(1));
                _nZSlider.SetVisible(LookAndFeel3D.IsNegativeSliderVisible(2));
                _nZSlider.Set3DCapVisible(LookAndFeel3D.IsNegativeSliderCapVisible(2));
            }

            if (!_isVertexSnapEnabled && !_is2DModeEnabled)
            {
                _xySlider.SetVisible(LookAndFeel3D.IsDblSliderVisible(PlaneId.XY));
                _xySlider.SetBorderVisible(_xySlider.IsVisible);
                _yzSlider.SetVisible(LookAndFeel3D.IsDblSliderVisible(PlaneId.YZ));
                _yzSlider.SetBorderVisible(_yzSlider.IsVisible);
                _zxSlider.SetVisible(LookAndFeel3D.IsDblSliderVisible(PlaneId.ZX));
                _zxSlider.SetBorderVisible(_zxSlider.IsVisible);

                PlaceDblSlidersInSliderPlanes(Gizmo.FocusCamera);
            }
            else
            if (_isVertexSnapEnabled)
            {
                if (GetVertexSnapState() == VertexSnapState.SelectingPivot && _vertexSnapDrag.SelectSnapPivotPoint(Gizmo))
                {
                    Gizmo.Transform.Position3D = _vertexSnapDrag.SnapPivot;
                }
            }
            else
            if (_is2DModeEnabled)
            {
                _p2DModeXSlider.SetVisible(LookAndFeel2D.IsPositiveSliderVisible(0));
                _p2DModeXSlider.Set2DCapVisible(LookAndFeel2D.IsPositiveSliderCapVisible(0));
                _p2DModeYSlider.SetVisible(LookAndFeel2D.IsPositiveSliderVisible(1));
                _p2DModeYSlider.Set2DCapVisible(LookAndFeel2D.IsPositiveSliderCapVisible(1));
                _n2DModeXSlider.SetVisible(LookAndFeel2D.IsNegativeSliderVisible(0));
                _n2DModeXSlider.Set2DCapVisible(LookAndFeel2D.IsNegativeSliderCapVisible(0));
                _n2DModeYSlider.SetVisible(LookAndFeel2D.IsNegativeSliderVisible(1));
                _n2DModeYSlider.Set2DCapVisible(LookAndFeel2D.IsNegativeSliderCapVisible(1));

                bool wasVisible = _2DModeDblSlider.IsVisible;
                _2DModeDblSlider.SetVisible(LookAndFeel2D.IsDblSliderVisible);
                _2DModeDblSlider.SetBorderVisible(LookAndFeel2D.IsDblSliderVisible);
                if (!wasVisible && _2DModeDblSlider.IsVisible)
                {
                    Update2DModeHandlePositions();
                }
            }
        }
Example #5
0
        public override void OnAttached()
        {
            // Move
            _mvXYSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.XYDblSlider);
            _mvYZSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.YZDblSlider);
            _mvZXSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.ZXDblSlider);

            _mvDblSliders.Add(_mvXYSlider);
            _mvDblSliders.Add(_mvYZSlider);
            _mvDblSliders.Add(_mvZXSlider);

            _mvPXSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.PXSlider, GizmoHandleId.PXCap);
            _mvPXSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvPXSlider.MapDirection(0, AxisSign.Positive);

            _mvNXSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.NXSlider, GizmoHandleId.NXCap);
            _mvNXSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvNXSlider.MapDirection(0, AxisSign.Negative);

            _mvPYSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.PYSlider, GizmoHandleId.PYCap);
            _mvPYSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvPYSlider.MapDirection(1, AxisSign.Positive);

            _mvNYSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.NYSlider, GizmoHandleId.NYCap);
            _mvNYSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvNYSlider.MapDirection(1, AxisSign.Negative);

            _mvPZSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.PZSlider, GizmoHandleId.PZCap);
            _mvPZSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvPZSlider.MapDirection(2, AxisSign.Positive);

            _mvNZSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.NZSlider, GizmoHandleId.NZCap);
            _mvNZSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvNZSlider.MapDirection(2, AxisSign.Negative);

            _mvAxesSliders.Add(_mvPXSlider);
            _mvAxesSliders.Add(_mvPYSlider);
            _mvAxesSliders.Add(_mvPZSlider);
            _mvAxesSliders.Add(_mvNXSlider);
            _mvAxesSliders.Add(_mvNYSlider);
            _mvAxesSliders.Add(_mvNZSlider);
            _mvAxesSliders.Make3DHoverPriorityLowerThan(_mvXYSlider.HoverPriority3D);
            _mvAxesSliders.Make3DHoverPriorityLowerThan(_mvYZSlider.HoverPriority3D);
            _mvAxesSliders.Make3DHoverPriorityLowerThan(_mvZXSlider.HoverPriority3D);

            _mvVertSnapCap = new GizmoCap2D(Gizmo, GizmoHandleId.VertSnap);
            _mvVertSnapCap.SetVisible(false);
            _mvVertSnapCap.DragSession = _mvVertexSnapDrag;
            _mvVertexSnapDrag.AddTargetTransform(Gizmo.Transform);

            _mv2DModeDblSlider = new GizmoPlaneSlider2D(Gizmo, GizmoHandleId.CamXYSlider);
            _mv2DModeDblSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mv2DModeDblSlider.SetVisible(false);

            _mvP2DModeXSlider = new GizmoLineSlider2D(Gizmo, GizmoHandleId.PCamXSlider, GizmoHandleId.PCamXCap);
            _mvP2DModeXSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvP2DModeXSlider.MapDirection(0, AxisSign.Positive);
            _mvP2DModeXSlider.HoverPriority2D.MakeLowerThan(_mv2DModeDblSlider.HoverPriority2D);

            _mvP2DModeYSlider = new GizmoLineSlider2D(Gizmo, GizmoHandleId.PCamYSlider, GizmoHandleId.PCamYCap);
            _mvP2DModeYSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvP2DModeYSlider.MapDirection(1, AxisSign.Positive);
            _mvP2DModeYSlider.HoverPriority2D.MakeLowerThan(_mv2DModeDblSlider.HoverPriority2D);

            _mvN2DModeXSlider = new GizmoLineSlider2D(Gizmo, GizmoHandleId.NCamXSlider, GizmoHandleId.NCamXCap);
            _mvN2DModeXSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvN2DModeXSlider.MapDirection(0, AxisSign.Negative);
            _mvN2DModeXSlider.HoverPriority2D.MakeLowerThan(_mv2DModeDblSlider.HoverPriority2D);

            _mvN2DModeYSlider = new GizmoLineSlider2D(Gizmo, GizmoHandleId.NCamYSlider, GizmoHandleId.NCamYCap);
            _mvN2DModeYSlider.SetDragChannel(GizmoDragChannel.Offset);
            _mvN2DModeYSlider.MapDirection(1, AxisSign.Negative);
            _mvN2DModeYSlider.HoverPriority2D.MakeLowerThan(_mv2DModeDblSlider.HoverPriority2D);

            _mv2DModeSliders.Add(_mvP2DModeXSlider);
            _mv2DModeSliders.Add(_mvP2DModeYSlider);
            _mv2DModeSliders.Add(_mvN2DModeXSlider);
            _mv2DModeSliders.Add(_mvN2DModeYSlider);
            Hide2DModeHandles();

            // Rotate
            _rtMidCap             = new GizmoCap3D(Gizmo, GizmoHandleId.CamXYRotation);
            _rtMidCap.DragSession = _rtCamXYRotationDrag;
            _rtCamXYRotationDrag.AddTargetTransform(Gizmo.Transform);

            _rtXSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.XRotationSlider);
            _rtXSlider.SetDragChannel(GizmoDragChannel.Rotation);
            _rtXSlider.LocalRotation = Quaternion.Euler(0.0f, 90.0f, 0.0f);
            _rtXSlider.SetVisible(false);
            _rtAxesSliders.Add(_rtXSlider);

            _rtYSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.YRotationSlider);
            _rtYSlider.SetDragChannel(GizmoDragChannel.Rotation);
            _rtYSlider.LocalRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);
            _rtYSlider.SetVisible(false);
            _rtAxesSliders.Add(_rtYSlider);

            _rtZSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.ZRotationSlider);
            _rtZSlider.SetDragChannel(GizmoDragChannel.Rotation);
            _rtZSlider.SetVisible(false);
            _rtAxesSliders.Add(_rtZSlider);

            _rtCamLookSlider = new GizmoPlaneSlider2D(Gizmo, GizmoHandleId.CamZRotation);
            _rtCamLookSlider.SetDragChannel(GizmoDragChannel.Rotation);
            _rtCamLookSlider.SetVisible(false);

            // Scale
            _scMidCap             = new GizmoCap3D(Gizmo, GizmoHandleId.MidScaleCap);
            _scMidCap.DragSession = _scUnformScaleDrag;

            // Setup hover priorities
            _rtAxesSliders.Make3DHoverPriorityHigherThan(_rtMidCap.HoverPriority3D);
            _mvAxesSliders.Make3DHoverPriorityHigherThan(_rtXSlider.HoverPriority3D);
            _mvDblSliders.Make3DHoverPriorityHigherThan(_mvPXSlider.HoverPriority3D);
            _scMidCap.HoverPriority3D.MakeHigherThan(_mvXYSlider.HoverPriority3D);

            SetupSharedLookAndFeel();
            SetupSharedSettings();
        }