Fixes the problem of attachment offset after crossings/TPs. Hopefully it fixes mantis #3126, as well as other random displacements. The problem was that the new object at the receiving region was being marked as attachment before AttachObject was called. That made its AbsolutePosition be the position of the avie, and that was what was being given to AttachObject.

0.6.3-post-fixes
diva 2009-02-10 22:54:05 +00:00
parent 8c157a7aae
commit b4be9baa4a
5 changed files with 43 additions and 42 deletions

View File

@ -218,8 +218,9 @@ namespace OpenSim.Region.CoreModules.Communications.Local
{
if (s.RegionInfo.RegionHandle == regionHandle)
{
//m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
return s.IncomingCreateObject(sog);
//m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
ISceneObject sogClone = sog.CloneForNewScene();
return s.IncomingCreateObject(sogClone);
}
}
return false;

View File

@ -223,8 +223,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST
public bool SendCreateObject(ulong regionHandle, ISceneObject sog)
{
// Try local first
ISceneObject sogClone = sog.CloneForNewScene();
if (m_localBackend.SendCreateObject(regionHandle, sogClone))
if (m_localBackend.SendCreateObject(regionHandle, sog))
{
//m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
return true;

View File

@ -2168,7 +2168,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool IncomingCreateObject(ISceneObject sog)
{
//Console.WriteLine(" >>> IncomingCreateObject <<<");
//Console.WriteLine(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
SceneObjectGroup newObject;
try
{
@ -2201,7 +2201,6 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
// Force allocation of new LocalId
//
foreach (SceneObjectPart p in sceneObject.Children.Values)
@ -2209,59 +2208,57 @@ namespace OpenSim.Region.Framework.Scenes
if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim)
{
if (sceneObject.RootPart.Shape.State != 0)
if (sceneObject.RootPart.Shape.State != 0) // Attchment
{
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
AddRestoredSceneObject(sceneObject, false, false);
// Handle attachment special case
//
//SceneObjectPart RootPrim = GetSceneObjectPart(primID);
SceneObjectPart RootPrim = sceneObject.RootPart;
// Fix up attachment Parent Local ID
//
ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
uint parentLocalID = 0;
if (sp != null)
{
parentLocalID = sp.LocalId;
sceneObject.RootPart.IsAttachment = true;
sceneObject.RootPart.SetParentLocalId(parentLocalID);
//sceneObject.RootPart.IsAttachment = true;
//sceneObject.RootPart.SetParentLocalId(parentLocalID);
AddRestoredSceneObject(sceneObject, false, false);
SceneObjectGroup grp = sceneObject;
// Handle attachment special case
//
SceneObjectPart RootPrim = GetSceneObjectPart(primID);
//SceneObjectPart RootPrim = sceneObject.RootPart;
//RootPrim.SetParentLocalId(parentLocalID);
if (RootPrim != null)
{
SceneObjectGroup grp = RootPrim.ParentGroup;
RootPrim.SetParentLocalId(parentLocalID);
if (grp != null)
{
m_log.DebugFormat("[ATTACHMENT]: Received " +
m_log.DebugFormat("[ATTACHMENT]: Received " +
"attachment {0}, inworld asset id {1}",
//grp.RootPart.LastOwnerID.ToString(),
grp.GetFromAssetID(),
grp.UUID.ToString());
if (sp != null)
{
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
m_log.DebugFormat("[ATTACHMENT]: Attach " +
"to avatar {0}",
sp.UUID.ToString());
AttachObject(sp.ControllingClient,
grp.LocalId, (uint)0,
grp.GroupRotation,
grp.AbsolutePosition, false);
grp.SendGroupFullUpdate();
}
else
{
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
}
}
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
m_log.DebugFormat("[ATTACHMENT]: Attach " +
"to avatar {0} at position {1}",
sp.UUID.ToString(), grp.AbsolutePosition);
AttachObject(sp.ControllingClient,
grp.LocalId, (uint)0,
grp.GroupRotation,
grp.AbsolutePosition, false);
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
grp.SendGroupFullUpdate();
}
else
{
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
}
}
else
{

View File

@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes
public string GetStateSnapshot()
{
Console.WriteLine(" >>> GetStateSnapshot <<<");
//Console.WriteLine(" >>> GetStateSnapshot <<<");
List<string> assemblies = new List<string>();
Dictionary<UUID, string> states = new Dictionary<UUID, string>();

View File

@ -1717,6 +1717,9 @@ namespace OpenSim.Region.Framework.Scenes
if (m_rootPart == null)
return;
if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
return;
lock (m_parts)
{
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
@ -3036,6 +3039,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual ISceneObject CloneForNewScene()
{
SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false);
sog.m_isDeleted = false;
return sog;
}