aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs126
1 files changed, 63 insertions, 63 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 20a6626..ce0820c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -37,6 +37,7 @@ using System.Xml.Serialization;
37using log4net; 37using log4net;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData;
40using OpenSim.Framework; 41using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes.Scripting; 43using OpenSim.Region.Framework.Scenes.Scripting;
@@ -116,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes
116 117
117 #endregion Enumerations 118 #endregion Enumerations
118 119
119 public class SceneObjectPart : IScriptHost, ISceneEntity 120 public class SceneObjectPart : ISceneEntity
120 { 121 {
121 /// <value> 122 /// <value>
122 /// Denote all sides of the prim 123 /// Denote all sides of the prim
@@ -136,6 +137,11 @@ namespace OpenSim.Region.Framework.Scenes
136 137
137 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 138 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
138 139
140 /// <summary>
141 /// Dynamic attributes can be created and deleted as required.
142 /// </summary>
143 public DAMap DynAttrs { get; set; }
144
139 /// <value> 145 /// <value>
140 /// Is this a root part? 146 /// Is this a root part?
141 /// </value> 147 /// </value>
@@ -386,6 +392,7 @@ namespace OpenSim.Region.Framework.Scenes
386 m_particleSystem = Utils.EmptyBytes; 392 m_particleSystem = Utils.EmptyBytes;
387 Rezzed = DateTime.UtcNow; 393 Rezzed = DateTime.UtcNow;
388 Description = String.Empty; 394 Description = String.Empty;
395 DynAttrs = new DAMap();
389 396
390 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, 397 // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
391 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 398 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
@@ -1342,7 +1349,7 @@ namespace OpenSim.Region.Framework.Scenes
1342 public UUID SitTargetAvatar { get; set; } 1349 public UUID SitTargetAvatar { get; set; }
1343 1350
1344 /// <summary> 1351 /// <summary>
1345 /// IDs of all avatars start on this object part. 1352 /// IDs of all avatars sat on this part.
1346 /// </summary> 1353 /// </summary>
1347 /// <remarks> 1354 /// <remarks>
1348 /// We need to track this so that we can stop sat upon prims from being attached. 1355 /// We need to track this so that we can stop sat upon prims from being attached.
@@ -2133,6 +2140,8 @@ namespace OpenSim.Region.Framework.Scenes
2133 // safeguard actual copy is done in sog.copy 2140 // safeguard actual copy is done in sog.copy
2134 dupe.KeyframeMotion = null; 2141 dupe.KeyframeMotion = null;
2135 2142
2143 dupe.DynAttrs.CopyFrom(DynAttrs);
2144
2136 if (userExposed) 2145 if (userExposed)
2137 { 2146 {
2138/* 2147/*
@@ -2446,11 +2455,11 @@ namespace OpenSim.Region.Framework.Scenes
2446 public int GetAxisRotation(int axis) 2455 public int GetAxisRotation(int axis)
2447 { 2456 {
2448 //Cannot use ScriptBaseClass constants as no referance to it currently. 2457 //Cannot use ScriptBaseClass constants as no referance to it currently.
2449 if (axis == 2)//STATUS_ROTATE_X 2458 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X)
2450 return STATUS_ROTATE_X; 2459 return STATUS_ROTATE_X;
2451 if (axis == 4)//STATUS_ROTATE_Y 2460 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y)
2452 return STATUS_ROTATE_Y; 2461 return STATUS_ROTATE_Y;
2453 if (axis == 8)//STATUS_ROTATE_Z 2462 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z)
2454 return STATUS_ROTATE_Z; 2463 return STATUS_ROTATE_Z;
2455 2464
2456 return 0; 2465 return 0;
@@ -2485,18 +2494,6 @@ namespace OpenSim.Region.Framework.Scenes
2485 return new Vector3(0, 0, 0); 2494 return new Vector3(0, 0, 0);
2486 2495
2487 return ParentGroup.GetGeometricCenter(); 2496 return ParentGroup.GetGeometricCenter();
2488
2489 /*
2490 PhysicsActor pa = PhysActor;
2491
2492 if (pa != null)
2493 {
2494 Vector3 vtmp = pa.CenterOfMass;
2495 return vtmp;
2496 }
2497 else
2498 return new Vector3(0, 0, 0);
2499 */
2500 } 2497 }
2501 2498
2502 public float GetMass() 2499 public float GetMass()
@@ -2910,11 +2907,14 @@ namespace OpenSim.Region.Framework.Scenes
2910 2907
2911 public void PhysicsOutOfBounds(Vector3 pos) 2908 public void PhysicsOutOfBounds(Vector3 pos)
2912 { 2909 {
2913 m_log.Error("[PHYSICS]: Physical Object went out of bounds."); 2910 // Note: This is only being called on the root prim at this time.
2911
2912 m_log.ErrorFormat(
2913 "[SCENE OBJECT PART]: Physical object {0}, localID {1} went out of bounds at {2} in {3}. Stopping at {4} and making non-physical.",
2914 Name, LocalId, pos, ParentGroup.Scene.Name, AbsolutePosition);
2914 2915
2915 RemFlag(PrimFlags.Physics); 2916 RemFlag(PrimFlags.Physics);
2916 DoPhysicsPropertyUpdate(false, true); 2917 DoPhysicsPropertyUpdate(false, true);
2917 //ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2918 } 2918 }
2919 2919
2920 public void PhysicsRequestingTerseUpdate() 2920 public void PhysicsRequestingTerseUpdate()
@@ -3337,13 +3337,13 @@ namespace OpenSim.Region.Framework.Scenes
3337 ParentGroup.SetAxisRotation(axis, rotate); 3337 ParentGroup.SetAxisRotation(axis, rotate);
3338 3338
3339 //Cannot use ScriptBaseClass constants as no referance to it currently. 3339 //Cannot use ScriptBaseClass constants as no referance to it currently.
3340 if (axis == 2)//STATUS_ROTATE_X 3340 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
3341 STATUS_ROTATE_X = rotate; 3341 STATUS_ROTATE_X = rotate;
3342 3342
3343 if (axis == 4)//STATUS_ROTATE_Y 3343 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
3344 STATUS_ROTATE_Y = rotate; 3344 STATUS_ROTATE_Y = rotate;
3345 3345
3346 if (axis == 8)//STATUS_ROTATE_Z 3346 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
3347 STATUS_ROTATE_Z = rotate; 3347 STATUS_ROTATE_Z = rotate;
3348 } 3348 }
3349 3349
@@ -4250,6 +4250,7 @@ namespace OpenSim.Region.Framework.Scenes
4250 result.distance = distance2; 4250 result.distance = distance2;
4251 result.HitTF = true; 4251 result.HitTF = true;
4252 result.ipoint = q; 4252 result.ipoint = q;
4253 result.face = i;
4253 //m_log.Info("[FACE]:" + i.ToString()); 4254 //m_log.Info("[FACE]:" + i.ToString());
4254 //m_log.Info("[POINT]: " + q.ToString()); 4255 //m_log.Info("[POINT]: " + q.ToString());
4255 //m_log.Info("[DIST]: " + distance2.ToString()); 4256 //m_log.Info("[DIST]: " + distance2.ToString());
@@ -4573,7 +4574,7 @@ namespace OpenSim.Region.Framework.Scenes
4573 if (ParentGroup.RootPart == this) 4574 if (ParentGroup.RootPart == this)
4574 AngularVelocity = new Vector3(0, 0, 0); 4575 AngularVelocity = new Vector3(0, 0, 0);
4575 } 4576 }
4576 else 4577 else if (SetVD != wasVD)
4577 { 4578 {
4578 if (ParentGroup.Scene.CollidablePrims) 4579 if (ParentGroup.Scene.CollidablePrims)
4579 { 4580 {
@@ -4661,9 +4662,9 @@ namespace OpenSim.Region.Framework.Scenes
4661 PhysicsShapeType, 4662 PhysicsShapeType,
4662 m_localId); 4663 m_localId);
4663 } 4664 }
4664 catch (Exception ex) 4665 catch (Exception e)
4665 { 4666 {
4666 m_log.ErrorFormat("[SCENE]: AddToPhysics object {0} failed: {1}", m_uuid, ex.Message); 4667 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom. e={1}", m_uuid, e);
4667 pa = null; 4668 pa = null;
4668 } 4669 }
4669 4670
@@ -5222,18 +5223,22 @@ namespace OpenSim.Region.Framework.Scenes
5222 /// <param name='avatarId'></param> 5223 /// <param name='avatarId'></param>
5223 protected internal bool AddSittingAvatar(UUID avatarId) 5224 protected internal bool AddSittingAvatar(UUID avatarId)
5224 { 5225 {
5225 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) 5226 lock (ParentGroup.m_sittingAvatars)
5226 SitTargetAvatar = avatarId; 5227 {
5228 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
5229 SitTargetAvatar = avatarId;
5227 5230
5228 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5231 if (m_sittingAvatars == null)
5232 m_sittingAvatars = new HashSet<UUID>();
5229 5233
5230 if (sittingAvatars == null) 5234 if (m_sittingAvatars.Add(avatarId))
5231 sittingAvatars = new HashSet<UUID>(); 5235 {
5236 ParentGroup.m_sittingAvatars.Add(avatarId);
5232 5237
5233 lock (sittingAvatars) 5238 return true;
5234 { 5239 }
5235 m_sittingAvatars = sittingAvatars; 5240
5236 return m_sittingAvatars.Add(avatarId); 5241 return false;
5237 } 5242 }
5238 } 5243 }
5239 5244
@@ -5247,27 +5252,26 @@ namespace OpenSim.Region.Framework.Scenes
5247 /// <param name='avatarId'></param> 5252 /// <param name='avatarId'></param>
5248 protected internal bool RemoveSittingAvatar(UUID avatarId) 5253 protected internal bool RemoveSittingAvatar(UUID avatarId)
5249 { 5254 {
5250 if (SitTargetAvatar == avatarId) 5255 lock (ParentGroup.m_sittingAvatars)
5251 SitTargetAvatar = UUID.Zero; 5256 {
5252 5257 if (SitTargetAvatar == avatarId)
5253 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5258 SitTargetAvatar = UUID.Zero;
5254 5259
5255 // This can occur under a race condition where another thread 5260 if (m_sittingAvatars == null)
5256 if (sittingAvatars == null) 5261 return false;
5257 return false;
5258 5262
5259 lock (sittingAvatars) 5263 if (m_sittingAvatars.Remove(avatarId))
5260 {
5261 if (sittingAvatars.Remove(avatarId))
5262 { 5264 {
5263 if (sittingAvatars.Count == 0) 5265 if (m_sittingAvatars.Count == 0)
5264 m_sittingAvatars = null; 5266 m_sittingAvatars = null;
5265 5267
5268 ParentGroup.m_sittingAvatars.Remove(avatarId);
5269
5266 return true; 5270 return true;
5267 } 5271 }
5268 }
5269 5272
5270 return false; 5273 return false;
5274 }
5271 } 5275 }
5272 5276
5273 /// <summary> 5277 /// <summary>
@@ -5277,16 +5281,12 @@ namespace OpenSim.Region.Framework.Scenes
5277 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> 5281 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
5278 public HashSet<UUID> GetSittingAvatars() 5282 public HashSet<UUID> GetSittingAvatars()
5279 { 5283 {
5280 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5284 lock (ParentGroup.m_sittingAvatars)
5281
5282 if (sittingAvatars == null)
5283 { 5285 {
5284 return null; 5286 if (m_sittingAvatars == null)
5285 } 5287 return null;
5286 else 5288 else
5287 { 5289 return new HashSet<UUID>(m_sittingAvatars);
5288 lock (sittingAvatars)
5289 return new HashSet<UUID>(sittingAvatars);
5290 } 5290 }
5291 } 5291 }
5292 5292
@@ -5297,13 +5297,13 @@ namespace OpenSim.Region.Framework.Scenes
5297 /// <returns></returns> 5297 /// <returns></returns>
5298 public int GetSittingAvatarsCount() 5298 public int GetSittingAvatarsCount()
5299 { 5299 {
5300 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5300 lock (ParentGroup.m_sittingAvatars)
5301 5301 {
5302 if (sittingAvatars == null) 5302 if (m_sittingAvatars == null)
5303 return 0; 5303 return 0;
5304 5304 else
5305 lock (sittingAvatars) 5305 return m_sittingAvatars.Count;
5306 return sittingAvatars.Count; 5306 }
5307 } 5307 }
5308 } 5308 }
5309} 5309}