aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs22
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations14
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations10
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs6
-rw-r--r--OpenSim/Framework/LandData.cs104
-rw-r--r--OpenSim/Framework/LandUpdateArgs.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs145
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs78
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs131
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs120
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs65
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs515
-rw-r--r--OpenSim/Region/DataSnapshot/ObjectSnapshot.cs15
-rw-r--r--OpenSim/Region/DataSnapshot/SnapshotStore.cs48
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEventQueue.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs69
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs63
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs22
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs8
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs24
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs15
37 files changed, 981 insertions, 733 deletions
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index 37d7a88..04446ce 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -677,7 +677,8 @@ namespace OpenSim.Data.MySQL
677 "MusicURL, PassHours, PassPrice, SnapshotUUID, " + 677 "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
678 "UserLocationX, UserLocationY, UserLocationZ, " + 678 "UserLocationX, UserLocationY, UserLocationZ, " +
679 "UserLookAtX, UserLookAtY, UserLookAtZ, " + 679 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
680 "AuthbuyerID, OtherCleanTime, Dwell) values (" + 680 "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
681 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
681 "?UUID, ?RegionUUID, " + 682 "?UUID, ?RegionUUID, " +
682 "?LocalLandID, ?Bitmap, ?Name, ?Description, " + 683 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
683 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + 684 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@@ -687,7 +688,8 @@ namespace OpenSim.Data.MySQL
687 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + 688 "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
688 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + 689 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
689 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + 690 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
690 "?AuthbuyerID, ?OtherCleanTime, ?Dwell)"; 691 "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
692 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
691 693
692 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); 694 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
693 695
@@ -1347,6 +1349,14 @@ namespace OpenSim.Data.MySQL
1347 m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); 1349 m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
1348 } 1350 }
1349 1351
1352 newData.MediaDescription = (string) row["MediaDescription"];
1353 newData.MediaType = (string) row["MediaType"];
1354 newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
1355 newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
1356 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
1357 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
1358 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
1359
1350 newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); 1360 newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
1351 1361
1352 return newData; 1362 return newData;
@@ -1651,6 +1661,14 @@ namespace OpenSim.Data.MySQL
1651 cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); 1661 cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
1652 cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); 1662 cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
1653 cmd.Parameters.AddWithValue("Dwell", land.Dwell); 1663 cmd.Parameters.AddWithValue("Dwell", land.Dwell);
1664 cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
1665 cmd.Parameters.AddWithValue("MediaType", land.MediaType);
1666 cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);
1667 cmd.Parameters.AddWithValue("MediaHeight", land.MediaHeight);
1668 cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
1669 cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
1670 cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
1671
1654 } 1672 }
1655 1673
1656 /// <summary> 1674 /// <summary>
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index ce99ce4..5c32209 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -801,9 +801,19 @@ ALTER TABLE `regionwindlight` CHANGE COLUMN `cloud_scroll_x` `cloud_scroll_x` F
801COMMIT; 801COMMIT;
802 802
803:VERSION 35 #--------------------- 803:VERSION 35 #---------------------
804-- Added post 0.7
805 804
806BEGIN; 805BEGIN;
807ALTER TABLE prims ADD COLUMN MediaURL varchar(255); 806ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
808ALTER TABLE primshapes ADD COLUMN Media TEXT; 807ALTER TABLE primshapes ADD COLUMN Media TEXT;
809COMMIT; \ No newline at end of file 808COMMIT;
809
810:VERSION 36 #---------------------
811
812BEGIN;
813ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ;
814ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
815ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
816ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
817ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
818ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
819COMMIT;
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index c461bf0..0c421ec 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -446,3 +446,13 @@ update land
446 where AuthbuyerID not like '%-%'; 446 where AuthbuyerID not like '%-%';
447 447
448COMMIT; 448COMMIT;
449
450:VERSION 19
451BEGIN ;
452ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ;
453ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
454ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
455ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
456ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
457ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
458COMMIT ; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 4208050..8432e74 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -1762,6 +1762,12 @@ namespace OpenSim.Data.SQLite
1762 row["AuthbuyerID"] = land.AuthBuyerID.ToString(); 1762 row["AuthbuyerID"] = land.AuthBuyerID.ToString();
1763 row["OtherCleanTime"] = land.OtherCleanTime; 1763 row["OtherCleanTime"] = land.OtherCleanTime;
1764 row["Dwell"] = land.Dwell; 1764 row["Dwell"] = land.Dwell;
1765 row["MediaType"] = land.MediaType;
1766 row["MediaDescription"] = land.MediaDescription;
1767 row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
1768 row["MediaLoop"] = land.MediaLoop.ToString();
1769 row["ObscureMusic"] = land.ObscureMusic.ToString();
1770 row["ObscureMedia"] = land.ObscureMedia.ToString();
1765 } 1771 }
1766 1772
1767 /// <summary> 1773 /// <summary>
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index ef07438..4440c94 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -90,6 +90,78 @@ namespace OpenSim.Framework
90 private Vector3 _userLookAt = new Vector3(); 90 private Vector3 _userLookAt = new Vector3();
91 private int _dwell = 0; 91 private int _dwell = 0;
92 private int _otherCleanTime = 0; 92 private int _otherCleanTime = 0;
93 private string _mediaType = "none/none";
94 private string _mediaDescription = "";
95 private int _mediaHeight = 0;
96 private int _mediaWidth = 0;
97 private bool _mediaLoop = false;
98 private bool _obscureMusic = false;
99 private bool _obscureMedia = false;
100
101 /// <summary>
102 /// Whether to obscure parcel media URL
103 /// </summary>
104 [XmlIgnore]
105 public bool ObscureMedia {
106 get {
107 return _obscureMedia;
108 }
109 set {
110 _obscureMedia = value;
111 }
112 }
113
114 /// <summary>
115 /// Whether to obscure parcel music URL
116 /// </summary>
117 [XmlIgnore]
118 public bool ObscureMusic {
119 get {
120 return _obscureMusic;
121 }
122 set {
123 _obscureMusic = value;
124 }
125 }
126
127 /// <summary>
128 /// Whether to loop parcel media
129 /// </summary>
130 [XmlIgnore]
131 public bool MediaLoop {
132 get {
133 return _mediaLoop;
134 }
135 set {
136 _mediaLoop = value;
137 }
138 }
139
140 /// <summary>
141 /// Height of parcel media render
142 /// </summary>
143 [XmlIgnore]
144 public int MediaHeight {
145 get {
146 return _mediaHeight;
147 }
148 set {
149 _mediaHeight = value;
150 }
151 }
152
153 /// <summary>
154 /// Width of parcel media render
155 /// </summary>
156 [XmlIgnore]
157 public int MediaWidth {
158 get {
159 return _mediaWidth;
160 }
161 set {
162 _mediaWidth = value;
163 }
164 }
93 165
94 /// <summary> 166 /// <summary>
95 /// Upper corner of the AABB for the parcel 167 /// Upper corner of the AABB for the parcel
@@ -358,20 +430,6 @@ namespace OpenSim.Framework
358 } 430 }
359 } 431 }
360 432
361 private int[] _mediaSize = new int[2];
362 public int[] MediaSize
363 {
364 get
365 {
366 return _mediaSize;
367 }
368 set
369 {
370 _mediaSize = value;
371 }
372 }
373
374 private string _mediaType = "";
375 public string MediaType 433 public string MediaType
376 { 434 {
377 get 435 get
@@ -586,6 +644,17 @@ namespace OpenSim.Framework
586 } 644 }
587 } 645 }
588 646
647 /// <summary>
648 /// parcel media description
649 /// </summary>
650 public string MediaDescription {
651 get {
652 return _mediaDescription;
653 }
654 set {
655 _mediaDescription = value;
656 }
657 }
589 658
590 public LandData() 659 public LandData()
591 { 660 {
@@ -635,6 +704,13 @@ namespace OpenSim.Framework
635 landData._userLookAt = _userLookAt; 704 landData._userLookAt = _userLookAt;
636 landData._otherCleanTime = _otherCleanTime; 705 landData._otherCleanTime = _otherCleanTime;
637 landData._dwell = _dwell; 706 landData._dwell = _dwell;
707 landData._mediaType = _mediaType;
708 landData._mediaDescription = _mediaDescription;
709 landData._mediaWidth = _mediaWidth;
710 landData._mediaHeight = _mediaHeight;
711 landData._mediaLoop = _mediaLoop;
712 landData._obscureMusic = _obscureMusic;
713 landData._obscureMedia = _obscureMedia;
638 714
639 landData._parcelAccessList.Clear(); 715 landData._parcelAccessList.Clear();
640 foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) 716 foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
diff --git a/OpenSim/Framework/LandUpdateArgs.cs b/OpenSim/Framework/LandUpdateArgs.cs
index 9760a1d..ed496a1 100644
--- a/OpenSim/Framework/LandUpdateArgs.cs
+++ b/OpenSim/Framework/LandUpdateArgs.cs
@@ -49,5 +49,12 @@ namespace OpenSim.Framework
49 public UUID SnapshotID; 49 public UUID SnapshotID;
50 public Vector3 UserLocation; 50 public Vector3 UserLocation;
51 public Vector3 UserLookAt; 51 public Vector3 UserLookAt;
52 public string MediaType;
53 public string MediaDescription;
54 public int MediaHeight;
55 public int MediaWidth;
56 public bool MediaLoop;
57 public bool ObscureMusic;
58 public bool ObscureMedia;
52 } 59 }
53} 60}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 87ed90f..105501f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -37,6 +37,7 @@ using System.Xml;
37using log4net; 37using log4net;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenMetaverse.Messages.Linden;
40using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
41using OpenSim.Framework; 42using OpenSim.Framework;
42using OpenSim.Framework.Client; 43using OpenSim.Framework.Client;
@@ -328,7 +329,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
328 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an 329 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
329 /// ownerless phantom. 330 /// ownerless phantom.
330 /// 331 ///
331 /// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock 332 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
332 /// 333 ///
333 /// </value> 334 /// </value>
334 protected HashSet<uint> m_killRecord; 335 protected HashSet<uint> m_killRecord;
@@ -394,18 +395,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
394 public string ActiveGroupName { get { return m_activeGroupName; } } 395 public string ActiveGroupName { get { return m_activeGroupName; } }
395 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } 396 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
396 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } 397 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
398
397 /// <summary> 399 /// <summary>
398 /// First name of the agent/avatar represented by the client 400 /// First name of the agent/avatar represented by the client
399 /// </summary> 401 /// </summary>
400 public string FirstName { get { return m_firstName; } } 402 public string FirstName { get { return m_firstName; } }
403
401 /// <summary> 404 /// <summary>
402 /// Last name of the agent/avatar represented by the client 405 /// Last name of the agent/avatar represented by the client
403 /// </summary> 406 /// </summary>
404 public string LastName { get { return m_lastName; } } 407 public string LastName { get { return m_lastName; } }
408
405 /// <summary> 409 /// <summary>
406 /// Full name of the client (first name and last name) 410 /// Full name of the client (first name and last name)
407 /// </summary> 411 /// </summary>
408 public string Name { get { return FirstName + " " + LastName; } } 412 public string Name { get { return FirstName + " " + LastName; } }
413
409 public uint CircuitCode { get { return m_circuitCode; } } 414 public uint CircuitCode { get { return m_circuitCode; } }
410 public int MoneyBalance { get { return m_moneyBalance; } } 415 public int MoneyBalance { get { return m_moneyBalance; } }
411 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } 416 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
@@ -2743,6 +2748,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2743 DirPlacesReplyPacket.StatusDataBlock[] status = 2748 DirPlacesReplyPacket.StatusDataBlock[] status =
2744 new DirPlacesReplyPacket.StatusDataBlock[0]; 2749 new DirPlacesReplyPacket.StatusDataBlock[0];
2745 2750
2751 packet.QueryReplies = replies;
2752 packet.StatusData = status;
2753
2746 foreach (DirPlacesReplyData d in data) 2754 foreach (DirPlacesReplyData d in data)
2747 { 2755 {
2748 int idx = replies.Length; 2756 int idx = replies.Length;
@@ -2781,7 +2789,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2781 } 2789 }
2782 } 2790 }
2783 2791
2784 if (replies.Length > 0) 2792 if (replies.Length > 0 || data.Length == 0)
2785 OutPacket(packet, ThrottleOutPacketType.Task); 2793 OutPacket(packet, ThrottleOutPacketType.Task);
2786 } 2794 }
2787 2795
@@ -4213,94 +4221,101 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4213 4221
4214 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) 4222 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
4215 { 4223 {
4216 ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ParcelProperties); 4224 ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
4217 // TODO: don't create new blocks if recycling an old packet
4218 4225
4219 updatePacket.ParcelData.AABBMax = landData.AABBMax; 4226 updateMessage.AABBMax = landData.AABBMax;
4220 updatePacket.ParcelData.AABBMin = landData.AABBMin; 4227 updateMessage.AABBMin = landData.AABBMin;
4221 updatePacket.ParcelData.Area = landData.Area; 4228 updateMessage.Area = landData.Area;
4222 updatePacket.ParcelData.AuctionID = landData.AuctionID; 4229 updateMessage.AuctionID = landData.AuctionID;
4223 updatePacket.ParcelData.AuthBuyerID = landData.AuthBuyerID; 4230 updateMessage.AuthBuyerID = landData.AuthBuyerID;
4224 4231
4225 updatePacket.ParcelData.Bitmap = landData.Bitmap; 4232 updateMessage.Bitmap = landData.Bitmap;
4226 4233
4227 updatePacket.ParcelData.Desc = Utils.StringToBytes(landData.Description); 4234 updateMessage.Desc = landData.Description;
4228 updatePacket.ParcelData.Category = (byte)landData.Category; 4235 updateMessage.Category = landData.Category;
4229 updatePacket.ParcelData.ClaimDate = landData.ClaimDate; 4236 updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate);
4230 updatePacket.ParcelData.ClaimPrice = landData.ClaimPrice; 4237 updateMessage.ClaimPrice = landData.ClaimPrice;
4231 updatePacket.ParcelData.GroupID = landData.GroupID; 4238 updateMessage.GroupID = landData.GroupID;
4232 updatePacket.ParcelData.GroupPrims = landData.GroupPrims; 4239 updateMessage.GroupPrims = landData.GroupPrims;
4233 updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; 4240 updateMessage.IsGroupOwned = landData.IsGroupOwned;
4234 updatePacket.ParcelData.LandingType = landData.LandingType; 4241 updateMessage.LandingType = (LandingType) landData.LandingType;
4235 updatePacket.ParcelData.LocalID = landData.LocalID; 4242 updateMessage.LocalID = landData.LocalID;
4236 4243
4237 if (landData.Area > 0) 4244 if (landData.Area > 0)
4238 { 4245 {
4239 updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; 4246 updateMessage.MaxPrims = parcelObjectCapacity;
4240 } 4247 }
4241 else 4248 else
4242 { 4249 {
4243 updatePacket.ParcelData.MaxPrims = 0; 4250 updateMessage.MaxPrims = 0;
4244 } 4251 }
4245 4252
4246 updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; 4253 updateMessage.MediaAutoScale = Convert.ToBoolean(landData.MediaAutoScale);
4247 updatePacket.ParcelData.MediaID = landData.MediaID; 4254 updateMessage.MediaID = landData.MediaID;
4248 updatePacket.ParcelData.MediaURL = Util.StringToBytes256(landData.MediaURL); 4255 updateMessage.MediaURL = landData.MediaURL;
4249 updatePacket.ParcelData.MusicURL = Util.StringToBytes256(landData.MusicURL); 4256 updateMessage.MusicURL = landData.MusicURL;
4250 updatePacket.ParcelData.Name = Util.StringToBytes256(landData.Name); 4257 updateMessage.Name = landData.Name;
4251 updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime; 4258 updateMessage.OtherCleanTime = landData.OtherCleanTime;
4252 updatePacket.ParcelData.OtherCount = 0; //TODO: Unimplemented 4259 updateMessage.OtherCount = 0; //TODO: Unimplemented
4253 updatePacket.ParcelData.OtherPrims = landData.OtherPrims; 4260 updateMessage.OtherPrims = landData.OtherPrims;
4254 updatePacket.ParcelData.OwnerID = landData.OwnerID; 4261 updateMessage.OwnerID = landData.OwnerID;
4255 updatePacket.ParcelData.OwnerPrims = landData.OwnerPrims; 4262 updateMessage.OwnerPrims = landData.OwnerPrims;
4256 updatePacket.ParcelData.ParcelFlags = landData.Flags; 4263 updateMessage.ParcelFlags = (ParcelFlags) landData.Flags;
4257 updatePacket.ParcelData.ParcelPrimBonus = simObjectBonusFactor; 4264 updateMessage.ParcelPrimBonus = simObjectBonusFactor;
4258 updatePacket.ParcelData.PassHours = landData.PassHours; 4265 updateMessage.PassHours = landData.PassHours;
4259 updatePacket.ParcelData.PassPrice = landData.PassPrice; 4266 updateMessage.PassPrice = landData.PassPrice;
4260 updatePacket.ParcelData.PublicCount = 0; //TODO: Unimplemented 4267 updateMessage.PublicCount = 0; //TODO: Unimplemented
4261 4268
4262 updatePacket.ParcelData.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0; 4269 updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0;
4263 updatePacket.ParcelData.RegionDenyIdentified = (regionFlags & (uint)RegionFlags.DenyIdentified) > 0; 4270 updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0;
4264 updatePacket.ParcelData.RegionDenyTransacted = (regionFlags & (uint)RegionFlags.DenyTransacted) > 0; 4271
4265 updatePacket.ParcelData.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0; 4272 //updateMessage.RegionDenyIdentified = (regionFlags & (uint)RegionFlags.DenyIdentified) > 0;
4266 4273 //updateMessage.RegionDenyTransacted = (regionFlags & (uint)RegionFlags.DenyTransacted) > 0;
4267 updatePacket.ParcelData.RentPrice = 0; 4274
4268 updatePacket.ParcelData.RequestResult = request_result; 4275 updateMessage.RentPrice = 0;
4269 updatePacket.ParcelData.SalePrice = landData.SalePrice; 4276 updateMessage.RequestResult = (ParcelResult) request_result;
4270 updatePacket.ParcelData.SelectedPrims = landData.SelectedPrims; 4277 updateMessage.SalePrice = landData.SalePrice;
4271 updatePacket.ParcelData.SelfCount = 0; //TODO: Unimplemented 4278 updateMessage.SelectedPrims = landData.SelectedPrims;
4272 updatePacket.ParcelData.SequenceID = sequence_id; 4279 updateMessage.SelfCount = 0; //TODO: Unimplemented
4280 updateMessage.SequenceID = sequence_id;
4273 if (landData.SimwideArea > 0) 4281 if (landData.SimwideArea > 0)
4274 { 4282 {
4275 updatePacket.ParcelData.SimWideMaxPrims = parcelObjectCapacity; 4283 updateMessage.SimWideMaxPrims = parcelObjectCapacity;
4276 } 4284 }
4277 else 4285 else
4278 { 4286 {
4279 updatePacket.ParcelData.SimWideMaxPrims = 0; 4287 updateMessage.SimWideMaxPrims = 0;
4280 } 4288 }
4281 updatePacket.ParcelData.SimWideTotalPrims = landData.SimwidePrims; 4289 updateMessage.SimWideTotalPrims = landData.SimwidePrims;
4282 updatePacket.ParcelData.SnapSelection = snap_selection; 4290 updateMessage.SnapSelection = snap_selection;
4283 updatePacket.ParcelData.SnapshotID = landData.SnapshotID; 4291 updateMessage.SnapshotID = landData.SnapshotID;
4284 updatePacket.ParcelData.Status = (byte)landData.Status; 4292 updateMessage.Status = (ParcelStatus) landData.Status;
4285 updatePacket.ParcelData.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + 4293 updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims +
4286 landData.SelectedPrims; 4294 landData.SelectedPrims;
4287 updatePacket.ParcelData.UserLocation = landData.UserLocation; 4295 updateMessage.UserLocation = landData.UserLocation;
4288 updatePacket.ParcelData.UserLookAt = landData.UserLookAt; 4296 updateMessage.UserLookAt = landData.UserLookAt;
4289 updatePacket.Header.Zerocoded = true; 4297
4298 updateMessage.MediaType = landData.MediaType;
4299 updateMessage.MediaDesc = landData.MediaDescription;
4300 updateMessage.MediaWidth = landData.MediaWidth;
4301 updateMessage.MediaHeight = landData.MediaHeight;
4302 updateMessage.MediaLoop = landData.MediaLoop;
4303 updateMessage.ObscureMusic = landData.ObscureMusic;
4304 updateMessage.ObscureMedia = landData.ObscureMedia;
4290 4305
4291 try 4306 try
4292 { 4307 {
4293 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); 4308 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
4294 if (eq != null) 4309 if (eq != null)
4295 { 4310 {
4296 eq.ParcelProperties(updatePacket, this.AgentId); 4311 eq.ParcelProperties(updateMessage, this.AgentId);
4297 } 4312 } else {
4313 m_log.Warn("No EQ Interface when sending parcel data.");
4314 }
4298 } 4315 }
4299 catch (Exception ex) 4316 catch (Exception ex)
4300 { 4317 {
4301 m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString()); 4318 m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString());
4302 m_log.Warn("sending parcel data via UDP");
4303 OutPacket(updatePacket, ThrottleOutPacketType.Task);
4304 } 4319 }
4305 } 4320 }
4306 4321
@@ -8993,7 +9008,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8993 if (handlerGodKickUser != null) 9008 if (handlerGodKickUser != null)
8994 { 9009 {
8995 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, 9010 handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
8996 gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason); 9011 gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason);
8997 } 9012 }
8998 } 9013 }
8999 else 9014 else
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 74784ae..38152cc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -471,12 +471,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
471 SceneObjectSerializer.ToOriginalXmlFormat(group); 471 SceneObjectSerializer.ToOriginalXmlFormat(group);
472 group.DetachToInventoryPrep(); 472 group.DetachToInventoryPrep();
473 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 473 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
474 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); 474 UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
475 m_scene.DeleteSceneObject(group, false); 475 m_scene.DeleteSceneObject(group, false);
476 return; 476 return;
477 } 477 }
478 } 478 }
479 } 479 }
480 } 480 }
481
482 public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos)
483 {
484 // If this is an attachment, then we need to save the modified
485 // object back into the avatar's inventory. First we save the
486 // attachment point information, then we update the relative
487 // positioning (which caused this method to get driven in the
488 // first place. Then we have to mark the object as NOT an
489 // attachment. This is necessary in order to correctly save
490 // and retrieve GroupPosition information for the attachment.
491 // Then we save the asset back into the appropriate inventory
492 // entry. Finally, we restore the object's attachment status.
493 byte attachmentPoint = sog.GetAttachmentPoint();
494 sog.UpdateGroupPosition(pos);
495 sog.RootPart.IsAttachment = false;
496 sog.AbsolutePosition = sog.RootPart.AttachedPos;
497 UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
498 sog.SetAttachmentPoint(attachmentPoint);
499 }
500
501 /// <summary>
502 /// Update the attachment asset for the new sog details if they have changed.
503 /// </summary>
504 ///
505 /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects,
506 /// these details are not stored on the region.
507 ///
508 /// <param name="remoteClient"></param>
509 /// <param name="grp"></param>
510 /// <param name="itemID"></param>
511 /// <param name="agentID"></param>
512 protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
513 {
514 if (grp != null)
515 {
516 if (!grp.HasGroupChanged)
517 {
518 m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
519 return;
520 }
521
522 m_log.DebugFormat(
523 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
524 grp.UUID, grp.GetAttachmentPoint());
525
526 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
527
528 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
529 item = m_scene.InventoryService.GetItem(item);
530
531 if (item != null)
532 {
533 AssetBase asset = m_scene.CreateAsset(
534 grp.GetPartName(grp.LocalId),
535 grp.GetPartDescription(grp.LocalId),
536 (sbyte)AssetType.Object,
537 Utils.StringToBytes(sceneObjectXml),
538 remoteClient.AgentId);
539 m_scene.AssetService.Store(asset);
540
541 item.AssetID = asset.FullID;
542 item.Description = asset.Description;
543 item.Name = asset.Name;
544 item.AssetType = asset.Type;
545 item.InvType = (int)InventoryType.Object;
546
547 m_scene.InventoryService.UpdateItem(item);
548
549 // this gets called when the agent logs off!
550 if (remoteClient != null)
551 remoteClient.SendInventoryItemCreateUpdate(item, 0);
552 }
553 }
554 }
481 } 555 }
482} 556} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 7683288..22c84e9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
261 261
262 while (archivePath.Length > 0) 262 while (archivePath.Length > 0)
263 { 263 {
264 m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); 264// m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
265 265
266 if (resolvedFolders.ContainsKey(archivePath)) 266 if (resolvedFolders.ContainsKey(archivePath))
267 { 267 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 84afb40..8343091 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
41 /// </summary> 41 /// </summary>
42 public static class InventoryArchiveUtils 42 public static class InventoryArchiveUtils
43 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings 46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings
47 public static readonly char ESCAPE_CHARACTER = '\\'; 47 public static readonly char ESCAPE_CHARACTER = '\\';
@@ -120,6 +120,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
120 foundFolders.Add(startFolder); 120 foundFolders.Add(startFolder);
121 return foundFolders; 121 return foundFolders;
122 } 122 }
123
124 // If the path isn't just / then trim any starting extraneous slashes
125 path = path.TrimStart(new char[] { PATH_DELIMITER });
126
127// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path);
123 128
124 string[] components = SplitEscapedPath(path); 129 string[] components = SplitEscapedPath(path);
125 components[0] = UnescapePath(components[0]); 130 components[0] = UnescapePath(components[0]);
@@ -199,6 +204,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
199 public static InventoryItemBase FindItemByPath( 204 public static InventoryItemBase FindItemByPath(
200 IInventoryService inventoryService, InventoryFolderBase startFolder, string path) 205 IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
201 { 206 {
207 // If the path isn't just / then trim any starting extraneous slashes
208 path = path.TrimStart(new char[] { PATH_DELIMITER });
209
202 string[] components = SplitEscapedPath(path); 210 string[] components = SplitEscapedPath(path);
203 components[0] = UnescapePath(components[0]); 211 components[0] = UnescapePath(components[0]);
204 212
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 25a78ff..9908018 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
221 InventoryItemBase inventoryItem = null; 221 InventoryItemBase inventoryItem = null;
222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); 222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
223 223
224 bool foundStar = false; 224 bool saveFolderContentsOnly = false;
225 225
226 // Eliminate double slashes and any leading / on the path. 226 // Eliminate double slashes and any leading / on the path.
227 string[] components 227 string[] components
@@ -234,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
234 // folder itself. This may get more sophisicated later on 234 // folder itself. This may get more sophisicated later on
235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) 235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
236 { 236 {
237 foundStar = true; 237 saveFolderContentsOnly = true;
238 maxComponentIndex--; 238 maxComponentIndex--;
239 } 239 }
240 240
@@ -281,10 +281,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
281 { 281 {
282 m_log.DebugFormat( 282 m_log.DebugFormat(
283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", 283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
284 inventoryFolder.Name, inventoryFolder.ID, m_invPath); 284 inventoryFolder.Name,
285 inventoryFolder.ID,
286 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath );
285 287
286 //recurse through all dirs getting dirs and files 288 //recurse through all dirs getting dirs and files
287 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); 289 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
288 } 290 }
289 else if (inventoryItem != null) 291 else if (inventoryItem != null)
290 { 292 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 3fb2c8c..0218f86 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -55,12 +55,58 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
55 { 55 {
56 protected ManualResetEvent mre = new ManualResetEvent(false); 56 protected ManualResetEvent mre = new ManualResetEvent(false);
57 57
58 /// <summary>
59 /// Stream of data representing a common IAR that can be reused in load tests.
60 /// </summary>
61 protected MemoryStream m_iarStream;
62
63 protected UserAccount m_ua1
64 = new UserAccount {
65 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
66 FirstName = "Mr",
67 LastName = "Tiddles" };
68 protected UserAccount m_ua2
69 = new UserAccount {
70 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
71 FirstName = "Lord",
72 LastName = "Lucan" };
73 string m_item1Name = "b.lsl";
74
58 private void SaveCompleted( 75 private void SaveCompleted(
59 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, 76 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
60 Exception reportedException) 77 Exception reportedException)
61 { 78 {
62 mre.Set(); 79 mre.Set();
63 } 80 }
81
82 [SetUp]
83 public void Init()
84 {
85 ConstructDefaultIarForTestLoad();
86 }
87
88 protected void ConstructDefaultIarForTestLoad()
89 {
90 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
91
92 MemoryStream archiveWriteStream = new MemoryStream();
93 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
94
95 InventoryItemBase item1 = new InventoryItemBase();
96 item1.Name = m_item1Name;
97 item1.AssetID = UUID.Random();
98 item1.GroupID = UUID.Random();
99 item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName);
100 //item1.CreatorId = userUuid.ToString();
101 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
102 item1.Owner = UUID.Zero;
103
104 string item1FileName
105 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
106 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
107 tar.Close();
108 m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
109 }
64 110
65 /// <summary> 111 /// <summary>
66 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive 112 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
@@ -122,6 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
122 MemoryStream archiveWriteStream = new MemoryStream(); 168 MemoryStream archiveWriteStream = new MemoryStream();
123 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 169 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
124 170
171 // Test saving a particular path
125 mre.Reset(); 172 mre.Reset();
126 archiverModule.ArchiveInventory( 173 archiverModule.ArchiveInventory(
127 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); 174 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
@@ -148,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
148 195
149 while (tar.ReadEntry(out filePath, out tarEntryType) != null) 196 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
150 { 197 {
151 Console.WriteLine("Got {0}", filePath); 198// Console.WriteLine("Got {0}", filePath);
152 199
153// if (ArchiveConstants.CONTROL_FILE_PATH == filePath) 200// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
154// { 201// {
@@ -297,6 +344,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
297 } 344 }
298 345
299 /// <summary> 346 /// <summary>
347 /// Test that things work when the load path specified starts with a slash
348 /// </summary>
349 [Test]
350 public void TestLoadIarPathStartsWithSlash()
351 {
352 TestHelper.InMethod();
353// log4net.Config.XmlConfigurator.Configure();
354
355 SerialiserModule serialiserModule = new SerialiserModule();
356 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
357 Scene scene = SceneSetupHelpers.SetupScene("inventory");
358 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
359
360 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
361 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
362
363 InventoryItemBase foundItem1
364 = InventoryArchiveUtils.FindItemByPath(
365 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
366
367 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
368 }
369
370 /// <summary>
300 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 371 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
301 /// an account exists with the creator name. 372 /// an account exists with the creator name.
302 /// </summary> 373 /// </summary>
@@ -308,34 +379,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
308 TestHelper.InMethod(); 379 TestHelper.InMethod();
309 //log4net.Config.XmlConfigurator.Configure(); 380 //log4net.Config.XmlConfigurator.Configure();
310 381
311 string userFirstName = "Mr";
312 string userLastName = "Tiddles";
313 UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555");
314 string userItemCreatorFirstName = "Lord";
315 string userItemCreatorLastName = "Lucan";
316 UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
317
318 string item1Name = "b.lsl";
319 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random());
320
321 MemoryStream archiveWriteStream = new MemoryStream();
322 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
323
324 InventoryItemBase item1 = new InventoryItemBase();
325 item1.Name = item1Name;
326 item1.AssetID = UUID.Random();
327 item1.GroupID = UUID.Random();
328 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
329 //item1.CreatorId = userUuid.ToString();
330 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
331 item1.Owner = UUID.Zero;
332
333 string item1FileName
334 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
335 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
336 tar.Close();
337
338 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
339 SerialiserModule serialiserModule = new SerialiserModule(); 382 SerialiserModule serialiserModule = new SerialiserModule();
340 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 383 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
341 384
@@ -344,15 +387,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
344 387
345 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 388 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
346 389
347 UserProfileTestUtils.CreateUserWithInventory( 390 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
348 scene, userFirstName, userLastName, userUuid, "meowfood"); 391 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
349 UserProfileTestUtils.CreateUserWithInventory(
350 scene, userItemCreatorFirstName, userItemCreatorLastName, userItemCreatorUuid, "hampshire");
351 392
352 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 393 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
353 394
354 InventoryItemBase foundItem1 395 InventoryItemBase foundItem1
355 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, item1Name); 396 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
356 397
357 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 398 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
358 399
@@ -362,31 +403,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
362// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), 403// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
363// "Loaded item non-uuid creator doesn't match original"); 404// "Loaded item non-uuid creator doesn't match original");
364 Assert.That( 405 Assert.That(
365 foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), 406 foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()),
366 "Loaded item non-uuid creator doesn't match original"); 407 "Loaded item non-uuid creator doesn't match original");
367 408
368 Assert.That( 409 Assert.That(
369 foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), 410 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID),
370 "Loaded item uuid creator doesn't match original"); 411 "Loaded item uuid creator doesn't match original");
371 Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), 412 Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID),
372 "Loaded item owner doesn't match inventory reciever"); 413 "Loaded item owner doesn't match inventory reciever");
373 414
374 // Now try loading to a root child folder 415 // Now try loading to a root child folder
375 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xA"); 416 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA");
376 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 417 MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
377 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); 418 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream);
378 419
379 InventoryItemBase foundItem2 420 InventoryItemBase foundItem2
380 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xA/" + item1Name); 421 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name);
381 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); 422 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
382 423
383 // Now try loading to a more deeply nested folder 424 // Now try loading to a more deeply nested folder
384 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xB/xC"); 425 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC");
385 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 426 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
386 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); 427 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream);
387 428
388 InventoryItemBase foundItem3 429 InventoryItemBase foundItem3
389 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xB/xC/" + item1Name); 430 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name);
390 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); 431 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
391 } 432 }
392 433
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ee07f30..314e163 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -200,6 +200,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", 200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}",
201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); 201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);
202 202
203 // Check that these are not the same coordinates
204 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
205 finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY)
206 {
207 // Can't do. Viewer crashes
208 sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
209 return;
210 }
211
203 // 212 //
204 // This is it 213 // This is it
205 // 214 //
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 0c6cb1b..35b70de 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -34,6 +34,7 @@ using System.Threading;
34using log4net; 34using log4net;
35using Nini.Config; 35using Nini.Config;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.Messages.Linden;
37using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
38using OpenMetaverse.StructuredData; 39using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 40using OpenSim.Framework;
@@ -137,10 +138,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
137 { 138 {
138 if (!queues.ContainsKey(agentId)) 139 if (!queues.ContainsKey(agentId))
139 { 140 {
141 /*
140 m_log.DebugFormat( 142 m_log.DebugFormat(
141 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", 143 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
142 agentId, m_scene.RegionInfo.RegionName); 144 agentId, m_scene.RegionInfo.RegionName);
143 145 */
144 queues[agentId] = new Queue<OSD>(); 146 queues[agentId] = new Queue<OSD>();
145 } 147 }
146 148
@@ -200,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
200 202
201 private void ClientClosed(UUID AgentID, Scene scene) 203 private void ClientClosed(UUID AgentID, Scene scene)
202 { 204 {
203 m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); 205 //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName);
204 206
205 int count = 0; 207 int count = 0;
206 while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) 208 while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5)
@@ -284,7 +286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
284 // Reuse open queues. The client does! 286 // Reuse open queues. The client does!
285 if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) 287 if (m_AvatarQueueUUIDMapping.ContainsKey(agentID))
286 { 288 {
287 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); 289 //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!");
288 EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; 290 EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
289 } 291 }
290 else 292 else
@@ -365,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
365 { 367 {
366 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! 368 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
367 array.Add(EventQueueHelper.KeepAliveEvent()); 369 array.Add(EventQueueHelper.KeepAliveEvent());
368 m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName); 370 //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName);
369 } 371 }
370 else 372 else
371 { 373 {
@@ -394,8 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
394 responsedata["keepalive"] = false; 396 responsedata["keepalive"] = false;
395 responsedata["reusecontext"] = false; 397 responsedata["reusecontext"] = false;
396 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); 398 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
399 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
397 return responsedata; 400 return responsedata;
398 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
399 } 401 }
400 402
401 public Hashtable NoEvents(UUID requestID, UUID agentID) 403 public Hashtable NoEvents(UUID requestID, UUID agentID)
@@ -461,7 +463,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
461 { 463 {
462 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! 464 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
463 array.Add(EventQueueHelper.KeepAliveEvent()); 465 array.Add(EventQueueHelper.KeepAliveEvent());
464 m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); 466 //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
465 } 467 }
466 else 468 else
467 { 469 {
@@ -697,9 +699,9 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
697 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); 699 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item);
698 } 700 }
699 701
700 public void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID) 702 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
701 { 703 {
702 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesPacket); 704 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
703 Enqueue(item, avatarID); 705 Enqueue(item, avatarID);
704 } 706 }
705 707
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
index e9bcae3..6294935 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
@@ -30,6 +30,7 @@ using System.Net;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.Packets; 31using OpenMetaverse.Packets;
32using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
33using OpenMetaverse.Messages.Linden;
33 34
34namespace OpenSim.Region.CoreModules.Framework.EventQueue 35namespace OpenSim.Region.CoreModules.Framework.EventQueue
35{ 36{
@@ -309,116 +310,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
309 return chatterBoxSessionAgentListUpdates; 310 return chatterBoxSessionAgentListUpdates;
310 } 311 }
311 312
312 public static OSD ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket)
313 {
314 OSDMap parcelProperties = new OSDMap();
315 OSDMap body = new OSDMap();
316
317 OSDArray ageVerificationBlock = new OSDArray();
318 OSDMap ageVerificationMap = new OSDMap();
319 ageVerificationMap.Add("RegionDenyAgeUnverified",
320 OSD.FromBoolean(parcelPropertiesPacket.AgeVerificationBlock.RegionDenyAgeUnverified));
321 ageVerificationBlock.Add(ageVerificationMap);
322 body.Add("AgeVerificationBlock", ageVerificationBlock);
323
324 // LL sims send media info in this event queue message but it's not in the UDP
325 // packet we construct this event queue message from. This should be refactored in
326 // other areas of the code so it can all be send in the same message. Until then we will
327 // still send the media info via UDP
328
329 //OSDArray mediaData = new OSDArray();
330 //OSDMap mediaDataMap = new OSDMap();
331 //mediaDataMap.Add("MediaDesc", OSD.FromString(""));
332 //mediaDataMap.Add("MediaHeight", OSD.FromInteger(0));
333 //mediaDataMap.Add("MediaLoop", OSD.FromInteger(0));
334 //mediaDataMap.Add("MediaType", OSD.FromString("type/type"));
335 //mediaDataMap.Add("MediaWidth", OSD.FromInteger(0));
336 //mediaDataMap.Add("ObscureMedia", OSD.FromInteger(0));
337 //mediaDataMap.Add("ObscureMusic", OSD.FromInteger(0));
338 //mediaData.Add(mediaDataMap);
339 //body.Add("MediaData", mediaData);
340
341 OSDArray parcelData = new OSDArray();
342 OSDMap parcelDataMap = new OSDMap();
343 OSDArray AABBMax = new OSDArray(3);
344 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.X));
345 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Y));
346 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Z));
347 parcelDataMap.Add("AABBMax", AABBMax);
348
349 OSDArray AABBMin = new OSDArray(3);
350 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.X));
351 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Y));
352 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Z));
353 parcelDataMap.Add("AABBMin", AABBMin);
354
355 parcelDataMap.Add("Area", OSD.FromInteger(parcelPropertiesPacket.ParcelData.Area));
356 parcelDataMap.Add("AuctionID", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.AuctionID)));
357 parcelDataMap.Add("AuthBuyerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.AuthBuyerID));
358 parcelDataMap.Add("Bitmap", OSD.FromBinary(parcelPropertiesPacket.ParcelData.Bitmap));
359 parcelDataMap.Add("Category", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Category));
360 parcelDataMap.Add("ClaimDate", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimDate));
361 parcelDataMap.Add("ClaimPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimPrice));
362 parcelDataMap.Add("Desc", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc)));
363 parcelDataMap.Add("GroupID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.GroupID));
364 parcelDataMap.Add("GroupPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.GroupPrims));
365 parcelDataMap.Add("IsGroupOwned", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.IsGroupOwned));
366 parcelDataMap.Add("LandingType", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LandingType));
367 parcelDataMap.Add("LocalID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LocalID));
368 parcelDataMap.Add("MaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.MaxPrims));
369 parcelDataMap.Add("MediaAutoScale", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.MediaAutoScale));
370 parcelDataMap.Add("MediaID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.MediaID));
371 parcelDataMap.Add("MediaURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL)));
372 parcelDataMap.Add("MusicURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL)));
373 parcelDataMap.Add("Name", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name)));
374 parcelDataMap.Add("OtherCleanTime", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCleanTime));
375 parcelDataMap.Add("OtherCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCount));
376 parcelDataMap.Add("OtherPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherPrims));
377 parcelDataMap.Add("OwnerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.OwnerID));
378 parcelDataMap.Add("OwnerPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OwnerPrims));
379 parcelDataMap.Add("ParcelFlags", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.ParcelFlags)));
380 parcelDataMap.Add("ParcelPrimBonus", OSD.FromReal(parcelPropertiesPacket.ParcelData.ParcelPrimBonus));
381 parcelDataMap.Add("PassHours", OSD.FromReal(parcelPropertiesPacket.ParcelData.PassHours));
382 parcelDataMap.Add("PassPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PassPrice));
383 parcelDataMap.Add("PublicCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PublicCount));
384 parcelDataMap.Add("RegionDenyAnonymous", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyAnonymous));
385 parcelDataMap.Add("RegionDenyIdentified", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyIdentified));
386 parcelDataMap.Add("RegionDenyTransacted", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyTransacted));
387
388 parcelDataMap.Add("RegionPushOverride", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionPushOverride));
389 parcelDataMap.Add("RentPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RentPrice));
390 parcelDataMap.Add("RequestResult", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RequestResult));
391 parcelDataMap.Add("SalePrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SalePrice));
392 parcelDataMap.Add("SelectedPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelectedPrims));
393 parcelDataMap.Add("SelfCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelfCount));
394 parcelDataMap.Add("SequenceID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SequenceID));
395 parcelDataMap.Add("SimWideMaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideMaxPrims));
396 parcelDataMap.Add("SimWideTotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideTotalPrims));
397 parcelDataMap.Add("SnapSelection", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.SnapSelection));
398 parcelDataMap.Add("SnapshotID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.SnapshotID));
399 parcelDataMap.Add("Status", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Status));
400 parcelDataMap.Add("TotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.TotalPrims));
401
402 OSDArray UserLocation = new OSDArray(3);
403 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.X));
404 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Y));
405 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Z));
406 parcelDataMap.Add("UserLocation", UserLocation);
407
408 OSDArray UserLookAt = new OSDArray(3);
409 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.X));
410 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Y));
411 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Z));
412 parcelDataMap.Add("UserLookAt", UserLookAt);
413
414 parcelData.Add(parcelDataMap);
415 body.Add("ParcelData", parcelData);
416 parcelProperties.Add("body", body);
417 parcelProperties.Add("message", OSD.FromString("ParcelProperties"));
418
419 return parcelProperties;
420 }
421
422 public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket) 313 public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket)
423 { 314 {
424 OSDMap groupUpdate = new OSDMap(); 315 OSDMap groupUpdate = new OSDMap();
@@ -495,5 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
495 return placesReply; 386 return placesReply;
496 } 387 }
497 388
389 public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
390 {
391 OSDMap message = new OSDMap();
392 message.Add("message", OSD.FromString("ParcelProperties"));
393 OSD message_body = parcelPropertiesMessage.Serialize();
394 message.Add("body", message_body);
395 return message;
396 }
397
498 } 398 }
499} 399}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index a402f4f..e51f118 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -243,9 +243,29 @@ namespace OpenSim.Region.CoreModules.World.Archiver
243 // to the same scene (when this is possible). 243 // to the same scene (when this is possible).
244 sceneObject.ResetIDs(); 244 sceneObject.ResetIDs();
245 245
246 List<SceneObjectPart> partList = null;
246 lock (sceneObject.Children) 247 lock (sceneObject.Children)
248 partList = new List<SceneObjectPart>(sceneObject.Children.Values);
249
250 foreach (SceneObjectPart part in partList)
247 { 251 {
248 foreach (SceneObjectPart part in sceneObject.Children.Values) 252 if (!ResolveUserUuid(part.CreatorID))
253 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
254
255 if (!ResolveUserUuid(part.OwnerID))
256 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
257
258 if (!ResolveUserUuid(part.LastOwnerID))
259 part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
260
261 // And zap any troublesome sit target information
262 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
263 part.SitTargetPosition = new Vector3(0, 0, 0);
264
265 // Fix ownership/creator of inventory items
266 // Not doing so results in inventory items
267 // being no copy/no mod for everyone
268 lock (part.TaskInventory)
249 { 269 {
250 if (!ResolveUserUuid(part.CreatorID)) 270 if (!ResolveUserUuid(part.CreatorID))
251 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; 271 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index d00cb07..776fe30 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -33,6 +33,8 @@ using System.Reflection;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
37using OpenMetaverse.Messages.Linden;
36using OpenSim.Framework; 38using OpenSim.Framework;
37using OpenSim.Framework.Capabilities; 39using OpenSim.Framework.Capabilities;
38using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
@@ -1078,7 +1080,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1078 { 1080 {
1079 for (int y = 0; y < inc_y; y++) 1081 for (int y = 0; y < inc_y; y++)
1080 { 1082 {
1081
1082 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); 1083 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y);
1083 1084
1084 if (currentParcel != null) 1085 if (currentParcel != null)
@@ -1378,8 +1379,68 @@ namespace OpenSim.Region.CoreModules.World.Land
1378 { 1379 {
1379 return RemoteParcelRequest(request, path, param, agentID, caps); 1380 return RemoteParcelRequest(request, path, param, agentID, caps);
1380 })); 1381 }));
1381 } 1382 UUID parcelCapID = UUID.Random();
1383 caps.RegisterHandler("ParcelPropertiesUpdate",
1384 new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
1385 delegate(string request, string path, string param,
1386 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
1387 {
1388 return ProcessPropertiesUpdate(request, path, param, agentID, caps);
1389 }));
1390 }
1391 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
1392 {
1393 IClientAPI client;
1394 if ( ! m_scene.TryGetClient(agentID, out client) ) {
1395 m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() );
1396 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1397 }
1398
1399 ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
1400 OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
1401
1402 properties.Deserialize(args);
1403
1404 LandUpdateArgs land_update = new LandUpdateArgs();
1405 int parcelID = properties.LocalID;
1406 land_update.AuthBuyerID = properties.AuthBuyerID;
1407 land_update.Category = properties.Category;
1408 land_update.Desc = properties.Desc;
1409 land_update.GroupID = properties.GroupID;
1410 land_update.LandingType = (byte) properties.Landing;
1411 land_update.MediaAutoScale = (byte) Convert.ToInt32(properties.MediaAutoScale);
1412 land_update.MediaID = properties.MediaID;
1413 land_update.MediaURL = properties.MediaURL;
1414 land_update.MusicURL = properties.MusicURL;
1415 land_update.Name = properties.Name;
1416 land_update.ParcelFlags = (uint) properties.ParcelFlags;
1417 land_update.PassHours = (int) properties.PassHours;
1418 land_update.PassPrice = (int) properties.PassPrice;
1419 land_update.SalePrice = (int) properties.SalePrice;
1420 land_update.SnapshotID = properties.SnapshotID;
1421 land_update.UserLocation = properties.UserLocation;
1422 land_update.UserLookAt = properties.UserLookAt;
1423 land_update.MediaDescription = properties.MediaDesc;
1424 land_update.MediaType = properties.MediaType;
1425 land_update.MediaWidth = properties.MediaWidth;
1426 land_update.MediaHeight = properties.MediaHeight;
1427 land_update.MediaLoop = properties.MediaLoop;
1428 land_update.ObscureMusic = properties.ObscureMusic;
1429 land_update.ObscureMedia = properties.ObscureMedia;
1430
1431 ILandObject land;
1432 lock (m_landList)
1433 {
1434 m_landList.TryGetValue(parcelID, out land);
1435 }
1382 1436
1437 if (land != null) {
1438 land.UpdateLandProperties(land_update, client);
1439 } else {
1440 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
1441 }
1442 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1443 }
1383 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the 1444 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
1384 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. 1445 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
1385 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x 1446 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 9e9934e..1b2cabb 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -229,6 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
229 newData.SnapshotID = args.SnapshotID; 229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation; 230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt; 231 newData.UserLookAt = args.UserLookAt;
232 newData.MediaType = args.MediaType;
233 newData.MediaDescription = args.MediaDescription;
234 newData.MediaWidth = args.MediaWidth;
235 newData.MediaHeight = args.MediaHeight;
236 newData.MediaLoop = args.MediaLoop;
237 newData.ObscureMusic = args.ObscureMusic;
238 newData.ObscureMedia = args.ObscureMedia;
232 239
233 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
234 241
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 2f70c0a..57eff8a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -228,280 +228,281 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
228 SceneObjectGroup mapdot = (SceneObjectGroup)obj; 228 SceneObjectGroup mapdot = (SceneObjectGroup)obj;
229 Color mapdotspot = Color.Gray; // Default color when prim color is white 229 Color mapdotspot = Color.Gray; // Default color when prim color is white
230 230
231 // Loop over prim in group 231 // Loop over prim in group
232 List<SceneObjectPart> partList = null;
232 lock (mapdot.Children) 233 lock (mapdot.Children)
234 partList = new List<SceneObjectPart>(mapdot.Children.Values);
235
236 foreach (SceneObjectPart part in partList)
233 { 237 {
234 foreach (SceneObjectPart part in mapdot.Children.Values) 238 if (part == null)
239 continue;
240
241 // Draw if the object is at least 1 meter wide in any direction
242 if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
235 { 243 {
236 if (part == null) 244 // Try to get the RGBA of the default texture entry..
237 continue; 245 //
238 246 try
239 // Draw if the object is at least 1 meter wide in any direction
240 if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
241 { 247 {
242 // Try to get the RGBA of the default texture entry.. 248 // get the null checks out of the way
243 // 249 // skip the ones that break
244 try 250 if (part == null)
251 continue;
252
253 if (part.Shape == null)
254 continue;
255
256 if (part.Shape.PCode == (byte)PCode.Tree || part.Shape.PCode == (byte)PCode.NewTree || part.Shape.PCode == (byte)PCode.Grass)
257 continue; // eliminates trees from this since we don't really have a good tree representation
258 // if you want tree blocks on the map comment the above line and uncomment the below line
259 //mapdotspot = Color.PaleGreen;
260
261 Primitive.TextureEntry textureEntry = part.Shape.Textures;
262
263 if (textureEntry == null || textureEntry.DefaultTexture == null)
264 continue;
265
266 Color4 texcolor = textureEntry.DefaultTexture.RGBA;
267
268 // Not sure why some of these are null, oh well.
269
270 int colorr = 255 - (int)(texcolor.R * 255f);
271 int colorg = 255 - (int)(texcolor.G * 255f);
272 int colorb = 255 - (int)(texcolor.B * 255f);
273
274 if (!(colorr == 255 && colorg == 255 && colorb == 255))
245 { 275 {
246 // get the null checks out of the way 276 //Try to set the map spot color
247 // skip the ones that break 277 try
248 if (part == null) 278 {
249 continue; 279 // If the color gets goofy somehow, skip it *shakes fist at Color4
250 280 mapdotspot = Color.FromArgb(colorr, colorg, colorb);
251 if (part.Shape == null) 281 }
252 continue; 282 catch (ArgumentException)
253
254 if (part.Shape.PCode == (byte)PCode.Tree || part.Shape.PCode == (byte)PCode.NewTree || part.Shape.PCode == (byte)PCode.Grass)
255 continue; // eliminates trees from this since we don't really have a good tree representation
256 // if you want tree blocks on the map comment the above line and uncomment the below line
257 //mapdotspot = Color.PaleGreen;
258
259 Primitive.TextureEntry textureEntry = part.Shape.Textures;
260
261 if (textureEntry == null || textureEntry.DefaultTexture == null)
262 continue;
263
264 Color4 texcolor = textureEntry.DefaultTexture.RGBA;
265
266 // Not sure why some of these are null, oh well.
267
268 int colorr = 255 - (int)(texcolor.R * 255f);
269 int colorg = 255 - (int)(texcolor.G * 255f);
270 int colorb = 255 - (int)(texcolor.B * 255f);
271
272 if (!(colorr == 255 && colorg == 255 && colorb == 255))
273 { 283 {
274 //Try to set the map spot color
275 try
276 {
277 // If the color gets goofy somehow, skip it *shakes fist at Color4
278 mapdotspot = Color.FromArgb(colorr, colorg, colorb);
279 }
280 catch (ArgumentException)
281 {
282 }
283 } 284 }
284 } 285 }
285 catch (IndexOutOfRangeException) 286 }
286 { 287 catch (IndexOutOfRangeException)
287 // Windows Array 288 {
288 } 289 // Windows Array
289 catch (ArgumentOutOfRangeException) 290 }
290 { 291 catch (ArgumentOutOfRangeException)
291 // Mono Array 292 {
292 } 293 // Mono Array
293 294 }
294 Vector3 pos = part.GetWorldPosition(); 295
295 296 Vector3 pos = part.GetWorldPosition();
296 // skip prim outside of retion 297
297 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) 298 // skip prim outside of retion
298 continue; 299 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f)
299 300 continue;
300 // skip prim in non-finite position 301
301 if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) || 302 // skip prim in non-finite position
302 Single.IsInfinity(pos.X) || Single.IsInfinity(pos.Y)) 303 if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) ||
304 Single.IsInfinity(pos.X) || Single.IsInfinity(pos.Y))
305 continue;
306
307 // Figure out if object is under 256m above the height of the terrain
308 bool isBelow256AboveTerrain = false;
309
310 try
311 {
312 isBelow256AboveTerrain = (pos.Z < ((float)hm[(int)pos.X, (int)pos.Y] + 256f));
313 }
314 catch (Exception)
315 {
316 }
317
318 if (isBelow256AboveTerrain)
319 {
320 // Translate scale by rotation so scale is represented properly when object is rotated
321 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z);
322 Vector3 scale = new Vector3();
323 Vector3 tScale = new Vector3();
324 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z);
325
326 Quaternion llrot = part.GetWorldRotation();
327 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
328 scale = lscale * rot;
329
330 // negative scales don't work in this situation
331 scale.X = Math.Abs(scale.X);
332 scale.Y = Math.Abs(scale.Y);
333 scale.Z = Math.Abs(scale.Z);
334
335 // This scaling isn't very accurate and doesn't take into account the face rotation :P
336 int mapdrawstartX = (int)(pos.X - scale.X);
337 int mapdrawstartY = (int)(pos.Y - scale.Y);
338 int mapdrawendX = (int)(pos.X + scale.X);
339 int mapdrawendY = (int)(pos.Y + scale.Y);
340
341 // If object is beyond the edge of the map, don't draw it to avoid errors
342 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1)
343 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0
344 || mapdrawendY > ((int)Constants.RegionSize - 1))
303 continue; 345 continue;
304 346
305 // Figure out if object is under 256m above the height of the terrain 347#region obb face reconstruction part duex
306 bool isBelow256AboveTerrain = false; 348 Vector3[] vertexes = new Vector3[8];
307 349
308 try 350 // float[] distance = new float[6];
309 { 351 Vector3[] FaceA = new Vector3[6]; // vertex A for Facei
310 isBelow256AboveTerrain = (pos.Z < ((float)hm[(int)pos.X, (int)pos.Y] + 256f)); 352 Vector3[] FaceB = new Vector3[6]; // vertex B for Facei
311 } 353 Vector3[] FaceC = new Vector3[6]; // vertex C for Facei
312 catch (Exception) 354 Vector3[] FaceD = new Vector3[6]; // vertex D for Facei
355
356 tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z);
357 scale = ((tScale * rot));
358 vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
359 // vertexes[0].x = pos.X + vertexes[0].x;
360 //vertexes[0].y = pos.Y + vertexes[0].y;
361 //vertexes[0].z = pos.Z + vertexes[0].z;
362
363 FaceA[0] = vertexes[0];
364 FaceB[3] = vertexes[0];
365 FaceA[4] = vertexes[0];
366
367 tScale = lscale;
368 scale = ((tScale * rot));
369 vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
370
371 // vertexes[1].x = pos.X + vertexes[1].x;
372 // vertexes[1].y = pos.Y + vertexes[1].y;
373 //vertexes[1].z = pos.Z + vertexes[1].z;
374
375 FaceB[0] = vertexes[1];
376 FaceA[1] = vertexes[1];
377 FaceC[4] = vertexes[1];
378
379 tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
380 scale = ((tScale * rot));
381
382 vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
383
384 //vertexes[2].x = pos.X + vertexes[2].x;
385 //vertexes[2].y = pos.Y + vertexes[2].y;
386 //vertexes[2].z = pos.Z + vertexes[2].z;
387
388 FaceC[0] = vertexes[2];
389 FaceD[3] = vertexes[2];
390 FaceC[5] = vertexes[2];
391
392 tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z);
393 scale = ((tScale * rot));
394 vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
395
396 //vertexes[3].x = pos.X + vertexes[3].x;
397 // vertexes[3].y = pos.Y + vertexes[3].y;
398 // vertexes[3].z = pos.Z + vertexes[3].z;
399
400 FaceD[0] = vertexes[3];
401 FaceC[1] = vertexes[3];
402 FaceA[5] = vertexes[3];
403
404 tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z);
405 scale = ((tScale * rot));
406 vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
407
408 // vertexes[4].x = pos.X + vertexes[4].x;
409 // vertexes[4].y = pos.Y + vertexes[4].y;
410 // vertexes[4].z = pos.Z + vertexes[4].z;
411
412 FaceB[1] = vertexes[4];
413 FaceA[2] = vertexes[4];
414 FaceD[4] = vertexes[4];
415
416 tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z);
417 scale = ((tScale * rot));
418 vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
419
420 // vertexes[5].x = pos.X + vertexes[5].x;
421 // vertexes[5].y = pos.Y + vertexes[5].y;
422 // vertexes[5].z = pos.Z + vertexes[5].z;
423
424 FaceD[1] = vertexes[5];
425 FaceC[2] = vertexes[5];
426 FaceB[5] = vertexes[5];
427
428 tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z);
429 scale = ((tScale * rot));
430 vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
431
432 // vertexes[6].x = pos.X + vertexes[6].x;
433 // vertexes[6].y = pos.Y + vertexes[6].y;
434 // vertexes[6].z = pos.Z + vertexes[6].z;
435
436 FaceB[2] = vertexes[6];
437 FaceA[3] = vertexes[6];
438 FaceB[4] = vertexes[6];
439
440 tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z);
441 scale = ((tScale * rot));
442 vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
443
444 // vertexes[7].x = pos.X + vertexes[7].x;
445 // vertexes[7].y = pos.Y + vertexes[7].y;
446 // vertexes[7].z = pos.Z + vertexes[7].z;
447
448 FaceD[2] = vertexes[7];
449 FaceC[3] = vertexes[7];
450 FaceD[5] = vertexes[7];
451#endregion
452
453 //int wy = 0;
454
455 //bool breakYN = false; // If we run into an error drawing, break out of the
456 // loop so we don't lag to death on error handling
457 DrawStruct ds = new DrawStruct();
458 ds.brush = new SolidBrush(mapdotspot);
459 //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY);
460
461 ds.trns = new face[FaceA.Length];
462
463 for (int i = 0; i < FaceA.Length; i++)
313 { 464 {
465 Point[] working = new Point[5];
466 working[0] = project(FaceA[i], axPos);
467 working[1] = project(FaceB[i], axPos);
468 working[2] = project(FaceD[i], axPos);
469 working[3] = project(FaceC[i], axPos);
470 working[4] = project(FaceA[i], axPos);
471
472 face workingface = new face();
473 workingface.pts = working;
474
475 ds.trns[i] = workingface;
314 } 476 }
315 477
316 if (isBelow256AboveTerrain) 478 z_sort.Add(part.LocalId, ds);
317 { 479 z_localIDs.Add(part.LocalId);
318 // Translate scale by rotation so scale is represented properly when object is rotated 480 z_sortheights.Add(pos.Z);
319 Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); 481
320 Vector3 scale = new Vector3(); 482 //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
321 Vector3 tScale = new Vector3(); 483 //{
322 Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); 484 //for (wy = mapdrawstartY; wy < mapdrawendY; wy++)
323
324 Quaternion llrot = part.GetWorldRotation();
325 Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
326 scale = lscale * rot;
327
328 // negative scales don't work in this situation
329 scale.X = Math.Abs(scale.X);
330 scale.Y = Math.Abs(scale.Y);
331 scale.Z = Math.Abs(scale.Z);
332
333 // This scaling isn't very accurate and doesn't take into account the face rotation :P
334 int mapdrawstartX = (int)(pos.X - scale.X);
335 int mapdrawstartY = (int)(pos.Y - scale.Y);
336 int mapdrawendX = (int)(pos.X + scale.X);
337 int mapdrawendY = (int)(pos.Y + scale.Y);
338
339 // If object is beyond the edge of the map, don't draw it to avoid errors
340 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1)
341 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0
342 || mapdrawendY > ((int)Constants.RegionSize - 1))
343 continue;
344
345 #region obb face reconstruction part duex
346 Vector3[] vertexes = new Vector3[8];
347
348 // float[] distance = new float[6];
349 Vector3[] FaceA = new Vector3[6]; // vertex A for Facei
350 Vector3[] FaceB = new Vector3[6]; // vertex B for Facei
351 Vector3[] FaceC = new Vector3[6]; // vertex C for Facei
352 Vector3[] FaceD = new Vector3[6]; // vertex D for Facei
353
354 tScale = new Vector3(lscale.X, -lscale.Y, lscale.Z);
355 scale = ((tScale * rot));
356 vertexes[0] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
357 // vertexes[0].x = pos.X + vertexes[0].x;
358 //vertexes[0].y = pos.Y + vertexes[0].y;
359 //vertexes[0].z = pos.Z + vertexes[0].z;
360
361 FaceA[0] = vertexes[0];
362 FaceB[3] = vertexes[0];
363 FaceA[4] = vertexes[0];
364
365 tScale = lscale;
366 scale = ((tScale * rot));
367 vertexes[1] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
368
369 // vertexes[1].x = pos.X + vertexes[1].x;
370 // vertexes[1].y = pos.Y + vertexes[1].y;
371 //vertexes[1].z = pos.Z + vertexes[1].z;
372
373 FaceB[0] = vertexes[1];
374 FaceA[1] = vertexes[1];
375 FaceC[4] = vertexes[1];
376
377 tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z);
378 scale = ((tScale * rot));
379
380 vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
381
382 //vertexes[2].x = pos.X + vertexes[2].x;
383 //vertexes[2].y = pos.Y + vertexes[2].y;
384 //vertexes[2].z = pos.Z + vertexes[2].z;
385
386 FaceC[0] = vertexes[2];
387 FaceD[3] = vertexes[2];
388 FaceC[5] = vertexes[2];
389
390 tScale = new Vector3(lscale.X, lscale.Y, -lscale.Z);
391 scale = ((tScale * rot));
392 vertexes[3] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
393
394 //vertexes[3].x = pos.X + vertexes[3].x;
395 // vertexes[3].y = pos.Y + vertexes[3].y;
396 // vertexes[3].z = pos.Z + vertexes[3].z;
397
398 FaceD[0] = vertexes[3];
399 FaceC[1] = vertexes[3];
400 FaceA[5] = vertexes[3];
401
402 tScale = new Vector3(-lscale.X, lscale.Y, lscale.Z);
403 scale = ((tScale * rot));
404 vertexes[4] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
405
406 // vertexes[4].x = pos.X + vertexes[4].x;
407 // vertexes[4].y = pos.Y + vertexes[4].y;
408 // vertexes[4].z = pos.Z + vertexes[4].z;
409
410 FaceB[1] = vertexes[4];
411 FaceA[2] = vertexes[4];
412 FaceD[4] = vertexes[4];
413
414 tScale = new Vector3(-lscale.X, lscale.Y, -lscale.Z);
415 scale = ((tScale * rot));
416 vertexes[5] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
417
418 // vertexes[5].x = pos.X + vertexes[5].x;
419 // vertexes[5].y = pos.Y + vertexes[5].y;
420 // vertexes[5].z = pos.Z + vertexes[5].z;
421
422 FaceD[1] = vertexes[5];
423 FaceC[2] = vertexes[5];
424 FaceB[5] = vertexes[5];
425
426 tScale = new Vector3(-lscale.X, -lscale.Y, lscale.Z);
427 scale = ((tScale * rot));
428 vertexes[6] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
429
430 // vertexes[6].x = pos.X + vertexes[6].x;
431 // vertexes[6].y = pos.Y + vertexes[6].y;
432 // vertexes[6].z = pos.Z + vertexes[6].z;
433
434 FaceB[2] = vertexes[6];
435 FaceA[3] = vertexes[6];
436 FaceB[4] = vertexes[6];
437
438 tScale = new Vector3(-lscale.X, -lscale.Y, -lscale.Z);
439 scale = ((tScale * rot));
440 vertexes[7] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z)));
441
442 // vertexes[7].x = pos.X + vertexes[7].x;
443 // vertexes[7].y = pos.Y + vertexes[7].y;
444 // vertexes[7].z = pos.Z + vertexes[7].z;
445
446 FaceD[2] = vertexes[7];
447 FaceC[3] = vertexes[7];
448 FaceD[5] = vertexes[7];
449 #endregion
450
451 //int wy = 0;
452
453 //bool breakYN = false; // If we run into an error drawing, break out of the
454 // loop so we don't lag to death on error handling
455 DrawStruct ds = new DrawStruct();
456 ds.brush = new SolidBrush(mapdotspot);
457 //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY);
458
459 ds.trns = new face[FaceA.Length];
460
461 for (int i = 0; i < FaceA.Length; i++)
462 {
463 Point[] working = new Point[5];
464 working[0] = project(FaceA[i], axPos);
465 working[1] = project(FaceB[i], axPos);
466 working[2] = project(FaceD[i], axPos);
467 working[3] = project(FaceC[i], axPos);
468 working[4] = project(FaceA[i], axPos);
469
470 face workingface = new face();
471 workingface.pts = working;
472
473 ds.trns[i] = workingface;
474 }
475
476 z_sort.Add(part.LocalId, ds);
477 z_localIDs.Add(part.LocalId);
478 z_sortheights.Add(pos.Z);
479
480 //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
481 //{ 485 //{
482 //for (wy = mapdrawstartY; wy < mapdrawendY; wy++) 486 //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy);
487 //try
483 //{ 488 //{
484 //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy); 489 // Remember, flip the y!
485 //try 490 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot);
486 //{
487 // Remember, flip the y!
488 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot);
489 //}
490 //catch (ArgumentException)
491 //{
492 // breakYN = true;
493 //}
494
495 //if (breakYN)
496 // break;
497 //} 491 //}
498 492 //catch (ArgumentException)
493 //{
494 // breakYN = true;
495 //}
496
499 //if (breakYN) 497 //if (breakYN)
500 // break; 498 // break;
501 //} 499 //}
502 } // Object is within 256m Z of terrain 500
503 } // object is at least a meter wide 501 //if (breakYN)
504 } // mapdot.Children lock 502 // break;
503 //}
504 } // Object is within 256m Z of terrain
505 } // object is at least a meter wide
505 } // loop over group children 506 } // loop over group children
506 } // entitybase is sceneobject group 507 } // entitybase is sceneobject group
507 } // foreach loop over entities 508 } // foreach loop over entities
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
index c489972..3c39f9e 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -142,9 +142,18 @@ namespace OpenSim.Region.DataSnapshot.Providers
142 node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString(); 142 node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString();
143 xmlobject.AppendChild(node); 143 xmlobject.AppendChild(node);
144 144
145 node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", ""); 145 if (land != null && land.LandData != null)
146 node.InnerText = land.LandData.GlobalID.ToString(); 146 {
147 xmlobject.AppendChild(node); 147 node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
148 node.InnerText = land.LandData.GlobalID.ToString();
149 xmlobject.AppendChild(node);
150 }
151 else
152 {
153 // Something is wrong with this object. Let's not list it.
154 m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName);
155 continue;
156 }
148 157
149 node = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); 158 node = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
150 Vector3 loc = obj.AbsolutePosition; 159 Vector3 loc = obj.AbsolutePosition;
diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs
index 70cb205..aa3d2ff 100644
--- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs
+++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Text.RegularExpressions;
33using System.Xml; 34using System.Xml;
34using log4net; 35using log4net;
35using OpenSim.Region.DataSnapshot.Interfaces; 36using OpenSim.Region.DataSnapshot.Interfaces;
@@ -98,13 +99,21 @@ namespace OpenSim.Region.DataSnapshot
98 { 99 {
99 String path = DataFileNameFragment(provider.GetParentScene, provider.Name); 100 String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
100 101
101 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default)) 102 try
102 { 103 {
103 snapXWriter.Formatting = Formatting.Indented; 104 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
104 snapXWriter.WriteStartDocument(); 105 {
105 data.WriteTo(snapXWriter); 106 snapXWriter.Formatting = Formatting.Indented;
106 snapXWriter.WriteEndDocument(); 107 snapXWriter.WriteStartDocument();
108 data.WriteTo(snapXWriter);
109 snapXWriter.WriteEndDocument();
110 }
111 }
112 catch (Exception e)
113 {
114 m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
107 } 115 }
116
108 } 117 }
109 118
110 //mark provider as not stale, parent scene as stale 119 //mark provider as not stale, parent scene as stale
@@ -185,12 +194,19 @@ namespace OpenSim.Region.DataSnapshot
185 //save snapshot 194 //save snapshot
186 String path = DataFileNameScene(scene); 195 String path = DataFileNameScene(scene);
187 196
188 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default)) 197 try
198 {
199 using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
200 {
201 snapXWriter.Formatting = Formatting.Indented;
202 snapXWriter.WriteStartDocument();
203 regionElement.WriteTo(snapXWriter);
204 snapXWriter.WriteEndDocument();
205 }
206 }
207 catch (Exception e)
189 { 208 {
190 snapXWriter.Formatting = Formatting.Indented; 209 m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
191 snapXWriter.WriteStartDocument();
192 regionElement.WriteTo(snapXWriter);
193 snapXWriter.WriteEndDocument();
194 } 210 }
195 211
196 m_scenes[scene] = false; 212 m_scenes[scene] = false;
@@ -206,15 +222,23 @@ namespace OpenSim.Region.DataSnapshot
206 #region Helpers 222 #region Helpers
207 private string DataFileNameFragment(Scene scene, String fragmentName) 223 private string DataFileNameFragment(Scene scene, String fragmentName)
208 { 224 {
209 return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName + "_" + fragmentName, "xml")); 225 return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName + "_" + fragmentName), "xml"));
210 } 226 }
211 227
212 private string DataFileNameScene(Scene scene) 228 private string DataFileNameScene(Scene scene)
213 { 229 {
214 return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName, "xml")); 230 return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName), "xml"));
215 //return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml"); 231 //return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml");
216 } 232 }
217 233
234 private static string Sanitize(string name)
235 {
236 string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
237 string invalidReStr = string.Format(@"[{0}]", invalidChars);
238 string newname = Regex.Replace(name, invalidReStr, "_");
239 return newname.Replace('.', '_');
240 }
241
218 private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc) 242 private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc)
219 { 243 {
220 XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", ""); 244 XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", "");
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 9fe6d96..59c035f 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -136,5 +136,13 @@ namespace OpenSim.Region.Framework.Interfaces
136 /// A <see cref="IClientAPI"/> 136 /// A <see cref="IClientAPI"/>
137 /// </param> 137 /// </param>
138 void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); 138 void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
139
140 /// <summary>
141 /// Update the position of an attachment
142 /// </summary>
143 /// <param name="client"></param>
144 /// <param name="sog"></param>
145 /// <param name="pos"></param>
146 void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos);
139 } 147 }
140} 148}
diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
index e093f0a..81e4952 100644
--- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs
@@ -28,6 +28,7 @@
28using System.Net; 28using System.Net;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenMetaverse.Packets; 30using OpenMetaverse.Packets;
31using OpenMetaverse.Messages.Linden;
31using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
32 33
33namespace OpenSim.Region.Framework.Interfaces 34namespace OpenSim.Region.Framework.Interfaces
@@ -54,7 +55,7 @@ namespace OpenSim.Region.Framework.Interfaces
54 uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket); 55 uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket);
55 void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, 56 void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat,
56 bool isModerator, bool textMute); 57 bool isModerator, bool textMute);
57 void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID); 58 void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID);
58 void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); 59 void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID);
59 } 60 }
60} 61}
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 145f9ed..3a3ec2b 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Scenes
31 31
32 public class Prioritizer 32 public class Prioritizer
33 { 33 {
34 private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 34// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
35 35
36 /// <summary> 36 /// <summary>
37 /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the 37 /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
@@ -75,7 +75,6 @@ namespace OpenSim.Region.Framework.Scenes
75 break; 75 break;
76 default: 76 default:
77 throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); 77 throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
78 break;
79 } 78 }
80 79
81 // Adjust priority so that root prims are sent to the viewer first. This is especially important for 80 // Adjust priority so that root prims are sent to the viewer first. This is especially important for
@@ -122,9 +121,16 @@ namespace OpenSim.Region.Framework.Scenes
122 // Use group position for child prims 121 // Use group position for child prims
123 Vector3 entityPos; 122 Vector3 entityPos;
124 if (entity is SceneObjectPart) 123 if (entity is SceneObjectPart)
125 entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; 124 {
125 // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
126 // before its scheduled update was triggered
127 //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
128 entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
129 }
126 else 130 else
131 {
127 entityPos = entity.AbsolutePosition; 132 entityPos = entity.AbsolutePosition;
133 }
128 134
129 return Vector3.DistanceSquared(presencePos, entityPos); 135 return Vector3.DistanceSquared(presencePos, entityPos);
130 } 136 }
@@ -157,7 +163,9 @@ namespace OpenSim.Region.Framework.Scenes
157 } 163 }
158 } 164 }
159 else 165 else
166 {
160 entityPos = entity.AbsolutePosition; 167 entityPos = entity.AbsolutePosition;
168 }
161 169
162 if (!presence.IsChildAgent) 170 if (!presence.IsChildAgent)
163 { 171 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 48508f8..8760c84 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1852,53 +1852,6 @@ namespace OpenSim.Region.Framework.Scenes
1852 } 1852 }
1853 } 1853 }
1854 1854
1855 public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
1856 {
1857 SceneObjectGroup objectGroup = grp;
1858 if (objectGroup != null)
1859 {
1860 if (!grp.HasGroupChanged)
1861 {
1862 m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID);
1863 return;
1864 }
1865
1866 m_log.InfoFormat(
1867 "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}",
1868 grp.UUID, grp.GetAttachmentPoint());
1869
1870 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
1871
1872 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1873 item = InventoryService.GetItem(item);
1874
1875 if (item != null)
1876 {
1877 AssetBase asset = CreateAsset(
1878 objectGroup.GetPartName(objectGroup.LocalId),
1879 objectGroup.GetPartDescription(objectGroup.LocalId),
1880 (sbyte)AssetType.Object,
1881 Utils.StringToBytes(sceneObjectXml),
1882 remoteClient.AgentId);
1883 AssetService.Store(asset);
1884
1885 item.AssetID = asset.FullID;
1886 item.Description = asset.Description;
1887 item.Name = asset.Name;
1888 item.AssetType = asset.Type;
1889 item.InvType = (int)InventoryType.Object;
1890
1891 InventoryService.UpdateItem(item);
1892
1893 // this gets called when the agent loggs off!
1894 if (remoteClient != null)
1895 {
1896 remoteClient.SendInventoryItemCreateUpdate(item, 0);
1897 }
1898 }
1899 }
1900 }
1901
1902 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) 1855 public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
1903 { 1856 {
1904 itemID = UUID.Zero; 1857 itemID = UUID.Zero;
@@ -2104,11 +2057,12 @@ namespace OpenSim.Region.Framework.Scenes
2104 sog.SetGroup(groupID, remoteClient); 2057 sog.SetGroup(groupID, remoteClient);
2105 sog.ScheduleGroupForFullUpdate(); 2058 sog.ScheduleGroupForFullUpdate();
2106 2059
2060 List<SceneObjectPart> partList = null;
2107 lock (sog.Children) 2061 lock (sog.Children)
2108 { 2062 partList = new List<SceneObjectPart>(sog.Children.Values);
2109 foreach (SceneObjectPart child in sog.Children.Values) 2063
2110 child.Inventory.ChangeInventoryOwner(ownerID); 2064 foreach (SceneObjectPart child in partList)
2111 } 2065 child.Inventory.ChangeInventoryOwner(ownerID);
2112 } 2066 }
2113 else 2067 else
2114 { 2068 {
@@ -2117,14 +2071,15 @@ namespace OpenSim.Region.Framework.Scenes
2117 2071
2118 if (sog.GroupID != groupID) 2072 if (sog.GroupID != groupID)
2119 continue; 2073 continue;
2120 2074
2075 List<SceneObjectPart> partList = null;
2121 lock (sog.Children) 2076 lock (sog.Children)
2077 partList = new List<SceneObjectPart>(sog.Children.Values);
2078
2079 foreach (SceneObjectPart child in partList)
2122 { 2080 {
2123 foreach (SceneObjectPart child in sog.Children.Values) 2081 child.LastOwnerID = child.OwnerID;
2124 { 2082 child.Inventory.ChangeInventoryOwner(groupID);
2125 child.LastOwnerID = child.OwnerID;
2126 child.Inventory.ChangeInventoryOwner(groupID);
2127 }
2128 } 2083 }
2129 2084
2130 sog.SetOwnerId(groupID); 2085 sog.SetOwnerId(groupID);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 9f1575d..c511774 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -164,16 +164,17 @@ namespace OpenSim.Region.Framework.Scenes
164 164
165 SceneObjectGroup sog = ent as SceneObjectGroup; 165 SceneObjectGroup sog = ent as SceneObjectGroup;
166 166
167 List<SceneObjectPart> partList = null;
167 lock (sog.Children) 168 lock (sog.Children)
169 partList = new List<SceneObjectPart>(sog.Children.Values);
170
171 foreach (SceneObjectPart part in partList)
168 { 172 {
169 foreach (KeyValuePair<UUID, SceneObjectPart> child in (sog.Children)) 173 if (part.LocalId == primLocalID)
170 { 174 {
171 if (child.Value.LocalId == primLocalID) 175 part.GetProperties(remoteClient);
172 { 176 foundPrim = true;
173 child.Value.GetProperties(remoteClient); 177 break;
174 foundPrim = true;
175 break;
176 }
177 } 178 }
178 } 179 }
179 180
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ec97d25..6a742c1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2131,19 +2131,20 @@ namespace OpenSim.Region.Framework.Scenes
2131 group.RemoveScriptInstances(true); 2131 group.RemoveScriptInstances(true);
2132 } 2132 }
2133 2133
2134 List<SceneObjectPart> partList = null;
2134 lock (group.Children) 2135 lock (group.Children)
2136 partList = new List<SceneObjectPart>(group.Children.Values);
2137
2138 foreach (SceneObjectPart part in partList)
2135 { 2139 {
2136 foreach (SceneObjectPart part in group.Children.Values) 2140 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
2137 { 2141 {
2138 if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) 2142 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed?
2139 { 2143 }
2140 PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? 2144 else if (part.PhysActor != null)
2141 } 2145 {
2142 else if (part.PhysActor != null) 2146 PhysicsScene.RemovePrim(part.PhysActor);
2143 { 2147 part.PhysActor = null;
2144 PhysicsScene.RemovePrim(part.PhysActor);
2145 part.PhysActor = null;
2146 }
2147 } 2148 }
2148 } 2149 }
2149 2150
@@ -3720,18 +3721,6 @@ namespace OpenSim.Region.Framework.Scenes
3720 return true; 3721 return true;
3721 } 3722 }
3722 3723
3723 private ILandObject GetParcelAtPoint(float x, float y)
3724 {
3725 foreach (var parcel in AllParcels())
3726 {
3727 if (parcel.ContainsPoint((int)x,(int)y))
3728 {
3729 return parcel;
3730 }
3731 }
3732 return null;
3733 }
3734
3735 /// <summary> 3724 /// <summary>
3736 /// Update an AgentCircuitData object with new information 3725 /// Update an AgentCircuitData object with new information
3737 /// </summary> 3726 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 59e4037..1293d5d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes
70 /// <summary> 70 /// <summary>
71 /// A user will arrive shortly, set up appropriate credentials so it can connect 71 /// A user will arrive shortly, set up appropriate credentials so it can connect
72 /// </summary> 72 /// </summary>
73 public event ExpectUserDelegate OnExpectUser; 73// public event ExpectUserDelegate OnExpectUser;
74 74
75 /// <summary> 75 /// <summary>
76 /// A Prim will arrive shortly 76 /// A Prim will arrive shortly
@@ -80,7 +80,7 @@ namespace OpenSim.Region.Framework.Scenes
80 /// <summary> 80 /// <summary>
81 /// A new prim has arrived 81 /// A new prim has arrived
82 /// </summary> 82 /// </summary>
83 public event PrimCrossing OnPrimCrossingIntoRegion; 83// public event PrimCrossing OnPrimCrossingIntoRegion;
84 84
85 ///// <summary> 85 ///// <summary>
86 ///// A New Region is up and available 86 ///// A New Region is up and available
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes
90 /// <summary> 90 /// <summary>
91 /// We have a child agent for this avatar and we're getting a status update about it 91 /// We have a child agent for this avatar and we're getting a status update about it
92 /// </summary> 92 /// </summary>
93 public event ChildAgentUpdate OnChildAgentUpdate; 93// public event ChildAgentUpdate OnChildAgentUpdate;
94 //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; 94 //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
95 95
96 /// <summary> 96 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 1d952c4..b86a564 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -402,23 +402,22 @@ namespace OpenSim.Region.Framework.Scenes
402 part.Shape.Scale = scale; 402 part.Shape.Scale = scale;
403 } 403 }
404 } 404 }
405 405
406 sceneObject.AttachToScene(m_parentScene);
407
408 if (sendClientUpdates)
409 sceneObject.ScheduleGroupForFullUpdate();
410
411 Entities.Add(sceneObject);
412 m_numPrim += sceneObject.Children.Count; 406 m_numPrim += sceneObject.Children.Count;
413
414 if (attachToBackup)
415 sceneObject.AttachToBackup();
416 } 407 }
408
409 sceneObject.AttachToScene(m_parentScene);
410
411 if (sendClientUpdates)
412 sceneObject.ScheduleGroupForFullUpdate();
413
414 Entities.Add(sceneObject);
415
416 if (attachToBackup)
417 sceneObject.AttachToBackup();
417 418
418 if (OnObjectCreate != null) 419 if (OnObjectCreate != null)
419 {
420 OnObjectCreate(sceneObject); 420 OnObjectCreate(sceneObject);
421 }
422 421
423 lock (SceneObjectGroupsByFullID) 422 lock (SceneObjectGroupsByFullID)
424 { 423 {
@@ -426,6 +425,7 @@ namespace OpenSim.Region.Framework.Scenes
426 foreach (SceneObjectPart part in sceneObject.Children.Values) 425 foreach (SceneObjectPart part in sceneObject.Children.Values)
427 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 426 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
428 } 427 }
428
429 lock (SceneObjectGroupsByLocalID) 429 lock (SceneObjectGroupsByLocalID)
430 { 430 {
431 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 431 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
@@ -1348,37 +1348,21 @@ namespace OpenSim.Region.Framework.Scenes
1348 /// <param name="localID"></param> 1348 /// <param name="localID"></param>
1349 /// <param name="pos"></param> 1349 /// <param name="pos"></param>
1350 /// <param name="remoteClient"></param> 1350 /// <param name="remoteClient"></param>
1351 protected internal void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) 1351 public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
1352 { 1352 {
1353 SceneObjectGroup group = GetGroupByPrim(localID); 1353 SceneObjectGroup group = GetGroupByPrim(localID);
1354
1354 if (group != null) 1355 if (group != null)
1355 { 1356 {
1356
1357 // Vector3 oldPos = group.AbsolutePosition;
1358 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) 1357 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
1359 { 1358 {
1360 1359 if (m_parentScene.AttachmentsModule != null)
1361 // If this is an attachment, then we need to save the modified 1360 m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos);
1362 // object back into the avatar's inventory. First we save the
1363 // attachment point information, then we update the relative
1364 // positioning (which caused this method to get driven in the
1365 // first place. Then we have to mark the object as NOT an
1366 // attachment. This is necessary in order to correctly save
1367 // and retrieve GroupPosition information for the attachment.
1368 // Then we save the asset back into the appropriate inventory
1369 // entry. Finally, we restore the object's attachment status.
1370
1371 byte attachmentPoint = group.GetAttachmentPoint();
1372 group.UpdateGroupPosition(pos);
1373 group.RootPart.IsAttachment = false;
1374 group.AbsolutePosition = group.RootPart.AttachedPos;
1375 m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
1376 group.SetAttachmentPoint(attachmentPoint);
1377
1378 } 1361 }
1379 else 1362 else
1380 { 1363 {
1381 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) 1364 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)
1365 && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
1382 { 1366 {
1383 group.UpdateGroupPosition(pos); 1367 group.UpdateGroupPosition(pos);
1384 } 1368 }
@@ -1387,14 +1371,19 @@ namespace OpenSim.Region.Framework.Scenes
1387 } 1371 }
1388 1372
1389 /// <summary> 1373 /// <summary>
1390 /// 1374 /// Update the texture entry of the given prim.
1391 /// </summary> 1375 /// </summary>
1376 ///
1377 /// A texture entry is an object that contains details of all the textures of the prim's face. In this case,
1378 /// the texture is given in its byte serialized form.
1379 ///
1392 /// <param name="localID"></param> 1380 /// <param name="localID"></param>
1393 /// <param name="texture"></param> 1381 /// <param name="texture"></param>
1394 /// <param name="remoteClient"></param> 1382 /// <param name="remoteClient"></param>
1395 protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) 1383 protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
1396 { 1384 {
1397 SceneObjectGroup group = GetGroupByPrim(localID); 1385 SceneObjectGroup group = GetGroupByPrim(localID);
1386
1398 if (group != null) 1387 if (group != null)
1399 { 1388 {
1400 if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) 1389 if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))
@@ -1784,8 +1773,6 @@ namespace OpenSim.Region.Framework.Scenes
1784 SceneObjectPart newRoot = newSet[0]; 1773 SceneObjectPart newRoot = newSet[0];
1785 newSet.RemoveAt(0); 1774 newSet.RemoveAt(0);
1786 1775
1787 List<uint> linkIDs = new List<uint>();
1788
1789 foreach (SceneObjectPart newChild in newSet) 1776 foreach (SceneObjectPart newChild in newSet)
1790 newChild.UpdateFlag = 0; 1777 newChild.UpdateFlag = 0;
1791 1778
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e003cf8..5a586d4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -398,6 +398,8 @@ namespace OpenSim.Region.Framework.Scenes
398 398
399 /// <value> 399 /// <value>
400 /// The parts of this scene object group. You must lock this property before using it. 400 /// The parts of this scene object group. You must lock this property before using it.
401 /// If you're doing anything other than reading values, please take a copy of the values rather than locking
402 /// the dictionary for the entirety of the operation. This increases liveness and reduces the danger of deadlock
401 /// If you want to know the number of children, consider using the PrimCount property instead 403 /// If you want to know the number of children, consider using the PrimCount property instead
402 /// </value> 404 /// </value>
403 public Dictionary<UUID, SceneObjectPart> Children 405 public Dictionary<UUID, SceneObjectPart> Children
@@ -2306,29 +2308,29 @@ namespace OpenSim.Region.Framework.Scenes
2306 // return; 2308 // return;
2307 2309
2308 lockPartsForRead(true); 2310 lockPartsForRead(true);
2309 {
2310 bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
2311 2311
2312 if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) 2312 bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
2313 {
2314 m_rootPart.UpdateFlag = 1;
2315 lastPhysGroupPos = AbsolutePosition;
2316 }
2317 2313
2318 if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) 2314 if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f))
2319 { 2315 {
2320 m_rootPart.UpdateFlag = 1; 2316 m_rootPart.UpdateFlag = 1;
2321 lastPhysGroupRot = GroupRotation; 2317 lastPhysGroupPos = AbsolutePosition;
2322 } 2318 }
2323 2319
2324 foreach (SceneObjectPart part in m_parts.Values) 2320 if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f))
2325 { 2321 {
2326 if (!IsSelected) 2322 m_rootPart.UpdateFlag = 1;
2327 part.UpdateLookAt(); 2323 lastPhysGroupRot = GroupRotation;
2324 }
2328 2325
2329 part.SendScheduledUpdates(); 2326 List<SceneObjectPart> partList = null;
2330 2327 partList = new List<SceneObjectPart>(m_parts.Values);
2331 } 2328
2329 foreach (SceneObjectPart part in partList)
2330 {
2331 if (!IsSelected)
2332 part.UpdateLookAt();
2333 part.SendScheduledUpdates();
2332 } 2334 }
2333 lockPartsForRead(false); 2335 lockPartsForRead(false);
2334 } 2336 }
@@ -3161,11 +3163,12 @@ namespace OpenSim.Region.Framework.Scenes
3161 public void UpdatePermissions(UUID AgentID, byte field, uint localID, 3163 public void UpdatePermissions(UUID AgentID, byte field, uint localID,
3162 uint mask, byte addRemTF) 3164 uint mask, byte addRemTF)
3163 { 3165 {
3166 List<SceneObjectPart> partList = null;
3164 lock (m_parts) 3167 lock (m_parts)
3165 { 3168 partList = new List<SceneObjectPart>(m_parts.Values);
3166 foreach (SceneObjectPart part in m_parts.Values) 3169
3167 part.UpdatePermissions(AgentID, field, localID, mask, addRemTF); 3170 foreach (SceneObjectPart part in partList)
3168 } 3171 part.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
3169 3172
3170 HasGroupChanged = true; 3173 HasGroupChanged = true;
3171 } 3174 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 9e52b00..eefe8bb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4756,20 +4756,8 @@ namespace OpenSim.Region.Framework.Scenes
4756 if (ParentGroup == null || ParentGroup.IsDeleted) 4756 if (ParentGroup == null || ParentGroup.IsDeleted)
4757 return; 4757 return;
4758 4758
4759 Vector3 lPos = OffsetPosition; 4759 if (IsAttachment && ParentGroup.RootPart != this)
4760 4760 return;
4761 if (IsAttachment)
4762 {
4763 if (ParentGroup.RootPart != this)
4764 return;
4765
4766 lPos = ParentGroup.RootPart.AttachedPos;
4767 }
4768 else
4769 {
4770 if (ParentGroup.RootPart == this)
4771 lPos = AbsolutePosition;
4772 }
4773 4761
4774 // Causes this thread to dig into the Client Thread Data. 4762 // Causes this thread to dig into the Client Thread Data.
4775 // Remember your locking here! 4763 // Remember your locking here!
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 10931b7..c5994b2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -724,8 +724,7 @@ namespace OpenSim.Region.Framework.Scenes
724 } 724 }
725 725
726 public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) 726 public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item)
727 { 727 {
728 UUID ownerID = item.OwnerID;
729 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); 728 AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
730 729
731 if (null == rezAsset) 730 if (null == rezAsset)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 02e60f8..cd80eb0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2668,15 +2668,15 @@ namespace OpenSim.Region.Framework.Scenes
2668 { 2668 {
2669 m_perfMonMS = Util.EnvironmentTickCount(); 2669 m_perfMonMS = Util.EnvironmentTickCount();
2670 2670
2671 PhysicsActor actor = m_physicsActor;
2672 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
2673
2674 Vector3 pos = m_pos; 2671 Vector3 pos = m_pos;
2675 pos.Z += m_appearance.HipOffset; 2672 pos.Z += m_appearance.HipOffset;
2676 2673
2677 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); 2674 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
2678 2675
2679 remoteClient.SendPrimUpdate(this, PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); 2676 remoteClient.SendPrimUpdate(
2677 this,
2678 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
2679 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
2680 2680
2681 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2681 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2682 m_scene.StatsReporter.AddAgentUpdates(1); 2682 m_scene.StatsReporter.AddAgentUpdates(1);
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 34171b0..c439e3e 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -186,18 +186,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
186 { 186 {
187 SceneObjectPart my = GetSOP(); 187 SceneObjectPart my = GetSOP();
188 IObject[] rets = null; 188 IObject[] rets = null;
189 189
190 int total = my.ParentGroup.PrimCount;
191
192 rets = new IObject[total];
193
194 int i = 0;
195
196 List<SceneObjectPart> partList = null;
190 lock (my.ParentGroup.Children) 197 lock (my.ParentGroup.Children)
198 partList = new List<SceneObjectPart>(my.ParentGroup.Children.Values);
199
200 foreach (SceneObjectPart part in partList)
191 { 201 {
192 int total = my.ParentGroup.Children.Count; 202 rets[i++] = new SOPObject(m_rootScene, part.LocalId, m_security);
193
194 rets = new IObject[total];
195
196 int i = 0;
197 foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children)
198 {
199 rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security);
200 }
201 } 203 }
202 204
203 return rets; 205 return rets;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8381efa..512957d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9611,8 +9611,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9611 // we send to all 9611 // we send to all
9612 landData.MediaID = new UUID(texture); 9612 landData.MediaID = new UUID(texture);
9613 landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; 9613 landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0;
9614 landData.MediaSize[0] = width; 9614 landData.MediaWidth = width;
9615 landData.MediaSize[1] = height; 9615 landData.MediaHeight = height;
9616 landData.MediaType = mediaType; 9616 landData.MediaType = mediaType;
9617 9617
9618 // do that one last, it will cause a ParcelPropertiesUpdate 9618 // do that one last, it will cause a ParcelPropertiesUpdate
@@ -9698,8 +9698,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9698 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); 9698 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType));
9699 break; 9699 break;
9700 case ParcelMediaCommandEnum.Size: 9700 case ParcelMediaCommandEnum.Size:
9701 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0])); 9701 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaWidth));
9702 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1])); 9702 list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaHeight));
9703 break; 9703 break;
9704 default: 9704 default:
9705 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; 9705 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index ed0b1a6..b70b47d 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Tests.Common.Mock
86 { 86 {
87 InventoryFolderBase folder = m_folders[folderID]; 87 InventoryFolderBase folder = m_folders[folderID];
88 88
89 m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0} {1}", folder.Name, folder.ID); 89// m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0} {1}", folder.Name, folder.ID);
90 90
91 List<InventoryItemBase> items = new List<InventoryItemBase>(); 91 List<InventoryItemBase> items = new List<InventoryItemBase>();
92 92
@@ -94,7 +94,7 @@ namespace OpenSim.Tests.Common.Mock
94 { 94 {
95 if (item.Folder == folderID) 95 if (item.Folder == folderID)
96 { 96 {
97 m_log.DebugFormat("[MOCK INV DB]: getInventoryInFolder() adding item {0}", item.Name); 97// m_log.DebugFormat("[MOCK INV DB]: getInventoryInFolder() adding item {0}", item.Name);
98 items.Add(item); 98 items.Add(item);
99 } 99 }
100 } 100 }
@@ -106,7 +106,7 @@ namespace OpenSim.Tests.Common.Mock
106 106
107 public InventoryFolderBase getUserRootFolder(UUID user) 107 public InventoryFolderBase getUserRootFolder(UUID user)
108 { 108 {
109 m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user); 109// m_log.DebugFormat("[MOCK INV DB]: Looking for root folder for {0}", user);
110 110
111 InventoryFolderBase folder = null; 111 InventoryFolderBase folder = null;
112 m_rootFolders.TryGetValue(user, out folder); 112 m_rootFolders.TryGetValue(user, out folder);
@@ -118,7 +118,7 @@ namespace OpenSim.Tests.Common.Mock
118 { 118 {
119 InventoryFolderBase parentFolder = m_folders[parentID]; 119 InventoryFolderBase parentFolder = m_folders[parentID];
120 120
121 m_log.DebugFormat("[MOCK INV DB]: Getting folders in folder {0} {1}", parentFolder.Name, parentFolder.ID); 121// m_log.DebugFormat("[MOCK INV DB]: Getting folders in folder {0} {1}", parentFolder.Name, parentFolder.ID);
122 122
123 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 123 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
124 124
@@ -126,9 +126,9 @@ namespace OpenSim.Tests.Common.Mock
126 { 126 {
127 if (folder.ParentID == parentID) 127 if (folder.ParentID == parentID)
128 { 128 {
129 m_log.DebugFormat( 129// m_log.DebugFormat(
130 "[MOCK INV DB]: Found folder {0} {1} in {2} {3}", 130// "[MOCK INV DB]: Found folder {0} {1} in {2} {3}",
131 folder.Name, folder.ID, parentFolder.Name, parentFolder.ID); 131// folder.Name, folder.ID, parentFolder.Name, parentFolder.ID);
132 132
133 folders.Add(folder); 133 folders.Add(folder);
134 } 134 }
@@ -152,9 +152,9 @@ namespace OpenSim.Tests.Common.Mock
152 152
153 public void addInventoryFolder(InventoryFolderBase folder) 153 public void addInventoryFolder(InventoryFolderBase folder)
154 { 154 {
155 m_log.DebugFormat( 155// m_log.DebugFormat(
156 "[MOCK INV DB]: Adding inventory folder {0} {1} type {2}", 156// "[MOCK INV DB]: Adding inventory folder {0} {1} type {2}",
157 folder.Name, folder.ID, (AssetType)folder.Type); 157// folder.Name, folder.ID, (AssetType)folder.Type);
158 158
159 m_folders[folder.ID] = folder; 159 m_folders[folder.ID] = folder;
160 160
@@ -187,8 +187,8 @@ namespace OpenSim.Tests.Common.Mock
187 { 187 {
188 InventoryFolderBase folder = m_folders[item.Folder]; 188 InventoryFolderBase folder = m_folders[item.Folder];
189 189
190 m_log.DebugFormat( 190// m_log.DebugFormat(
191 "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID); 191// "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID);
192 192
193 m_items[item.ID] = item; 193 m_items[item.ID] = item;
194 } 194 }
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index 380f258..26156f3 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -127,12 +127,19 @@ namespace OpenSim.Tests.Common.Setup
127 { 127 {
128 UserAccount ua 128 UserAccount ua
129 = new UserAccount(userId) 129 = new UserAccount(userId)
130 { FirstName = firstName, LastName = lastName, ServiceURLs = new Dictionary<string, object>() }; 130 { FirstName = firstName, LastName = lastName };
131 CreateUserWithInventory(scene, ua, pw);
132 return ua;
133 }
134
135 public static void CreateUserWithInventory(Scene scene, UserAccount ua, string pw)
136 {
137 // FIXME: This should really be set up by UserAccount itself
138 ua.ServiceURLs = new Dictionary<string, object>();
139
131 scene.UserAccountService.StoreUserAccount(ua); 140 scene.UserAccountService.StoreUserAccount(ua);
132 scene.InventoryService.CreateUserInventory(ua.PrincipalID); 141 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
133 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); 142 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
134 143 }
135 return ua;
136 }
137 } 144 }
138} \ No newline at end of file 145} \ No newline at end of file