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();
        }
        public GizmoPolygon2DBorder(GizmoPlaneSlider2D planeSlider, GizmoHandle targetHandle, PolygonShape2D targetPolygon)
        {
            _planeSlider = planeSlider;

            _targetHandle  = targetHandle;
            _targetPolygon = targetPolygon;

            _borderPolygonIndex          = _targetHandle.Add2DShape(_borderPolygon);
            _borderPolygon.PtContainMode = Shape2DPtContainMode.OnBorder;

            _thickBorderPolygonIndex          = _targetHandle.Add2DShape(_thickBorderPolygon);
            _thickBorderPolygon.PtContainMode = Shape2DPtContainMode.OnBorder;
            _thickBorderPolygon.BorderRenderDesc.BorderType = Shape2DBorderType.Thick;
            _thickBorderPolygon.BorderRenderDesc.Direction  = Shape2DBorderDirection.Outward;

            _controllerData.Border                  = this;
            _controllerData.PlaneSlider             = _planeSlider;
            _controllerData.BorderPolygon           = _borderPolygon;
            _controllerData.BorderPolygonIndex      = _borderPolygonIndex;
            _controllerData.ThickBorderPolygon      = _thickBorderPolygon;
            _controllerData.ThickBorderPolygonIndex = _thickBorderPolygonIndex;
            _controllerData.Gizmo         = targetHandle.Gizmo;
            _controllerData.TargetHandle  = targetHandle;
            _controllerData.TargetPolygon = _targetPolygon;

            _controllers[(int)GizmoPolygon2DBorderType.Thin]  = new GizmoThinPolygon2DBorderController(_controllerData);
            _controllers[(int)GizmoPolygon2DBorderType.Thick] = new GizmoThickPolygon2DBorderController(_controllerData);

            _targetHandle.Gizmo.PreUpdateBegin += OnGizmoPreUpdateBegin;
        }
Exemple #3
0
        public override void UpdateTransforms()
        {
            CircleShape2D      circle = _data.Circle;
            GizmoPlaneSlider2D slider = _data.Slider;

            circle.Center          = slider.Position;
            circle.RotationDegrees = slider.RotationDegrees;
            circle.Radius          = slider.GetRealCircleRadius();
            _data.CircleBorder.OnCircleShapeChanged();
        }
        public override void UpdateTransforms()
        {
            QuadShape2D        quad   = _data.Quad;
            GizmoPlaneSlider2D slider = _data.Slider;

            quad.Center          = slider.Position;
            quad.RotationDegrees = slider.RotationDegrees;
            quad.Size            = slider.GetRealQuadSize();
            _data.QuadBorder.OnQuadShapeChanged();
        }
        public GizmoCircle2DBorder(GizmoPlaneSlider2D planeSlider, GizmoHandle targetHandle, CircleShape2D targetCircle)
        {
            _planeSlider = planeSlider;

            _targetHandle = targetHandle;
            _targetCircle = targetCircle;

            _borderCircleIndex          = _targetHandle.Add2DShape(_borderCircle);
            _borderCircle.PtContainMode = Shape2DPtContainMode.OnBorder;

            _controllerData.Border            = this;
            _controllerData.PlaneSlider       = _planeSlider;
            _controllerData.BorderCircle      = _borderCircle;
            _controllerData.BorderCircleIndex = _borderCircleIndex;
            _controllerData.Gizmo             = targetHandle.Gizmo;
            _controllerData.TargetHandle      = targetHandle;
            _controllerData.TargetCircle      = _targetCircle;

            _controllers[(int)GizmoCircle2DBorderType.Thin] = new GizmoThinCircle2DBorderController(_controllerData);

            _targetHandle.Gizmo.PreUpdateBegin += OnGizmoPreUpdateBegin;
        }
 public void ConnectCamLookSliderSettings(GizmoPlaneSlider2D slider)
 {
     slider.SharedSettings = _camLookSliderSettings;
 }
Exemple #7
0
        public override void OnAttached()
        {
            _midCap = new GizmoCap3D(Gizmo, GizmoHandleId.MidDisplayCap);
            _midCap.SetHoverable(false);

            _xySlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.XYDblSlider);
            _yzSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.YZDblSlider);
            _zxSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.ZXDblSlider);

            _dblSliders.Add(_xySlider);
            _dblSliders.Add(_yzSlider);
            _dblSliders.Add(_zxSlider);

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

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

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

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

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

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

            _axesSliders.Add(_pXSlider);
            _axesSliders.Add(_pYSlider);
            _axesSliders.Add(_pZSlider);
            _axesSliders.Add(_nXSlider);
            _axesSliders.Add(_nYSlider);
            _axesSliders.Add(_nZSlider);
            _axesSliders.Make3DHoverPriorityLowerThan(_xySlider.HoverPriority3D);
            _axesSliders.Make3DHoverPriorityLowerThan(_yzSlider.HoverPriority3D);
            _axesSliders.Make3DHoverPriorityLowerThan(_zxSlider.HoverPriority3D);

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

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

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

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

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

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

            _2DModeSliders.Add(_p2DModeXSlider);
            _2DModeSliders.Add(_p2DModeYSlider);
            _2DModeSliders.Add(_n2DModeXSlider);
            _2DModeSliders.Add(_n2DModeYSlider);
            Hide2DModeHandles();

            SetupSharedLookAndFeel();
            SetupSharedSettings();
        }
 public void ConnectCamLookSliderLookAndFeel(GizmoPlaneSlider2D slider)
 {
     slider.SharedLookAndFeel = _camLookSliderLookAndFeel;
 }
Exemple #9
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();
        }
 public void ConnectDblSliderSettings(GizmoPlaneSlider2D slider)
 {
     slider.SharedSettings = _dblSliderSettings;
 }
Exemple #11
0
 public void ConnectMvDblSliderLookAndFeel(GizmoPlaneSlider2D slider)
 {
     slider.SharedLookAndFeel = _mvDblSliderLookAndFeel;
 }