aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs246
1 files changed, 109 insertions, 137 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 6ba74c7..3355ebe 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -116,66 +116,78 @@ 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 if (sog != null)
122 sog.SendFullUpdateToClient(remoteClient);
123 }
124
125 /// <summary>
126 /// Invoked when the client selects a prim.
127 /// </summary>
128 /// <param name="primLocalID"></param>
129 /// <param name="remoteClient"></param>
130 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
131 {
132 SceneObjectPart part = GetSceneObjectPart(primLocalID);
133
134 if (null == part)
135 return;
136
137 if (part.IsRoot)
121 { 138 {
122 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))
123 { 146 {
124 if (((SceneObjectGroup)ent).LocalId == primLocalID) 147 EventManager.TriggerParcelPrimCountTainted();
125 {
126 ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
127 return;
128 }
129 } 148 }
130 } 149 }
150 else
151 {
152 part.SendPropertiesToClient(remoteClient);
153 }
131 } 154 }
132 155
133 /// <summary> 156 /// <summary>
134 /// Invoked when the client selects a prim. 157 /// Handle the update of an object's user group.
135 /// </summary> 158 /// </summary>
136 /// <param name="primLocalID"></param>
137 /// <param name="remoteClient"></param> 159 /// <param name="remoteClient"></param>
138 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 160 /// <param name="groupID"></param>
161 /// <param name="objectLocalID"></param>
162 /// <param name="Garbage"></param>
163 private void HandleObjectGroupUpdate(
164 IClientAPI remoteClient, UUID groupID, uint objectLocalID, UUID Garbage)
139 { 165 {
140 EntityBase[] entityList = GetEntities(); 166 if (m_groupsModule == null)
141 foreach (EntityBase ent in entityList) 167 return;
168
169 // XXX: Might be better to get rid of this special casing and have GetMembershipData return something
170 // reasonable for a UUID.Zero group.
171 if (groupID != UUID.Zero)
142 { 172 {
143 if (ent is SceneObjectGroup) 173 GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, remoteClient.AgentId);
174
175 if (gmd == null)
144 { 176 {
145 if (((SceneObjectGroup) ent).LocalId == primLocalID) 177// m_log.WarnFormat(
146 { 178// "[GROUPS]: User {0} is not a member of group {1} so they can't update {2} to this group",
147 ((SceneObjectGroup) ent).SendPropertiesToClient(remoteClient); 179// remoteClient.Name, GroupID, objectLocalID);
148 ((SceneObjectGroup) ent).IsSelected = true; 180
149 // A prim is only tainted if it's allowed to be edited by the person clicking it. 181 return;
150 if (Permissions.CanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) 182 }
151 || Permissions.CanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) 183 }
152 { 184
153 EventManager.TriggerParcelPrimCountTainted(); 185 SceneObjectGroup so = ((Scene)remoteClient.Scene).GetGroupByPrim(objectLocalID);
154 } 186 if (so != null)
155 break; 187 {
156 } 188 if (so.OwnerID == remoteClient.AgentId)
157 else 189 {
158 { 190 so.SetGroup(groupID, remoteClient);
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 } 191 }
180 } 192 }
181 } 193 }
@@ -250,121 +262,81 @@ namespace OpenSim.Region.Framework.Scenes
250 262
251 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 263 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
252 { 264 {
253 EntityBase[] EntityList = GetEntities(); 265 SceneObjectPart part = GetSceneObjectPart(localID);
266
267 if (part == null)
268 return;
269
270 SceneObjectGroup obj = part.ParentGroup;
254 271
255 SurfaceTouchEventArgs surfaceArg = null; 272 SurfaceTouchEventArgs surfaceArg = null;
256 if (surfaceArgs != null && surfaceArgs.Count > 0) 273 if (surfaceArgs != null && surfaceArgs.Count > 0)
257 surfaceArg = surfaceArgs[0]; 274 surfaceArg = surfaceArgs[0];
258 275
259 foreach (EntityBase ent in EntityList) 276 // Currently only grab/touch for the single prim
277 // the client handles rez correctly
278 obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
279
280 // If the touched prim handles touches, deliver it
281 // If not, deliver to root prim
282 if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
283 EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
284
285 // Deliver to the root prim if the touched prim doesn't handle touches
286 // or if we're meant to pass on touches anyway. Don't send to root prim
287 // if prim touched is the root prim as we just did it
288 if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
289 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
260 { 290 {
261 if (ent is SceneObjectGroup) 291 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 } 292 }
293 } 293 }
294 294
295 public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 295 public virtual void ProcessObjectGrabUpdate(
296 UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
296 { 297 {
297 EntityBase[] EntityList = GetEntities(); 298 SceneObjectPart part = GetSceneObjectPart(objectID);
299 if (part == null)
300 return;
301
302 SceneObjectGroup obj = part.ParentGroup;
298 303
299 SurfaceTouchEventArgs surfaceArg = null; 304 SurfaceTouchEventArgs surfaceArg = null;
300 if (surfaceArgs != null && surfaceArgs.Count > 0) 305 if (surfaceArgs != null && surfaceArgs.Count > 0)
301 surfaceArg = surfaceArgs[0]; 306 surfaceArg = surfaceArgs[0];
302 307
303 foreach (EntityBase ent in EntityList) 308 // If the touched prim handles touches, deliver it
309 // If not, deliver to root prim
310 if ((part.ScriptEvents & scriptEvents.touch) != 0)
311 EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
312 // Deliver to the root prim if the touched prim doesn't handle touches
313 // or if we're meant to pass on touches anyway. Don't send to root prim
314 // if prim touched is the root prim as we just did it
315 if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
316 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
304 { 317 {
305 if (ent is SceneObjectGroup) 318 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 } 319 }
333 } 320 }
334 321
335 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 322 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
336 { 323 {
337 EntityBase[] EntityList = GetEntities(); 324 SceneObjectPart part = GetSceneObjectPart(localID);
325 if (part == null)
326 return;
327
328 SceneObjectGroup obj = part.ParentGroup;
338 329
339 SurfaceTouchEventArgs surfaceArg = null; 330 SurfaceTouchEventArgs surfaceArg = null;
340 if (surfaceArgs != null && surfaceArgs.Count > 0) 331 if (surfaceArgs != null && surfaceArgs.Count > 0)
341 surfaceArg = surfaceArgs[0]; 332 surfaceArg = surfaceArgs[0];
342 333
343 foreach (EntityBase ent in EntityList) 334 // If the touched prim handles touches, deliver it
344 { 335 // If not, deliver to root prim
345 if (ent is SceneObjectGroup) 336 if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
346 { 337 EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg);
347 SceneObjectGroup obj = ent as SceneObjectGroup; 338 else
348 339 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 } 340 }
369 341
370 public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) 342 public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query)