diff options
author | Melanie | 2013-11-03 21:34:36 +0000 |
---|---|---|
committer | Melanie | 2013-11-03 21:34:36 +0000 |
commit | ba203ed94fb9fb27e4da2663dad6cac21d5892e3 (patch) | |
tree | c03981fa7b9070af3cec331234b78762c49a8a06 /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff) | |
parent | Add current .NET windows framework requirement to README. (diff) | |
download | opensim-SC-ba203ed94fb9fb27e4da2663dad6cac21d5892e3.zip opensim-SC-ba203ed94fb9fb27e4da2663dad6cac21d5892e3.tar.gz opensim-SC-ba203ed94fb9fb27e4da2663dad6cac21d5892e3.tar.bz2 opensim-SC-ba203ed94fb9fb27e4da2663dad6cac21d5892e3.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
4 files changed, 175 insertions, 79 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 659bde9..f384462 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -31,6 +31,7 @@ using System.Collections; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Timers; | 33 | using System.Timers; |
34 | using System.Xml; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenMetaverse.Packets; | 36 | using OpenMetaverse.Packets; |
36 | using log4net; | 37 | using log4net; |
@@ -2301,6 +2302,85 @@ namespace OpenSim.Region.Framework.Scenes | |||
2301 | } | 2302 | } |
2302 | 2303 | ||
2303 | /// <summary> | 2304 | /// <summary> |
2305 | /// Returns the list of Scene Objects in an asset. | ||
2306 | /// </summary> | ||
2307 | /// <remarks> | ||
2308 | /// Returns one object if the asset is a regular object, and multiple objects for a coalesced object. | ||
2309 | /// </remarks> | ||
2310 | /// <param name="assetData">Asset data</param> | ||
2311 | /// <param name="attachment">Whether the item is an attachment</param> | ||
2312 | /// <param name="objlist">The objects included in the asset</param> | ||
2313 | /// <param name="veclist">Relative positions of the objects</param> | ||
2314 | /// <param name="bbox">Bounding box of all the objects</param> | ||
2315 | /// <param name="offsetHeight">Offset in the Z axis from the centre of the bounding box | ||
2316 | /// to the centre of the root prim (relevant only when returning a single object)</param> | ||
2317 | /// <returns>true = returning a single object; false = multiple objects</returns> | ||
2318 | public bool GetObjectsToRez(byte[] assetData, bool attachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, | ||
2319 | out Vector3 bbox, out float offsetHeight) | ||
2320 | { | ||
2321 | objlist = new List<SceneObjectGroup>(); | ||
2322 | veclist = new List<Vector3>(); | ||
2323 | |||
2324 | XmlDocument doc = new XmlDocument(); | ||
2325 | string xmlData = Utils.BytesToString(assetData); | ||
2326 | doc.LoadXml(xmlData); | ||
2327 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | ||
2328 | |||
2329 | if (e == null || attachment) // Single | ||
2330 | { | ||
2331 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
2332 | |||
2333 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
2334 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
2335 | g.RootPart.AttachRotation = g.GroupRotation; | ||
2336 | if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && | ||
2337 | g.RootPart.Shape.PCode != (byte)PCode.Tree) | ||
2338 | g.RootPart.Shape.State = 0; | ||
2339 | |||
2340 | objlist.Add(g); | ||
2341 | veclist.Add(new Vector3(0, 0, 0)); | ||
2342 | bbox = g.GetAxisAlignedBoundingBox(out offsetHeight); | ||
2343 | return true; | ||
2344 | } | ||
2345 | else | ||
2346 | { | ||
2347 | XmlElement coll = (XmlElement)e; | ||
2348 | float bx = Convert.ToSingle(coll.GetAttribute("x")); | ||
2349 | float by = Convert.ToSingle(coll.GetAttribute("y")); | ||
2350 | float bz = Convert.ToSingle(coll.GetAttribute("z")); | ||
2351 | bbox = new Vector3(bx, by, bz); | ||
2352 | offsetHeight = 0; | ||
2353 | |||
2354 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); | ||
2355 | foreach (XmlNode n in groups) | ||
2356 | { | ||
2357 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | ||
2358 | |||
2359 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
2360 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
2361 | g.RootPart.AttachRotation = g.GroupRotation; | ||
2362 | if (g.RootPart.Shape.PCode != (byte)PCode.NewTree && | ||
2363 | g.RootPart.Shape.PCode != (byte)PCode.Tree) | ||
2364 | g.RootPart.Shape.State = 0; | ||
2365 | |||
2366 | objlist.Add(g); | ||
2367 | |||
2368 | XmlElement el = (XmlElement)n; | ||
2369 | string rawX = el.GetAttribute("offsetx"); | ||
2370 | string rawY = el.GetAttribute("offsety"); | ||
2371 | string rawZ = el.GetAttribute("offsetz"); | ||
2372 | |||
2373 | float x = Convert.ToSingle(rawX); | ||
2374 | float y = Convert.ToSingle(rawY); | ||
2375 | float z = Convert.ToSingle(rawZ); | ||
2376 | veclist.Add(new Vector3(x, y, z)); | ||
2377 | } | ||
2378 | } | ||
2379 | |||
2380 | return false; | ||
2381 | } | ||
2382 | |||
2383 | /// <summary> | ||
2304 | /// Event Handler Rez an object into a scene | 2384 | /// Event Handler Rez an object into a scene |
2305 | /// Calls the non-void event handler | 2385 | /// Calls the non-void event handler |
2306 | /// </summary> | 2386 | /// </summary> |
@@ -2375,19 +2455,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2375 | /// will be used if it exists.</param> | 2455 | /// will be used if it exists.</param> |
2376 | /// <param name="vel">The velocity of the rezzed object.</param> | 2456 | /// <param name="vel">The velocity of the rezzed object.</param> |
2377 | /// <param name="param"></param> | 2457 | /// <param name="param"></param> |
2378 | /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns> | 2458 | /// <returns>The SceneObjectGroup(s) rezzed, or null if rez was unsuccessful</returns> |
2379 | public virtual SceneObjectGroup RezObject( | 2459 | public virtual List<SceneObjectGroup> RezObject( |
2380 | SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param) | 2460 | SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param) |
2381 | { | 2461 | { |
2382 | if (null == item) | 2462 | if (null == item) |
2383 | return null; | 2463 | return null; |
2464 | |||
2465 | List<SceneObjectGroup> objlist; | ||
2466 | List<Vector3> veclist; | ||
2384 | 2467 | ||
2385 | SceneObjectGroup group = sourcePart.Inventory.GetRezReadySceneObject(item); | 2468 | bool success = sourcePart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist); |
2386 | 2469 | if (!success) | |
2387 | if (null == group) | ||
2388 | return null; | 2470 | return null; |
2389 | 2471 | ||
2390 | if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) | 2472 | int totalPrims = 0; |
2473 | foreach (SceneObjectGroup group in objlist) | ||
2474 | totalPrims += group.PrimCount; | ||
2475 | |||
2476 | if (!Permissions.CanRezObject(totalPrims, item.OwnerID, pos)) | ||
2391 | return null; | 2477 | return null; |
2392 | 2478 | ||
2393 | if (!Permissions.BypassPermissions()) | 2479 | if (!Permissions.BypassPermissions()) |
@@ -2396,23 +2482,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2396 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); | 2482 | sourcePart.Inventory.RemoveInventoryItem(item.ItemID); |
2397 | } | 2483 | } |
2398 | 2484 | ||
2399 | 2485 | for (int i = 0; i < objlist.Count; i++) | |
2400 | if (group.IsAttachment == false && group.RootPart.Shape.State != 0) | ||
2401 | { | 2486 | { |
2402 | group.RootPart.AttachedPos = group.AbsolutePosition; | 2487 | SceneObjectGroup group = objlist[i]; |
2403 | group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; | 2488 | Vector3 curpos = pos + veclist[i]; |
2489 | |||
2490 | if (group.IsAttachment == false && group.RootPart.Shape.State != 0) | ||
2491 | { | ||
2492 | group.RootPart.AttachedPos = group.AbsolutePosition; | ||
2493 | group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; | ||
2494 | } | ||
2495 | |||
2496 | group.FromPartID = sourcePart.UUID; | ||
2497 | AddNewSceneObject(group, true, curpos, rot, vel); | ||
2498 | |||
2499 | // We can only call this after adding the scene object, since the scene object references the scene | ||
2500 | // to find out if scripts should be activated at all. | ||
2501 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); | ||
2502 | |||
2503 | group.ScheduleGroupForFullUpdate(); | ||
2404 | } | 2504 | } |
2405 | 2505 | ||
2406 | group.FromPartID = sourcePart.UUID; | 2506 | return objlist; |
2407 | AddNewSceneObject(group, true, pos, rot, vel); | ||
2408 | |||
2409 | // We can only call this after adding the scene object, since the scene object references the scene | ||
2410 | // to find out if scripts should be activated at all. | ||
2411 | group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); | ||
2412 | |||
2413 | group.ScheduleGroupForFullUpdate(); | ||
2414 | |||
2415 | return group; | ||
2416 | } | 2507 | } |
2417 | 2508 | ||
2418 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, | 2509 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 421cb08..46b2d2e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -252,8 +252,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
252 | if (part.ParentGroup.RootPart.LocalId != part.LocalId) | 252 | if (part.ParentGroup.RootPart.LocalId != part.LocalId) |
253 | return; | 253 | return; |
254 | 254 | ||
255 | bool isAttachment = false; | ||
256 | |||
257 | // This is wrong, wrong, wrong. Selection should not be | 255 | // This is wrong, wrong, wrong. Selection should not be |
258 | // handled by group, but by prim. Legacy cruft. | 256 | // handled by group, but by prim. Legacy cruft. |
259 | // TODO: Make selection flagging per prim! | 257 | // TODO: Make selection flagging per prim! |
@@ -262,17 +260,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
262 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) | 260 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) |
263 | part.ParentGroup.IsSelected = false; | 261 | part.ParentGroup.IsSelected = false; |
264 | 262 | ||
265 | if (part.ParentGroup.IsAttachment) | 263 | part.ParentGroup.ScheduleGroupForFullUpdate(); |
266 | isAttachment = true; | ||
267 | else | ||
268 | part.ParentGroup.ScheduleGroupForFullUpdate(); | ||
269 | 264 | ||
270 | // If it's not an attachment, and we are allowed to move it, | 265 | // If it's not an attachment, and we are allowed to move it, |
271 | // then we might have done so. If we moved across a parcel | 266 | // then we might have done so. If we moved across a parcel |
272 | // boundary, we will need to recount prims on the parcels. | 267 | // boundary, we will need to recount prims on the parcels. |
273 | // For attachments, that makes no sense. | 268 | // For attachments, that makes no sense. |
274 | // | 269 | // |
275 | if (!isAttachment) | 270 | if (!part.ParentGroup.IsAttachment) |
276 | { | 271 | { |
277 | if (Permissions.CanEditObject( | 272 | if (Permissions.CanEditObject( |
278 | part.UUID, remoteClient.AgentId) | 273 | part.UUID, remoteClient.AgentId) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 66b42a1..f5cb84b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3158,7 +3158,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3158 | return; | 3158 | return; |
3159 | 3159 | ||
3160 | // This was pulled from SceneViewer. Attachments always receive full updates. | 3160 | // This was pulled from SceneViewer. Attachments always receive full updates. |
3161 | // I could not verify if this is a requirement but this maintains existing behavior | 3161 | // This is needed because otherwise if only the root prim changes position, then |
3162 | // it looks as if the entire object has moved (including the other prims). | ||
3162 | if (ParentGroup.IsAttachment) | 3163 | if (ParentGroup.IsAttachment) |
3163 | { | 3164 | { |
3164 | ScheduleFullUpdate(); | 3165 | ScheduleFullUpdate(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3be0623..b4fc472 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -881,8 +881,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
881 | 881 | ||
882 | return items; | 882 | return items; |
883 | } | 883 | } |
884 | 884 | ||
885 | public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) | 885 | public bool GetRezReadySceneObjects(TaskInventoryItem item, out List<SceneObjectGroup> objlist, out List<Vector3> veclist) |
886 | { | 886 | { |
887 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); | 887 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); |
888 | 888 | ||
@@ -891,70 +891,79 @@ namespace OpenSim.Region.Framework.Scenes | |||
891 | m_log.WarnFormat( | 891 | m_log.WarnFormat( |
892 | "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", | 892 | "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", |
893 | item.AssetID, item.Name, m_part.Name); | 893 | item.AssetID, item.Name, m_part.Name); |
894 | return null; | 894 | objlist = null; |
895 | veclist = null; | ||
896 | return false; | ||
895 | } | 897 | } |
896 | 898 | ||
897 | string xmlData = Utils.BytesToString(rezAsset.Data); | 899 | Vector3 bbox; |
898 | SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 900 | float offsetHeight; |
899 | 901 | ||
900 | group.RootPart.AttachPoint = group.RootPart.Shape.State; | 902 | bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); |
901 | group.RootPart.AttachOffset = group.AbsolutePosition; | ||
902 | group.RootPart.AttachRotation = group.GroupRotation; | ||
903 | 903 | ||
904 | group.ResetIDs(); | 904 | for (int i = 0; i < objlist.Count; i++) |
905 | { | ||
906 | SceneObjectGroup group = objlist[i]; | ||
905 | 907 | ||
906 | SceneObjectPart rootPart = group.GetPart(group.UUID); | 908 | group.RootPart.AttachPoint = group.RootPart.Shape.State; |
909 | group.RootPart.AttachOffset = group.AbsolutePosition; | ||
910 | group.RootPart.AttachRotation = group.GroupRotation; | ||
907 | 911 | ||
908 | // Since renaming the item in the inventory does not affect the name stored | 912 | group.ResetIDs(); |
909 | // in the serialization, transfer the correct name from the inventory to the | ||
910 | // object itself before we rez. | ||
911 | rootPart.Name = item.Name; | ||
912 | rootPart.Description = item.Description; | ||
913 | 913 | ||
914 | SceneObjectPart[] partList = group.Parts; | 914 | SceneObjectPart rootPart = group.GetPart(group.UUID); |
915 | 915 | ||
916 | group.SetGroup(m_part.GroupID, null); | 916 | // Since renaming the item in the inventory does not affect the name stored |
917 | // in the serialization, transfer the correct name from the inventory to the | ||
918 | // object itself before we rez. | ||
919 | rootPart.Name = item.Name; | ||
920 | rootPart.Description = item.Description; | ||
917 | 921 | ||
918 | // TODO: Remove magic number badness | 922 | SceneObjectPart[] partList = group.Parts; |
919 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | 923 | |
920 | { | 924 | group.SetGroup(m_part.GroupID, null); |
921 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | 925 | |
926 | // TODO: Remove magic number badness | ||
927 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
922 | { | 928 | { |
923 | foreach (SceneObjectPart part in partList) | 929 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) |
924 | { | 930 | { |
925 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 931 | foreach (SceneObjectPart part in partList) |
926 | part.EveryoneMask = item.EveryonePermissions; | 932 | { |
927 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | 933 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) |
928 | part.NextOwnerMask = item.NextPermissions; | 934 | part.EveryoneMask = item.EveryonePermissions; |
929 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 935 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) |
930 | part.GroupMask = item.GroupPermissions; | 936 | part.NextOwnerMask = item.NextPermissions; |
937 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
938 | part.GroupMask = item.GroupPermissions; | ||
939 | } | ||
940 | |||
941 | group.ApplyNextOwnerPermissions(); | ||
931 | } | 942 | } |
932 | |||
933 | group.ApplyNextOwnerPermissions(); | ||
934 | } | 943 | } |
935 | } | ||
936 | 944 | ||
937 | foreach (SceneObjectPart part in partList) | 945 | foreach (SceneObjectPart part in partList) |
938 | { | ||
939 | // TODO: Remove magic number badness | ||
940 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number | ||
941 | { | 946 | { |
942 | part.LastOwnerID = part.OwnerID; | 947 | // TODO: Remove magic number badness |
943 | part.OwnerID = item.OwnerID; | 948 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number |
944 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | 949 | { |
950 | part.LastOwnerID = part.OwnerID; | ||
951 | part.OwnerID = item.OwnerID; | ||
952 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
953 | } | ||
954 | |||
955 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
956 | part.EveryoneMask = item.EveryonePermissions; | ||
957 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
958 | part.NextOwnerMask = item.NextPermissions; | ||
959 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
960 | part.GroupMask = item.GroupPermissions; | ||
945 | } | 961 | } |
946 | 962 | ||
947 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 963 | rootPart.TrimPermissions(); |
948 | part.EveryoneMask = item.EveryonePermissions; | ||
949 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
950 | part.NextOwnerMask = item.NextPermissions; | ||
951 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
952 | part.GroupMask = item.GroupPermissions; | ||
953 | } | 964 | } |
954 | 965 | ||
955 | rootPart.TrimPermissions(); | 966 | return true; |
956 | |||
957 | return group; | ||
958 | } | 967 | } |
959 | 968 | ||
960 | /// <summary> | 969 | /// <summary> |