Exemple #1
0
        public override ITransformGizmo Build(FScene scene, List <SceneObject> targets)
        {
            if (targets.Count != 1)
            {
                return(null);
            }
            LengthenPivotSO pivotSO = targets[0] as LengthenPivotSO;

            if (pivotSO == null)
            {
                return(null);
            }

            // [TODO] lost this functionality when we removed OriginalFrameS.
            //
            //Frame3f frameS = pivotSO.OriginalFrameS;
            Frame3f frameS = pivotSO.GetLocalFrame(CoordSpace.SceneCoords);

            MoveLengthenPivotGizmo gizmo = new MoveLengthenPivotGizmo();

            gizmo.ScenePositionF = (ray) => {
                DistLine3Ray3 dist = new DistLine3Ray3(ray, new Line3d(frameS.Origin, -frameS.Y));
                dist.Compute();
                // [RMS] disabling clamp here because we don't know original "start" point now
                //if (dist.LineParameter < 0)
                //    return dist.Line.Origin;
                //else
                return(dist.LineClosest);
            };

            gizmo.WidgetScale = WidgetScale;
            gizmo.Create(scene, targets);
            return(gizmo);
        }
Exemple #2
0
        public static bool EmitLengthenPivotSO(SceneSerializer s, IOutputStream o, SceneObject gso)
        {
            LengthenPivotSO so = gso as LengthenPivotSO;

            if (so == null)
            {
                throw new Exception("EmitLengthenPivotSO: input so is not an LengthenPivotSO!");
            }
            o.AddAttribute(IOStrings.ASOType, so.Type.identifier);
            s.EmitFrame(o, PivotOriginalLegPoint, new Frame3f(so.InitialLegPtL));
            SceneSerializerEmitTypesExt.EmitPivotSO(s, o, so as PivotSO);
            return(true);
        }
Exemple #3
0
        public static SceneObject BuildLengthenPivotSO(SOFactory factory, FScene scene, TypedAttribSet attributes)
        {
            LengthenPivotSO so = new LengthenPivotSO();

            so.Create(scene.PivotSOMaterial);
            factory.RestorePivotSOType(scene, attributes, so);
            if (factory.find_struct(attributes, PivotOriginalLegPoint) != null)
            {
                Frame3f frameL = factory.RestoreFrame(attributes, PivotOriginalLegPoint);
                so.InitialLegPtL = frameL.Origin;
            }
            else
            {
                so.InitialLegPtL = Vector3d.Zero;
            }
            return(so);
        }