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.cs89
1 files changed, 88 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0100ab3..c47db97 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2629,6 +2629,10 @@ namespace OpenSim.Region.Framework.Scenes
2629 /// <summary> 2629 /// <summary>
2630 /// Link the prims in a given group to this group 2630 /// Link the prims in a given group to this group
2631 /// </summary> 2631 /// </summary>
2632 /// <remarks>
2633 /// Do not call this method directly - use Scene.LinkObjects() instead to avoid races between threads.
2634 /// FIXME: There are places where scripts call these methods directly without locking. This is a potential race condition.
2635 /// </remarks>
2632 /// <param name="objectGroup">The group of prims which should be linked to this group</param> 2636 /// <param name="objectGroup">The group of prims which should be linked to this group</param>
2633 public void LinkToGroup(SceneObjectGroup objectGroup) 2637 public void LinkToGroup(SceneObjectGroup objectGroup)
2634 { 2638 {
@@ -2708,6 +2712,7 @@ namespace OpenSim.Region.Framework.Scenes
2708 } 2712 }
2709 2713
2710 linkPart.LinkNum = linkNum++; 2714 linkPart.LinkNum = linkNum++;
2715 linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
2711 2716
2712 SceneObjectPart[] ogParts = objectGroup.Parts; 2717 SceneObjectPart[] ogParts = objectGroup.Parts;
2713 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) 2718 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
@@ -2759,6 +2764,11 @@ namespace OpenSim.Region.Framework.Scenes
2759 /// Delink the given prim from this group. The delinked prim is established as 2764 /// Delink the given prim from this group. The delinked prim is established as
2760 /// an independent SceneObjectGroup. 2765 /// an independent SceneObjectGroup.
2761 /// </summary> 2766 /// </summary>
2767 /// <remarks>
2768 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2769 /// condition. But currently there is no
2770 /// alternative method that does take a lonk to delink a single prim.
2771 /// </remarks>
2762 /// <param name="partID"></param> 2772 /// <param name="partID"></param>
2763 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> 2773 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2764 public SceneObjectGroup DelinkFromGroup(uint partID) 2774 public SceneObjectGroup DelinkFromGroup(uint partID)
@@ -2770,6 +2780,11 @@ namespace OpenSim.Region.Framework.Scenes
2770 /// Delink the given prim from this group. The delinked prim is established as 2780 /// Delink the given prim from this group. The delinked prim is established as
2771 /// an independent SceneObjectGroup. 2781 /// an independent SceneObjectGroup.
2772 /// </summary> 2782 /// </summary>
2783 /// <remarks>
2784 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2785 /// condition. But currently there is no
2786 /// alternative method that does take a lonk to delink a single prim.
2787 /// </remarks>
2773 /// <param name="partID"></param> 2788 /// <param name="partID"></param>
2774 /// <param name="sendEvents"></param> 2789 /// <param name="sendEvents"></param>
2775 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns> 2790 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
@@ -2795,6 +2810,11 @@ namespace OpenSim.Region.Framework.Scenes
2795 /// Delink the given prim from this group. The delinked prim is established as 2810 /// Delink the given prim from this group. The delinked prim is established as
2796 /// an independent SceneObjectGroup. 2811 /// an independent SceneObjectGroup.
2797 /// </summary> 2812 /// </summary>
2813 /// <remarks>
2814 /// FIXME: This method should not be called directly since it bypasses update locking, allowing a potential race
2815 /// condition. But currently there is no
2816 /// alternative method that does take a lonk to delink a single prim.
2817 /// </remarks>
2798 /// <param name="partID"></param> 2818 /// <param name="partID"></param>
2799 /// <param name="sendEvents"></param> 2819 /// <param name="sendEvents"></param>
2800 /// <returns>The object group of the newly delinked prim.</returns> 2820 /// <returns>The object group of the newly delinked prim.</returns>
@@ -2928,6 +2948,8 @@ namespace OpenSim.Region.Framework.Scenes
2928 oldRot = part.RotationOffset; 2948 oldRot = part.RotationOffset;
2929 Quaternion newRot = Quaternion.Inverse(parentRot) * worldRot; 2949 Quaternion newRot = Quaternion.Inverse(parentRot) * worldRot;
2930 part.RotationOffset = newRot; 2950 part.RotationOffset = newRot;
2951
2952 part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
2931 } 2953 }
2932 2954
2933 /// <summary> 2955 /// <summary>
@@ -4081,7 +4103,72 @@ namespace OpenSim.Region.Framework.Scenes
4081 for (int i = 0; i < parts.Length; i++) 4103 for (int i = 0; i < parts.Length; i++)
4082 parts[i].TriggerScriptChangedEvent(val); 4104 parts[i].TriggerScriptChangedEvent(val);
4083 } 4105 }
4084 4106
4107 /// <summary>
4108 /// Returns a count of the number of scripts in this groups parts.
4109 /// </summary>
4110 public int ScriptCount()
4111 {
4112 int count = 0;
4113 SceneObjectPart[] parts = m_parts.GetArray();
4114 for (int i = 0; i < parts.Length; i++)
4115 count += parts[i].Inventory.ScriptCount();
4116
4117 return count;
4118 }
4119
4120 /// <summary>
4121 /// A float the value is a representative execution time in milliseconds of all scripts in the link set.
4122 /// </summary>
4123 public float ScriptExecutionTime()
4124 {
4125 IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>();
4126
4127 if (engines.Length == 0) // No engine at all
4128 return 0.0f;
4129
4130 float time = 0.0f;
4131
4132 // get all the scripts in all parts
4133 SceneObjectPart[] parts = m_parts.GetArray();
4134 List<TaskInventoryItem> scripts = new List<TaskInventoryItem>();
4135 for (int i = 0; i < parts.Length; i++)
4136 {
4137 scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL));
4138 }
4139 // extract the UUIDs
4140 List<UUID> ids = new List<UUID>(scripts.Count);
4141 foreach (TaskInventoryItem script in scripts)
4142 {
4143 if (!ids.Contains(script.ItemID))
4144 {
4145 ids.Add(script.ItemID);
4146 }
4147 }
4148 // Offer the list of script UUIDs to each engine found and accumulate the time
4149 foreach (IScriptModule e in engines)
4150 {
4151 if (e != null)
4152 {
4153 time += e.GetScriptExecutionTime(ids);
4154 }
4155 }
4156 return time;
4157 }
4158
4159 /// <summary>
4160 /// Returns a count of the number of running scripts in this groups parts.
4161 /// </summary>
4162 public int RunningScriptCount()
4163 {
4164 int count = 0;
4165 SceneObjectPart[] parts = m_parts.GetArray();
4166 for (int i = 0; i < parts.Length; i++)
4167 count += parts[i].Inventory.RunningScriptCount();
4168
4169 return count;
4170 }
4171
4085 public override string ToString() 4172 public override string ToString()
4086 { 4173 {
4087 return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); 4174 return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);