public void PlayfwdState(SceneObjectPart part) { if (part != null) { bool ChangedScale = false; bool ChangedRot = false; bool ChangedPos = false; part.Undoing = true; if (part.UUID == part.ParentGroup.UUID) { if (Position != Vector3.Zero) { ChangedPos = true; part.ParentGroup.AbsolutePosition = Position; } if (Rotation != Quaternion.Identity) { ChangedRot = true; part.UpdateRotation(Rotation); } if (Scale != Vector3.Zero) { ChangedScale = true; part.Resize(Scale); } foreach (SceneObjectPart child in part.ParentGroup.ChildrenList) { if (child.UUID != part.UUID) { child.Redo(); //No updates here, child redo will do it on their own } } } else { if (Position != Vector3.Zero) { ChangedPos = true; part.FixOffsetPosition(Position, false); } if (Rotation != Quaternion.Identity) { ChangedRot = true; part.ParentGroup.Rotation = (Rotation); } if (Scale != Vector3.Zero) { ChangedScale = true; part.Resize(Scale); } } part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) | (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) | (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None)); part.Undoing = false; } }
private void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader) { obj.FixOffsetPosition(ReadVector(reader, "OffsetPosition"), true); }
/// <summary> /// Builds the prim from a datarecord. /// </summary> /// <param name = "primRow">datarecord</param> /// <returns></returns> private static SceneObjectPart BuildPrim(IDataRecord primRow, IScene scene) { SceneObjectPart prim = new SceneObjectPart(scene) { UUID = new UUID((Guid)primRow["UUID"]), CreationDate = Convert.ToInt32(primRow["CreationDate"]), Name = (string)primRow["Name"], Text = (string)primRow["Text"], Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]), Convert.ToInt32(primRow["ColorR"]), Convert.ToInt32(primRow["ColorG"]), Convert.ToInt32(primRow["ColorB"])), Description = (string)primRow["Description"], SitName = (string)primRow["SitName"], TouchName = (string)primRow["TouchName"], Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]), CreatorID = new UUID((Guid)primRow["CreatorID"]), OwnerID = new UUID((Guid)primRow["OwnerID"]), GroupID = new UUID((Guid)primRow["GroupID"]), LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]), OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]), NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]), GroupMask = Convert.ToUInt32(primRow["GroupMask"]), EveryoneMask = Convert.ToUInt32(primRow["EveryoneMask"]), BaseMask = Convert.ToUInt32(primRow["BaseMask"]) }; // explicit conversion of integers is required, which sort // of sucks. No idea if there is a shortcut here or not. // various text fields // permissions // vectors prim.FixOffsetPosition(new Vector3( Convert.ToSingle(primRow["PositionX"]), Convert.ToSingle(primRow["PositionY"]), Convert.ToSingle(primRow["PositionZ"])) , true); prim.FixGroupPosition(new Vector3( Convert.ToSingle(primRow["GroupPositionX"]), Convert.ToSingle(primRow["GroupPositionY"]), Convert.ToSingle(primRow["GroupPositionZ"])) , true); prim.Velocity = new Vector3( Convert.ToSingle(primRow["VelocityX"]), Convert.ToSingle(primRow["VelocityY"]), Convert.ToSingle(primRow["VelocityZ"])); prim.AngularVelocity = new Vector3( Convert.ToSingle(primRow["AngularVelocityX"]), Convert.ToSingle(primRow["AngularVelocityY"]), Convert.ToSingle(primRow["AngularVelocityZ"])); prim.Acceleration = new Vector3( Convert.ToSingle(primRow["AccelerationX"]), Convert.ToSingle(primRow["AccelerationY"]), Convert.ToSingle(primRow["AccelerationZ"])); // quaternions prim.RotationOffset = new Quaternion( Convert.ToSingle(primRow["RotationX"]), Convert.ToSingle(primRow["RotationY"]), Convert.ToSingle(primRow["RotationZ"]), Convert.ToSingle(primRow["RotationW"])); prim.SitTargetPositionLL = new Vector3( Convert.ToSingle(primRow["SitTargetOffsetX"]), Convert.ToSingle(primRow["SitTargetOffsetY"]), Convert.ToSingle(primRow["SitTargetOffsetZ"])); prim.SitTargetOrientationLL = new Quaternion( Convert.ToSingle(primRow["SitTargetOrientX"]), Convert.ToSingle(primRow["SitTargetOrientY"]), Convert.ToSingle(primRow["SitTargetOrientZ"]), Convert.ToSingle(primRow["SitTargetOrientW"])); prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]); prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]); prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]); prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]); prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]); prim.Sound = new UUID((Guid)primRow["LoopedSound"]); prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]); prim.SoundFlags = 1; // If it's persisted at all, it's looped if (!(primRow["TextureAnimation"] is DBNull)) { prim.TextureAnimation = (Byte[])primRow["TextureAnimation"]; } if (!(primRow["ParticleSystem"] is DBNull)) { prim.ParticleSystem = (Byte[])primRow["ParticleSystem"]; } prim.AngularVelocity = new Vector3( Convert.ToSingle(primRow["OmegaX"]), Convert.ToSingle(primRow["OmegaY"]), Convert.ToSingle(primRow["OmegaZ"])); prim.CameraEyeOffset = new Vector3( Convert.ToSingle(primRow["CameraEyeOffsetX"]), Convert.ToSingle(primRow["CameraEyeOffsetY"]), Convert.ToSingle(primRow["CameraEyeOffsetZ"]) ); prim.CameraAtOffset = new Vector3( Convert.ToSingle(primRow["CameraAtOffsetX"]), Convert.ToSingle(primRow["CameraAtOffsetY"]), Convert.ToSingle(primRow["CameraAtOffsetZ"]) ); if (Convert.ToInt16(primRow["ForceMouselook"]) != 0) { prim.ForceMouselook = (true); } prim.ScriptAccessPin = Convert.ToInt32(primRow["ScriptAccessPin"]); if (Convert.ToInt16(primRow["AllowedDrop"]) != 0) { prim.AllowedDrop = true; } if (Convert.ToInt16(primRow["DieAtEdge"]) != 0) { prim.DIE_AT_EDGE = true; } prim.SalePrice = Convert.ToInt32(primRow["SalePrice"]); prim.ObjectSaleType = Convert.ToByte(primRow["SaleType"]); prim.Material = Convert.ToByte(primRow["Material"]); if (!(primRow["ClickAction"] is DBNull)) { prim.ClickAction = Convert.ToByte(primRow["ClickAction"]); } prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]); prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); prim.PassTouch = Convert.ToInt32(primRow["PassTouches"]); prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); prim.GenericData = (string)primRow["Generic"]; if (!(primRow["MediaURL"] is DBNull)) { prim.MediaUrl = (string)primRow["MediaURL"]; } return(prim); }
public void PlaybackState(SceneObjectPart part) { if (part != null) { part.Undoing = true; bool ChangedScale = false; bool ChangedRot = false; bool ChangedPos = false; if (part.UUID == part.ParentGroup.UUID) { if (Position != Vector3.Zero) { ChangedPos = true; part.ParentGroup.AbsolutePosition = Position; } ChangedRot = true; part.RotationOffset = Rotation; if (Scale != Vector3.Zero) { ChangedScale = true; part.Scale = Scale; } #if (!ISWIN) foreach (SceneObjectPart child in part.ParentGroup.ChildrenList) { if (child.UUID != part.UUID) { child.Undo(); //No updates here, child undo will do it on their own } } #else foreach (SceneObjectPart child in part.ParentGroup.ChildrenList.Where(child => child.UUID != part.UUID)) { child.Undo(); //No updates here, child undo will do it on their own } #endif } 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)); } }