From 5fd2fa687edd1a559ce2ed569308acdfa99bee65 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 16 Nov 2007 22:13:13 +0000 Subject: * Resolved the situation where prim is loaded from storage and when pushed never stops. --- OpenSim/Region/Environment/Scenes/Scene.cs | 1 + .../Region/Environment/Scenes/SceneObjectPart.cs | 55 +++++++++++++++------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 10 ++-- 3 files changed, 44 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 24755b3..f6a6461 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -553,6 +553,7 @@ namespace OpenSim.Region.Environment.Scenes new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); + rootPart.doPhysicsPropertyUpdate(UsePhysics); } MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 0a81679..61cc973 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -130,8 +130,8 @@ namespace OpenSim.Region.Environment.Scenes public uint ObjectFlags { - get { return (uint) m_flags; } - set { m_flags = (LLObject.ObjectFlags) value; } + get { return (uint) m_flags;} + set {m_flags = (LLObject.ObjectFlags) value;} } protected LLObject.MaterialType m_material = 0; @@ -416,7 +416,7 @@ namespace OpenSim.Region.Environment.Scenes m_name = "Primitive"; m_regionHandle = regionHandle; m_parentGroup = parent; - + CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; OwnerID = ownerID; CreatorID = OwnerID; @@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes { m_regionHandle = regionHandle; m_parentGroup = parent; - + TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); CreationDate = creationDate; OwnerID = ownerID; CreatorID = creatorID; @@ -490,6 +490,9 @@ namespace OpenSim.Region.Environment.Scenes OffsetPosition = position; RotationOffset = rotation; ObjectFlags = flags; + bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); + doPhysicsPropertyUpdate(UsePhysics); + ScheduleFullUpdate(); } #endregion @@ -502,7 +505,11 @@ namespace OpenSim.Region.Environment.Scenes public static SceneObjectPart FromXml(XmlReader xmlReader) { XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); - return (SceneObjectPart) serializer.Deserialize(xmlReader); + SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); + bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); + newobject.doPhysicsPropertyUpdate(UsePhysics); + + return newobject; } /// @@ -567,6 +574,8 @@ namespace OpenSim.Region.Environment.Scenes byte[] extraP = new byte[Shape.ExtraParams.Length]; Array.Copy(Shape.ExtraParams, extraP, extraP.Length); dupe.Shape.ExtraParams = extraP; + bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); + dupe.doPhysicsPropertyUpdate(UsePhysics); return dupe; } @@ -890,8 +899,9 @@ namespace OpenSim.Region.Environment.Scenes // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); ScheduleFullUpdate(); } - private void doPhysicsPropertyUpdate(bool UsePhysics) + public void doPhysicsPropertyUpdate(bool UsePhysics) { + if (PhysActor != null) { if (PhysActor.IsPhysical) @@ -903,21 +913,31 @@ namespace OpenSim.Region.Environment.Scenes /// that's not wholesome. Had to make m_scene public PhysActor = null; - PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape( - Name, - Shape, - new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, - AbsolutePosition.Z), - new PhysicsVector(Scale.X, Scale.Y, Scale.Z), - new Quaternion(RotationOffset.W, RotationOffset.X, - RotationOffset.Y, RotationOffset.Z), UsePhysics); - if (UsePhysics) + if (!((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0)) { - PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; - PhysActor.OnOutOfBounds += PhysicsOutOfBounds; + PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape( + Name, + Shape, + new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, + AbsolutePosition.Z), + new PhysicsVector(Scale.X, Scale.Y, Scale.Z), + new Quaternion(RotationOffset.W, RotationOffset.X, + RotationOffset.Y, RotationOffset.Z), UsePhysics); + if (UsePhysics) + { + PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; + PhysActor.OnOutOfBounds += PhysicsOutOfBounds; + } } + + + } + + + + } public void UpdateExtraParam(ushort type, bool inUse, byte[] data) @@ -1162,6 +1182,7 @@ namespace OpenSim.Region.Environment.Scenes public void PhysicsRequestingTerseUpdate() { ScheduleTerseUpdate(); + //SendTerseUpdateToAllClients(); } #endregion diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 87fa5cf..67b375a 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -337,12 +337,9 @@ namespace OpenSim.Region.Environment.Scenes // could have been sent in the last update - we still need to send the // second here. - // after object un-linking was introduced, this broke and needs fixing - // *all* object movements create a fullobjectupdate (which is bad) - // Physical objects do not need this bit of code, so lets make sure that they don't - // get updated and make matters worse until this gets fixed. + - if (update.LastFullUpdateTime < part.TimeStampFull && !((part.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) !=0 )) + if (update.LastFullUpdateTime < part.TimeStampFull) { //need to do a full update part.SendFullUpdate(ControllingClient); @@ -357,7 +354,10 @@ namespace OpenSim.Region.Environment.Scenes } else if (update.LastTerseUpdateTime <= part.TimeStampTerse) { + + part.SendTerseUpdate(ControllingClient); + update.LastTerseUpdateTime = part.TimeStampTerse; updateCount++; } -- cgit v1.1