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.
dsg
Huaiyu (Kitty) Liu 2011-03-23 10:23:13 -07:00
parent 71566e31c2
commit 0ad9366abb
7 changed files with 37 additions and 52 deletions

View File

@ -27,7 +27,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;

View File

@ -581,25 +581,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
group.ResetIDs(); 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); // 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 attachment we set it's asset id so object updates can reflect that
// if not, we set it's position in world. // if not, we set it's position in world.
@ -693,6 +674,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
rootPart.TrimPermissions(); 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 (!attachment)
{ {
if (group.RootPart.Shape.PCode == (byte)PCode.Prim) if (group.RootPart.Shape.PCode == (byte)PCode.Prim)

View File

@ -419,26 +419,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//no SyncConnector connected. Do nothing. //no SyncConnector connected. Do nothing.
return; 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. //First, make sure the linked group has updated timestamp info for synchronization
//For now, a complete list of object properties include properties sog.BucketSyncInfoUpdate();
//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));
* */
SymmetricSyncMessage rsm = CreateNewObjectMessage(sog); SymmetricSyncMessage rsm = CreateNewObjectMessage(sog);

View File

@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
if (entity is SceneObjectGroup) 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; SceneObjectGroup sog = (SceneObjectGroup)entity;
sog.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); sog.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0);
sog.ResumeScripts(); sog.ResumeScripts();

View File

@ -2198,11 +2198,13 @@ namespace OpenSim.Region.Framework.Scenes
AddNewSceneObject(group, true, pos, rot, vel); AddNewSceneObject(group, true, pos, rot, vel);
//SYNC DEBUG //SYNC DEBUG
/*
string partnames = ""; string partnames = "";
foreach (SceneObjectPart part in group.Parts){ foreach (SceneObjectPart part in group.Parts){
partnames += "(" + part.Name + ", " + part.UUID + ")"; 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); 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 // 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. // to find out if scripts should be activated at all.

View File

@ -313,8 +313,6 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddNewSceneObject( public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{ {
AddNewSceneObject(sceneObject, true, false);
// we set it's position in world. // we set it's position in world.
sceneObject.AbsolutePosition = pos; sceneObject.AbsolutePosition = pos;
@ -331,7 +329,12 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
sceneObject.Velocity = vel; 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; return true;
} }

View File

@ -294,12 +294,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_rootPart.GroupPosition; } get { return m_rootPart.GroupPosition; }
set set
{ {
/*
SetAbsolutePosition(value);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].UpdateBucketSyncInfo("GroupPosition");
*/
Vector3 val = value; Vector3 val = value;
//REGION SYNC touched //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) //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)) // || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
// && !IsAttachmentCheckFull()) // && !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); m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
} }
@ -3897,8 +3891,8 @@ namespace OpenSim.Region.Framework.Scenes
public void ScheduleGroupForFullUpdate_SyncInfoUnchanged() public void ScheduleGroupForFullUpdate_SyncInfoUnchanged()
{ {
if (IsAttachment) //if (IsAttachment)
m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId); // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
checkAtTargets(); checkAtTargets();
RootPart.ScheduleFullUpdate_SyncInfoUnchanged(); RootPart.ScheduleFullUpdate_SyncInfoUnchanged();