aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorRobert Adams2013-10-16 07:53:44 -0700
committerRobert Adams2013-10-16 07:53:44 -0700
commit8937a2244d65ea71c402777bb68a986f60982e07 (patch)
tree03601074b85b0c41ff15f5155a4b14c197954450 /OpenSim/Region/Framework
parentvarregion: move the compressed heighmap compression factor from (diff)
parentBulletSim: implement the SL bug where VEHICLE_HOVER_UP_ONLY disables (diff)
downloadopensim-SC-8937a2244d65ea71c402777bb68a986f60982e07.zip
opensim-SC-8937a2244d65ea71c402777bb68a986f60982e07.tar.gz
opensim-SC-8937a2244d65ea71c402777bb68a986f60982e07.tar.bz2
opensim-SC-8937a2244d65ea71c402777bb68a986f60982e07.tar.xz
Merge branch 'master' into varregion
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs119
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs101
4 files changed, 163 insertions, 72 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 150193d..9ffda51 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -234,15 +234,17 @@ namespace OpenSim.Region.Framework.Interfaces
234 List<TaskInventoryItem> GetInventoryItems(InventoryType type); 234 List<TaskInventoryItem> GetInventoryItems(InventoryType type);
235 235
236 /// <summary> 236 /// <summary>
237 /// Get the scene object referenced by an inventory item. 237 /// Get the scene object(s) referenced by an inventory item.
238 /// </summary> 238 /// </summary>
239 /// 239 ///
240 /// This is returned in a 'rez ready' state. That is, name, description, permissions and other details have 240 /// This is returned in a 'rez ready' state. That is, name, description, permissions and other details have
241 /// been adjusted to reflect the part and item from which it originates. 241 /// been adjusted to reflect the part and item from which it originates.
242 /// 242 ///
243 /// <param name="item"></param> 243 /// <param name="item">Inventory item</param>
244 /// <returns>The scene object. Null if the scene object asset couldn't be found</returns> 244 /// <param name="objlist">The scene objects</param>
245 SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item); 245 /// <param name="veclist">Relative offsets for each object</param>
246 /// <returns>true = success, false = the scene object asset couldn't be found</returns>
247 bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist);
246 248
247 /// <summary> 249 /// <summary>
248 /// Update an existing inventory item. 250 /// Update an existing inventory item.
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index d49b24e..944c66b 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -54,5 +54,10 @@ namespace OpenSim.Region.Framework.Interfaces
54 54
55 void setEstateTerrainBaseTexture(int level, UUID texture); 55 void setEstateTerrainBaseTexture(int level, UUID texture);
56 void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue); 56 void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue);
57
58 /// <summary>
59 /// Returns whether the transfer ID is being used for a terrain transfer.
60 /// </summary>
61 bool IsTerrainXfer(ulong xferID);
57 } 62 }
58} 63}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4bebbe8..65536db 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -31,6 +31,7 @@ using System.Collections;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Timers; 33using System.Timers;
34using System.Xml;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenMetaverse.Packets; 36using OpenMetaverse.Packets;
36using log4net; 37using log4net;
@@ -2135,6 +2136,69 @@ namespace OpenSim.Region.Framework.Scenes
2135 } 2136 }
2136 2137
2137 /// <summary> 2138 /// <summary>
2139 /// Returns the list of Scene Objects in an asset.
2140 /// </summary>
2141 /// <remarks>
2142 /// Returns one object if the asset is a regular object, and multiple objects for a coalesced object.
2143 /// </remarks>
2144 /// <param name="assetData">Asset data</param>
2145 /// <param name="attachment">Whether the item is an attachment</param>
2146 /// <param name="objlist">The objects included in the asset</param>
2147 /// <param name="veclist">Relative positions of the objects</param>
2148 /// <param name="bbox">Bounding box of all the objects</param>
2149 /// <param name="offsetHeight">Offset in the Z axis from the centre of the bounding box
2150 /// to the centre of the root prim (relevant only when returning a single object)</param>
2151 /// <returns>true = returning a single object; false = multiple objects</returns>
2152 public bool GetObjectsToRez(byte[] assetData, bool attachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist,
2153 out Vector3 bbox, out float offsetHeight)
2154 {
2155 objlist = new List<SceneObjectGroup>();
2156 veclist = new List<Vector3>();
2157
2158 XmlDocument doc = new XmlDocument();
2159 string xmlData = Utils.BytesToString(assetData);
2160 doc.LoadXml(xmlData);
2161 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
2162
2163 if (e == null || attachment) // Single
2164 {
2165 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
2166 objlist.Add(g);
2167 veclist.Add(new Vector3(0, 0, 0));
2168 bbox = g.GetAxisAlignedBoundingBox(out offsetHeight);
2169 return true;
2170 }
2171 else
2172 {
2173 XmlElement coll = (XmlElement)e;
2174 float bx = Convert.ToSingle(coll.GetAttribute("x"));
2175 float by = Convert.ToSingle(coll.GetAttribute("y"));
2176 float bz = Convert.ToSingle(coll.GetAttribute("z"));
2177 bbox = new Vector3(bx, by, bz);
2178 offsetHeight = 0;
2179
2180 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
2181 foreach (XmlNode n in groups)
2182 {
2183 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
2184 objlist.Add(g);
2185
2186 XmlElement el = (XmlElement)n;
2187 string rawX = el.GetAttribute("offsetx");
2188 string rawY = el.GetAttribute("offsety");
2189 string rawZ = el.GetAttribute("offsetz");
2190
2191 float x = Convert.ToSingle(rawX);
2192 float y = Convert.ToSingle(rawY);
2193 float z = Convert.ToSingle(rawZ);
2194 veclist.Add(new Vector3(x, y, z));
2195 }
2196 }
2197
2198 return false;
2199 }
2200
2201 /// <summary>
2138 /// Event Handler Rez an object into a scene 2202 /// Event Handler Rez an object into a scene
2139 /// Calls the non-void event handler 2203 /// Calls the non-void event handler
2140 /// </summary> 2204 /// </summary>
@@ -2209,19 +2273,25 @@ namespace OpenSim.Region.Framework.Scenes
2209 /// will be used if it exists.</param> 2273 /// will be used if it exists.</param>
2210 /// <param name="vel">The velocity of the rezzed object.</param> 2274 /// <param name="vel">The velocity of the rezzed object.</param>
2211 /// <param name="param"></param> 2275 /// <param name="param"></param>
2212 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns> 2276 /// <returns>The SceneObjectGroup(s) rezzed, or null if rez was unsuccessful</returns>
2213 public virtual SceneObjectGroup RezObject( 2277 public virtual List<SceneObjectGroup> RezObject(
2214 SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param) 2278 SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param)
2215 { 2279 {
2216 if (null == item) 2280 if (null == item)
2217 return null; 2281 return null;
2282
2283 List<SceneObjectGroup> objlist;
2284 List<Vector3> veclist;
2218 2285
2219 SceneObjectGroup group = sourcePart.Inventory.GetRezReadySceneObject(item); 2286 bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist);
2220 2287 if (!success)
2221 if (null == group)
2222 return null; 2288 return null;
2223 2289
2224 if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) 2290 int totalPrims = 0;
2291 foreach (SceneObjectGroup group in objlist)
2292 totalPrims += group.PrimCount;
2293
2294 if (!Permissions.CanRezObject(totalPrims, item.OwnerID, pos))
2225 return null; 2295 return null;
2226 2296
2227 if (!Permissions.BypassPermissions()) 2297 if (!Permissions.BypassPermissions())
@@ -2230,23 +2300,28 @@ namespace OpenSim.Region.Framework.Scenes
2230 sourcePart.Inventory.RemoveInventoryItem(item.ItemID); 2300 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
2231 } 2301 }
2232 2302
2233 2303 for (int i = 0; i < objlist.Count; i++)
2234 if (group.IsAttachment == false && group.RootPart.Shape.State != 0)
2235 { 2304 {
2236 group.RootPart.AttachedPos = group.AbsolutePosition; 2305 SceneObjectGroup group = objlist[i];
2237 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; 2306 Vector3 curpos = pos + veclist[i];
2307
2308 if (group.IsAttachment == false && group.RootPart.Shape.State != 0)
2309 {
2310 group.RootPart.AttachedPos = group.AbsolutePosition;
2311 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
2312 }
2313
2314 group.FromPartID = sourcePart.UUID;
2315 AddNewSceneObject(group, true, curpos, rot, vel);
2316
2317 // We can only call this after adding the scene object, since the scene object references the scene
2318 // to find out if scripts should be activated at all.
2319 group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
2320
2321 group.ScheduleGroupForFullUpdate();
2238 } 2322 }
2239 2323
2240 group.FromPartID = sourcePart.UUID; 2324 return objlist;
2241 AddNewSceneObject(group, true, pos, rot, vel);
2242
2243 // We can only call this after adding the scene object, since the scene object references the scene
2244 // to find out if scripts should be activated at all.
2245 group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
2246
2247 group.ScheduleGroupForFullUpdate();
2248
2249 return group;
2250 } 2325 }
2251 2326
2252 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, 2327 public virtual bool returnObjects(SceneObjectGroup[] returnobjects,
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3f223a3..380e402 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -733,8 +733,8 @@ namespace OpenSim.Region.Framework.Scenes
733 733
734 return items; 734 return items;
735 } 735 }
736 736
737 public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) 737 public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist)
738 { 738 {
739 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); 739 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
740 740
@@ -743,66 +743,75 @@ namespace OpenSim.Region.Framework.Scenes
743 m_log.WarnFormat( 743 m_log.WarnFormat(
744 "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", 744 "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}",
745 item.AssetID, item.Name, m_part.Name); 745 item.AssetID, item.Name, m_part.Name);
746 return null; 746 objlist = null;
747 veclist = null;
748 return false;
747 } 749 }
748 750
749 string xmlData = Utils.BytesToString(rezAsset.Data); 751 Vector3 bbox;
750 SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); 752 float offsetHeight;
751 753
752 group.ResetIDs(); 754 bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
753 755
754 SceneObjectPart rootPart = group.GetPart(group.UUID); 756 for (int i = 0; i < objlist.Count; i++)
757 {
758 SceneObjectGroup group = objlist[i];
755 759
756 // Since renaming the item in the inventory does not affect the name stored 760 group.ResetIDs();
757 // in the serialization, transfer the correct name from the inventory to the
758 // object itself before we rez.
759 rootPart.Name = item.Name;
760 rootPart.Description = item.Description;
761 761
762 SceneObjectPart[] partList = group.Parts; 762 SceneObjectPart rootPart = group.GetPart(group.UUID);
763 763
764 group.SetGroup(m_part.GroupID, null); 764 // Since renaming the item in the inventory does not affect the name stored
765 // in the serialization, transfer the correct name from the inventory to the
766 // object itself before we rez.
767 rootPart.Name = item.Name;
768 rootPart.Description = item.Description;
765 769
766 // TODO: Remove magic number badness 770 SceneObjectPart[] partList = group.Parts;
767 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number 771
768 { 772 group.SetGroup(m_part.GroupID, null);
769 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) 773
774 // TODO: Remove magic number badness
775 if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
770 { 776 {
771 foreach (SceneObjectPart part in partList) 777 if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
772 { 778 {
773 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) 779 foreach (SceneObjectPart part in partList)
774 part.EveryoneMask = item.EveryonePermissions; 780 {
775 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) 781 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
776 part.NextOwnerMask = item.NextPermissions; 782 part.EveryoneMask = item.EveryonePermissions;
777 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) 783 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
778 part.GroupMask = item.GroupPermissions; 784 part.NextOwnerMask = item.NextPermissions;
785 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
786 part.GroupMask = item.GroupPermissions;
787 }
788
789 group.ApplyNextOwnerPermissions();
779 } 790 }
780
781 group.ApplyNextOwnerPermissions();
782 } 791 }
783 }
784 792
785 foreach (SceneObjectPart part in partList) 793 foreach (SceneObjectPart part in partList)
786 {
787 // TODO: Remove magic number badness
788 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
789 { 794 {
790 part.LastOwnerID = part.OwnerID; 795 // TODO: Remove magic number badness
791 part.OwnerID = item.OwnerID; 796 if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
792 part.Inventory.ChangeInventoryOwner(item.OwnerID); 797 {
798 part.LastOwnerID = part.OwnerID;
799 part.OwnerID = item.OwnerID;
800 part.Inventory.ChangeInventoryOwner(item.OwnerID);
801 }
802
803 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
804 part.EveryoneMask = item.EveryonePermissions;
805 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
806 part.NextOwnerMask = item.NextPermissions;
807 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
808 part.GroupMask = item.GroupPermissions;
793 } 809 }
794 810
795 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) 811 rootPart.TrimPermissions();
796 part.EveryoneMask = item.EveryonePermissions;
797 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
798 part.NextOwnerMask = item.NextPermissions;
799 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
800 part.GroupMask = item.GroupPermissions;
801 } 812 }
802 813
803 rootPart.TrimPermissions(); 814 return true;
804
805 return group;
806 } 815 }
807 816
808 /// <summary> 817 /// <summary>