aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs91
1 files changed, 89 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 7568888..46a7e3d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2670,6 +2670,10 @@ namespace OpenSim.Region.Framework.Scenes
2670 /// <summary> 2670 /// <summary>
2671 /// Link the prims in a given group to this group 2671 /// Link the prims in a given group to this group
2672 /// </summary> 2672 /// </summary>
2673 /// <remarks>
2674 /// Do not call this method directly - use Scene.LinkObjects() instead to avoid races between threads.
2675 /// FIXME: There are places where scripts call these methods directly without locking. This is a potential race condition.
2676 /// </remarks>
2673 /// <param name="objectGroup">The group of prims which should be linked to this group</param> 2677 /// <param name="objectGroup">The group of prims which should be linked to this group</param>
2674 public void LinkToGroup(SceneObjectGroup objectGroup) 2678 public void LinkToGroup(SceneObjectGroup objectGroup)
2675 { 2679 {
@@ -2751,6 +2755,7 @@ namespace OpenSim.Region.Framework.Scenes
2751 } 2755 }
2752 2756
2753 linkPart.LinkNum = linkNum++; 2757 linkPart.LinkNum = linkNum++;
2758 linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
2754 2759
2755 SceneObjectPart[] ogParts = objectGroup.Parts; 2760 SceneObjectPart[] ogParts = objectGroup.Parts;
2756 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) 2761 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
@@ -2802,6 +2807,11 @@ namespace OpenSim.Region.Framework.Scenes
2802 /// Delink the given prim from this group. The delinked prim is established as 2807 /// Delink the given prim from this group. The delinked prim is established as
2803 /// an independent SceneObjectGroup. 2808 /// an independent SceneObjectGroup.
2804 /// </summary> 2809 /// </summary>
2810 /// <remarks>
2811 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2812 /// condition. But currently there is no
2813 /// alternative method that does take a lonk to delink a single prim.
2814 /// </remarks>
2805 /// <param name="partID"></param> 2815 /// <param name="partID"></param>
2806 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> 2816 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2807 public SceneObjectGroup DelinkFromGroup(uint partID) 2817 public SceneObjectGroup DelinkFromGroup(uint partID)
@@ -2813,6 +2823,11 @@ namespace OpenSim.Region.Framework.Scenes
2813 /// Delink the given prim from this group. The delinked prim is established as 2823 /// Delink the given prim from this group. The delinked prim is established as
2814 /// an independent SceneObjectGroup. 2824 /// an independent SceneObjectGroup.
2815 /// </summary> 2825 /// </summary>
2826 /// <remarks>
2827 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2828 /// condition. But currently there is no
2829 /// alternative method that does take a lonk to delink a single prim.
2830 /// </remarks>
2816 /// <param name="partID"></param> 2831 /// <param name="partID"></param>
2817 /// <param name="sendEvents"></param> 2832 /// <param name="sendEvents"></param>
2818 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> 2833 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
@@ -2838,6 +2853,11 @@ namespace OpenSim.Region.Framework.Scenes
2838 /// Delink the given prim from this group. The delinked prim is established as 2853 /// Delink the given prim from this group. The delinked prim is established as
2839 /// an independent SceneObjectGroup. 2854 /// an independent SceneObjectGroup.
2840 /// </summary> 2855 /// </summary>
2856 /// <remarks>
2857 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2858 /// condition. But currently there is no
2859 /// alternative method that does take a lonk to delink a single prim.
2860 /// </remarks>
2841 /// <param name="partID"></param> 2861 /// <param name="partID"></param>
2842 /// <param name="sendEvents"></param> 2862 /// <param name="sendEvents"></param>
2843 /// <returns>The object group of the newly delinked prim.</returns> 2863 /// <returns>The object group of the newly delinked prim.</returns>
@@ -2971,6 +2991,8 @@ namespace OpenSim.Region.Framework.Scenes
2971 oldRot = part.RotationOffset; 2991 oldRot = part.RotationOffset;
2972 Quaternion newRot = Quaternion.Conjugate(parentRot) * worldRot; 2992 Quaternion newRot = Quaternion.Conjugate(parentRot) * worldRot;
2973 part.RotationOffset = newRot; 2993 part.RotationOffset = newRot;
2994
2995 part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
2974 } 2996 }
2975 2997
2976 /// <summary> 2998 /// <summary>
@@ -3482,7 +3504,7 @@ namespace OpenSim.Region.Framework.Scenes
3482 3504
3483 //we need to do a terse update even if the move wasn't allowed 3505 //we need to do a terse update even if the move wasn't allowed
3484 // so that the position is reset in the client (the object snaps back) 3506 // so that the position is reset in the client (the object snaps back)
3485 ScheduleGroupForTerseUpdate(); 3507 RootPart.ScheduleTerseUpdate();
3486 } 3508 }
3487 3509
3488 /// <summary> 3510 /// <summary>
@@ -4182,7 +4204,72 @@ namespace OpenSim.Region.Framework.Scenes
4182 for (int i = 0; i < parts.Length; i++) 4204 for (int i = 0; i < parts.Length; i++)
4183 parts[i].TriggerScriptChangedEvent(val); 4205 parts[i].TriggerScriptChangedEvent(val);
4184 } 4206 }
4185 4207
4208 /// <summary>
4209 /// Returns a count of the number of scripts in this groups parts.
4210 /// </summary>
4211 public int ScriptCount()
4212 {
4213 int count = 0;
4214 SceneObjectPart[] parts = m_parts.GetArray();
4215 for (int i = 0; i < parts.Length; i++)
4216 count += parts[i].Inventory.ScriptCount();
4217
4218 return count;
4219 }
4220
4221 /// <summary>
4222 /// A float the value is a representative execution time in milliseconds of all scripts in the link set.
4223 /// </summary>
4224 public float ScriptExecutionTime()
4225 {
4226 IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>();
4227
4228 if (engines.Length == 0) // No engine at all
4229 return 0.0f;
4230
4231 float time = 0.0f;
4232
4233 // get all the scripts in all parts
4234 SceneObjectPart[] parts = m_parts.GetArray();
4235 List<TaskInventoryItem> scripts = new List<TaskInventoryItem>();
4236 for (int i = 0; i < parts.Length; i++)
4237 {
4238 scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL));
4239 }
4240 // extract the UUIDs
4241 List<UUID> ids = new List<UUID>(scripts.Count);
4242 foreach (TaskInventoryItem script in scripts)
4243 {
4244 if (!ids.Contains(script.ItemID))
4245 {
4246 ids.Add(script.ItemID);
4247 }
4248 }
4249 // Offer the list of script UUIDs to each engine found and accumulate the time
4250 foreach (IScriptModule e in engines)
4251 {
4252 if (e != null)
4253 {
4254 time += e.GetScriptExecutionTime(ids);
4255 }
4256 }
4257 return time;
4258 }
4259
4260 /// <summary>
4261 /// Returns a count of the number of running scripts in this groups parts.
4262 /// </summary>
4263 public int RunningScriptCount()
4264 {
4265 int count = 0;
4266 SceneObjectPart[] parts = m_parts.GetArray();
4267 for (int i = 0; i < parts.Length; i++)
4268 count += parts[i].Inventory.RunningScriptCount();
4269
4270 return count;
4271 }
4272
4186 public override string ToString() 4273 public override string ToString()
4187 { 4274 {
4188 return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); 4275 return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);