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.
parent
8c157a7aae
commit
b4be9baa4a
|
@ -218,8 +218,9 @@ namespace OpenSim.Region.CoreModules.Communications.Local
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||||
{
|
{
|
||||||
//m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
|
//m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
|
||||||
return s.IncomingCreateObject(sog);
|
ISceneObject sogClone = sog.CloneForNewScene();
|
||||||
|
return s.IncomingCreateObject(sogClone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -223,8 +223,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST
|
||||||
public bool SendCreateObject(ulong regionHandle, ISceneObject sog)
|
public bool SendCreateObject(ulong regionHandle, ISceneObject sog)
|
||||||
{
|
{
|
||||||
// Try local first
|
// Try local first
|
||||||
ISceneObject sogClone = sog.CloneForNewScene();
|
if (m_localBackend.SendCreateObject(regionHandle, sog))
|
||||||
if (m_localBackend.SendCreateObject(regionHandle, sogClone))
|
|
||||||
{
|
{
|
||||||
//m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
|
//m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2168,7 +2168,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public bool IncomingCreateObject(ISceneObject sog)
|
public bool IncomingCreateObject(ISceneObject sog)
|
||||||
{
|
{
|
||||||
//Console.WriteLine(" >>> IncomingCreateObject <<<");
|
//Console.WriteLine(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted);
|
||||||
SceneObjectGroup newObject;
|
SceneObjectGroup newObject;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2201,7 +2201,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force allocation of new LocalId
|
// Force allocation of new LocalId
|
||||||
//
|
//
|
||||||
foreach (SceneObjectPart p in sceneObject.Children.Values)
|
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.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
|
// Fix up attachment Parent Local ID
|
||||||
//
|
//
|
||||||
ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
|
ScenePresence sp = GetScenePresence(sceneObject.OwnerID);
|
||||||
|
|
||||||
uint parentLocalID = 0;
|
uint parentLocalID = 0;
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
|
{
|
||||||
parentLocalID = sp.LocalId;
|
parentLocalID = sp.LocalId;
|
||||||
|
|
||||||
sceneObject.RootPart.IsAttachment = true;
|
//sceneObject.RootPart.IsAttachment = true;
|
||||||
sceneObject.RootPart.SetParentLocalId(parentLocalID);
|
//sceneObject.RootPart.SetParentLocalId(parentLocalID);
|
||||||
|
|
||||||
AddRestoredSceneObject(sceneObject, false, false);
|
SceneObjectGroup grp = sceneObject;
|
||||||
|
|
||||||
// Handle attachment special case
|
//RootPrim.SetParentLocalId(parentLocalID);
|
||||||
//
|
|
||||||
SceneObjectPart RootPrim = GetSceneObjectPart(primID);
|
|
||||||
//SceneObjectPart RootPrim = sceneObject.RootPart;
|
|
||||||
|
|
||||||
if (RootPrim != null)
|
m_log.DebugFormat("[ATTACHMENT]: Received " +
|
||||||
{
|
|
||||||
SceneObjectGroup grp = RootPrim.ParentGroup;
|
|
||||||
|
|
||||||
RootPrim.SetParentLocalId(parentLocalID);
|
|
||||||
|
|
||||||
if (grp != null)
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[ATTACHMENT]: Received " +
|
|
||||||
"attachment {0}, inworld asset id {1}",
|
"attachment {0}, inworld asset id {1}",
|
||||||
//grp.RootPart.LastOwnerID.ToString(),
|
//grp.RootPart.LastOwnerID.ToString(),
|
||||||
grp.GetFromAssetID(),
|
grp.GetFromAssetID(),
|
||||||
grp.UUID.ToString());
|
grp.UUID.ToString());
|
||||||
|
|
||||||
if (sp != null)
|
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
|
||||||
{
|
m_log.DebugFormat("[ATTACHMENT]: Attach " +
|
||||||
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
|
"to avatar {0} at position {1}",
|
||||||
m_log.DebugFormat("[ATTACHMENT]: Attach " +
|
sp.UUID.ToString(), grp.AbsolutePosition);
|
||||||
"to avatar {0}",
|
AttachObject(sp.ControllingClient,
|
||||||
sp.UUID.ToString());
|
grp.LocalId, (uint)0,
|
||||||
AttachObject(sp.ControllingClient,
|
grp.GroupRotation,
|
||||||
grp.LocalId, (uint)0,
|
grp.AbsolutePosition, false);
|
||||||
grp.GroupRotation,
|
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
|
||||||
grp.AbsolutePosition, false);
|
grp.SendGroupFullUpdate();
|
||||||
grp.SendGroupFullUpdate();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
|
|
||||||
RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
|
||||||
|
RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public string GetStateSnapshot()
|
public string GetStateSnapshot()
|
||||||
{
|
{
|
||||||
Console.WriteLine(" >>> GetStateSnapshot <<<");
|
//Console.WriteLine(" >>> GetStateSnapshot <<<");
|
||||||
|
|
||||||
List<string> assemblies = new List<string>();
|
List<string> assemblies = new List<string>();
|
||||||
Dictionary<UUID, string> states = new Dictionary<UUID, string>();
|
Dictionary<UUID, string> states = new Dictionary<UUID, string>();
|
||||||
|
|
|
@ -1717,6 +1717,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_rootPart == null)
|
if (m_rootPart == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
lock (m_parts)
|
lock (m_parts)
|
||||||
{
|
{
|
||||||
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
|
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
|
||||||
|
@ -3036,6 +3039,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public virtual ISceneObject CloneForNewScene()
|
public virtual ISceneObject CloneForNewScene()
|
||||||
{
|
{
|
||||||
SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false);
|
SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false);
|
||||||
|
sog.m_isDeleted = false;
|
||||||
return sog;
|
return sog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue