コード例 #1
0
        public override void OnGizmoUpdateBegin()
        {
            Update2DGizmoPosition();
            if (!_is2DModeEnabled && !_isVertexSnapEnabled)
            {
                _midCap.SetVisible(LookAndFeel3D.IsMidCapVisible);
            }

            SetSnapEnabled(Hotkeys.EnableSnapping.IsActive());
            Set2DModeEnabled(Hotkeys.Enable2DMode.IsActive());

            if (!_is2DModeEnabled)
            {
                bool vSnapWasEnabled = _isVertexSnapEnabled;
                if (!vSnapWasEnabled)
                {
                    _postVSnapPosRestore = Gizmo.Transform.Position3D;
                }
                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();
                }
            }
        }
コード例 #2
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;
        }