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++; 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)); SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data));
SendObjectUpdateToRelevantSyncConnectors(linkedGroup, rsm); SendObjectUpdateToRelevantSyncConnectors(linkedGroup, rsm);
} }
@ -764,6 +767,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["LastUpdateTimeStamp"] = OSD.FromLong(updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp); data["LastUpdateTimeStamp"] = OSD.FromLong(updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp);
data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID); 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)); 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()); //m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg); SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg);
@ -838,6 +843,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
//string sogxml = SceneObjectSerializer.ToXml2Format(sog); //string sogxml = SceneObjectSerializer.ToXml2Format(sog);
//SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml); //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()); 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); string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml); 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) if (sog.IsDeleted)
{ {
SymmetricSyncMessage.HandleTrivial(LogHeader, msg, String.Format("Ignoring update on deleted object, UUID: {0}.", sog.UUID)); 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) private void HandleLinkObject(SymmetricSyncMessage msg, string senderActorID)
{ {
// Get the data from message and error check // Get the data from message and error check
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
@ -1717,6 +1734,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
childrenIDs.Add(data[partTempID].AsUUID()); childrenIDs.Add(data[partTempID].AsUUID());
} }
m_log.Debug(LogHeader + " received LinkObject from " + senderActorID);
//m_log.Debug("LinkedObject: " + sogxml);
m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs); m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs);
//if this is a relay node, forwards the event //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); AddNewSceneObject(group, true, pos, rot, vel);
//SYNC DEBUG //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 // 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

@ -791,11 +791,14 @@ namespace OpenSim.Region.Framework.Scenes
continue; 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); 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 //Leverage the LinkObject implementation to get the book keeping of Group and Parts relations right
m_sceneGraph.LinkObjectsBySync(root, children); m_sceneGraph.LinkObjectsBySync(root, children);

View File

@ -2018,7 +2018,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else 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); AddSceneObjectByStateSynch(updatedSog);
updateResult = Scene.ObjectUpdateResult.New; updateResult = Scene.ObjectUpdateResult.New;
} }
@ -2062,6 +2062,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_numPrim += children.Length; m_numPrim += children.Length;
m_log.Debug("Attached obj " + sceneObject.Name + "," + sceneObject.UUID + " to Scene");
sceneObject.AttachToScene(m_parentScene); sceneObject.AttachToScene(m_parentScene);
//Take some special care of the case of this object being an attachment //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 //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) // so that the position is reset in the client (the object snaps back)
//ScheduleGroupForTerseUpdate(); //ScheduleGroupForTerseUpdate();
m_log.Debug(this.Name + " GroupPosition changed to " + AbsolutePosition.ToString());
List<SceneObjectPartProperties> updatedProperties = new List<SceneObjectPartProperties>() { SceneObjectPartProperties.GroupPosition }; List<SceneObjectPartProperties> updatedProperties = new List<SceneObjectPartProperties>() { SceneObjectPartProperties.GroupPosition };
if (IsAttachment) if (IsAttachment)
{ {

View File

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

View File

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

View File

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