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 0d2da03..415a82b 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.
@@ -2118,6 +2125,8 @@ namespace OpenSim.Region.Framework.Scenes
2118 // safeguard actual copy is done in sog.copy 2125 // safeguard actual copy is done in sog.copy
2119 dupe.KeyframeMotion = null; 2126 dupe.KeyframeMotion = null;
2120 2127
2128 dupe.DynAttrs.CopyFrom(DynAttrs);
2129
2121 if (userExposed) 2130 if (userExposed)
2122 { 2131 {
2123/* 2132/*
@@ -2431,11 +2440,11 @@ namespace OpenSim.Region.Framework.Scenes
2431 public int GetAxisRotation(int axis) 2440 public int GetAxisRotation(int axis)
2432 { 2441 {
2433 //Cannot use ScriptBaseClass constants as no referance to it currently. 2442 //Cannot use ScriptBaseClass constants as no referance to it currently.
2434 if (axis == 2)//STATUS_ROTATE_X 2443 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X)
2435 return STATUS_ROTATE_X; 2444 return STATUS_ROTATE_X;
2436 if (axis == 4)//STATUS_ROTATE_Y 2445 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y)
2437 return STATUS_ROTATE_Y; 2446 return STATUS_ROTATE_Y;
2438 if (axis == 8)//STATUS_ROTATE_Z 2447 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z)
2439 return STATUS_ROTATE_Z; 2448 return STATUS_ROTATE_Z;
2440 2449
2441 return 0; 2450 return 0;
@@ -2470,18 +2479,6 @@ namespace OpenSim.Region.Framework.Scenes
2470 return new Vector3(0, 0, 0); 2479 return new Vector3(0, 0, 0);
2471 2480
2472 return ParentGroup.GetGeometricCenter(); 2481 return ParentGroup.GetGeometricCenter();
2473
2474 /*
2475 PhysicsActor pa = PhysActor;
2476
2477 if (pa != null)
2478 {
2479 Vector3 vtmp = pa.CenterOfMass;
2480 return vtmp;
2481 }
2482 else
2483 return new Vector3(0, 0, 0);
2484 */
2485 } 2482 }
2486 2483
2487 public float GetMass() 2484 public float GetMass()
@@ -2895,11 +2892,14 @@ namespace OpenSim.Region.Framework.Scenes
2895 2892
2896 public void PhysicsOutOfBounds(Vector3 pos) 2893 public void PhysicsOutOfBounds(Vector3 pos)
2897 { 2894 {
2898 m_log.Error("[PHYSICS]: Physical Object went out of bounds."); 2895 // Note: This is only being called on the root prim at this time.
2896
2897 m_log.ErrorFormat(
2898 "[SCENE OBJECT PART]: Physical object {0}, localID {1} went out of bounds at {2} in {3}. Stopping at {4} and making non-physical.",
2899 Name, LocalId, pos, ParentGroup.Scene.Name, AbsolutePosition);
2899 2900
2900 RemFlag(PrimFlags.Physics); 2901 RemFlag(PrimFlags.Physics);
2901 DoPhysicsPropertyUpdate(false, true); 2902 DoPhysicsPropertyUpdate(false, true);
2902 //ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2903 } 2903 }
2904 2904
2905 public void PhysicsRequestingTerseUpdate() 2905 public void PhysicsRequestingTerseUpdate()
@@ -3322,13 +3322,13 @@ namespace OpenSim.Region.Framework.Scenes
3322 ParentGroup.SetAxisRotation(axis, rotate); 3322 ParentGroup.SetAxisRotation(axis, rotate);
3323 3323
3324 //Cannot use ScriptBaseClass constants as no referance to it currently. 3324 //Cannot use ScriptBaseClass constants as no referance to it currently.
3325 if (axis == 2)//STATUS_ROTATE_X 3325 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
3326 STATUS_ROTATE_X = rotate; 3326 STATUS_ROTATE_X = rotate;
3327 3327
3328 if (axis == 4)//STATUS_ROTATE_Y 3328 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
3329 STATUS_ROTATE_Y = rotate; 3329 STATUS_ROTATE_Y = rotate;
3330 3330
3331 if (axis == 8)//STATUS_ROTATE_Z 3331 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
3332 STATUS_ROTATE_Z = rotate; 3332 STATUS_ROTATE_Z = rotate;
3333 } 3333 }
3334 3334
@@ -4235,6 +4235,7 @@ namespace OpenSim.Region.Framework.Scenes
4235 result.distance = distance2; 4235 result.distance = distance2;
4236 result.HitTF = true; 4236 result.HitTF = true;
4237 result.ipoint = q; 4237 result.ipoint = q;
4238 result.face = i;
4238 //m_log.Info("[FACE]:" + i.ToString()); 4239 //m_log.Info("[FACE]:" + i.ToString());
4239 //m_log.Info("[POINT]: " + q.ToString()); 4240 //m_log.Info("[POINT]: " + q.ToString());
4240 //m_log.Info("[DIST]: " + distance2.ToString()); 4241 //m_log.Info("[DIST]: " + distance2.ToString());
@@ -4558,7 +4559,7 @@ namespace OpenSim.Region.Framework.Scenes
4558 if (ParentGroup.RootPart == this) 4559 if (ParentGroup.RootPart == this)
4559 AngularVelocity = new Vector3(0, 0, 0); 4560 AngularVelocity = new Vector3(0, 0, 0);
4560 } 4561 }
4561 else 4562 else if (SetVD != wasVD)
4562 { 4563 {
4563 if (ParentGroup.Scene.CollidablePrims) 4564 if (ParentGroup.Scene.CollidablePrims)
4564 { 4565 {
@@ -4646,9 +4647,9 @@ namespace OpenSim.Region.Framework.Scenes
4646 PhysicsShapeType, 4647 PhysicsShapeType,
4647 m_localId); 4648 m_localId);
4648 } 4649 }
4649 catch (Exception ex) 4650 catch (Exception e)
4650 { 4651 {
4651 m_log.ErrorFormat("[SCENE]: AddToPhysics object {0} failed: {1}", m_uuid, ex.Message); 4652 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom. e={1}", m_uuid, e);
4652 pa = null; 4653 pa = null;
4653 } 4654 }
4654 4655
@@ -5202,18 +5203,22 @@ namespace OpenSim.Region.Framework.Scenes
5202 /// <param name='avatarId'></param> 5203 /// <param name='avatarId'></param>
5203 protected internal bool AddSittingAvatar(UUID avatarId) 5204 protected internal bool AddSittingAvatar(UUID avatarId)
5204 { 5205 {
5205 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) 5206 lock (ParentGroup.m_sittingAvatars)
5206 SitTargetAvatar = avatarId; 5207 {
5208 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
5209 SitTargetAvatar = avatarId;
5207 5210
5208 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5211 if (m_sittingAvatars == null)
5212 m_sittingAvatars = new HashSet<UUID>();
5209 5213
5210 if (sittingAvatars == null) 5214 if (m_sittingAvatars.Add(avatarId))
5211 sittingAvatars = new HashSet<UUID>(); 5215 {
5216 ParentGroup.m_sittingAvatars.Add(avatarId);
5212 5217
5213 lock (sittingAvatars) 5218 return true;
5214 { 5219 }
5215 m_sittingAvatars = sittingAvatars; 5220
5216 return m_sittingAvatars.Add(avatarId); 5221 return false;
5217 } 5222 }
5218 } 5223 }
5219 5224
@@ -5227,27 +5232,26 @@ namespace OpenSim.Region.Framework.Scenes
5227 /// <param name='avatarId'></param> 5232 /// <param name='avatarId'></param>
5228 protected internal bool RemoveSittingAvatar(UUID avatarId) 5233 protected internal bool RemoveSittingAvatar(UUID avatarId)
5229 { 5234 {
5230 if (SitTargetAvatar == avatarId) 5235 lock (ParentGroup.m_sittingAvatars)
5231 SitTargetAvatar = UUID.Zero; 5236 {
5232 5237 if (SitTargetAvatar == avatarId)
5233 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5238 SitTargetAvatar = UUID.Zero;
5234 5239
5235 // This can occur under a race condition where another thread 5240 if (m_sittingAvatars == null)
5236 if (sittingAvatars == null) 5241 return false;
5237 return false;
5238 5242
5239 lock (sittingAvatars) 5243 if (m_sittingAvatars.Remove(avatarId))
5240 {
5241 if (sittingAvatars.Remove(avatarId))
5242 { 5244 {
5243 if (sittingAvatars.Count == 0) 5245 if (m_sittingAvatars.Count == 0)
5244 m_sittingAvatars = null; 5246 m_sittingAvatars = null;
5245 5247
5248 ParentGroup.m_sittingAvatars.Remove(avatarId);
5249
5246 return true; 5250 return true;
5247 } 5251 }
5248 }
5249 5252
5250 return false; 5253 return false;
5254 }
5251 } 5255 }
5252 5256
5253 /// <summary> 5257 /// <summary>
@@ -5257,16 +5261,12 @@ namespace OpenSim.Region.Framework.Scenes
5257 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> 5261 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
5258 public HashSet<UUID> GetSittingAvatars() 5262 public HashSet<UUID> GetSittingAvatars()
5259 { 5263 {
5260 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5264 lock (ParentGroup.m_sittingAvatars)
5261
5262 if (sittingAvatars == null)
5263 { 5265 {
5264 return null; 5266 if (m_sittingAvatars == null)
5265 } 5267 return null;
5266 else 5268 else
5267 { 5269 return new HashSet<UUID>(m_sittingAvatars);
5268 lock (sittingAvatars)
5269 return new HashSet<UUID>(sittingAvatars);
5270 } 5270 }
5271 } 5271 }
5272 5272
@@ -5277,13 +5277,13 @@ namespace OpenSim.Region.Framework.Scenes
5277 /// <returns></returns> 5277 /// <returns></returns>
5278 public int GetSittingAvatarsCount() 5278 public int GetSittingAvatarsCount()
5279 { 5279 {
5280 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5280 lock (ParentGroup.m_sittingAvatars)
5281 5281 {
5282 if (sittingAvatars == null) 5282 if (m_sittingAvatars == null)
5283 return 0; 5283 return 0;
5284 5284 else
5285 lock (sittingAvatars) 5285 return m_sittingAvatars.Count;
5286 return sittingAvatars.Count; 5286 }
5287 } 5287 }
5288 } 5288 }
5289} 5289}