diff options
author | diva | 2009-02-10 22:54:05 +0000 |
---|---|---|
committer | diva | 2009-02-10 22:54:05 +0000 |
commit | b4be9baa4a8b10c99b9c9e471607b782c8c75851 (patch) | |
tree | 45e4d6834f281dee94f8375ffa7a4530a3280a86 /OpenSim/Region | |
parent | * Remove load and save inventory commands from the console since these are ac... (diff) | |
download | opensim-SC-b4be9baa4a8b10c99b9c9e471607b782c8c75851.zip opensim-SC-b4be9baa4a8b10c99b9c9e471607b782c8c75851.tar.gz opensim-SC-b4be9baa4a8b10c99b9c9e471607b782c8c75851.tar.bz2 opensim-SC-b4be9baa4a8b10c99b9c9e471607b782c8c75851.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region')
5 files changed, 43 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs index 3a9df4a..5c2fc1c 100644 --- a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs | |||
@@ -218,8 +218,9 @@ namespace OpenSim.Region.CoreModules.Communications.Local | |||
218 | { | 218 | { |
219 | if (s.RegionInfo.RegionHandle == regionHandle) | 219 | if (s.RegionInfo.RegionHandle == regionHandle) |
220 | { | 220 | { |
221 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); | 221 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); |
222 | return s.IncomingCreateObject(sog); | 222 | ISceneObject sogClone = sog.CloneForNewScene(); |
223 | return s.IncomingCreateObject(sogClone); | ||
223 | } | 224 | } |
224 | } | 225 | } |
225 | return false; | 226 | return false; |
diff --git a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs index b4f4814..8a4bb09 100644 --- a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs | |||
@@ -223,8 +223,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
223 | public bool SendCreateObject(ulong regionHandle, ISceneObject sog) | 223 | public bool SendCreateObject(ulong regionHandle, ISceneObject sog) |
224 | { | 224 | { |
225 | // Try local first | 225 | // Try local first |
226 | ISceneObject sogClone = sog.CloneForNewScene(); | 226 | if (m_localBackend.SendCreateObject(regionHandle, sog)) |
227 | if (m_localBackend.SendCreateObject(regionHandle, sogClone)) | ||
228 | { | 227 | { |
229 | //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded"); | 228 | //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded"); |
230 | return true; | 229 | return true; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b2d77f5..fd979a3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2168,7 +2168,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2168 | 2168 | ||
2169 | public bool IncomingCreateObject(ISceneObject sog) | 2169 | public bool IncomingCreateObject(ISceneObject sog) |
2170 | { | 2170 | { |
2171 | //Console.WriteLine(" >>> IncomingCreateObject <<<"); | 2171 | //Console.WriteLine(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); |
2172 | SceneObjectGroup newObject; | 2172 | SceneObjectGroup newObject; |
2173 | try | 2173 | try |
2174 | { | 2174 | { |
@@ -2201,7 +2201,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2201 | 2201 | ||
2202 | return false; | 2202 | return false; |
2203 | } | 2203 | } |
2204 | |||
2205 | // Force allocation of new LocalId | 2204 | // Force allocation of new LocalId |
2206 | // | 2205 | // |
2207 | foreach (SceneObjectPart p in sceneObject.Children.Values) | 2206 | foreach (SceneObjectPart p in sceneObject.Children.Values) |
@@ -2209,59 +2208,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
2209 | 2208 | ||
2210 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) | 2209 | if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) |
2211 | { | 2210 | { |
2212 | if (sceneObject.RootPart.Shape.State != 0) | 2211 | if (sceneObject.RootPart.Shape.State != 0) // Attchment |
2213 | { | 2212 | { |
2213 | |||
2214 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | ||
2215 | |||
2216 | AddRestoredSceneObject(sceneObject, false, false); | ||
2217 | |||
2218 | // Handle attachment special case | ||
2219 | // | ||
2220 | //SceneObjectPart RootPrim = GetSceneObjectPart(primID); | ||
2221 | SceneObjectPart RootPrim = sceneObject.RootPart; | ||
2222 | |||
2214 | // Fix up attachment Parent Local ID | 2223 | // Fix up attachment Parent Local ID |
2215 | // | 2224 | // |
2216 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); | 2225 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); |
2217 | 2226 | ||
2218 | uint parentLocalID = 0; | 2227 | uint parentLocalID = 0; |
2219 | if (sp != null) | 2228 | if (sp != null) |
2229 | { | ||
2220 | parentLocalID = sp.LocalId; | 2230 | parentLocalID = sp.LocalId; |
2221 | 2231 | ||
2222 | sceneObject.RootPart.IsAttachment = true; | 2232 | //sceneObject.RootPart.IsAttachment = true; |
2223 | sceneObject.RootPart.SetParentLocalId(parentLocalID); | 2233 | //sceneObject.RootPart.SetParentLocalId(parentLocalID); |
2224 | |||
2225 | AddRestoredSceneObject(sceneObject, false, false); | ||
2226 | |||
2227 | // Handle attachment special case | ||
2228 | // | ||
2229 | SceneObjectPart RootPrim = GetSceneObjectPart(primID); | ||
2230 | //SceneObjectPart RootPrim = sceneObject.RootPart; | ||
2231 | 2234 | ||
2232 | if (RootPrim != null) | 2235 | SceneObjectGroup grp = sceneObject; |
2233 | { | ||
2234 | SceneObjectGroup grp = RootPrim.ParentGroup; | ||
2235 | 2236 | ||
2236 | RootPrim.SetParentLocalId(parentLocalID); | 2237 | //RootPrim.SetParentLocalId(parentLocalID); |
2237 | 2238 | ||
2238 | if (grp != null) | 2239 | m_log.DebugFormat("[ATTACHMENT]: Received " + |
2239 | { | ||
2240 | m_log.DebugFormat("[ATTACHMENT]: Received " + | ||
2241 | "attachment {0}, inworld asset id {1}", | 2240 | "attachment {0}, inworld asset id {1}", |
2242 | //grp.RootPart.LastOwnerID.ToString(), | 2241 | //grp.RootPart.LastOwnerID.ToString(), |
2243 | grp.GetFromAssetID(), | 2242 | grp.GetFromAssetID(), |
2244 | grp.UUID.ToString()); | 2243 | grp.UUID.ToString()); |
2245 | 2244 | ||
2246 | if (sp != null) | 2245 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); |
2247 | { | 2246 | m_log.DebugFormat("[ATTACHMENT]: Attach " + |
2248 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | 2247 | "to avatar {0} at position {1}", |
2249 | m_log.DebugFormat("[ATTACHMENT]: Attach " + | 2248 | sp.UUID.ToString(), grp.AbsolutePosition); |
2250 | "to avatar {0}", | 2249 | AttachObject(sp.ControllingClient, |
2251 | sp.UUID.ToString()); | 2250 | grp.LocalId, (uint)0, |
2252 | AttachObject(sp.ControllingClient, | 2251 | grp.GroupRotation, |
2253 | grp.LocalId, (uint)0, | 2252 | grp.AbsolutePosition, false); |
2254 | grp.GroupRotation, | 2253 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2255 | grp.AbsolutePosition, false); | 2254 | grp.SendGroupFullUpdate(); |
2256 | grp.SendGroupFullUpdate(); | 2255 | } |
2257 | } | 2256 | else |
2258 | else | 2257 | { |
2259 | { | 2258 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2260 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2259 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2261 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | ||
2262 | } | ||
2263 | } | ||
2264 | } | 2260 | } |
2261 | |||
2265 | } | 2262 | } |
2266 | else | 2263 | else |
2267 | { | 2264 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index c3485ab..e1362f9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
309 | 309 | ||
310 | public string GetStateSnapshot() | 310 | public string GetStateSnapshot() |
311 | { | 311 | { |
312 | Console.WriteLine(" >>> GetStateSnapshot <<<"); | 312 | //Console.WriteLine(" >>> GetStateSnapshot <<<"); |
313 | 313 | ||
314 | List<string> assemblies = new List<string>(); | 314 | List<string> assemblies = new List<string>(); |
315 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); | 315 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 520b228..997cce5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1717,6 +1717,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1717 | if (m_rootPart == null) | 1717 | if (m_rootPart == null) |
1718 | return; | 1718 | return; |
1719 | 1719 | ||
1720 | if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | ||
1721 | return; | ||
1722 | |||
1720 | lock (m_parts) | 1723 | lock (m_parts) |
1721 | { | 1724 | { |
1722 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); | 1725 | bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); |
@@ -3036,6 +3039,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3036 | public virtual ISceneObject CloneForNewScene() | 3039 | public virtual ISceneObject CloneForNewScene() |
3037 | { | 3040 | { |
3038 | SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false); | 3041 | SceneObjectGroup sog = Copy(this.OwnerID, this.GroupID, false); |
3042 | sog.m_isDeleted = false; | ||
3039 | return sog; | 3043 | return sog; |
3040 | } | 3044 | } |
3041 | 3045 | ||