public override void UpdateTransforms(float zoomFactor) { GizmoLineSlider3D slider = _data.Slider; _data.Segment.StartPoint = slider.StartPosition; _data.Segment.SetEndPtFromStart(slider.Direction, slider.GetRealLength(zoomFactor)); }
public override void UpdateTransforms(float zoomFactor) { GizmoLineSlider3D slider = _data.Slider; _data.Box.AlignWidth(slider.GetRealDirection()); _data.Box.Size = new Vector3(slider.GetRealLength(zoomFactor), slider.GetRealBoxHeight(zoomFactor), slider.GetRealBoxDepth(zoomFactor)); _data.Box.SetFaceCenter(BoxFace.Left, slider.StartPosition); }
public void Remove(GizmoLineSlider3D slider) { if (Contains(slider)) { _sliders.Remove(slider); _handleIdToSlider.Remove(slider.HandleId); } }
public void Add(GizmoLineSlider3D slider) { if (!Contains(slider)) { _sliders.Add(slider); _handleIdToSlider.Add(slider.HandleId, slider); } }
public override float GetRealSizeAlongDirection(Vector3 direction, float zoomFactor) { GizmoLineSlider3D slider = _data.Slider; float cylinderLength = slider.GetRealLength(zoomFactor); float cylinderRadius = slider.GetRealCylinderRadius(zoomFactor); Vector3 size = _data.Cylinder.Rotation * new Vector3(cylinderRadius * 2.0f, cylinderLength, cylinderRadius * 2.0f); return(Vector3Ex.AbsDot(direction, size)); }
public override void UpdateTransforms(float zoomFactor) { GizmoLineSlider3D slider = _data.Slider; _data.Cylinder.AlignCentralAxis(slider.GetRealDirection()); _data.Cylinder.Radius = slider.GetRealCylinderRadius(zoomFactor); _data.Cylinder.Height = slider.GetRealLength(zoomFactor); _data.Cylinder.BaseCenter = slider.StartPosition; }
public override float GetRealSizeAlongDirection(Vector3 direction, float zoomFactor) { direction.Normalize(); GizmoLineSlider3D slider = _data.Slider; float boxWidth = slider.GetRealLength(zoomFactor); float boxHeight = slider.GetRealBoxHeight(zoomFactor); float boxDepth = slider.GetRealBoxDepth(zoomFactor); Vector3 size = _data.Box.Rotation * new Vector3(boxWidth, boxHeight, boxDepth); return(Vector3Ex.AbsDot(direction, size)); }
public override void OnAttached() { RTUndoRedo.Get.UndoEnd += OnUndoRedoEnd; RTUndoRedo.Get.RedoEnd += OnUndoRedoEnd; _rightExtrude = new GizmoLineSlider3D(Gizmo, GizmoHandleId.ExtrudeSliderRight, GizmoHandleId.ExtrudeCapRight); _rightExtrude.SetDragChannel(GizmoDragChannel.Offset); _leftExtrude = new GizmoLineSlider3D(Gizmo, GizmoHandleId.ExtrudeSliderLeft, GizmoHandleId.ExtrudeCapLeft); _leftExtrude.SetDragChannel(GizmoDragChannel.Offset); _upExtrude = new GizmoLineSlider3D(Gizmo, GizmoHandleId.ExtrudeSliderTop, GizmoHandleId.ExtrudeCapTop); _upExtrude.SetDragChannel(GizmoDragChannel.Offset); _bottomExtrude = new GizmoLineSlider3D(Gizmo, GizmoHandleId.ExtrudeSliderBottom, GizmoHandleId.ExtrudeCapBottom); _bottomExtrude.SetDragChannel(GizmoDragChannel.Offset); _frontExtrude = new GizmoLineSlider3D(Gizmo, GizmoHandleId.ExtrudeSliderBack, GizmoHandleId.ExtrudeCapBack); _frontExtrude.SetDragChannel(GizmoDragChannel.Offset); _backExtrude = new GizmoLineSlider3D(Gizmo, GizmoHandleId.ExtrudeSliderFront, GizmoHandleId.ExtrudeCapFront); _backExtrude.SetDragChannel(GizmoDragChannel.Offset); _extrudeSliders.Add(_rightExtrude); _extrudeSliders.Add(_upExtrude); _extrudeSliders.Add(_frontExtrude); _extrudeSliders.Add(_leftExtrude); _extrudeSliders.Add(_bottomExtrude); _extrudeSliders.Add(_backExtrude); _extrudeSliders.SetSnapEnabled(true); _boundsQConfig.ObjectTypes = GameObjectType.Sprite | GameObjectType.Mesh; _boundsQConfig.NoVolumeSize = Vector3.zero; _sceneOverlapFilter.AllowedObjectTypes.Add(GameObjectType.Mesh); _sceneOverlapFilter.AllowedObjectTypes.Add(GameObjectType.Sprite); ValidateBoxSize(); SetupSharedLookAndFeel(); }
public override void OnAttached() { _midCap = new GizmoCap3D(Gizmo, GizmoHandleId.MidScaleCap); _midCap.DragSession = _unformScaleDrag; _pstvXSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.PXSlider, GizmoHandleId.PXCap); _pstvXSlider.SetDragChannel(GizmoDragChannel.Scale); _pstvXSlider.MapDirection(0, AxisSign.Positive); _pstvXSlider.ScaleDragAxisIndex = 0; _negXSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.NXSlider, GizmoHandleId.NXCap); _negXSlider.SetDragChannel(GizmoDragChannel.Scale); _negXSlider.MapDirection(0, AxisSign.Negative); _negXSlider.ScaleDragAxisIndex = 0; _pstvYSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.PYSlider, GizmoHandleId.PYCap); _pstvYSlider.SetDragChannel(GizmoDragChannel.Scale); _pstvYSlider.MapDirection(1, AxisSign.Positive); _pstvYSlider.ScaleDragAxisIndex = 1; _negYSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.NYSlider, GizmoHandleId.NYCap); _negYSlider.SetDragChannel(GizmoDragChannel.Scale); _negYSlider.MapDirection(1, AxisSign.Negative); _negYSlider.ScaleDragAxisIndex = 1; _pstvZSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.PZSlider, GizmoHandleId.PZCap); _pstvZSlider.SetDragChannel(GizmoDragChannel.Scale); _pstvZSlider.MapDirection(2, AxisSign.Positive); _pstvZSlider.ScaleDragAxisIndex = 2; _negZSlider = new GizmoLineSlider3D(Gizmo, GizmoHandleId.NZSlider, GizmoHandleId.NZCap); _negZSlider.SetDragChannel(GizmoDragChannel.Scale); _negZSlider.MapDirection(2, AxisSign.Negative); _negZSlider.ScaleDragAxisIndex = 2; _axesSliders.Add(_pstvXSlider); _axesSliders.Add(_pstvYSlider); _axesSliders.Add(_pstvZSlider); _axesSliders.Add(_negXSlider); _axesSliders.Add(_negYSlider); _axesSliders.Add(_negZSlider); _axesSliders.Make3DHoverPriorityLowerThan(_midCap.HoverPriority3D); _axesSliders.RegisterScalerHandle(_midCap.HandleId, new int[] { 0, 1, 2 }); _xySlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.XYDblSlider); _xySlider.SetDragChannel(GizmoDragChannel.Scale); _xySlider.ScaleDragAxisIndexRight = 0; _xySlider.ScaleDragAxisIndexUp = 1; _yzSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.YZDblSlider); _yzSlider.SetDragChannel(GizmoDragChannel.Scale); _yzSlider.ScaleDragAxisIndexRight = 1; _yzSlider.ScaleDragAxisIndexUp = 2; _zxSlider = new GizmoPlaneSlider3D(Gizmo, GizmoHandleId.ZXDblSlider); _zxSlider.SetDragChannel(GizmoDragChannel.Scale); _zxSlider.ScaleDragAxisIndexRight = 2; _zxSlider.ScaleDragAxisIndexUp = 0; _dblSliders.Add(_xySlider); _dblSliders.Add(_yzSlider); _dblSliders.Add(_zxSlider); _axesSliders.RegisterScalerHandle(_xySlider.HandleId, new int[] { _xySlider.ScaleDragAxisIndexRight, _xySlider.ScaleDragAxisIndexUp }); _axesSliders.RegisterScalerHandle(_yzSlider.HandleId, new int[] { _yzSlider.ScaleDragAxisIndexRight, _yzSlider.ScaleDragAxisIndexUp }); _axesSliders.RegisterScalerHandle(_zxSlider.HandleId, new int[] { _zxSlider.ScaleDragAxisIndexRight, _zxSlider.ScaleDragAxisIndexUp }); SetMultiAxisScaleMode(GizmoMultiAxisScaleMode.Uniform); SetupSharedLookAndFeel(); SetupSharedSettings(); }
public void ConnectSliderSettings(GizmoLineSlider3D slider, int axisIndex, AxisSign axisSign) { slider.SharedSettings = GetSglSliderSettings(axisIndex, axisSign); }
public void ConnectSliderLookAndFeel(GizmoLineSlider3D slider, int axisIndex, AxisSign axisSign) { slider.SharedLookAndFeel = GetSglSliderLookAndFeel(axisIndex, axisSign); }
public void MakeSliderPlane(GizmoTransform sliderPlaneTransform, PlaneId planeId, GizmoLineSlider3D firstAxisSlider, GizmoLineSlider3D secondAxisSlider, Camera camera) { PlaneQuadrantId quadrantId = sliderPlaneTransform.Get3DQuadrantFacingCamera(planeId, camera); AlignToQuadrant(sliderPlaneTransform, planeId, quadrantId, true); Vector3 firstQdrAxis = sliderPlaneTransform.GetAxis3D(PlaneIdHelper.GetFirstAxisDescriptor(planeId, quadrantId)); Vector3 secondQdrAxis = sliderPlaneTransform.GetAxis3D(PlaneIdHelper.GetSecondAxisDescriptor(planeId, quadrantId)); Vector3 sliderOffset = firstQdrAxis * secondAxisSlider.GetRealSizeAlongDirection(camera, firstQdrAxis) * 0.5f + secondQdrAxis * firstAxisSlider.GetRealSizeAlongDirection(camera, secondQdrAxis) * 0.5f; if (LookAndFeel.PlaneType == GizmoPlane3DType.Quad) { SetQuadCornerPosition(QuadCorner.BottomLeft, sliderPlaneTransform.Position3D + sliderOffset); } }
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 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 bool Contains(GizmoLineSlider3D slider) { return(_handleIdToSlider.ContainsKey(slider.HandleId)); }
public override float GetRealSizeAlongDirection(Vector3 direction, float zoomFactor) { GizmoLineSlider3D slider = _data.Slider; return(Vector3Ex.AbsDot(direction, slider.Direction * slider.GetRealLength(zoomFactor))); }