From 0ad9366abbfc189c8ddd89fae3c7086ae2339c96 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 23 Mar 2011 10:23:13 -0700 Subject: [PATCH] In InventoryAccessModule.RezObject, move the calling of AddNewSceneObject to the later part of the function, so that the object's most properties have values already set when AddNewSceneObject is called, which will trigger RegionSyncModule.SendNewObject to sync across scene copies. --- .../ClientStack/LindenUDP/LLClientView.cs | 2 +- .../InventoryAccess/InventoryAccessModule.cs | 41 ++++++++++--------- .../SymmetricSync/RegionSyncModule.cs | 21 +--------- .../SymmetricSync/ScriptEngineSyncModule.cs | 2 +- .../Framework/Scenes/Scene.Inventory.cs | 2 + OpenSim/Region/Framework/Scenes/SceneGraph.cs | 9 ++-- .../Framework/Scenes/SceneObjectGroup.cs | 12 ++---- 7 files changed, 37 insertions(+), 52 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d463ea336b..53c48f7695 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -27,7 +27,7 @@ using System; using System.Collections; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Net; using System.Reflection; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 180c3babe5..e67c07dbea 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -581,25 +581,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess group.ResetIDs(); - if (attachment) - { - group.RootPart.Flags |= PrimFlags.Phantom; - group.RootPart.IsAttachment = true; - - // If we're rezzing an attachment then don't ask - // AddNewSceneObject() to update the client since - // we'll be doing that later on. Scheduling more - // than one full update during the attachment - // process causes some clients to fail to display - // the attachment properly. - // Also, don't persist attachments. - m_Scene.AddNewSceneObject(group, false, false); - } - else - { - m_Scene.AddNewSceneObject(group, true, false); - } - // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); // if attachment we set it's asset id so object updates can reflect that // if not, we set it's position in world. @@ -693,6 +674,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess rootPart.TrimPermissions(); + //SYMMETRIC SYNC: move this part to the bottom of this function, + //so that all properties of the object would have been set once + //AddNewSceneObject is called. + if (attachment) + { + group.RootPart.Flags |= PrimFlags.Phantom; + group.RootPart.IsAttachment = true; + + // If we're rezzing an attachment then don't ask + // AddNewSceneObject() to update the client since + // we'll be doing that later on. Scheduling more + // than one full update during the attachment + // process causes some clients to fail to display + // the attachment properly. + // Also, don't persist attachments. + m_Scene.AddNewSceneObject(group, false, false); + } + else + { + m_Scene.AddNewSceneObject(group, true, false); + } + if (!attachment) { if (group.RootPart.Shape.PCode == (byte)PCode.Prim) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 9999a05ff2..0ba77439d9 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -419,26 +419,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //no SyncConnector connected. Do nothing. return; } - - /* - //m_log.DebugFormat(LogHeader + " SendNewObject called for object {0}, {1}", sog.Name, sog.UUID); - //This is a new object (newly rezzed). Send out updates for all properties. - //For now, a complete list of object properties include properties - //in its xml serialization, plus the set of Physics properties as in Physics bucket - OSDMap data = new OSDMap(); - string sogxml = SceneObjectSerializer.ToXml2Format(sog); - data["sogxml"] = OSD.FromString(sogxml); - OSDArray partArray = new OSDArray(); - foreach (SceneObjectPart part in sog.Parts){ - OSDMap partData = PhysicsBucketPropertiesEncoder(m_physicsBucketName, part); - partArray.Add(partData); - } - data["partPhysicsProperties"] = partArray; - //string sogxml = SceneObjectSerializer.ToXml2Format(sog); - SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(data)); - - * */ + //First, make sure the linked group has updated timestamp info for synchronization + sog.BucketSyncInfoUpdate(); SymmetricSyncMessage rsm = CreateNewObjectMessage(sog); diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScriptEngineSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScriptEngineSyncModule.cs index 1749c7c36a..a95c5899d9 100755 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScriptEngineSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScriptEngineSyncModule.cs @@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (entity is SceneObjectGroup) { - m_log.Debug(LogHeader + ": start script for obj " + entity.UUID); + //m_log.DebugFormat("{0}: start script for obj {1}", LogHeader, entity.UUID); SceneObjectGroup sog = (SceneObjectGroup)entity; sog.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); sog.ResumeScripts(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6d086d6844..501aa42a02 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2198,11 +2198,13 @@ namespace OpenSim.Region.Framework.Scenes AddNewSceneObject(group, true, pos, rot, vel); //SYNC DEBUG + /* string partnames = ""; foreach (SceneObjectPart part in group.Parts){ partnames += "(" + part.Name + ", " + part.UUID + ")"; } m_log.DebugFormat("[SCENE] RezObject {0} with InvItem name {1} at pos {2} with parts {3}", group.UUID.ToString(), item.Name, group.RootPart.GroupPosition.ToString(), partnames); + * */ // We can only call this after adding the scene object, since the scene object references the scene // to find out if scripts should be activated at all. diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 3534179f31..9c5e15763a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -313,8 +313,6 @@ namespace OpenSim.Region.Framework.Scenes public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) { - AddNewSceneObject(sceneObject, true, false); - // we set it's position in world. sceneObject.AbsolutePosition = pos; @@ -331,7 +329,12 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); sceneObject.Velocity = vel; } - + + //SYMMETRIC SYNC + //Moving AddNewSceneObject to the end of this function, so that + //all object properties are set when AddNewSceneObject is called. + AddNewSceneObject(sceneObject, true, false); + return true; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a1fde883ec..05fc9a94de 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -294,12 +294,6 @@ namespace OpenSim.Region.Framework.Scenes get { return m_rootPart.GroupPosition; } set { - /* - SetAbsolutePosition(value); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].UpdateBucketSyncInfo("GroupPosition"); - */ Vector3 val = value; //REGION SYNC touched @@ -307,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes //if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) // || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) // && !IsAttachmentCheckFull()) - if (m_scene.IsBorderCrossing(LocX, LocY, val) && !IsAttachmentCheckFull()&& (!m_scene.LoadingPrims)) + if (m_scene !=null && m_scene.IsBorderCrossing(LocX, LocY, val) && !IsAttachmentCheckFull()&& (!m_scene.LoadingPrims)) { m_scene.CrossPrimGroupIntoNewRegion(val, this, true); } @@ -3897,8 +3891,8 @@ namespace OpenSim.Region.Framework.Scenes public void ScheduleGroupForFullUpdate_SyncInfoUnchanged() { - if (IsAttachment) - m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId); + //if (IsAttachment) + // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId); checkAtTargets(); RootPart.ScheduleFullUpdate_SyncInfoUnchanged();