diff options
author | MW | 2008-03-14 15:23:33 +0000 |
---|---|---|
committer | MW | 2008-03-14 15:23:33 +0000 |
commit | 7ab08f2ac471f22327e4cac969f9f8d1b937d071 (patch) | |
tree | 18038095b6c585bca9fd483a51c51009348145da /OpenSim | |
parent | addressing the request for msbuild support from mantis 723 (diff) | |
download | opensim-SC-7ab08f2ac471f22327e4cac969f9f8d1b937d071.zip opensim-SC-7ab08f2ac471f22327e4cac969f9f8d1b937d071.tar.gz opensim-SC-7ab08f2ac471f22327e4cac969f9f8d1b937d071.tar.bz2 opensim-SC-7ab08f2ac471f22327e4cac969f9f8d1b937d071.tar.xz |
Attempt to fix mantis #741, could not replicate it myself. But the error was suggesting that the SceneObjectPart was null, so added a null check, to make sure the sceneobject to be attached is found before attempting the attachment.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 267 |
1 files changed, 137 insertions, 130 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 0272a7e..053fc85 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -290,140 +290,147 @@ namespace OpenSim.Region.Environment.Scenes | |||
290 | { | 290 | { |
291 | System.Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); | 291 | System.Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); |
292 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); | 292 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); |
293 | ScenePresence av = null; | 293 | if (p != null) |
294 | if (TryGetAvatar(remoteClient.AgentId, out av)) | ||
295 | { | 294 | { |
296 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 295 | ScenePresence av = null; |
297 | objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; | 296 | if (TryGetAvatar(remoteClient.AgentId, out av)) |
298 | objupdate.RegionData.TimeDilation = ushort.MaxValue; | 297 | { |
299 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2]; | 298 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); |
300 | // avatar stuff - horrible group copypaste | 299 | objupdate.RegionData.RegionHandle = m_regInfo.RegionHandle; |
301 | 300 | objupdate.RegionData.TimeDilation = ushort.MaxValue; | |
302 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | 301 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2]; |
303 | objupdate.ObjectData[0].PSBlock = new byte[0]; | 302 | // avatar stuff - horrible group copypaste |
304 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | 303 | |
305 | objupdate.ObjectData[0].MediaURL = new byte[0]; | 304 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); |
306 | objupdate.ObjectData[0].NameValue = new byte[0]; | 305 | objupdate.ObjectData[0].PSBlock = new byte[0]; |
307 | objupdate.ObjectData[0].Text = new byte[0]; | 306 | objupdate.ObjectData[0].ExtraParams = new byte[1]; |
308 | objupdate.ObjectData[0].TextColor = new byte[4]; | 307 | objupdate.ObjectData[0].MediaURL = new byte[0]; |
309 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); | 308 | objupdate.ObjectData[0].NameValue = new byte[0]; |
310 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | 309 | objupdate.ObjectData[0].Text = new byte[0]; |
311 | objupdate.ObjectData[0].Material = 4; | 310 | objupdate.ObjectData[0].TextColor = new byte[4]; |
312 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | 311 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0); |
313 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | 312 | objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); |
314 | 313 | objupdate.ObjectData[0].Material = 4; | |
315 | objupdate.ObjectData[0].State = 0; | 314 | objupdate.ObjectData[0].TextureAnim = new byte[0]; |
316 | objupdate.ObjectData[0].Data = new byte[0]; | 315 | objupdate.ObjectData[0].Sound = LLUUID.Zero; |
317 | 316 | ||
318 | objupdate.ObjectData[0].ObjectData = new byte[76]; | 317 | objupdate.ObjectData[0].State = 0; |
319 | objupdate.ObjectData[0].ObjectData[15] = 128; | 318 | objupdate.ObjectData[0].Data = new byte[0]; |
320 | objupdate.ObjectData[0].ObjectData[16] = 63; | 319 | |
321 | objupdate.ObjectData[0].ObjectData[56] = 128; | 320 | objupdate.ObjectData[0].ObjectData = new byte[76]; |
322 | objupdate.ObjectData[0].ObjectData[61] = 102; | 321 | objupdate.ObjectData[0].ObjectData[15] = 128; |
323 | objupdate.ObjectData[0].ObjectData[62] = 40; | 322 | objupdate.ObjectData[0].ObjectData[16] = 63; |
324 | objupdate.ObjectData[0].ObjectData[63] = 61; | 323 | objupdate.ObjectData[0].ObjectData[56] = 128; |
325 | objupdate.ObjectData[0].ObjectData[64] = 189; | 324 | objupdate.ObjectData[0].ObjectData[61] = 102; |
326 | 325 | objupdate.ObjectData[0].ObjectData[62] = 40; | |
327 | 326 | objupdate.ObjectData[0].ObjectData[63] = 61; | |
328 | objupdate.ObjectData[0].UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); | 327 | objupdate.ObjectData[0].ObjectData[64] = 189; |
329 | objupdate.ObjectData[0].PathCurve = 16; | 328 | |
330 | objupdate.ObjectData[0].ProfileCurve = 1; | 329 | |
331 | objupdate.ObjectData[0].PathScaleX = 100; | 330 | objupdate.ObjectData[0].UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24); |
332 | objupdate.ObjectData[0].PathScaleY = 100; | 331 | objupdate.ObjectData[0].PathCurve = 16; |
333 | objupdate.ObjectData[0].ParentID = 0; | 332 | objupdate.ObjectData[0].ProfileCurve = 1; |
334 | objupdate.ObjectData[0].OwnerID = LLUUID.Zero; | 333 | objupdate.ObjectData[0].PathScaleX = 100; |
335 | objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1); | 334 | objupdate.ObjectData[0].PathScaleY = 100; |
336 | objupdate.ObjectData[0].PCode = 47; | 335 | objupdate.ObjectData[0].ParentID = 0; |
337 | objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture; | 336 | objupdate.ObjectData[0].OwnerID = LLUUID.Zero; |
338 | 337 | objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1); | |
339 | objupdate.ObjectData[0].ID = av.LocalId; | 338 | objupdate.ObjectData[0].PCode = 47; |
340 | objupdate.ObjectData[0].FullID = remoteClient.AgentId; | 339 | objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture; |
341 | objupdate.ObjectData[0].ParentID = 0; | 340 | |
342 | objupdate.ObjectData[0].NameValue = | 341 | objupdate.ObjectData[0].ID = av.LocalId; |
343 | Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname); | 342 | objupdate.ObjectData[0].FullID = remoteClient.AgentId; |
344 | LLVector3 pos2 = av.AbsolutePosition; | 343 | objupdate.ObjectData[0].ParentID = 0; |
345 | // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); | 344 | objupdate.ObjectData[0].NameValue = |
346 | byte[] pb = pos2.GetBytes(); | 345 | Helpers.StringToField("FirstName STRING RW SV " + av.Firstname + "\nLastName STRING RW SV " + av.Lastname); |
347 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 346 | LLVector3 pos2 = av.AbsolutePosition; |
348 | 347 | // new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z); | |
349 | 348 | byte[] pb = pos2.GetBytes(); | |
350 | // primitive part | 349 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
351 | objupdate.ObjectData[1] = new ObjectUpdatePacket.ObjectDataBlock(); | 350 | |
352 | // SetDefaultPrimPacketValues | 351 | |
353 | objupdate.ObjectData[1].PSBlock = new byte[0]; | 352 | // primitive part |
354 | objupdate.ObjectData[1].ExtraParams = new byte[1]; | 353 | objupdate.ObjectData[1] = new ObjectUpdatePacket.ObjectDataBlock(); |
355 | objupdate.ObjectData[1].MediaURL = new byte[0]; | 354 | // SetDefaultPrimPacketValues |
356 | objupdate.ObjectData[1].NameValue = new byte[0]; | 355 | objupdate.ObjectData[1].PSBlock = new byte[0]; |
357 | objupdate.ObjectData[1].Text = new byte[0]; | 356 | objupdate.ObjectData[1].ExtraParams = new byte[1]; |
358 | objupdate.ObjectData[1].TextColor = new byte[4]; | 357 | objupdate.ObjectData[1].MediaURL = new byte[0]; |
359 | objupdate.ObjectData[1].JointAxisOrAnchor = new LLVector3(0, 0, 0); | 358 | objupdate.ObjectData[1].NameValue = new byte[0]; |
360 | objupdate.ObjectData[1].JointPivot = new LLVector3(0, 0, 0); | 359 | objupdate.ObjectData[1].Text = new byte[0]; |
361 | objupdate.ObjectData[1].Material = 3; | 360 | objupdate.ObjectData[1].TextColor = new byte[4]; |
362 | objupdate.ObjectData[1].TextureAnim = new byte[0]; | 361 | objupdate.ObjectData[1].JointAxisOrAnchor = new LLVector3(0, 0, 0); |
363 | objupdate.ObjectData[1].Sound = LLUUID.Zero; | 362 | objupdate.ObjectData[1].JointPivot = new LLVector3(0, 0, 0); |
364 | objupdate.ObjectData[1].State = 0; | 363 | objupdate.ObjectData[1].Material = 3; |
365 | objupdate.ObjectData[1].Data = new byte[0]; | 364 | objupdate.ObjectData[1].TextureAnim = new byte[0]; |
366 | 365 | objupdate.ObjectData[1].Sound = LLUUID.Zero; | |
367 | objupdate.ObjectData[1].ObjectData = new byte[60]; | 366 | objupdate.ObjectData[1].State = 0; |
368 | objupdate.ObjectData[1].ObjectData[46] = 128; | 367 | objupdate.ObjectData[1].Data = new byte[0]; |
369 | objupdate.ObjectData[1].ObjectData[47] = 63; | 368 | |
370 | 369 | objupdate.ObjectData[1].ObjectData = new byte[60]; | |
371 | // SetPrimPacketShapeData | 370 | objupdate.ObjectData[1].ObjectData[46] = 128; |
372 | PrimitiveBaseShape primData = p.Shape; | 371 | objupdate.ObjectData[1].ObjectData[47] = 63; |
373 | 372 | ||
374 | objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; | 373 | // SetPrimPacketShapeData |
375 | objupdate.ObjectData[1].PCode = primData.PCode; | 374 | PrimitiveBaseShape primData = p.Shape; |
376 | objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4); | 375 | |
377 | objupdate.ObjectData[1].PathBegin = primData.PathBegin; | 376 | objupdate.ObjectData[1].TextureEntry = primData.TextureEntry; |
378 | objupdate.ObjectData[1].PathEnd = primData.PathEnd; | 377 | objupdate.ObjectData[1].PCode = primData.PCode; |
379 | objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; | 378 | objupdate.ObjectData[1].State = (byte)(((byte)AttachmentPt) << 4); |
380 | objupdate.ObjectData[1].PathScaleY = primData.PathScaleY; | 379 | objupdate.ObjectData[1].PathBegin = primData.PathBegin; |
381 | objupdate.ObjectData[1].PathShearX = primData.PathShearX; | 380 | objupdate.ObjectData[1].PathEnd = primData.PathEnd; |
382 | objupdate.ObjectData[1].PathShearY = primData.PathShearY; | 381 | objupdate.ObjectData[1].PathScaleX = primData.PathScaleX; |
383 | objupdate.ObjectData[1].PathSkew = primData.PathSkew; | 382 | objupdate.ObjectData[1].PathScaleY = primData.PathScaleY; |
384 | objupdate.ObjectData[1].ProfileBegin = primData.ProfileBegin; | 383 | objupdate.ObjectData[1].PathShearX = primData.PathShearX; |
385 | objupdate.ObjectData[1].ProfileEnd = primData.ProfileEnd; | 384 | objupdate.ObjectData[1].PathShearY = primData.PathShearY; |
386 | objupdate.ObjectData[1].Scale = primData.Scale; | 385 | objupdate.ObjectData[1].PathSkew = primData.PathSkew; |
387 | objupdate.ObjectData[1].PathCurve = primData.PathCurve; | 386 | objupdate.ObjectData[1].ProfileBegin = primData.ProfileBegin; |
388 | objupdate.ObjectData[1].ProfileCurve = primData.ProfileCurve; | 387 | objupdate.ObjectData[1].ProfileEnd = primData.ProfileEnd; |
389 | objupdate.ObjectData[1].ProfileHollow = primData.ProfileHollow; | 388 | objupdate.ObjectData[1].Scale = primData.Scale; |
390 | objupdate.ObjectData[1].PathRadiusOffset = primData.PathRadiusOffset; | 389 | objupdate.ObjectData[1].PathCurve = primData.PathCurve; |
391 | objupdate.ObjectData[1].PathRevolutions = primData.PathRevolutions; | 390 | objupdate.ObjectData[1].ProfileCurve = primData.ProfileCurve; |
392 | objupdate.ObjectData[1].PathTaperX = primData.PathTaperX; | 391 | objupdate.ObjectData[1].ProfileHollow = primData.ProfileHollow; |
393 | objupdate.ObjectData[1].PathTaperY = primData.PathTaperY; | 392 | objupdate.ObjectData[1].PathRadiusOffset = primData.PathRadiusOffset; |
394 | objupdate.ObjectData[1].PathTwist = primData.PathTwist; | 393 | objupdate.ObjectData[1].PathRevolutions = primData.PathRevolutions; |
395 | objupdate.ObjectData[1].PathTwistBegin = primData.PathTwistBegin; | 394 | objupdate.ObjectData[1].PathTaperX = primData.PathTaperX; |
396 | objupdate.ObjectData[1].ExtraParams = primData.ExtraParams; | 395 | objupdate.ObjectData[1].PathTaperY = primData.PathTaperY; |
397 | 396 | objupdate.ObjectData[1].PathTwist = primData.PathTwist; | |
398 | 397 | objupdate.ObjectData[1].PathTwistBegin = primData.PathTwistBegin; | |
399 | objupdate.ObjectData[1].UpdateFlags = 276957500; // flags; // ?? | 398 | objupdate.ObjectData[1].ExtraParams = primData.ExtraParams; |
400 | objupdate.ObjectData[1].ID = p.LocalId; | 399 | |
401 | objupdate.ObjectData[1].FullID = p.UUID; | 400 | |
402 | objupdate.ObjectData[1].OwnerID = p.OwnerID; | 401 | objupdate.ObjectData[1].UpdateFlags = 276957500; // flags; // ?? |
403 | objupdate.ObjectData[1].Text = Helpers.StringToField(p.Text); | 402 | objupdate.ObjectData[1].ID = p.LocalId; |
404 | objupdate.ObjectData[1].TextColor[0] = 255; | 403 | objupdate.ObjectData[1].FullID = p.UUID; |
405 | objupdate.ObjectData[1].TextColor[1] = 255; | 404 | objupdate.ObjectData[1].OwnerID = p.OwnerID; |
406 | objupdate.ObjectData[1].TextColor[2] = 255; | 405 | objupdate.ObjectData[1].Text = Helpers.StringToField(p.Text); |
407 | objupdate.ObjectData[1].TextColor[3] = 128; | 406 | objupdate.ObjectData[1].TextColor[0] = 255; |
408 | objupdate.ObjectData[1].ParentID = objupdate.ObjectData[0].ID; | 407 | objupdate.ObjectData[1].TextColor[1] = 255; |
409 | //objupdate.ObjectData[1].PSBlock = particleSystem; | 408 | objupdate.ObjectData[1].TextColor[2] = 255; |
410 | //objupdate.ObjectData[1].ClickAction = clickAction; | 409 | objupdate.ObjectData[1].TextColor[3] = 128; |
411 | objupdate.ObjectData[1].Radius = 20; | 410 | objupdate.ObjectData[1].ParentID = objupdate.ObjectData[0].ID; |
412 | objupdate.ObjectData[1].NameValue = | 411 | //objupdate.ObjectData[1].PSBlock = particleSystem; |
413 | Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); | 412 | //objupdate.ObjectData[1].ClickAction = clickAction; |
414 | LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0); | 413 | objupdate.ObjectData[1].Radius = 20; |
415 | 414 | objupdate.ObjectData[1].NameValue = | |
416 | pb = pos.GetBytes(); | 415 | Helpers.StringToField("AttachItemID STRING RW SV " + p.UUID); |
417 | Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); | 416 | LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0); |
418 | 417 | ||
419 | byte[] brot = rot.GetBytes(); | 418 | pb = pos.GetBytes(); |
420 | Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length); | 419 | Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length); |
421 | 420 | ||
422 | remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task); | 421 | byte[] brot = rot.GetBytes(); |
422 | Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length); | ||
423 | |||
424 | remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task); | ||
425 | } | ||
426 | else | ||
427 | { | ||
428 | m_log.Info("[SCENE]: Avatar " + remoteClient.AgentId + " not found"); | ||
429 | } | ||
423 | } | 430 | } |
424 | else | 431 | else |
425 | { | 432 | { |
426 | m_log.Info("[SCENE]: Avatar " + remoteClient.AgentId + " not found"); | 433 | m_log.Info("[SCENE]: Attempting to attach object; Object " + objectLocalID + "(localID) not found"); |
427 | } | 434 | } |
428 | } | 435 | } |
429 | 436 | ||