aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
authorMelanie2010-08-25 23:22:23 +0100
committerMelanie2010-08-25 23:22:23 +0100
commit252e159340575cb75b35091ff5d6c5b8fa9beed7 (patch)
tree8e77d58e98ad74a47daec298d7488e19e6797748 /OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
parentPrevent an object disposed exception that made forms comms unreliable. After (diff)
parentPrevent an object disposed exception that made forms comms unreliable. After (diff)
downloadopensim-SC-252e159340575cb75b35091ff5d6c5b8fa9beed7.zip
opensim-SC-252e159340575cb75b35091ff5d6c5b8fa9beed7.tar.gz
opensim-SC-252e159340575cb75b35091ff5d6c5b8fa9beed7.tar.bz2
opensim-SC-252e159340575cb75b35091ff5d6c5b8fa9beed7.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs128
1 files changed, 56 insertions, 72 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0384224..012732b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes
122 else 122 else
123 { 123 {
124 m_log.WarnFormat( 124 m_log.WarnFormat(
125 "[AGENT INVENTORY]: Agent {1} could not add item {2} {3}", 125 "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
126 AgentID, item.Name, item.ID); 126 AgentID, item.Name, item.ID);
127 127
128 return; 128 return;
@@ -2004,7 +2004,7 @@ namespace OpenSim.Region.Framework.Scenes
2004 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 2004 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
2005 RezSelected, RemoveItem, fromTaskID, false); 2005 RezSelected, RemoveItem, fromTaskID, false);
2006 } 2006 }
2007 2007
2008 /// <summary> 2008 /// <summary>
2009 /// Rez an object into the scene from a prim's inventory. 2009 /// Rez an object into the scene from a prim's inventory.
2010 /// </summary> 2010 /// </summary>
@@ -2019,95 +2019,79 @@ namespace OpenSim.Region.Framework.Scenes
2019 SceneObjectPart sourcePart, TaskInventoryItem item, 2019 SceneObjectPart sourcePart, TaskInventoryItem item,
2020 Vector3 pos, Quaternion rot, Vector3 vel, int param) 2020 Vector3 pos, Quaternion rot, Vector3 vel, int param)
2021 { 2021 {
2022 // Rez object 2022 if (null == item)
2023 if (item != null) 2023 return null;
2024 { 2024
2025 UUID ownerID = item.OwnerID; 2025 UUID ownerID = item.OwnerID;
2026 2026 AssetBase rezAsset = AssetService.Get(item.AssetID.ToString());
2027 AssetBase rezAsset = AssetService.Get(item.AssetID.ToString());
2028
2029 if (rezAsset != null)
2030 {
2031 string xmlData = Utils.BytesToString(rezAsset.Data);
2032 SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
2033 2027
2034 if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos)) 2028 if (null == rezAsset)
2035 { 2029 return null;
2036 return null;
2037 }
2038 group.ResetIDs();
2039 2030
2040 AddNewSceneObject(group, true); 2031 string xmlData = Utils.BytesToString(rezAsset.Data);
2032 SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
2041 2033
2042 // we set it's position in world. 2034 if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos))
2043 group.AbsolutePosition = pos; 2035 return null;
2044 2036
2045 SceneObjectPart rootPart = group.GetChildPart(group.UUID); 2037 group.ResetIDs();
2046 2038
2047 // Since renaming the item in the inventory does not affect the name stored 2039 SceneObjectPart rootPart = group.GetChildPart(group.UUID);
2048 // in the serialization, transfer the correct name from the inventory to the
2049 // object itself before we rez.
2050 rootPart.Name = item.Name;
2051 rootPart.Description = item.Description;
2052 2040
2053 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 2041 // Since renaming the item in the inventory does not affect the name stored
2042 // in the serialization, transfer the correct name from the inventory to the
2043 // object itself before we rez.
2044 rootPart.Name = item.Name;
2045 rootPart.Description = item.Description;
2054 2046
2055 group.SetGroup(sourcePart.GroupID, null); 2047 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
2056 2048
2057 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) 2049 group.SetGroup(sourcePart.GroupID, null);
2058 {
2059 if (Permissions.PropagatePermissions())
2060 {
2061 foreach (SceneObjectPart part in partList)
2062 {
2063 part.EveryoneMask = item.EveryonePermissions;
2064 part.NextOwnerMask = item.NextPermissions;
2065 }
2066 group.ApplyNextOwnerPermissions();
2067 }
2068 }
2069 2050
2051 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
2052 {
2053 if (Permissions.PropagatePermissions())
2054 {
2070 foreach (SceneObjectPart part in partList) 2055 foreach (SceneObjectPart part in partList)
2071 { 2056 {
2072 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
2073 {
2074 part.LastOwnerID = part.OwnerID;
2075 part.OwnerID = item.OwnerID;
2076 part.Inventory.ChangeInventoryOwner(item.OwnerID);
2077 }
2078 part.EveryoneMask = item.EveryonePermissions; 2057 part.EveryoneMask = item.EveryonePermissions;
2079 part.NextOwnerMask = item.NextPermissions; 2058 part.NextOwnerMask = item.NextPermissions;
2080 } 2059 }
2081 2060
2082 rootPart.TrimPermissions(); 2061 group.ApplyNextOwnerPermissions();
2083 2062 }
2084 if (group.RootPart.Shape.PCode == (byte)PCode.Prim) 2063 }
2085 {
2086 group.ClearPartAttachmentData();
2087 }
2088
2089 group.UpdateGroupRotationR(rot);
2090
2091 //group.ApplyPhysics(m_physicalPrim);
2092 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
2093 {
2094 group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
2095 group.Velocity = vel;
2096 rootPart.ScheduleFullUpdate();
2097 }
2098 group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
2099 rootPart.ScheduleFullUpdate();
2100 2064
2101 if (!Permissions.BypassPermissions()) 2065 foreach (SceneObjectPart part in partList)
2102 { 2066 {
2103 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 2067 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
2104 sourcePart.Inventory.RemoveInventoryItem(item.ItemID); 2068 {
2105 } 2069 part.LastOwnerID = part.OwnerID;
2106 return rootPart.ParentGroup; 2070 part.OwnerID = item.OwnerID;
2071 part.Inventory.ChangeInventoryOwner(item.OwnerID);
2107 } 2072 }
2073
2074 part.EveryoneMask = item.EveryonePermissions;
2075 part.NextOwnerMask = item.NextPermissions;
2108 } 2076 }
2077
2078 rootPart.TrimPermissions();
2109 2079
2110 return null; 2080 if (!Permissions.BypassPermissions())
2081 {
2082 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
2083 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2084 }
2085
2086 AddNewSceneObject(group, true, pos, rot, vel);
2087
2088 // We can only call this after adding the scene object, since the scene object references the scene
2089 // to find out if scripts should be activated at all.
2090 group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
2091
2092 group.ScheduleGroupForFullUpdate();
2093
2094 return rootPart.ParentGroup;
2111 } 2095 }
2112 2096
2113 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) 2097 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)