aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorBlueWall2011-04-13 09:53:44 -0400
committerBlueWall2011-04-13 09:53:44 -0400
commitd3457eae7a33f01a8fa906c4040792cdc4a67857 (patch)
treef92e60733b8397576b86c486e05aa5219f27d034 /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' of /home/opensim/src/OpenSim/Core (diff)
parentMove example HttpProxy setting to OpenSim.ini.example and tidy (diff)
downloadopensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.zip
opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.gz
opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.bz2
opensim-SC_OLD-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.xz
Merge branch 'master' of /home/git/repo/OpenSim
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs250
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs72
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs119
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs10
9 files changed, 311 insertions, 233 deletions
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 64567db..8feb022 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes
137 x = m_inventoryDeletes.Dequeue(); 137 x = m_inventoryDeletes.Dequeue();
138 138
139 m_log.DebugFormat( 139 m_log.DebugFormat(
140 "[ASYNC DELETER]: Sending object to user's inventory, {0} item(s) remaining.", left); 140 "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", left, x.action, x.objectGroups.Count);
141 141
142 try 142 try
143 { 143 {
@@ -177,4 +177,4 @@ namespace OpenSim.Region.Framework.Scenes
177 return false; 177 return false;
178 } 178 }
179 } 179 }
180} \ No newline at end of file 180}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index c321a15..fd62535 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -242,7 +242,15 @@ namespace OpenSim.Region.Framework.Scenes
242 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); 242 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
243 243
244 public event EstateToolsSunUpdate OnEstateToolsSunUpdate; 244 public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
245
246 /// <summary>
247 /// Triggered when an object is added to the scene.
248 /// </summary>
249 public event Action<SceneObjectGroup> OnObjectAddedToScene;
245 250
251 /// <summary>
252 /// Triggered when an object is removed from the scene.
253 /// </summary>
246 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); 254 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
247 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; 255 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
248 256
@@ -345,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
345 public delegate void Attach(uint localID, UUID itemID, UUID avatarID); 353 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
346 public event Attach OnAttach; 354 public event Attach OnAttach;
347 355
356
348 /// <summary> 357 /// <summary>
349 /// Called immediately after an object is loaded from storage. 358 /// Called immediately after an object is loaded from storage.
350 /// </summary> 359 /// </summary>
@@ -800,6 +809,27 @@ namespace OpenSim.Region.Framework.Scenes
800 } 809 }
801 } 810 }
802 811
812 public void TriggerObjectAddedToScene(SceneObjectGroup obj)
813 {
814 Action<SceneObjectGroup> handler = OnObjectAddedToScene;
815 if (handler != null)
816 {
817 foreach (Action<SceneObjectGroup> d in handler.GetInvocationList())
818 {
819 try
820 {
821 d(obj);
822 }
823 catch (Exception e)
824 {
825 m_log.ErrorFormat(
826 "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}",
827 e.Message, e.StackTrace);
828 }
829 }
830 }
831 }
832
803 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) 833 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
804 { 834 {
805 ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; 835 ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index f9599f5..4694e2b 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -58,17 +58,8 @@ namespace OpenSim.Region.Framework.Scenes
58 58
59 public class Prioritizer 59 public class Prioritizer
60 { 60 {
61// private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
62 62
63 /// <summary>
64 /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
65 /// viewer before child prim updates.
66 /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up
67 /// being double. We do it both ways so that there is a still a priority delta even if the priority is already
68 /// double.MinValue or double.MaxValue.
69 /// </summary>
70 private double m_childPrimAdjustmentFactor = 0.05;
71
72 private Scene m_scene; 63 private Scene m_scene;
73 64
74 public Prioritizer(Scene scene) 65 public Prioritizer(Scene scene)
@@ -76,17 +67,35 @@ namespace OpenSim.Region.Framework.Scenes
76 m_scene = scene; 67 m_scene = scene;
77 } 68 }
78 69
79 public double GetUpdatePriority(IClientAPI client, ISceneEntity entity) 70 /// <summary>
71 /// Returns the priority queue into which the update should be placed. Updates within a
72 /// queue will be processed in arrival order. There are currently 12 priority queues
73 /// implemented in PriorityQueue class in LLClientView. Queue 0 is generally retained
74 /// for avatar updates. The fair queuing discipline for processing the priority queues
75 /// assumes that the number of entities in each priority queues increases exponentially.
76 /// So for example... if queue 1 contains all updates within 10m of the avatar or camera
77 /// then queue 2 at 20m is about 3X bigger in space & about 3X bigger in total number
78 /// of updates.
79 /// </summary>
80 public uint GetUpdatePriority(IClientAPI client, ISceneEntity entity)
80 { 81 {
81 double priority = 0; 82 // If entity is null we have a serious problem
82
83 if (entity == null) 83 if (entity == null)
84 return 100000; 84 {
85 m_log.WarnFormat("[PRIORITIZER] attempt to prioritize null entity");
86 throw new InvalidOperationException("Prioritization entity not defined");
87 }
88
89 // If this is an update for our own avatar give it the highest priority
90 if (client.AgentId == entity.UUID)
91 return 0;
92
93 uint priority;
85 94
86 switch (m_scene.UpdatePrioritizationScheme) 95 switch (m_scene.UpdatePrioritizationScheme)
87 { 96 {
88 case UpdatePrioritizationSchemes.Time: 97 case UpdatePrioritizationSchemes.Time:
89 priority = GetPriorityByTime(); 98 priority = GetPriorityByTime(client, entity);
90 break; 99 break;
91 case UpdatePrioritizationSchemes.Distance: 100 case UpdatePrioritizationSchemes.Distance:
92 priority = GetPriorityByDistance(client, entity); 101 priority = GetPriorityByDistance(client, entity);
@@ -104,180 +113,111 @@ namespace OpenSim.Region.Framework.Scenes
104 throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); 113 throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
105 } 114 }
106 115
107 // Adjust priority so that root prims are sent to the viewer first. This is especially important for
108 // attachments acting as huds, since current viewers fail to display hud child prims if their updates
109 // arrive before the root one.
110 if (entity is SceneObjectPart)
111 {
112 SceneObjectPart sop = ((SceneObjectPart)entity);
113
114 if (sop.IsRoot)
115 {
116 if (priority >= double.MinValue + m_childPrimAdjustmentFactor)
117 priority -= m_childPrimAdjustmentFactor;
118 }
119 else
120 {
121 if (priority <= double.MaxValue - m_childPrimAdjustmentFactor)
122 priority += m_childPrimAdjustmentFactor;
123 }
124 }
125
126 return priority; 116 return priority;
127 } 117 }
128 118
129 private double GetPriorityByTime() 119
120 private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity)
130 { 121 {
131 return DateTime.UtcNow.ToOADate(); 122 return 1;
132 } 123 }
133 124
134 private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity) 125 private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
135 { 126 {
136 ScenePresence presence = m_scene.GetScenePresence(client.AgentId); 127 return ComputeDistancePriority(client,entity,false);
137 if (presence != null) 128 }
138 { 129
139 // If this is an update for our own avatar give it the highest priority 130 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
140 if (presence == entity) 131 {
141 return 0.0; 132 return ComputeDistancePriority(client,entity,true);
142
143 // Use the camera position for local agents and avatar position for remote agents
144 Vector3 presencePos = (presence.IsChildAgent) ?
145 presence.AbsolutePosition :
146 presence.CameraPosition;
147
148 // Use group position for child prims
149 Vector3 entityPos;
150 if (entity is SceneObjectPart)
151 {
152 // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
153 // before its scheduled update was triggered
154 //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
155 entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
156 }
157 else
158 {
159 entityPos = entity.AbsolutePosition;
160 }
161
162 return Vector3.DistanceSquared(presencePos, entityPos);
163 }
164
165 return double.NaN;
166 } 133 }
167 134
168 private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) 135 private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity)
169 { 136 {
137 uint pqueue = ComputeDistancePriority(client,entity,true);
138
170 ScenePresence presence = m_scene.GetScenePresence(client.AgentId); 139 ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
171 if (presence != null) 140 if (presence != null)
172 { 141 {
173 // If this is an update for our own avatar give it the highest priority
174 if (presence == entity)
175 return 0.0;
176
177 // Use group position for child prims
178 Vector3 entityPos = entity.AbsolutePosition;
179 if (entity is SceneObjectPart)
180 {
181 // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
182 // before its scheduled update was triggered
183 //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
184 entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
185 }
186 else
187 {
188 entityPos = entity.AbsolutePosition;
189 }
190
191 if (!presence.IsChildAgent) 142 if (!presence.IsChildAgent)
192 { 143 {
193 // Root agent. Use distance from camera and a priority decrease for objects behind us 144 if (entity is SceneObjectPart)
194 Vector3 camPosition = presence.CameraPosition; 145 {
195 Vector3 camAtAxis = presence.CameraAtAxis; 146 // Non physical prims are lower priority than physical prims
196 147 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
197 // Distance 148 if (physActor == null || !physActor.IsPhysical)
198 double priority = Vector3.DistanceSquared(camPosition, entityPos); 149 pqueue++;
199
200 // Plane equation
201 float d = -Vector3.Dot(camPosition, camAtAxis);
202 float p = Vector3.Dot(camAtAxis, entityPos) + d;
203 if (p < 0.0f) priority *= 2.0;
204
205 return priority;
206 }
207 else
208 {
209 // Child agent. Use the normal distance method
210 Vector3 presencePos = presence.AbsolutePosition;
211 150
212 return Vector3.DistanceSquared(presencePos, entityPos); 151 // Attachments are high priority,
152 // MIC: shouldn't these already be in the highest priority queue already
153 // since their root position is same as the avatars?
154 if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
155 pqueue = 1;
156 }
213 } 157 }
214 } 158 }
215 159
216 return double.NaN; 160 return pqueue;
217 } 161 }
218 162
219 private double GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) 163 private uint ComputeDistancePriority(IClientAPI client, ISceneEntity entity, bool useFrontBack)
220 { 164 {
221 // If this is an update for our own avatar give it the highest priority 165 // Get this agent's position
222 if (client.AgentId == entity.UUID) 166 ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
223 return 0.0; 167 if (presence == null)
224 if (entity == null) 168 {
225 return double.NaN; 169 m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId);
226 170 // throw new InvalidOperationException("Prioritization agent not defined");
227 // Use group position for child prims 171 return Int32.MaxValue;
172 }
173
174 // Use group position for child prims, since we are putting child prims in
175 // the same queue with the root of the group, the root prim (which goes into
176 // the queue first) should always be sent first, no need to adjust child prim
177 // priorities
228 Vector3 entityPos = entity.AbsolutePosition; 178 Vector3 entityPos = entity.AbsolutePosition;
229 if (entity is SceneObjectPart) 179 if (entity is SceneObjectPart)
230 { 180 {
231 SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; 181 SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
232 if (group != null) 182 if (group != null)
233 entityPos = group.AbsolutePosition; 183 entityPos = group.AbsolutePosition;
234 else
235 entityPos = entity.AbsolutePosition;
236 } 184 }
237 else
238 entityPos = entity.AbsolutePosition;
239 185
240 ScenePresence presence = m_scene.GetScenePresence(client.AgentId); 186 // Use the camera position for local agents and avatar position for remote agents
241 if (presence != null) 187 Vector3 presencePos = (presence.IsChildAgent) ?
242 { 188 presence.AbsolutePosition :
243 if (!presence.IsChildAgent) 189 presence.CameraPosition;
244 {
245 if (entity is ScenePresence)
246 return 1.0;
247
248 // Root agent. Use distance from camera and a priority decrease for objects behind us
249 Vector3 camPosition = presence.CameraPosition;
250 Vector3 camAtAxis = presence.CameraAtAxis;
251 190
252 // Distance 191 // Compute the distance...
253 double priority = Vector3.DistanceSquared(camPosition, entityPos); 192 double distance = Vector3.Distance(presencePos, entityPos);
254 193
255 // Plane equation 194 // And convert the distance to a priority queue, this computation gives queues
256 float d = -Vector3.Dot(camPosition, camAtAxis); 195 // at 10, 20, 40, 80, 160, 320, 640, and 1280m
257 float p = Vector3.Dot(camAtAxis, entityPos) + d; 196 uint pqueue = 1;
258 if (p < 0.0f) priority *= 2.0; 197 for (int i = 0; i < 8; i++)
259 198 {
260 if (entity is SceneObjectPart) 199 if (distance < 10 * Math.Pow(2.0,i))
261 { 200 break;
262 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; 201 pqueue++;
263 if (physActor == null || !physActor.IsPhysical) 202 }
264 priority += 100; 203
265 204 // If this is a root agent, then determine front & back
266 if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) 205 // Bump up the priority queue (drop the priority) for any objects behind the avatar
267 priority = 1.0; 206 if (useFrontBack && ! presence.IsChildAgent)
268 } 207 {
269 return priority; 208 // Root agent, decrease priority for objects behind us
270 } 209 Vector3 camPosition = presence.CameraPosition;
271 else 210 Vector3 camAtAxis = presence.CameraAtAxis;
272 { 211
273 // Child agent. Use the normal distance method 212 // Plane equation
274 Vector3 presencePos = presence.AbsolutePosition; 213 float d = -Vector3.Dot(camPosition, camAtAxis);
275 214 float p = Vector3.Dot(camAtAxis, entityPos) + d;
276 return Vector3.DistanceSquared(presencePos, entityPos); 215 if (p < 0.0f)
277 } 216 pqueue++;
278 } 217 }
279 218
280 return double.NaN; 219 return pqueue;
281 } 220 }
221
282 } 222 }
283} 223}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index fcbcf59..0f85925 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1955,11 +1955,49 @@ namespace OpenSim.Region.Framework.Scenes
1955 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 1955 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
1956 bool RezSelected, bool RemoveItem, UUID fromTaskID) 1956 bool RezSelected, bool RemoveItem, UUID fromTaskID)
1957 { 1957 {
1958 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 1958// m_log.DebugFormat(
1959 if (invAccess != null) 1959// "[PRIM INVENTORY]: RezObject from {0} for item {1} from task id {2}",
1960 invAccess.RezObject( 1960// remoteClient.Name, itemID, fromTaskID);
1961 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 1961
1962 RezSelected, RemoveItem, fromTaskID, false); 1962 if (fromTaskID == UUID.Zero)
1963 {
1964 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
1965 if (invAccess != null)
1966 invAccess.RezObject(
1967 remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
1968 RezSelected, RemoveItem, fromTaskID, false);
1969 }
1970 else
1971 {
1972 SceneObjectPart part = GetSceneObjectPart(fromTaskID);
1973 if (part == null)
1974 {
1975 m_log.ErrorFormat(
1976 "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such scene object",
1977 remoteClient.Name, itemID, fromTaskID);
1978
1979 return;
1980 }
1981
1982 TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
1983 if (item == null)
1984 {
1985 m_log.ErrorFormat(
1986 "[TASK INVENTORY]: {0} tried to rez item id {1} from object id {2} but there is no such item",
1987 remoteClient.Name, itemID, fromTaskID);
1988
1989 return;
1990 }
1991
1992 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
1993 Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
1994 Vector3 pos
1995 = GetNewRezLocation(
1996 RayStart, RayEnd, RayTargetID, Quaternion.Identity,
1997 BypassRayCast, bRayEndIsIntersection, true, scale, false);
1998
1999 RezObject(part, item, pos, null, Vector3.Zero, 0);
2000 }
1963 } 2001 }
1964 2002
1965 /// <summary> 2003 /// <summary>
@@ -1967,14 +2005,14 @@ namespace OpenSim.Region.Framework.Scenes
1967 /// </summary> 2005 /// </summary>
1968 /// <param name="sourcePart"></param> 2006 /// <param name="sourcePart"></param>
1969 /// <param name="item"></param> 2007 /// <param name="item"></param>
1970 /// <param name="pos"></param> 2008 /// <param name="pos">The position of the rezzed object.</param>
1971 /// <param name="rot"></param> 2009 /// <param name="rot">The rotation of the rezzed object. If null, then the rotation stored with the object
1972 /// <param name="vel"></param> 2010 /// will be used if it exists.</param>
2011 /// <param name="vel">The velocity of the rezzed object.</param>
1973 /// <param name="param"></param> 2012 /// <param name="param"></param>
1974 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns> 2013 /// <returns>The SceneObjectGroup rezzed or null if rez was unsuccessful</returns>
1975 public virtual SceneObjectGroup RezObject( 2014 public virtual SceneObjectGroup RezObject(
1976 SceneObjectPart sourcePart, TaskInventoryItem item, 2015 SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param)
1977 Vector3 pos, Quaternion rot, Vector3 vel, int param)
1978 { 2016 {
1979 if (null == item) 2017 if (null == item)
1980 return null; 2018 return null;
@@ -1992,8 +2030,14 @@ namespace OpenSim.Region.Framework.Scenes
1992 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 2030 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1993 sourcePart.Inventory.RemoveInventoryItem(item.ItemID); 2031 sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
1994 } 2032 }
1995 2033
1996 AddNewSceneObject(group, true, pos, rot, vel); 2034 AddNewSceneObject(group, true);
2035
2036 group.AbsolutePosition = pos;
2037 group.Velocity = vel;
2038
2039 if (rot != null)
2040 group.UpdateGroupRotationR((Quaternion)rot);
1997 2041
1998 // We can only call this after adding the scene object, since the scene object references the scene 2042 // We can only call this after adding the scene object, since the scene object references the scene
1999 // to find out if scripts should be activated at all. 2043 // to find out if scripts should be activated at all.
@@ -2069,7 +2113,10 @@ namespace OpenSim.Region.Framework.Scenes
2069 SceneObjectPart[] partList = sog.Parts; 2113 SceneObjectPart[] partList = sog.Parts;
2070 2114
2071 foreach (SceneObjectPart child in partList) 2115 foreach (SceneObjectPart child in partList)
2116 {
2072 child.Inventory.ChangeInventoryOwner(ownerID); 2117 child.Inventory.ChangeInventoryOwner(ownerID);
2118 child.TriggerScriptChangedEvent(Changed.OWNER);
2119 }
2073 } 2120 }
2074 else 2121 else
2075 { 2122 {
@@ -2085,6 +2132,7 @@ namespace OpenSim.Region.Framework.Scenes
2085 { 2132 {
2086 child.LastOwnerID = child.OwnerID; 2133 child.LastOwnerID = child.OwnerID;
2087 child.Inventory.ChangeInventoryOwner(groupID); 2134 child.Inventory.ChangeInventoryOwner(groupID);
2135 child.TriggerScriptChangedEvent(Changed.OWNER);
2088 } 2136 }
2089 2137
2090 sog.SetOwnerId(groupID); 2138 sog.SetOwnerId(groupID);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1a6a70b..f0acc38 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -563,7 +563,6 @@ namespace OpenSim.Region.Framework.Scenes
563 m_regInfo = regInfo; 563 m_regInfo = regInfo;
564 m_regionHandle = m_regInfo.RegionHandle; 564 m_regionHandle = m_regInfo.RegionHandle;
565 m_regionName = m_regInfo.RegionName; 565 m_regionName = m_regInfo.RegionName;
566 m_datastore = m_regInfo.DataStore;
567 m_lastUpdate = Util.EnvironmentTickCount(); 566 m_lastUpdate = Util.EnvironmentTickCount();
568 567
569 m_physicalPrim = physicalPrim; 568 m_physicalPrim = physicalPrim;
@@ -1109,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes
1109 // 1108 //
1110 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) 1109 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
1111 { 1110 {
1112 MainConsole.Instance.Output("The current estate has no owner set."); 1111 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName);
1113 List<char> excluded = new List<char>(new char[1]{' '}); 1112 List<char> excluded = new List<char>(new char[1]{' '});
1114 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); 1113 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
1115 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); 1114 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
@@ -1429,20 +1428,6 @@ namespace OpenSim.Region.Framework.Scenes
1429 } 1428 }
1430 1429
1431 /// <summary> 1430 /// <summary>
1432 /// Recount SceneObjectPart in parcel aabb
1433 /// </summary>
1434 private void UpdateLand()
1435 {
1436 if (LandChannel != null)
1437 {
1438 if (LandChannel.IsLandPrimCountTainted())
1439 {
1440 EventManager.TriggerParcelPrimCountUpdate();
1441 }
1442 }
1443 }
1444
1445 /// <summary>
1446 /// Update the terrain if it needs to be updated. 1431 /// Update the terrain if it needs to be updated.
1447 /// </summary> 1432 /// </summary>
1448 private void UpdateTerrain() 1433 private void UpdateTerrain()
@@ -1536,8 +1521,11 @@ namespace OpenSim.Region.Framework.Scenes
1536 } 1521 }
1537 1522
1538 /// <summary> 1523 /// <summary>
1539 /// Return object to avatar Message 1524 /// Tell an agent that their object has been returned.
1540 /// </summary> 1525 /// </summary>
1526 /// <remarks>
1527 /// The actual return is handled by the caller.
1528 /// </remarks>
1541 /// <param name="agentID">Avatar Unique Id</param> 1529 /// <param name="agentID">Avatar Unique Id</param>
1542 /// <param name="objectName">Name of object returned</param> 1530 /// <param name="objectName">Name of object returned</param>
1543 /// <param name="location">Location of object returned</param> 1531 /// <param name="location">Location of object returned</param>
@@ -1956,8 +1944,14 @@ namespace OpenSim.Region.Framework.Scenes
1956 /// If false, it is left to the caller to schedule the update 1944 /// If false, it is left to the caller to schedule the update
1957 /// </param> 1945 /// </param>
1958 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 1946 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
1959 { 1947 {
1960 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); 1948 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
1949 {
1950 EventManager.TriggerObjectAddedToScene(sceneObject);
1951 return true;
1952 }
1953
1954 return false;
1961 } 1955 }
1962 1956
1963 /// <summary> 1957 /// <summary>
@@ -1974,7 +1968,13 @@ namespace OpenSim.Region.Framework.Scenes
1974 public bool AddNewSceneObject( 1968 public bool AddNewSceneObject(
1975 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) 1969 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
1976 { 1970 {
1977 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); 1971 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
1972 {
1973 EventManager.TriggerObjectAddedToScene(sceneObject);
1974 return true;
1975 }
1976
1977 return false;
1978 } 1978 }
1979 1979
1980 /// <summary> 1980 /// <summary>
@@ -4854,8 +4854,17 @@ namespace OpenSim.Region.Framework.Scenes
4854 { 4854 {
4855 float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; 4855 float ominX, ominY, ominZ, omaxX, omaxY, omaxZ;
4856 4856
4857 Vector3 vec = g.AbsolutePosition;
4858
4857 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); 4859 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
4858 4860
4861 ominX += vec.X;
4862 omaxX += vec.X;
4863 ominY += vec.Y;
4864 omaxY += vec.Y;
4865 ominZ += vec.Z;
4866 omaxZ += vec.Z;
4867
4859 if (minX > ominX) 4868 if (minX > ominX)
4860 minX = ominX; 4869 minX = ominX;
4861 if (minY > ominY) 4870 if (minY > ominY)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index f343bc8..c4547f2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -136,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes
136 get { return m_permissions; } 136 get { return m_permissions; }
137 } 137 }
138 138
139 protected string m_datastore;
140
141 /* Used by the loadbalancer plugin on GForge */ 139 /* Used by the loadbalancer plugin on GForge */
142 protected RegionStatus m_regStatus; 140 protected RegionStatus m_regStatus;
143 public RegionStatus RegionStatus 141 public RegionStatus RegionStatus
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 734ba22..97af0a0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -88,9 +88,21 @@ namespace OpenSim.Region.Framework.Scenes
88 protected internal object m_syncRoot = new object(); 88 protected internal object m_syncRoot = new object();
89 89
90 protected internal PhysicsScene _PhyScene; 90 protected internal PhysicsScene _PhyScene;
91 91
92 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); 92 /// <summary>
93 /// Index the SceneObjectGroup for each part by the root part's UUID.
94 /// </summary>
93 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); 95 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
96
97 /// <summary>
98 /// Index the SceneObjectGroup for each part by that part's UUID.
99 /// </summary>
100 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullPartID = new Dictionary<UUID, SceneObjectGroup>();
101
102 /// <summary>
103 /// Index the SceneObjectGroup for each part by that part's local ID.
104 /// </summary>
105 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
94 106
95 private Object m_updateLock = new Object(); 107 private Object m_updateLock = new Object();
96 108
@@ -133,8 +145,10 @@ namespace OpenSim.Region.Framework.Scenes
133 145
134 lock (SceneObjectGroupsByFullID) 146 lock (SceneObjectGroupsByFullID)
135 SceneObjectGroupsByFullID.Clear(); 147 SceneObjectGroupsByFullID.Clear();
136 lock (SceneObjectGroupsByLocalID) 148 lock (SceneObjectGroupsByFullPartID)
137 SceneObjectGroupsByLocalID.Clear(); 149 SceneObjectGroupsByFullPartID.Clear();
150 lock (SceneObjectGroupsByLocalPartID)
151 SceneObjectGroupsByLocalPartID.Clear();
138 152
139 Entities.Clear(); 153 Entities.Clear();
140 } 154 }
@@ -349,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes
349 363
350 if (Entities.ContainsKey(sceneObject.UUID)) 364 if (Entities.ContainsKey(sceneObject.UUID))
351 return false; 365 return false;
366
367// m_log.DebugFormat(
368// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
369// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
352 370
353 SceneObjectPart[] children = sceneObject.Parts; 371 SceneObjectPart[] children = sceneObject.Parts;
354 372
@@ -385,17 +403,20 @@ namespace OpenSim.Region.Framework.Scenes
385 OnObjectCreate(sceneObject); 403 OnObjectCreate(sceneObject);
386 404
387 lock (SceneObjectGroupsByFullID) 405 lock (SceneObjectGroupsByFullID)
388 {
389 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 406 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
407
408 lock (SceneObjectGroupsByFullPartID)
409 {
410 SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
390 foreach (SceneObjectPart part in children) 411 foreach (SceneObjectPart part in children)
391 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 412 SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
392 } 413 }
393 414
394 lock (SceneObjectGroupsByLocalID) 415 lock (SceneObjectGroupsByLocalPartID)
395 { 416 {
396 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 417 SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
397 foreach (SceneObjectPart part in children) 418 foreach (SceneObjectPart part in children)
398 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 419 SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
399 } 420 }
400 421
401 return true; 422 return true;
@@ -426,21 +447,24 @@ namespace OpenSim.Region.Framework.Scenes
426 447
427 if (OnObjectRemove != null) 448 if (OnObjectRemove != null)
428 OnObjectRemove(Entities[uuid]); 449 OnObjectRemove(Entities[uuid]);
429 450
430 lock (SceneObjectGroupsByFullID) 451 lock (SceneObjectGroupsByFullID)
452 SceneObjectGroupsByFullID.Remove(grp.UUID);
453
454 lock (SceneObjectGroupsByFullPartID)
431 { 455 {
432 SceneObjectPart[] parts = grp.Parts; 456 SceneObjectPart[] parts = grp.Parts;
433 for (int i = 0; i < parts.Length; i++) 457 for (int i = 0; i < parts.Length; i++)
434 SceneObjectGroupsByFullID.Remove(parts[i].UUID); 458 SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
435 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); 459 SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
436 } 460 }
437 461
438 lock (SceneObjectGroupsByLocalID) 462 lock (SceneObjectGroupsByLocalPartID)
439 { 463 {
440 SceneObjectPart[] parts = grp.Parts; 464 SceneObjectPart[] parts = grp.Parts;
441 for (int i = 0; i < parts.Length; i++) 465 for (int i = 0; i < parts.Length; i++)
442 SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); 466 SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
443 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); 467 SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
444 } 468 }
445 469
446 return Entities.Remove(uuid); 470 return Entities.Remove(uuid);
@@ -627,7 +651,7 @@ namespace OpenSim.Region.Framework.Scenes
627 if (!Entities.Remove(agentID)) 651 if (!Entities.Remove(agentID))
628 { 652 {
629 m_log.WarnFormat( 653 m_log.WarnFormat(
630 "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", 654 "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
631 agentID); 655 agentID);
632 } 656 }
633 657
@@ -650,7 +674,7 @@ namespace OpenSim.Region.Framework.Scenes
650 } 674 }
651 else 675 else
652 { 676 {
653 m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); 677 m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
654 } 678 }
655 } 679 }
656 } 680 }
@@ -854,14 +878,14 @@ namespace OpenSim.Region.Framework.Scenes
854 878
855 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); 879 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
856 SceneObjectGroup sog; 880 SceneObjectGroup sog;
857 lock (SceneObjectGroupsByLocalID) 881 lock (SceneObjectGroupsByLocalPartID)
858 SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); 882 SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
859 883
860 if (sog != null) 884 if (sog != null)
861 { 885 {
862 if (sog.HasChildPrim(localID)) 886 if (sog.HasChildPrim(localID))
863 return sog; 887 return sog;
864 SceneObjectGroupsByLocalID.Remove(localID); 888 SceneObjectGroupsByLocalPartID.Remove(localID);
865 } 889 }
866 890
867 EntityBase[] entityList = GetEntities(); 891 EntityBase[] entityList = GetEntities();
@@ -873,8 +897,8 @@ namespace OpenSim.Region.Framework.Scenes
873 sog = (SceneObjectGroup)ent; 897 sog = (SceneObjectGroup)ent;
874 if (sog.HasChildPrim(localID)) 898 if (sog.HasChildPrim(localID))
875 { 899 {
876 lock (SceneObjectGroupsByLocalID) 900 lock (SceneObjectGroupsByLocalPartID)
877 SceneObjectGroupsByLocalID[localID] = sog; 901 SceneObjectGroupsByLocalPartID[localID] = sog;
878 return sog; 902 return sog;
879 } 903 }
880 } 904 }
@@ -891,16 +915,16 @@ namespace OpenSim.Region.Framework.Scenes
891 private SceneObjectGroup GetGroupByPrim(UUID fullID) 915 private SceneObjectGroup GetGroupByPrim(UUID fullID)
892 { 916 {
893 SceneObjectGroup sog; 917 SceneObjectGroup sog;
894 lock (SceneObjectGroupsByFullID) 918 lock (SceneObjectGroupsByFullPartID)
895 SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); 919 SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog);
896 920
897 if (sog != null) 921 if (sog != null)
898 { 922 {
899 if (sog.ContainsPart(fullID)) 923 if (sog.ContainsPart(fullID))
900 return sog; 924 return sog;
901 925
902 lock (SceneObjectGroupsByFullID) 926 lock (SceneObjectGroupsByFullPartID)
903 SceneObjectGroupsByFullID.Remove(fullID); 927 SceneObjectGroupsByFullPartID.Remove(fullID);
904 } 928 }
905 929
906 EntityBase[] entityList = GetEntities(); 930 EntityBase[] entityList = GetEntities();
@@ -911,8 +935,8 @@ namespace OpenSim.Region.Framework.Scenes
911 sog = (SceneObjectGroup)ent; 935 sog = (SceneObjectGroup)ent;
912 if (sog.HasChildPrim(fullID)) 936 if (sog.HasChildPrim(fullID))
913 { 937 {
914 lock (SceneObjectGroupsByFullID) 938 lock (SceneObjectGroupsByFullPartID)
915 SceneObjectGroupsByFullID[fullID] = sog; 939 SceneObjectGroupsByFullPartID[fullID] = sog;
916 return sog; 940 return sog;
917 } 941 }
918 } 942 }
@@ -1064,11 +1088,12 @@ namespace OpenSim.Region.Framework.Scenes
1064 } 1088 }
1065 1089
1066 /// <summary> 1090 /// <summary>
1067 /// Performs action on all scene object groups. 1091 /// Performs action once on all scene object groups.
1068 /// </summary> 1092 /// </summary>
1069 /// <param name="action"></param> 1093 /// <param name="action"></param>
1070 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1094 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1071 { 1095 {
1096 // FIXME: Need to lock here, really.
1072 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); 1097 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1073 foreach (SceneObjectGroup obj in objlist) 1098 foreach (SceneObjectGroup obj in objlist)
1074 { 1099 {
@@ -1079,11 +1104,11 @@ namespace OpenSim.Region.Framework.Scenes
1079 catch (Exception e) 1104 catch (Exception e)
1080 { 1105 {
1081 // Catch it and move on. This includes situations where splist has inconsistent info 1106 // Catch it and move on. This includes situations where splist has inconsistent info
1082 m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString()); 1107 m_log.WarnFormat(
1108 "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace);
1083 } 1109 }
1084 } 1110 }
1085 } 1111 }
1086
1087 1112
1088 /// <summary> 1113 /// <summary>
1089 /// Performs action on all scene presences. This can ultimately run the actions in parallel but 1114 /// Performs action on all scene presences. This can ultimately run the actions in parallel but
@@ -1103,8 +1128,8 @@ namespace OpenSim.Region.Framework.Scenes
1103 } 1128 }
1104 catch (Exception e) 1129 catch (Exception e)
1105 { 1130 {
1106 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); 1131 m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1107 m_log.Info("[BUG] Stack Trace: " + e.StackTrace); 1132 m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace);
1108 } 1133 }
1109 }); 1134 });
1110 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction); 1135 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction);
@@ -1119,7 +1144,7 @@ namespace OpenSim.Region.Framework.Scenes
1119 } 1144 }
1120 catch (Exception e) 1145 catch (Exception e)
1121 { 1146 {
1122 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); 1147 m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1123 } 1148 }
1124 } 1149 }
1125 } 1150 }
@@ -1777,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes
1777 /// <param name="rot"></param> 1802 /// <param name="rot"></param>
1778 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) 1803 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
1779 { 1804 {
1780 //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); 1805// m_log.DebugFormat(
1806// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
1807// originalPrimID, offset, AgentID);
1808
1781 SceneObjectGroup original = GetGroupByPrim(originalPrimID); 1809 SceneObjectGroup original = GetGroupByPrim(originalPrimID);
1782 if (original != null) 1810 if (original != null)
1783 { 1811 {
@@ -1808,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes
1808 copy.RootPart.SalePrice = 10; 1836 copy.RootPart.SalePrice = 10;
1809 } 1837 }
1810 1838
1839 // FIXME: This section needs to be refactored so that it just calls AddSceneObject()
1811 Entities.Add(copy); 1840 Entities.Add(copy);
1841
1842 lock (SceneObjectGroupsByFullID)
1843 SceneObjectGroupsByFullID[copy.UUID] = copy;
1844
1845 SceneObjectPart[] children = copy.Parts;
1846
1847 lock (SceneObjectGroupsByFullPartID)
1848 {
1849 SceneObjectGroupsByFullPartID[copy.UUID] = copy;
1850 foreach (SceneObjectPart part in children)
1851 SceneObjectGroupsByFullPartID[part.UUID] = copy;
1852 }
1853
1854 lock (SceneObjectGroupsByLocalPartID)
1855 {
1856 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
1857 foreach (SceneObjectPart part in children)
1858 SceneObjectGroupsByLocalPartID[part.LocalId] = copy;
1859 }
1860 // PROBABLE END OF FIXME
1812 1861
1813 // Since we copy from a source group that is in selected 1862 // Since we copy from a source group that is in selected
1814 // state, but the copy is shown deselected in the viewer, 1863 // state, but the copy is shown deselected in the viewer,
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f17fb28..ca7d9d9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -325,6 +325,8 @@ namespace OpenSim.Region.Framework.Scenes
325 //m_rootPart.GroupPosition.Z); 325 //m_rootPart.GroupPosition.Z);
326 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 326 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
327 //} 327 //}
328
329 m_scene.EventManager.TriggerParcelPrimCountTainted();
328 } 330 }
329 } 331 }
330 332
@@ -1313,8 +1315,10 @@ namespace OpenSim.Region.Framework.Scenes
1313 parcel.LandData.OtherCleanTime) 1315 parcel.LandData.OtherCleanTime)
1314 { 1316 {
1315 DetachFromBackup(); 1317 DetachFromBackup();
1316 m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); 1318 m_log.DebugFormat(
1317 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); 1319 "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn",
1320 RootPart.UUID);
1321 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn");
1318 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, 1322 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
1319 DeRezAction.Return, UUID.Zero); 1323 DeRezAction.Return, UUID.Zero);
1320 1324
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index fa404c0..3281eab 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -175,12 +175,12 @@ namespace OpenSim.Region.Framework.Scenes
175 foreach (TaskInventoryItem item in items) 175 foreach (TaskInventoryItem item in items)
176 { 176 {
177 if (ownerId != item.OwnerID) 177 if (ownerId != item.OwnerID)
178 {
179 item.LastOwnerID = item.OwnerID; 178 item.LastOwnerID = item.OwnerID;
180 item.OwnerID = ownerId; 179
181 item.PermsMask = 0; 180 item.OwnerID = ownerId;
182 item.PermsGranter = UUID.Zero; 181 item.PermsMask = 0;
183 } 182 item.PermsGranter = UUID.Zero;
183 item.OwnerChanged = true;
184 } 184 }
185 } 185 }
186 186