aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs209
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs91
7 files changed, 154 insertions, 234 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 547e693..209a0a6 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -1588,6 +1588,12 @@ namespace OpenSim.Region.Framework.Scenes
1588 1588
1589 public void TriggerRequestChangeWaterHeight(float height) 1589 public void TriggerRequestChangeWaterHeight(float height)
1590 { 1590 {
1591 if (height < 0)
1592 {
1593 // ignore negative water height
1594 return;
1595 }
1596
1591 RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; 1597 RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
1592 if (handlerRequestChangeWaterHeight != null) 1598 if (handlerRequestChangeWaterHeight != null)
1593 { 1599 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 59170df..fd179ba 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -116,18 +116,10 @@ namespace OpenSim.Region.Framework.Scenes
116 /// <param name="remoteClient"></param> 116 /// <param name="remoteClient"></param>
117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient) 117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
118 { 118 {
119 EntityBase[] entityList = GetEntities(); 119 SceneObjectGroup sog = GetGroupByPrim(primLocalID);
120 foreach (EntityBase ent in entityList) 120
121 { 121 if (sog != null)
122 if (ent is SceneObjectGroup) 122 sog.SendFullUpdateToClient(remoteClient);
123 {
124 if (((SceneObjectGroup)ent).LocalId == primLocalID)
125 {
126 ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
127 return;
128 }
129 }
130 }
131 } 123 }
132 124
133 /// <summary> 125 /// <summary>
@@ -137,47 +129,28 @@ namespace OpenSim.Region.Framework.Scenes
137 /// <param name="remoteClient"></param> 129 /// <param name="remoteClient"></param>
138 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 130 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
139 { 131 {
140 EntityBase[] entityList = GetEntities(); 132 SceneObjectPart part = GetSceneObjectPart(primLocalID);
141 foreach (EntityBase ent in entityList) 133
134 if (null == part)
135 return;
136
137 if (part.IsRoot)
142 { 138 {
143 if (ent is SceneObjectGroup) 139 SceneObjectGroup sog = part.ParentGroup;
140 sog.SendPropertiesToClient(remoteClient);
141 sog.IsSelected = true;
142
143 // A prim is only tainted if it's allowed to be edited by the person clicking it.
144 if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
145 || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
144 { 146 {
145 if (((SceneObjectGroup) ent).LocalId == primLocalID) 147 EventManager.TriggerParcelPrimCountTainted();
146 {
147 ((SceneObjectGroup) ent).SendPropertiesToClient(remoteClient);
148 ((SceneObjectGroup) ent).IsSelected = true;
149 // A prim is only tainted if it's allowed to be edited by the person clicking it.
150 if (Permissions.CanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)
151 || Permissions.CanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId))
152 {
153 EventManager.TriggerParcelPrimCountTainted();
154 }
155 break;
156 }
157 else
158 {
159 // We also need to check the children of this prim as they
160 // can be selected as well and send property information
161 bool foundPrim = false;
162
163 SceneObjectGroup sog = ent as SceneObjectGroup;
164
165 SceneObjectPart[] partList = sog.Parts;
166 foreach (SceneObjectPart part in partList)
167 {
168 if (part.LocalId == primLocalID)
169 {
170 part.SendPropertiesToClient(remoteClient);
171 foundPrim = true;
172 break;
173 }
174 }
175
176 if (foundPrim)
177 break;
178 }
179 } 148 }
180 } 149 }
150 else
151 {
152 part.SendPropertiesToClient(remoteClient);
153 }
181 } 154 }
182 155
183 /// <summary> 156 /// <summary>
@@ -250,121 +223,81 @@ namespace OpenSim.Region.Framework.Scenes
250 223
251 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 224 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
252 { 225 {
253 EntityBase[] EntityList = GetEntities(); 226 SceneObjectPart part = GetSceneObjectPart(localID);
227
228 if (part == null)
229 return;
230
231 SceneObjectGroup obj = part.ParentGroup;
254 232
255 SurfaceTouchEventArgs surfaceArg = null; 233 SurfaceTouchEventArgs surfaceArg = null;
256 if (surfaceArgs != null && surfaceArgs.Count > 0) 234 if (surfaceArgs != null && surfaceArgs.Count > 0)
257 surfaceArg = surfaceArgs[0]; 235 surfaceArg = surfaceArgs[0];
258 236
259 foreach (EntityBase ent in EntityList) 237 // Currently only grab/touch for the single prim
238 // the client handles rez correctly
239 obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
240
241 // If the touched prim handles touches, deliver it
242 // If not, deliver to root prim
243 if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
244 EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
245
246 // Deliver to the root prim if the touched prim doesn't handle touches
247 // or if we're meant to pass on touches anyway. Don't send to root prim
248 // if prim touched is the root prim as we just did it
249 if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
250 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
260 { 251 {
261 if (ent is SceneObjectGroup) 252 EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
262 {
263 SceneObjectGroup obj = ent as SceneObjectGroup;
264 if (obj != null)
265 {
266 // Is this prim part of the group
267 if (obj.HasChildPrim(localID))
268 {
269 // Currently only grab/touch for the single prim
270 // the client handles rez correctly
271 obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
272
273 SceneObjectPart part = obj.GetChildPart(localID);
274
275 // If the touched prim handles touches, deliver it
276 // If not, deliver to root prim
277 if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
278 EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
279 // Deliver to the root prim if the touched prim doesn't handle touches
280 // or if we're meant to pass on touches anyway. Don't send to root prim
281 // if prim touched is the root prim as we just did it
282 if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
283 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
284 {
285 EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
286 }
287
288 return;
289 }
290 }
291 }
292 } 253 }
293 } 254 }
294 255
295 public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 256 public virtual void ProcessObjectGrabUpdate(
257 UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
296 { 258 {
297 EntityBase[] EntityList = GetEntities(); 259 SceneObjectPart part = GetSceneObjectPart(objectID);
260 if (part == null)
261 return;
262
263 SceneObjectGroup obj = part.ParentGroup;
298 264
299 SurfaceTouchEventArgs surfaceArg = null; 265 SurfaceTouchEventArgs surfaceArg = null;
300 if (surfaceArgs != null && surfaceArgs.Count > 0) 266 if (surfaceArgs != null && surfaceArgs.Count > 0)
301 surfaceArg = surfaceArgs[0]; 267 surfaceArg = surfaceArgs[0];
302 268
303 foreach (EntityBase ent in EntityList) 269 // If the touched prim handles touches, deliver it
270 // If not, deliver to root prim
271 if ((part.ScriptEvents & scriptEvents.touch) != 0)
272 EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
273 // Deliver to the root prim if the touched prim doesn't handle touches
274 // or if we're meant to pass on touches anyway. Don't send to root prim
275 // if prim touched is the root prim as we just did it
276 if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
277 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
304 { 278 {
305 if (ent is SceneObjectGroup) 279 EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
306 {
307 SceneObjectGroup obj = ent as SceneObjectGroup;
308 if (obj != null)
309 {
310 // Is this prim part of the group
311 if (obj.HasChildPrim(objectID))
312 {
313 SceneObjectPart part = obj.GetChildPart(objectID);
314
315 // If the touched prim handles touches, deliver it
316 // If not, deliver to root prim
317 if ((part.ScriptEvents & scriptEvents.touch) != 0)
318 EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
319 // Deliver to the root prim if the touched prim doesn't handle touches
320 // or if we're meant to pass on touches anyway. Don't send to root prim
321 // if prim touched is the root prim as we just did it
322 if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
323 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
324 {
325 EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
326 }
327
328 return;
329 }
330 }
331 }
332 } 280 }
333 } 281 }
334 282
335 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 283 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
336 { 284 {
337 EntityBase[] EntityList = GetEntities(); 285 SceneObjectPart part = GetSceneObjectPart(localID);
286 if (part == null)
287 return;
288
289 SceneObjectGroup obj = part.ParentGroup;
338 290
339 SurfaceTouchEventArgs surfaceArg = null; 291 SurfaceTouchEventArgs surfaceArg = null;
340 if (surfaceArgs != null && surfaceArgs.Count > 0) 292 if (surfaceArgs != null && surfaceArgs.Count > 0)
341 surfaceArg = surfaceArgs[0]; 293 surfaceArg = surfaceArgs[0];
342 294
343 foreach (EntityBase ent in EntityList) 295 // If the touched prim handles touches, deliver it
344 { 296 // If not, deliver to root prim
345 if (ent is SceneObjectGroup) 297 if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
346 { 298 EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg);
347 SceneObjectGroup obj = ent as SceneObjectGroup; 299 else
348 300 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
349 // Is this prim part of the group
350 if (obj.HasChildPrim(localID))
351 {
352 SceneObjectPart part=obj.GetChildPart(localID);
353 if (part != null)
354 {
355 // If the touched prim handles touches, deliver it
356 // If not, deliver to root prim
357 if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
358 EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg);
359 else
360 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
361
362 return;
363 }
364 return;
365 }
366 }
367 }
368 } 301 }
369 302
370 public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) 303 public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index bfabcc2..f8487e7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2636,7 +2636,7 @@ namespace OpenSim.Region.Framework.Scenes
2636 if (sp == null) 2636 if (sp == null)
2637 { 2637 {
2638 m_log.DebugFormat( 2638 m_log.DebugFormat(
2639 "[SCENE]: Adding new child scene presence {0} to scene {1}", client.Name, RegionInfo.RegionName); 2639 "[SCENE]: Adding new child scene presence {0} to scene {1} at pos {2}", client.Name, RegionInfo.RegionName, client.StartPos);
2640 2640
2641 m_clientManager.Add(client); 2641 m_clientManager.Add(client);
2642 SubscribeToClientEvents(client); 2642 SubscribeToClientEvents(client);
@@ -2900,7 +2900,6 @@ namespace OpenSim.Region.Framework.Scenes
2900 2900
2901 public virtual void SubscribeToClientParcelEvents(IClientAPI client) 2901 public virtual void SubscribeToClientParcelEvents(IClientAPI client)
2902 { 2902 {
2903 client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate;
2904 client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; 2903 client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel;
2905 client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime; 2904 client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime;
2906 client.OnParcelBuy += ProcessParcelBuy; 2905 client.OnParcelBuy += ProcessParcelBuy;
@@ -3027,7 +3026,6 @@ namespace OpenSim.Region.Framework.Scenes
3027 3026
3028 public virtual void UnSubscribeToClientParcelEvents(IClientAPI client) 3027 public virtual void UnSubscribeToClientParcelEvents(IClientAPI client)
3029 { 3028 {
3030 client.OnObjectGroupRequest -= m_sceneGraph.HandleObjectGroupUpdate;
3031 client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel; 3029 client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel;
3032 client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime; 3030 client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime;
3033 client.OnParcelBuy -= ProcessParcelBuy; 3031 client.OnParcelBuy -= ProcessParcelBuy;
@@ -3386,9 +3384,9 @@ namespace OpenSim.Region.Framework.Scenes
3386 3384
3387 // Don't disable this log message - it's too helpful 3385 // Don't disable this log message - it's too helpful
3388 m_log.DebugFormat( 3386 m_log.DebugFormat(
3389 "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", 3387 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6}, position {7})",
3390 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3388 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3391 agent.AgentID, agent.circuitcode, teleportFlags); 3389 agent.AgentID, agent.circuitcode, teleportFlags, agent.startpos);
3392 3390
3393 if (LoginsDisabled) 3391 if (LoginsDisabled)
3394 { 3392 {
@@ -3434,7 +3432,7 @@ namespace OpenSim.Region.Framework.Scenes
3434 catch (Exception e) 3432 catch (Exception e)
3435 { 3433 {
3436 m_log.ErrorFormat( 3434 m_log.ErrorFormat(
3437 "[CONNECTION BEGIN]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); 3435 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace);
3438 return false; 3436 return false;
3439 } 3437 }
3440 } 3438 }
@@ -3452,12 +3450,12 @@ namespace OpenSim.Region.Framework.Scenes
3452 catch (Exception e) 3450 catch (Exception e)
3453 { 3451 {
3454 m_log.ErrorFormat( 3452 m_log.ErrorFormat(
3455 "[CONNECTION BEGIN]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); 3453 "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace);
3456 return false; 3454 return false;
3457 } 3455 }
3458 3456
3459 m_log.InfoFormat( 3457 m_log.InfoFormat(
3460 "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", 3458 "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})",
3461 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3459 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3462 agent.AgentID, agent.circuitcode); 3460 agent.AgentID, agent.circuitcode);
3463 3461
@@ -4462,7 +4460,7 @@ namespace OpenSim.Region.Framework.Scenes
4462 /// Get a scene object group that contains the prim with the given local id 4460 /// Get a scene object group that contains the prim with the given local id
4463 /// </summary> 4461 /// </summary>
4464 /// <param name="localID"></param> 4462 /// <param name="localID"></param>
4465 /// <returns>null if no scene object group containing that prim is found</returns> 4463 /// <returns>null if no scene object group containing that prim is found</returns>
4466 public SceneObjectGroup GetGroupByPrim(uint localID) 4464 public SceneObjectGroup GetGroupByPrim(uint localID)
4467 { 4465 {
4468 return m_sceneGraph.GetGroupByPrim(localID); 4466 return m_sceneGraph.GetGroupByPrim(localID);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index c16038c..cd825eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -640,20 +640,6 @@ namespace OpenSim.Region.Framework.Scenes
640 } 640 }
641 } 641 }
642 642
643 protected internal void HandleObjectGroupUpdate(
644 IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
645 {
646 if (!remoteClient.IsGroupMember(GroupID))
647 return;
648
649 SceneObjectGroup group = GetGroupByPrim(objectLocalID);
650 if (group != null)
651 {
652 if (group.OwnerID == remoteClient.AgentId)
653 group.SetGroup(GroupID, remoteClient);
654 }
655 }
656
657 protected internal ScenePresence CreateAndAddChildScenePresence( 643 protected internal ScenePresence CreateAndAddChildScenePresence(
658 IClientAPI client, AvatarAppearance appearance, PresenceType type) 644 IClientAPI client, AvatarAppearance appearance, PresenceType type)
659 { 645 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 09cbbfe..948dca2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1724,19 +1724,23 @@ namespace OpenSim.Region.Framework.Scenes
1724 1724
1725 #endregion 1725 #endregion
1726 1726
1727 // Send the parts of this SOG to a single client 1727 /// <summary>
1728 // Used when the client initially connects and when client sends RequestPrim packet 1728 /// Send the parts of this SOG to a single client
1729 /// </summary>
1730 /// <remarks>
1731 /// Used when the client initially connects and when client sends RequestPrim packet
1732 /// </remarks>
1733 /// <param name="remoteClient"></param>
1729 public void SendFullUpdateToClient(IClientAPI remoteClient) 1734 public void SendFullUpdateToClient(IClientAPI remoteClient)
1730 { 1735 {
1731 RootPart.SendFullUpdate( 1736 RootPart.SendFullUpdate(remoteClient);
1732 remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
1733 1737
1734 SceneObjectPart[] parts = m_parts.GetArray(); 1738 SceneObjectPart[] parts = m_parts.GetArray();
1735 for (int i = 0; i < parts.Length; i++) 1739 for (int i = 0; i < parts.Length; i++)
1736 { 1740 {
1737 SceneObjectPart part = parts[i]; 1741 SceneObjectPart part = parts[i];
1738 if (part != RootPart) 1742 if (part != RootPart)
1739 part.SendFullUpdate(remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID)); 1743 part.SendFullUpdate(remoteClient);
1740 } 1744 }
1741 } 1745 }
1742 1746
@@ -2067,10 +2071,11 @@ namespace OpenSim.Region.Framework.Scenes
2067 2071
2068 /// <summary> 2072 /// <summary>
2069 /// Reset the UUIDs for all the prims that make up this group. 2073 /// Reset the UUIDs for all the prims that make up this group.
2070 /// 2074 /// </summary>
2075 /// <remarks>
2071 /// This is called by methods which want to add a new group to an existing scene, in order 2076 /// This is called by methods which want to add a new group to an existing scene, in order
2072 /// to ensure that there are no clashes with groups already present. 2077 /// to ensure that there are no clashes with groups already present.
2073 /// </summary> 2078 /// </remarks>
2074 public void ResetIDs() 2079 public void ResetIDs()
2075 { 2080 {
2076 lock (m_parts.SyncRoot) 2081 lock (m_parts.SyncRoot)
@@ -3636,6 +3641,8 @@ namespace OpenSim.Region.Framework.Scenes
3636 part.Inventory.ChangeInventoryGroup(GroupID); 3641 part.Inventory.ChangeInventoryGroup(GroupID);
3637 } 3642 }
3638 3643
3644 HasGroupChanged = true;
3645
3639 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled 3646 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
3640 // for the same object with very different properties. The caller must schedule the update. 3647 // for the same object with very different properties. The caller must schedule the update.
3641 //ScheduleGroupForFullUpdate(); 3648 //ScheduleGroupForFullUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 666ce2a..fd70bfd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2886,8 +2886,7 @@ namespace OpenSim.Region.Framework.Scenes
2886 /// Send a full update to the client for the given part 2886 /// Send a full update to the client for the given part
2887 /// </summary> 2887 /// </summary>
2888 /// <param name="remoteClient"></param> 2888 /// <param name="remoteClient"></param>
2889 /// <param name="clientFlags"></param> 2889 protected internal void SendFullUpdate(IClientAPI remoteClient)
2890 protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
2891 { 2890 {
2892 if (ParentGroup == null) 2891 if (ParentGroup == null)
2893 return; 2892 return;
@@ -2899,16 +2898,16 @@ namespace OpenSim.Region.Framework.Scenes
2899 { 2898 {
2900 if (ParentGroup.IsAttachment) 2899 if (ParentGroup.IsAttachment)
2901 { 2900 {
2902 SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags); 2901 SendFullUpdateToClient(remoteClient, AttachedPos);
2903 } 2902 }
2904 else 2903 else
2905 { 2904 {
2906 SendFullUpdateToClient(remoteClient, AbsolutePosition, clientFlags); 2905 SendFullUpdateToClient(remoteClient, AbsolutePosition);
2907 } 2906 }
2908 } 2907 }
2909 else 2908 else
2910 { 2909 {
2911 SendFullUpdateToClient(remoteClient, clientFlags); 2910 SendFullUpdateToClient(remoteClient);
2912 } 2911 }
2913 } 2912 }
2914 2913
@@ -2922,7 +2921,7 @@ namespace OpenSim.Region.Framework.Scenes
2922 2921
2923 ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 2922 ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
2924 { 2923 {
2925 SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID)); 2924 SendFullUpdate(avatar.ControllingClient);
2926 }); 2925 });
2927 } 2926 }
2928 2927
@@ -2930,12 +2929,9 @@ namespace OpenSim.Region.Framework.Scenes
2930 /// Sends a full update to the client 2929 /// Sends a full update to the client
2931 /// </summary> 2930 /// </summary>
2932 /// <param name="remoteClient"></param> 2931 /// <param name="remoteClient"></param>
2933 /// <param name="clientFlags"></param> 2932 public void SendFullUpdateToClient(IClientAPI remoteClient)
2934 public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags)
2935 { 2933 {
2936 Vector3 lPos; 2934 SendFullUpdateToClient(remoteClient, OffsetPosition);
2937 lPos = OffsetPosition;
2938 SendFullUpdateToClient(remoteClient, lPos, clientflags);
2939 } 2935 }
2940 2936
2941 /// <summary> 2937 /// <summary>
@@ -2943,8 +2939,7 @@ namespace OpenSim.Region.Framework.Scenes
2943 /// </summary> 2939 /// </summary>
2944 /// <param name="remoteClient"></param> 2940 /// <param name="remoteClient"></param>
2945 /// <param name="lPos"></param> 2941 /// <param name="lPos"></param>
2946 /// <param name="clientFlags"></param> 2942 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
2947 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
2948 { 2943 {
2949 if (ParentGroup == null) 2944 if (ParentGroup == null)
2950 return; 2945 return;
@@ -2961,15 +2956,10 @@ namespace OpenSim.Region.Framework.Scenes
2961 (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38)) 2956 (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38))
2962 return; 2957 return;
2963 2958
2964 clientFlags &= ~(uint) PrimFlags.CreateSelected;
2965
2966 if (remoteClient.AgentId == OwnerID) 2959 if (remoteClient.AgentId == OwnerID)
2967 { 2960 {
2968 if ((Flags & PrimFlags.CreateSelected) != 0) 2961 if ((Flags & PrimFlags.CreateSelected) != 0)
2969 {
2970 clientFlags |= (uint) PrimFlags.CreateSelected;
2971 Flags &= ~PrimFlags.CreateSelected; 2962 Flags &= ~PrimFlags.CreateSelected;
2972 }
2973 } 2963 }
2974 //bool isattachment = IsAttachment; 2964 //bool isattachment = IsAttachment;
2975 //if (LocalId != ParentGroup.RootPart.LocalId) 2965 //if (LocalId != ParentGroup.RootPart.LocalId)
@@ -3403,6 +3393,11 @@ namespace OpenSim.Region.Framework.Scenes
3403 3393
3404 public void SetGroup(UUID groupID, IClientAPI client) 3394 public void SetGroup(UUID groupID, IClientAPI client)
3405 { 3395 {
3396 // Scene.AddNewPrims() calls with client == null so can't use this.
3397// m_log.DebugFormat(
3398// "[SCENE OBJECT PART]: Setting group for {0} to {1} for {2}",
3399// Name, groupID, OwnerID);
3400
3406 GroupID = groupID; 3401 GroupID = groupID;
3407 if (client != null) 3402 if (client != null)
3408 SendPropertiesToClient(client); 3403 SendPropertiesToClient(client);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 49acc02..0eecf77 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -289,16 +289,10 @@ namespace OpenSim.Region.Framework.Scenes
289 289
290 #region Properties 290 #region Properties
291 291
292 protected PhysicsActor m_physicsActor;
293
294 /// <summary> 292 /// <summary>
295 /// Physical scene representation of this Avatar. 293 /// Physical scene representation of this Avatar.
296 /// </summary> 294 /// </summary>
297 public PhysicsActor PhysicsActor 295 public PhysicsActor PhysicsActor { get; private set; }
298 {
299 set { m_physicsActor = value; }
300 get { return m_physicsActor; }
301 }
302 296
303 private byte m_movementflag; 297 private byte m_movementflag;
304 298
@@ -512,9 +506,9 @@ namespace OpenSim.Region.Framework.Scenes
512 { 506 {
513 m_pos = PhysicsActor.Position; 507 m_pos = PhysicsActor.Position;
514 508
515// m_log.DebugFormat( 509 //m_log.DebugFormat(
516// "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", 510 // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!",
517// m_pos, Name, Scene.RegionInfo.RegionName); 511 // m_pos, Name, Scene.RegionInfo.RegionName);
518 } 512 }
519 else 513 else
520 { 514 {
@@ -544,7 +538,6 @@ namespace OpenSim.Region.Framework.Scenes
544 } 538 }
545 } 539 }
546 } 540 }
547
548 return m_pos; 541 return m_pos;
549 } 542 }
550 set 543 set
@@ -568,9 +561,9 @@ namespace OpenSim.Region.Framework.Scenes
568 ParentPosition = Vector3.Zero; 561 ParentPosition = Vector3.Zero;
569 } 562 }
570 563
571// m_log.DebugFormat( 564 //m_log.DebugFormat(
572// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", 565 // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
573// Scene.RegionInfo.RegionName, Name, m_pos); 566 // Scene.RegionInfo.RegionName, Name, m_pos);
574 } 567 }
575 } 568 }
576 569
@@ -806,7 +799,6 @@ namespace OpenSim.Region.Framework.Scenes
806 public void RegisterToEvents() 799 public void RegisterToEvents()
807 { 800 {
808 ControllingClient.OnCompleteMovementToRegion += CompleteMovement; 801 ControllingClient.OnCompleteMovementToRegion += CompleteMovement;
809 //ControllingClient.OnCompleteMovementToRegion += SendInitialData;
810 ControllingClient.OnAgentUpdate += HandleAgentUpdate; 802 ControllingClient.OnAgentUpdate += HandleAgentUpdate;
811 ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; 803 ControllingClient.OnAgentRequestSit += HandleAgentRequestSit;
812 ControllingClient.OnAgentSit += HandleAgentSit; 804 ControllingClient.OnAgentSit += HandleAgentSit;
@@ -854,11 +846,6 @@ namespace OpenSim.Region.Framework.Scenes
854 846
855 #endregion 847 #endregion
856 848
857 public uint GenerateClientFlags(UUID ObjectID)
858 {
859 return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
860 }
861
862 #region Status Methods 849 #region Status Methods
863 850
864 /// <summary> 851 /// <summary>
@@ -1049,18 +1036,19 @@ namespace OpenSim.Region.Framework.Scenes
1049 { 1036 {
1050 if (PhysicsActor != null) 1037 if (PhysicsActor != null)
1051 { 1038 {
1052 try 1039// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1053 { 1040 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1054 PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1041 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1055 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1042 PhysicsActor.UnSubscribeEvents();
1056 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 1043 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1057 PhysicsActor.UnSubscribeEvents(); 1044 PhysicsActor = null;
1058 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1059 PhysicsActor = null;
1060 }
1061 catch
1062 { }
1063 } 1045 }
1046// else
1047// {
1048// m_log.ErrorFormat(
1049// "[SCENE PRESENCE]: Attempt to remove physics actor for {0} on {1} but this scene presence has no physics actor",
1050// Name, Scene.RegionInfo.RegionName);
1051// }
1064 } 1052 }
1065 1053
1066 /// <summary> 1054 /// <summary>
@@ -1173,13 +1161,11 @@ namespace OpenSim.Region.Framework.Scenes
1173 /// <summary> 1161 /// <summary>
1174 /// Sets avatar height in the physics plugin 1162 /// Sets avatar height in the physics plugin
1175 /// </summary> 1163 /// </summary>
1164 /// <param name="height">New height of avatar</param>
1176 public void SetHeight(float height) 1165 public void SetHeight(float height)
1177 { 1166 {
1178 if (PhysicsActor != null && !IsChildAgent) 1167 if (PhysicsActor != null && !IsChildAgent)
1179 { 1168 PhysicsActor.Size = new Vector3(0.45f, 0.6f, height);
1180 Vector3 SetSize = new Vector3(0.45f, 0.6f, height);
1181 PhysicsActor.Size = SetSize;
1182 }
1183 } 1169 }
1184 1170
1185 /// <summary> 1171 /// <summary>
@@ -1945,7 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes
1945// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); 1931// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
1946 1932
1947 if (PhysicsActor != null) 1933 if (PhysicsActor != null)
1948 m_sitAvatarHeight = m_physicsActor.Size.Z; 1934 m_sitAvatarHeight = PhysicsActor.Size.Z;
1949 1935
1950 bool canSit = false; 1936 bool canSit = false;
1951 pos = part.AbsolutePosition + offset; 1937 pos = part.AbsolutePosition + offset;
@@ -2592,7 +2578,10 @@ namespace OpenSim.Region.Framework.Scenes
2592 // only send update from root agents to other clients; children are only "listening posts" 2578 // only send update from root agents to other clients; children are only "listening posts"
2593 if (IsChildAgent) 2579 if (IsChildAgent)
2594 { 2580 {
2595 m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); 2581 m_log.WarnFormat(
2582 "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}",
2583 Name, Scene.RegionInfo.RegionName);
2584
2596 return; 2585 return;
2597 } 2586 }
2598 2587
@@ -2650,7 +2639,10 @@ namespace OpenSim.Region.Framework.Scenes
2650 // only send update from root agents to other clients; children are only "listening posts" 2639 // only send update from root agents to other clients; children are only "listening posts"
2651 if (IsChildAgent) 2640 if (IsChildAgent)
2652 { 2641 {
2653 m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); 2642 m_log.WarnFormat(
2643 "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}",
2644 Name, Scene.RegionInfo.RegionName);
2645
2654 return; 2646 return;
2655 } 2647 }
2656 2648
@@ -3032,6 +3024,7 @@ namespace OpenSim.Region.Framework.Scenes
3032 CopyFrom(cAgentData); 3024 CopyFrom(cAgentData);
3033 } 3025 }
3034 3026
3027 private static Vector3 marker = new Vector3(-1f, -1f, -1f);
3035 /// <summary> 3028 /// <summary>
3036 /// This updates important decision making data about a child agent 3029 /// This updates important decision making data about a child agent
3037 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region 3030 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
@@ -3052,8 +3045,8 @@ namespace OpenSim.Region.Framework.Scenes
3052 // region's draw distance. 3045 // region's draw distance.
3053 // DrawDistance = cAgentData.Far; 3046 // DrawDistance = cAgentData.Far;
3054 DrawDistance = Scene.DefaultDrawDistance; 3047 DrawDistance = Scene.DefaultDrawDistance;
3055 3048
3056 if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! 3049 if (cAgentData.Position != marker) // UGH!!
3057 m_pos = cAgentData.Position + offset; 3050 m_pos = cAgentData.Position + offset;
3058 3051
3059 if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance) 3052 if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance)
@@ -3064,8 +3057,6 @@ namespace OpenSim.Region.Framework.Scenes
3064 3057
3065 CameraPosition = cAgentData.Center + offset; 3058 CameraPosition = cAgentData.Center + offset;
3066 3059
3067 //SetHeight(cAgentData.AVHeight);
3068
3069 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 3060 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
3070 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 3061 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
3071 3062
@@ -3274,6 +3265,13 @@ namespace OpenSim.Region.Framework.Scenes
3274// "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", 3265// "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}",
3275// Name, isFlying, Scene.RegionInfo.RegionName); 3266// Name, isFlying, Scene.RegionInfo.RegionName);
3276 3267
3268 if (PhysicsActor != null)
3269 {
3270 m_log.ErrorFormat(
3271 "[SCENE PRESENCE]: Adding physics actor for {0} to {1} but this scene presence already has a physics actor",
3272 Name, Scene.RegionInfo.RegionName);
3273 }
3274
3277 if (Appearance.AvatarHeight == 0) 3275 if (Appearance.AvatarHeight == 0)
3278 Appearance.SetHeight(); 3276 Appearance.SetHeight();
3279 3277
@@ -3281,18 +3279,15 @@ namespace OpenSim.Region.Framework.Scenes
3281 3279
3282 Vector3 pVec = AbsolutePosition; 3280 Vector3 pVec = AbsolutePosition;
3283 3281
3284 // Old bug where the height was in centimeters instead of meters 3282 PhysicsActor = scene.AddAvatar(
3285 PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, 3283 LocalId, Firstname + "." + Lastname, pVec,
3286 new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); 3284 new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying);
3287 3285
3288 scene.AddPhysicsActorTaint(PhysicsActor);
3289 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3286 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3290 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3287 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3291 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3288 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3292 PhysicsActor.SubscribeEvents(500); 3289 PhysicsActor.SubscribeEvents(500);
3293 PhysicsActor.LocalID = LocalId; 3290 PhysicsActor.LocalID = LocalId;
3294
3295 SetHeight(Appearance.AvatarHeight);
3296 } 3291 }
3297 3292
3298 private void OutOfBoundsCall(Vector3 pos) 3293 private void OutOfBoundsCall(Vector3 pos)