Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="gizmo">The gizmo which owns the slider.</param>
        /// <param name="handleId">The id of the slider handle.</param>
        /// <param name="capHandleId">The id of the slider's cap handle.</param>
        public GizmoLineSlider3D(Gizmo gizmo, int handleId, int capHandleId)
            : base(gizmo, handleId)
        {
            _segmentIndex  = Handle.Add3DShape(_segment);
            _boxIndex      = Handle.Add3DShape(_box);
            _cylinderIndex = Handle.Add3DShape(_cylinder);

            _cap3D = new GizmoCap3D(Gizmo, capHandleId);
            SetupSharedLookAndFeel();

            MapDirection(0, AxisSign.Positive);
            SetDragChannel(GizmoDragChannel.Offset);

            _controllerData.Gizmo         = Gizmo;
            _controllerData.Slider        = this;
            _controllerData.SliderHandle  = Handle;
            _controllerData.Segment       = _segment;
            _controllerData.Box           = _box;
            _controllerData.Cylinder      = _cylinder;
            _controllerData.SegmentIndex  = _segmentIndex;
            _controllerData.BoxIndex      = _boxIndex;
            _controllerData.CylinderIndex = _cylinderIndex;

            _controllers[(int)GizmoLine3DType.Thin]     = new GizmoThinLineSlider3DController(_controllerData);
            _controllers[(int)GizmoLine3DType.Box]      = new GizmoBoxLineSlider3DController(_controllerData);
            _controllers[(int)GizmoLine3DType.Cylinder] = new GizmoCylinderLineSlider3DController(_controllerData);

            _transform.Changed        += OnTransformChanged;
            Gizmo.PreUpdateBegin      += OnGizmoPreUpdateBegin;
            Gizmo.PreDragBeginAttempt += OnGizmoAttemptHandleDragBegin;
            Gizmo.PreHoverEnter       += OnGizmoHandleHoverEnter;
            Gizmo.PreHoverExit        += OnGizmoHandleHoverExit;
            Gizmo.PostEnabled         += OnGizmoPostEnabled;
            Gizmo.PostDisabled        += OnGizmoPostDisabled;

            AddTargetTransform(_transform);
            AddTargetTransform(Gizmo.Transform);
            _cap3D.RegisterTransformAsDragTarget(_offsetDrag);
            _cap3D.RegisterTransformAsDragTarget(_rotationDrag);
            _cap3D.RegisterTransformAsDragTarget(_scaleDrag);
            _transform.SetParent(Gizmo.Transform);
        }
Ejemplo n.º 2
0
        public GizmoPlaneSlider3D(Gizmo gizmo, int handleId)
            : base(gizmo, handleId)
        {
            _quadIndex       = Handle.Add3DShape(_quad);
            _raTriangleIndex = Handle.Add3DShape(_raTriangle);
            _circleIndex     = Handle.Add3DShape(_circle);

            _quadBorder       = new GizmoQuad3DBorder(this, Handle, _quad);
            _raTriangleBorder = new GizmoRATriangle3DBorder(this, Handle, _raTriangle);
            _circleBorder     = new GizmoCircle3DBorder(this, Handle, _circle);

            _controllerData.Gizmo            = Gizmo;
            _controllerData.Slider           = this;
            _controllerData.SliderHandle     = Handle;
            _controllerData.QuadBorder       = _quadBorder;
            _controllerData.Quad             = _quad;
            _controllerData.QuadIndex        = _quadIndex;
            _controllerData.RATriangleBorder = _raTriangleBorder;
            _controllerData.RATriangle       = _raTriangle;
            _controllerData.RATriangleIndex  = _raTriangleIndex;
            _controllerData.CircleBorder     = _circleBorder;
            _controllerData.Circle           = _circle;
            _controllerData.CircleIndex      = _circleIndex;

            _controllers[(int)GizmoPlane3DType.Quad]       = new GizmoQuadPlaneSlider3DController(_controllerData);
            _controllers[(int)GizmoPlane3DType.RATriangle] = new GizmoRATrianglePlaneSlider3DController(_controllerData);
            _controllers[(int)GizmoPlane3DType.Circle]     = new GizmoCirclePlaneSlider3DController(_controllerData);

            _transform.Changed        += OnTransformChanged;
            Gizmo.PreUpdateBegin      += OnGizmoPreUpdateBegin;
            Gizmo.PreDragBeginAttempt += OnGizmoAttemptHandleDragBegin;
            Gizmo.PostEnabled         += OnGizmoPostEnabled;
            Handle.CanHover           += OnCanHoverHandle;

            SetDragChannel(GizmoDragChannel.Offset);
            AddTargetTransform(_transform);
            AddTargetTransform(Gizmo.Transform);
            _transform.SetParent(Gizmo.Transform);
        }
Ejemplo n.º 3
0
        public GizmoCap3D(Gizmo gizmo, int handleId)
            : base(gizmo, handleId)
        {
            _coneIndex    = Handle.Add3DShape(_cone);
            _pyramidIndex = Handle.Add3DShape(_pyramid);
            _boxIndex     = Handle.Add3DShape(_box);
            _sphereIndex  = Handle.Add3DShape(_sphere);
            _trPrismIndex = Handle.Add3DShape(_trPrism);

            SetZoomFactorTransform(_transform);

            _controllerData.Gizmo        = Gizmo;
            _controllerData.Cap          = this;
            _controllerData.CapHandle    = Handle;
            _controllerData.Cone         = _cone;
            _controllerData.ConeIndex    = _coneIndex;
            _controllerData.Pyramid      = _pyramid;
            _controllerData.PyramidIndex = _pyramidIndex;
            _controllerData.Box          = _box;
            _controllerData.BoxIndex     = _boxIndex;
            _controllerData.Sphere       = _sphere;
            _controllerData.SphereIndex  = _sphereIndex;
            _controllerData.TrPrism      = _trPrism;
            _controllerData.TrPrismIndex = _trPrismIndex;

            _controllers[(int)GizmoCap3DType.Cone]        = new GizmoConeCap3DController(_controllerData);
            _controllers[(int)GizmoCap3DType.Pyramid]     = new GizmoPyramidCap3DController(_controllerData);
            _controllers[(int)GizmoCap3DType.Box]         = new GizmoBoxCap3DController(_controllerData);
            _controllers[(int)GizmoCap3DType.Sphere]      = new GizmoSphereCap3DController(_controllerData);
            _controllers[(int)GizmoCap3DType.TriangPrism] = new GizmoTriPrismCap3DController(_controllerData);

            _transform.Changed += OnTransformChanged;
            _transform.SetParent(Gizmo.Transform);
            Gizmo.PreUpdateBegin += OnGizmoPreUpdateBegin;
            Gizmo.PostEnabled    += OnGizmoPostEnabled;
            Gizmo.PostDisabled   += OnGizmoPostDisabled;
        }