diff options
author | Justin Clarke Casey | 2008-11-21 21:16:42 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-21 21:16:42 +0000 |
commit | 915593bfbc2f0d6729efe4dfe8d4c8a3f0fc9fbe (patch) | |
tree | 1f62bf777f73c4f3fffb2f5237cd7e5eaeddcb6f /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | * Extend sog delete to inventory test to crank the normally async sog deleter... (diff) | |
download | opensim-SC-915593bfbc2f0d6729efe4dfe8d4c8a3f0fc9fbe.zip opensim-SC-915593bfbc2f0d6729efe4dfe8d4c8a3f0fc9fbe.tar.gz opensim-SC-915593bfbc2f0d6729efe4dfe8d4c8a3f0fc9fbe.tar.bz2 opensim-SC-915593bfbc2f0d6729efe4dfe8d4c8a3f0fc9fbe.tar.xz |
* refactor: Rip out SOP inventory from the partial into a separate class
* SceneObjectPartInventory.cs isn't a particularly good name but it's probably not got a long life
* A proper inventory interface to follow
* Parallel changes for other inventory partial classes to follow at a later date
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 67 |
1 files changed, 48 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 888643e..250c803 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -28,20 +28,20 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.Reflection; | ||
31 | using System.Runtime.Serialization; | 32 | using System.Runtime.Serialization; |
32 | using System.Security.Permissions; | 33 | using System.Security.Permissions; |
33 | using System.Xml; | 34 | using System.Xml; |
34 | using System.Xml.Serialization; | 35 | using System.Xml.Serialization; |
35 | 36 | using log4net; | |
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
37 | using OpenMetaverse.Packets; | 38 | using OpenMetaverse.Packets; |
38 | |||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Region.Environment.Scenes.Scripting; | 40 | using OpenSim.Region.Environment.Scenes.Scripting; |
41 | using OpenSim.Region.Physics.Manager; | 41 | using OpenSim.Region.Physics.Manager; |
42 | 42 | ||
43 | namespace OpenSim.Region.Environment.Scenes | 43 | namespace OpenSim.Region.Environment.Scenes |
44 | { | 44 | { |
45 | #region Enumerations | 45 | #region Enumerations |
46 | 46 | ||
47 | [Flags] | 47 | [Flags] |
@@ -92,8 +92,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
92 | #endregion Enumerations | 92 | #endregion Enumerations |
93 | 93 | ||
94 | [Serializable] | 94 | [Serializable] |
95 | public partial class SceneObjectPart : IScriptHost, ISerializable | 95 | public class SceneObjectPart : IScriptHost, ISerializable |
96 | { | 96 | { |
97 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
98 | |||
97 | #region Fields | 99 | #region Fields |
98 | 100 | ||
99 | [XmlIgnore] | 101 | [XmlIgnore] |
@@ -140,6 +142,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
140 | public uint AttachmentPoint = (byte)0; | 142 | public uint AttachmentPoint = (byte)0; |
141 | [XmlIgnore] | 143 | [XmlIgnore] |
142 | public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f); | 144 | public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f); |
145 | |||
146 | /// <summary> | ||
147 | /// This part's inventory | ||
148 | /// </summary> | ||
149 | [XmlIgnore] | ||
150 | public readonly SceneObjectPartInventory Inventory; | ||
143 | 151 | ||
144 | [XmlIgnore] | 152 | [XmlIgnore] |
145 | public bool Undoing = false; | 153 | public bool Undoing = false; |
@@ -218,6 +226,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
218 | m_TextureAnimation = new byte[0]; | 226 | m_TextureAnimation = new byte[0]; |
219 | m_particleSystem = new byte[0]; | 227 | m_particleSystem = new byte[0]; |
220 | Rezzed = DateTime.Now; | 228 | Rezzed = DateTime.Now; |
229 | |||
230 | Inventory = new SceneObjectPartInventory(this); | ||
221 | } | 231 | } |
222 | 232 | ||
223 | /// <summary> | 233 | /// <summary> |
@@ -266,6 +276,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
266 | 276 | ||
267 | TrimPermissions(); | 277 | TrimPermissions(); |
268 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); | 278 | //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo()); |
279 | |||
280 | Inventory = new SceneObjectPartInventory(this); | ||
269 | } | 281 | } |
270 | 282 | ||
271 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) | 283 | protected SceneObjectPart(SerializationInfo info, StreamingContext context) |
@@ -285,6 +297,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
285 | 297 | ||
286 | //System.Console.WriteLine("SceneObjectPart Deserialize END"); | 298 | //System.Console.WriteLine("SceneObjectPart Deserialize END"); |
287 | Rezzed = DateTime.Now; | 299 | Rezzed = DateTime.Now; |
300 | |||
301 | Inventory = new SceneObjectPartInventory(this); | ||
288 | } | 302 | } |
289 | 303 | ||
290 | #endregion Constructors | 304 | #endregion Constructors |
@@ -332,16 +346,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
332 | set { } // Don't allow assignment, or legacy prims wil b0rk | 346 | set { } // Don't allow assignment, or legacy prims wil b0rk |
333 | } | 347 | } |
334 | 348 | ||
349 | /// <value> | ||
350 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | ||
351 | /// </value> | ||
335 | public uint InventorySerial | 352 | public uint InventorySerial |
336 | { | 353 | { |
337 | get { return m_inventorySerial; } | 354 | get { return Inventory.Serial; } |
338 | set { m_inventorySerial = value; } | 355 | set { Inventory.Serial = value; } |
339 | } | 356 | } |
340 | 357 | ||
358 | /// <value> | ||
359 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | ||
360 | /// </value> | ||
341 | public TaskInventoryDictionary TaskInventory | 361 | public TaskInventoryDictionary TaskInventory |
342 | { | 362 | { |
343 | get { return m_taskInventory; } | 363 | get { return Inventory.Items; } |
344 | set { m_taskInventory = value; } | 364 | set { Inventory.Items = value; } |
345 | } | 365 | } |
346 | 366 | ||
347 | public uint ObjectFlags | 367 | public uint ObjectFlags |
@@ -1239,7 +1259,7 @@ if (m_shape != null) { | |||
1239 | dupe._category = _category; | 1259 | dupe._category = _category; |
1240 | dupe.m_rezzed = m_rezzed; | 1260 | dupe.m_rezzed = m_rezzed; |
1241 | 1261 | ||
1242 | dupe.TaskInventory = (TaskInventoryDictionary)dupe.TaskInventory.Clone(); | 1262 | dupe.Inventory.Items = (TaskInventoryDictionary)dupe.Inventory.Items.Clone(); |
1243 | 1263 | ||
1244 | if (userExposed) | 1264 | if (userExposed) |
1245 | dupe.ResetIDs(linkNum); | 1265 | dupe.ResetIDs(linkNum); |
@@ -1412,7 +1432,7 @@ if (m_shape != null) { | |||
1412 | throw new ArgumentNullException("info"); | 1432 | throw new ArgumentNullException("info"); |
1413 | } | 1433 | } |
1414 | 1434 | ||
1415 | info.AddValue("m_inventoryFileName", GetInventoryFileName()); | 1435 | info.AddValue("m_inventoryFileName", Inventory.GetInventoryFileName()); |
1416 | info.AddValue("m_folderID", UUID); | 1436 | info.AddValue("m_folderID", UUID); |
1417 | info.AddValue("PhysActor", PhysActor); | 1437 | info.AddValue("PhysActor", PhysActor); |
1418 | 1438 | ||
@@ -1452,7 +1472,7 @@ if (m_shape != null) { | |||
1452 | info.AddValue("m_updateFlag", m_updateFlag); | 1472 | info.AddValue("m_updateFlag", m_updateFlag); |
1453 | info.AddValue("CreatorID", _creatorID.Guid); | 1473 | info.AddValue("CreatorID", _creatorID.Guid); |
1454 | 1474 | ||
1455 | info.AddValue("m_inventorySerial", m_inventorySerial); | 1475 | info.AddValue("m_inventorySerial", Inventory.Serial); |
1456 | info.AddValue("m_uuid", m_uuid.Guid); | 1476 | info.AddValue("m_uuid", m_uuid.Guid); |
1457 | info.AddValue("m_localID", m_localId); | 1477 | info.AddValue("m_localID", m_localId); |
1458 | info.AddValue("m_name", m_name); | 1478 | info.AddValue("m_name", m_name); |
@@ -1929,8 +1949,7 @@ if (m_shape != null) { | |||
1929 | UUID = UUID.Random(); | 1949 | UUID = UUID.Random(); |
1930 | LinkNum = linkNum; | 1950 | LinkNum = linkNum; |
1931 | LocalId = 0; | 1951 | LocalId = 0; |
1932 | 1952 | Inventory.ResetInventoryIDs(); | |
1933 | ResetInventoryIDs(); | ||
1934 | } | 1953 | } |
1935 | 1954 | ||
1936 | /// <summary> | 1955 | /// <summary> |
@@ -2993,7 +3012,7 @@ if (m_shape != null) { | |||
2993 | if (god) | 3012 | if (god) |
2994 | { | 3013 | { |
2995 | _baseMask = ApplyMask(_baseMask, set, mask); | 3014 | _baseMask = ApplyMask(_baseMask, set, mask); |
2996 | ApplyGodPermissions(_baseMask); | 3015 | Inventory.ApplyGodPermissions(_baseMask); |
2997 | } | 3016 | } |
2998 | 3017 | ||
2999 | break; | 3018 | break; |
@@ -3394,9 +3413,19 @@ if (m_shape != null) { | |||
3394 | RotationalVelocity, state, FromAssetID, | 3413 | RotationalVelocity, state, FromAssetID, |
3395 | OwnerID, (int)AttachmentPoint); | 3414 | OwnerID, (int)AttachmentPoint); |
3396 | } | 3415 | } |
3397 | } | 3416 | |
3398 | } | 3417 | public void AddScriptLPS(int count) |
3399 | 3418 | { | |
3400 | 3419 | m_parentGroup.AddScriptLPS(count); | |
3401 | 3420 | } | |
3421 | |||
3422 | public void ApplyNextOwnerPermissions() | ||
3423 | { | ||
3424 | _baseMask &= _nextOwnerMask; | ||
3425 | _ownerMask &= _nextOwnerMask; | ||
3426 | _everyoneMask &= _nextOwnerMask; | ||
3402 | 3427 | ||
3428 | Inventory.ApplyNextOwnerPermissions(); | ||
3429 | } | ||
3430 | } | ||
3431 | } | ||