Fixed bugs in llCreateLink to sync LinkObject properly.

Also, added logs for debug purposes.
dsg
Huaiyu (Kitty) Liu 2011-03-11 09:22:32 -08:00
parent b848df2a3a
commit 13798f9f7d
8 changed files with 66 additions and 6 deletions

View File

@ -432,6 +432,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
partNum++;
}
m_log.Debug(LogHeader + " to SendLinkObject to link " + children.Count + " parts to " + root.Name);
m_log.Debug("LinkedObject: "+sogxml);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data));
SendObjectUpdateToRelevantSyncConnectors(linkedGroup, rsm);
}
@ -764,6 +767,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["LastUpdateTimeStamp"] = OSD.FromLong(updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp);
data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID);
m_log.Debug(LogHeader + " Send out Physics Bucket updates for " + updatedPart.Name + ". GroupPosition: " + updatedPart.GroupPosition.ToString() + ", Position = " + pa.Position);
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data));
//m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg);
@ -838,6 +843,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
//SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
m_log.Debug(LogHeader + " send " + syncMsg.Type.ToString() + " about "+sog.Name+"," + sog.UUID+ " to " + connector.OtherSideActorID);
connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes());
}
}
@ -1518,6 +1526,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
//SYNC DEBUG
string partnames = "";
foreach (SceneObjectPart part in sog.Parts)
{
partnames += "(" + part.Name + ", " + part.UUID + ")";
}
m_log.Debug(LogHeader+" received "+msg.Type.ToString()+" from "+senderActorID+" about obj "+sog.Name+", "+sog.UUID+"; parts -- "+partnames);
if (sog.IsDeleted)
{
SymmetricSyncMessage.HandleTrivial(LogHeader, msg, String.Format("Ignoring update on deleted object, UUID: {0}.", sog.UUID));
@ -1696,6 +1712,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void HandleLinkObject(SymmetricSyncMessage msg, string senderActorID)
{
// Get the data from message and error check
OSDMap data = DeserializeMessage(msg);
if (data == null)
@ -1717,6 +1734,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
childrenIDs.Add(data[partTempID].AsUUID());
}
m_log.Debug(LogHeader + " received LinkObject from " + senderActorID);
//m_log.Debug("LinkedObject: " + sogxml);
m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs);
//if this is a relay node, forwards the event

View File

@ -2198,7 +2198,11 @@ namespace OpenSim.Region.Framework.Scenes
AddNewSceneObject(group, true, pos, rot, vel);
//SYNC DEBUG
m_log.DebugFormat("[SCENE] RezObject {0} with InvItem name {1} at pos {2}", group.UUID.ToString(), item.Name, group.RootPart.GroupPosition.ToString());
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.

View File

@ -791,11 +791,14 @@ namespace OpenSim.Region.Framework.Scenes
continue;
}
m_log.Debug("to link part " + part.DebugObjectPartProperties());
//m_log.Debug("to link part " + part.DebugObjectPartProperties());
m_log.Debug("to link part " + part.Name + "," + part.UUID + "; its SOG has " + part.ParentGroup.Parts + " parts");
children.Add(part);
}
//m_log.Debug("to link " + children.Count + " parts with " + root.Name);
//Leverage the LinkObject implementation to get the book keeping of Group and Parts relations right
m_sceneGraph.LinkObjectsBySync(root, children);

View File

@ -2018,7 +2018,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
m_log.Debug("AddSceneObjectByStateSynch to be called");
m_log.Debug(updatedSog.Name+" "+updatedSog.UUID+" not found in Entities list. Need to add");
AddSceneObjectByStateSynch(updatedSog);
updateResult = Scene.ObjectUpdateResult.New;
}
@ -2062,6 +2062,8 @@ namespace OpenSim.Region.Framework.Scenes
}
m_numPrim += children.Length;
m_log.Debug("Attached obj " + sceneObject.Name + "," + sceneObject.UUID + " to Scene");
sceneObject.AttachToScene(m_parentScene);
//Take some special care of the case of this object being an attachment

View File

