From 287c724b5585b87822da4ba92f8a1c55b7d33a67 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 29 Nov 2008 01:33:10 +0000 Subject: A try to better attachment crossing. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 + OpenSim/Region/Environment/Scenes/Scene.cs | 109 +++++++++++---------- .../Region/Environment/Scenes/SceneObjectGroup.cs | 8 +- 3 files changed, 66 insertions(+), 53 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 1823ccf..5dd7dd2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2414,6 +2414,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (AttachPoint > 30 && ownerID != AgentId) // Someone else's HUD return; + if (parentID == 0) + return; if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) rotation = Quaternion.Identity; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 97442fd..c67d994 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2145,84 +2145,93 @@ namespace OpenSim.Region.Environment.Scenes { SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); + // If the user is banned, we won't let any of their objects + // enter. Period. + // + if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) + { + m_log.Info("[INTERREGION]: Denied prim crossing for "+ + "banned avatar"); + + return false; + } + // Force allocation of new LocalId // foreach (SceneObjectPart p in sceneObject.Children.Values) p.LocalId = 0; - AddRestoredSceneObject(sceneObject, true, false); - - SceneObjectPart RootPrim = GetSceneObjectPart(primID); - if (RootPrim != null) + if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) { - if (m_regInfo.EstateSettings.IsBanned(RootPrim.OwnerID)) + if(sceneObject.RootPart.Shape.State != 0) { - SceneObjectGroup grp = RootPrim.ParentGroup; - if (grp != null) - DeleteSceneObject(grp, false); + // Fix up attachment Parent Local ID + // + ScenePresence sp = GetScenePresence(sceneObject.OwnerID); - m_log.Info("[INTERREGION]: Denied prim crossing for banned avatar"); + uint parentLocalID = 0; + if (sp != null) + parentLocalID = sp.LocalId; - return false; - } - if (RootPrim.Shape.PCode == (byte)PCode.Prim) - { - SceneObjectGroup grp = RootPrim.ParentGroup; - if((RootPrim.Shape.State == 0) && - (!Permissions.CanObjectEntry(RootPrim.UUID, - true, RootPrim.AbsolutePosition))) - { - if (grp != null) - { - DeleteSceneObject(grp, false); - } + sceneObject.RootPart.SetParentLocalId(parentLocalID); - m_log.Info("[INTERREGION]: Denied prim crossing because of parcel settings"); + AddRestoredSceneObject(sceneObject, false, false); - return false; - } - if (grp != null) - { - if (RootPrim.Shape.State != 0) - { - // Never persist + // Handle attachment special case + // + SceneObjectPart RootPrim = GetSceneObjectPart(primID); - m_log.DebugFormat("[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.RootPart.LastOwnerID.ToString(), grp.UUID.ToString()); + RootPrim.SetParentLocalId(parentLocalID); - grp.DetachFromBackup(); + if (RootPrim != null) + { + SceneObjectGroup grp = RootPrim.ParentGroup; + + if (grp != null) + { + m_log.DebugFormat("[ATTACHMENT]: Received "+ + "attachment {0}, inworld asset id {1}", + grp.RootPart.LastOwnerID.ToString(), + grp.UUID.ToString()); - // Attachment - ScenePresence sp = GetScenePresence(grp.OwnerID); if (sp != null) { - // hack assetID until we get assetID into the XML format. - // LastOwnerID is used for group deeding, so when you do stuff - // with the deeded object, it goes back to them - 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); + m_log.DebugFormat("[ATTACHMENT]: Attach "+ + "to avatar {0}", + sp.UUID.ToString()); + AttachObject(sp.ControllingClient, + grp.LocalId, (uint)0, + grp.GroupRotation, + grp.AbsolutePosition, false); } else { - // Remove, then add, to ensure the expire - // time is refreshed. Wouldn't do to - // have it poof before the avatar gets - // there. - // RootPrim.RemFlag(PrimFlags.TemporaryOnRez); RootPrim.AddFlag(PrimFlags.TemporaryOnRez); } } } } + else + { + if (!Permissions.CanObjectEntry(sceneObject.UUID, + true, sceneObject.AbsolutePosition)) + { + // Deny non attachments based on parcel settings + // + m_log.Info("[INTERREGION]: Denied prim crossing "+ + "because of parcel settings"); + + return false; + } + } + + AddRestoredSceneObject(sceneObject, true, false); } - return true; - } - else - { - return false; } + + return true; } #endregion diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 8a6f06c..fabf276 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -592,7 +592,8 @@ namespace OpenSim.Region.Environment.Scenes m_scene = scene; RegionHandle = m_scene.RegionInfo.RegionHandle; - m_rootPart.ParentID = 0; + if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) + m_rootPart.ParentID = 0; if (m_rootPart.LocalId==0) m_rootPart.LocalId = m_scene.AllocateLocalId(); @@ -921,9 +922,10 @@ namespace OpenSim.Region.Environment.Scenes public void SetRootPart(SceneObjectPart part) { part.SetParent(this); - part.ParentID = 0; - part.LinkNum = 0; m_rootPart = part; + if (!IsAttachment) + part.ParentID = 0; + part.LinkNum = 0; // No locking required since the SOG should not be in the scene yet - one can't change root parts after // the scene object has been attached to the scene -- cgit v1.1