public void PlaybackState(ISceneChildEntity part)
        {
            if (part != null)
            {
                part.Undoing = true;

                bool ChangedScale = false;
                bool ChangedRot   = false;
                bool ChangedPos   = false;

                if (part.UUID == part.ParentEntity.UUID)
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.ParentEntity.AbsolutePosition = Position;
                    }
                    ChangedRot = true;
                    part.SetRotationOffset(true, Rotation, true);
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Scale   = Scale;
                    }

                    foreach (
                        ISceneChildEntity child in
                        part.ParentEntity.ChildrenEntities().Where(child => child.UUID != part.UUID))
                    {
                        child.Undo(); //No updates here, child undo will do it on their own
                    }
                }
                else
                {
                    if (Position != Vector3.Zero)
                    {
                        ChangedPos = true;
                        part.FixOffsetPosition(Position, false);
                    }
                    ChangedRot = true;
                    part.UpdateRotation(Rotation);
                    if (Scale != Vector3.Zero)
                    {
                        ChangedScale = true;
                        part.Resize(Scale);
                    }
                }
                part.Undoing = false;
                part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                                    (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
            }
        }
Пример #2
0
        public void PlaybackState (ISceneChildEntity part)
        {
            if (part != null) {
                part.Undoing = true;

                bool ChangedScale = false;
                bool ChangedPos = false;

                if (part.UUID == part.ParentEntity.UUID) {
                    if (Position != Vector3.Zero) {
                        ChangedPos = true;
                        part.ParentEntity.AbsolutePosition = Position;
                    }
                    part.SetRotationOffset (true, Rotation, true);
                    if (Scale != Vector3.Zero) {
                        ChangedScale = true;
                        part.Scale = Scale;
                    }

                    foreach (
                        ISceneChildEntity child in
                            part.ParentEntity.ChildrenEntities ().Where (child => child.UUID != part.UUID)) {
                        child.Undo (); //No updates here, child undo will do it on their own
                    }
                } else {
                    if (Position != Vector3.Zero) {
                        ChangedPos = true;
                        part.FixOffsetPosition (Position, false);
                    }
                    part.UpdateRotation (Rotation);
                    if (Scale != Vector3.Zero) {
                        ChangedScale = true;
                        part.Resize (Scale);
                    }
                }
                part.Undoing = false;
                var updateFlags =
                    (ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
                    (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
                    PrimUpdateFlags.Rotation;

                part.ScheduleUpdate (updateFlags);
            }
        }