@ -2909,6 +2909,7 @@ namespace OpenSim.Region.Framework.Scenes
//we need to do a terse update even if the move wasn't allowed
// so that the position is reset in the client (the object snaps back)
//ScheduleGroupForTerseUpdate();
m_log.Debug(this.Name + " GroupPosition changed to " + AbsolutePosition.ToString());
List<SceneObjectPartProperties> updatedProperties = new List<SceneObjectPartProperties>() { SceneObjectPartProperties.GroupPosition };
if (IsAttachment)
{

View File

@ -5504,15 +5504,33 @@ namespace OpenSim.Region.Framework.Scenes
//buckets may not be filled at all in "updatedPart".
private void PhysicsBucketUpdateProcessor(Object updatedPartO, string bucketName)
{
SceneObjectPart localPart = this;
if (updatedPartO is SceneObjectPart)
{
SceneObjectPart updatedPart = (SceneObjectPart)updatedPartO;
localPart.GroupPosition = updatedPart.GroupPosition;
localPart.OffsetPosition = updatedPart.OffsetPosition;
localPart.Scale = updatedPart.Scale;
localPart.Velocity = updatedPart.Velocity;
localPart.AngularVelocity = updatedPart.AngularVelocity;
localPart.RotationOffset = updatedPart.RotationOffset;
return;
}
if (!(updatedPartO is OSDMap)) return;
OSDMap data = (OSDMap)updatedPartO;
//If needed, we could define new set functions for these properties, and cast this SOP to SOPBase to
//invoke the set functions in SOPBase
//SceneObjectPartBase localPart = (SceneObjectPartBase)this;
SceneObjectPart localPart = this;
//SceneObjectPart localPart = this;
PhysicsActor pa = localPart.PhysActor;
m_log.Debug("Received Physics Bucket updates for " + localPart.Name + ". GroupPosition: " + data["GroupPosition"].AsVector3().ToString()
+ ", Position = " + data["Position"].AsVector3().ToString());
//m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor. pos={1}", "[SCENE OBJECT PART]", data["Position"].AsVector3().ToString());
lock (m_bucketUpdateLocks[bucketName])
@ -5618,6 +5636,9 @@ namespace OpenSim.Region.Framework.Scenes
string bucketName = m_primPropertyBucketMap[property];
//m_bucketSyncTainted[bucketName] = true;
m_bucketSyncInfoList[bucketName].TaintBucket();
m_log.Debug(this.Name + ": " + property.ToString() + " just changed. Tainted " + bucketName);
}
}
}
@ -5758,6 +5779,8 @@ namespace OpenSim.Region.Framework.Scenes
//Second, if need to update local properties, call each bucket's update process
if (m_bucketUpdateProcessors.ContainsKey(bucketName))
{
m_log.Debug("Update properties in " + bucketName + " buckets");
m_bucketUpdateProcessors[bucketName](updatedPart, bucketName);
partUpdateResult = Scene.ObjectUpdateResult.Updated;
}

View File

@ -3567,12 +3567,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
item = m_host.TaskInventory[invItemID];
}
/*
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
return;
}
*/
IClientAPI client = null;
ScenePresence sp = World.GetScenePresence(item.PermsGranter);
@ -3585,6 +3587,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; // Fail silently if attached
SceneObjectGroup parentPrim = null, childPrim = null;
//SYEMMETRIC SYNC
List<SceneObjectPart> children = new List<SceneObjectPart>();
if (targetPart != null)
{
if (parent != 0) {
@ -3596,6 +3601,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
parentPrim = targetPart.ParentGroup;
childPrim = m_host.ParentGroup;
}
children.Add(childPrim.RootPart);
// byte uf = childPrim.RootPart.UpdateFlag;
childPrim.RootPart.UpdateFlag = 0;
parentPrim.LinkToGroup(childPrim);
@ -3614,7 +3621,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
//Tell other actors to link the SceneObjectParts together as a new group.
//parentGroup.SyncInfoUpdate();
World.RegionSyncModule.SendLinkObject(parentPrim, parentPrim.RootPart, new List<SceneObjectPart>(childPrim.Parts));
World.RegionSyncModule.SendLinkObject(parentPrim, parentPrim.RootPart, children);
}
m_host.ScheduleFullUpdate(new List<SceneObjectPartProperties>(){SceneObjectPartProperties.None}); //SendLinkObject above will synchronize the link operation, no need to taint updates here
//end of SYMMETRIC SYNC

View File

@ -741,7 +741,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
catch (Exception e)
{
m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
m_InEvent = false;
m_CurrentEvent = String.Empty;