diff options
author | Teravus Ovares | 2008-04-27 20:10:28 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-27 20:10:28 +0000 |
commit | 911e63765c7cea748b5ae2227f5c1d6ff131d329 (patch) | |
tree | f95eeffb4974a9b3f6ded4a46bdc240278a336b0 | |
parent | Minor svn, formatting cleanup. (diff) | |
download | opensim-SC-911e63765c7cea748b5ae2227f5c1d6ff131d329.zip opensim-SC-911e63765c7cea748b5ae2227f5c1d6ff131d329.tar.gz opensim-SC-911e63765c7cea748b5ae2227f5c1d6ff131d329.tar.bz2 opensim-SC-911e63765c7cea748b5ae2227f5c1d6ff131d329.tar.xz |
* Single Attachments now work from inventory. You can attach from inventory and detach from inventory.
* Detaching from right clicking in world, detaches to your inventory.
* If you go up to a prim and attach it from in world, it appears in your inventory.
* Attachment placement is saved when you detach them.
* Choosing wear remembers your last attachment point from inventory.
* Wrote a method to update an inventory item's asset and sends the updated inventory item to the Client
* Wrote a recursive method to find the folder of a known existing inventory item.
* Removed a block on physics object position on creation. This might crash a region or two, let us know via Mantis if your region crashes because of a physics out of bounds error.
* Drop doesn't work. The menu item doesn't even come up. Don't know why :P.
-rw-r--r-- | OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | 9 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 70 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 99 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 32 |
10 files changed, 240 insertions, 33 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index f1268d5..9749366 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -272,8 +272,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
272 | { | 272 | { |
273 | if (!RootFolder.Items.ContainsKey(itemInfo.ID)) | 273 | if (!RootFolder.Items.ContainsKey(itemInfo.ID)) |
274 | { | 274 | { |
275 | |||
275 | RootFolder.Items.Add(itemInfo.ID, itemInfo); | 276 | RootFolder.Items.Add(itemInfo.ID, itemInfo); |
276 | } | 277 | } |
278 | else | ||
279 | { | ||
280 | RootFolder.Items[itemInfo.ID] = itemInfo; | ||
281 | } | ||
277 | } | 282 | } |
278 | } | 283 | } |
279 | else | 284 | else |
@@ -287,6 +292,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
287 | { | 292 | { |
288 | folder.Items.Add(itemInfo.ID, itemInfo); | 293 | folder.Items.Add(itemInfo.ID, itemInfo); |
289 | } | 294 | } |
295 | else | ||
296 | { | ||
297 | folder.Items[itemInfo.ID] = itemInfo; | ||
298 | } | ||
290 | } | 299 | } |
291 | } | 300 | } |
292 | } | 301 | } |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 174d20a..fb32397 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -455,6 +455,7 @@ namespace OpenSim.Framework | |||
455 | event SetAppearance OnSetAppearance; | 455 | event SetAppearance OnSetAppearance; |
456 | event AvatarNowWearing OnAvatarNowWearing; | 456 | event AvatarNowWearing OnAvatarNowWearing; |
457 | event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 457 | event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
458 | event UUIDNameRequest OnDetachAttachmentIntoInv; | ||
458 | event ObjectAttach OnObjectAttach; | 459 | event ObjectAttach OnObjectAttach; |
459 | event ObjectDeselect OnObjectDetach; | 460 | event ObjectDeselect OnObjectDetach; |
460 | event StartAnim OnStartAnim; | 461 | event StartAnim OnStartAnim; |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index fb9d638..94de013 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -145,6 +145,7 @@ namespace OpenSim.Region.ClientStack | |||
145 | private SetAppearance handlerSetAppearance = null; //OnSetAppearance; | 145 | private SetAppearance handlerSetAppearance = null; //OnSetAppearance; |
146 | private AvatarNowWearing handlerAvatarNowWearing = null; //OnAvatarNowWearing; | 146 | private AvatarNowWearing handlerAvatarNowWearing = null; //OnAvatarNowWearing; |
147 | private RezSingleAttachmentFromInv handlerRezSingleAttachment = null; //OnRezSingleAttachmentFromInv; | 147 | private RezSingleAttachmentFromInv handlerRezSingleAttachment = null; //OnRezSingleAttachmentFromInv; |
148 | private UUIDNameRequest handlerDetachAttachmentIntoInv = null; // Detach attachment! | ||
148 | private ObjectAttach handlerObjectAttach = null; //OnObjectAttach; | 149 | private ObjectAttach handlerObjectAttach = null; //OnObjectAttach; |
149 | private SetAlwaysRun handlerSetAlwaysRun = null; //OnSetAlwaysRun; | 150 | private SetAlwaysRun handlerSetAlwaysRun = null; //OnSetAlwaysRun; |
150 | private GenericCall2 handlerCompleteMovementToRegion = null; //OnCompleteMovementToRegion; | 151 | private GenericCall2 handlerCompleteMovementToRegion = null; //OnCompleteMovementToRegion; |
@@ -690,6 +691,7 @@ namespace OpenSim.Region.ClientStack | |||
690 | public event SetAppearance OnSetAppearance; | 691 | public event SetAppearance OnSetAppearance; |
691 | public event AvatarNowWearing OnAvatarNowWearing; | 692 | public event AvatarNowWearing OnAvatarNowWearing; |
692 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 693 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
694 | public event UUIDNameRequest OnDetachAttachmentIntoInv; | ||
693 | public event ObjectAttach OnObjectAttach; | 695 | public event ObjectAttach OnObjectAttach; |
694 | public event ObjectDeselect OnObjectDetach; | 696 | public event ObjectDeselect OnObjectDetach; |
695 | public event GenericCall2 OnCompleteMovementToRegion; | 697 | public event GenericCall2 OnCompleteMovementToRegion; |
@@ -3442,6 +3444,18 @@ namespace OpenSim.Region.ClientStack | |||
3442 | } | 3444 | } |
3443 | 3445 | ||
3444 | break; | 3446 | break; |
3447 | case PacketType.DetachAttachmentIntoInv: | ||
3448 | handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; | ||
3449 | if (handlerDetachAttachmentIntoInv != null) | ||
3450 | { | ||
3451 | DetachAttachmentIntoInvPacket detachtoInv = (DetachAttachmentIntoInvPacket)Pack; | ||
3452 | |||
3453 | LLUUID itemID = detachtoInv.ObjectData.ItemID; | ||
3454 | LLUUID ATTACH_agentID = detachtoInv.ObjectData.AgentID; | ||
3455 | |||
3456 | handlerDetachAttachmentIntoInv(itemID, this); | ||
3457 | } | ||
3458 | break; | ||
3445 | case PacketType.ObjectAttach: | 3459 | case PacketType.ObjectAttach: |
3446 | if (OnObjectAttach != null) | 3460 | if (OnObjectAttach != null) |
3447 | { | 3461 | { |
@@ -3451,7 +3465,10 @@ namespace OpenSim.Region.ClientStack | |||
3451 | 3465 | ||
3452 | if (handlerObjectAttach != null) | 3466 | if (handlerObjectAttach != null) |
3453 | { | 3467 | { |
3454 | handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation); | 3468 | if (att.ObjectData.Length > 0) |
3469 | { | ||
3470 | handlerObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation); | ||
3471 | } | ||
3455 | } | 3472 | } |
3456 | } | 3473 | } |
3457 | 3474 | ||
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index e76cf70..104ae48 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -304,7 +304,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
304 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) | 304 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) |
305 | { | 305 | { |
306 | SceneObjectGroup group = (SceneObjectGroup)obj; | 306 | SceneObjectGroup group = (SceneObjectGroup)obj; |
307 | group.DetachToGround(); | 307 | |
308 | //group.DetachToGround(); | ||
309 | DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient); | ||
308 | } | 310 | } |
309 | } | 311 | } |
310 | } | 312 | } |
@@ -339,6 +341,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
339 | 341 | ||
340 | } | 342 | } |
341 | 343 | ||
344 | // What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards. | ||
345 | // To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID?? | ||
346 | public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient) | ||
347 | { | ||
348 | |||
349 | if (itemID == LLUUID.Zero) // If this happened, someone made a mistake.... | ||
350 | return; | ||
351 | |||
352 | List<EntityBase> EntityList = GetEntities(); | ||
353 | |||
354 | foreach (EntityBase obj in EntityList) | ||
355 | { | ||
356 | if (obj is SceneObjectGroup) | ||
357 | { | ||
358 | if (((SceneObjectGroup)obj).GetFromAssetID() == itemID) | ||
359 | { | ||
360 | SceneObjectGroup group = (SceneObjectGroup)obj; | ||
361 | group.DetachToInventoryPrep(); | ||
362 | m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | ||
363 | m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(),group.OwnerID); | ||
364 | m_parentScene.DeleteSceneObjectGroup(group); | ||
365 | } | ||
366 | } | ||
367 | } | ||
368 | |||
369 | } | ||
370 | |||
342 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos) | 371 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos) |
343 | { | 372 | { |
344 | List<EntityBase> EntityList = GetEntities(); | 373 | List<EntityBase> EntityList = GetEntities(); |
@@ -349,21 +378,36 @@ namespace OpenSim.Region.Environment.Scenes | |||
349 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) | 378 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) |
350 | { | 379 | { |
351 | SceneObjectGroup group = (SceneObjectGroup)obj; | 380 | SceneObjectGroup group = (SceneObjectGroup)obj; |
381 | |||
382 | // If the attachment point isn't the same as the one previously used | ||
383 | // set it's offset position = 0 so that it appears on the attachment point | ||
384 | // and not in a weird location somewhere unknown. | ||
385 | if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) | ||
386 | { | ||
387 | |||
388 | attachPos = LLVector3.Zero; | ||
389 | } | ||
390 | |||
391 | // AttachmentPt 0 means the client chose to 'wear' the attachment. | ||
352 | if (AttachmentPt == 0) | 392 | if (AttachmentPt == 0) |
353 | { | 393 | { |
394 | |||
354 | // Check object for stored attachment point | 395 | // Check object for stored attachment point |
355 | AttachmentPt = (uint)group.GetAttachmentPoint(); | 396 | AttachmentPt = (uint)group.GetAttachmentPoint(); |
397 | |||
356 | 398 | ||
399 | } | ||
357 | 400 | ||
358 | // if we still didn't find a suitable attachment point....... | 401 | // if we still didn't find a suitable attachment point....... |
359 | if (AttachmentPt == 0) | 402 | if (AttachmentPt == 0) |
360 | { | 403 | { |
361 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | 404 | // Stick it on left hand with Zero Offset from the attachment point. |
362 | attachPos = LLVector3.Zero; | 405 | AttachmentPt = (uint)AttachmentPoint.LeftHand; |
363 | } | 406 | attachPos = LLVector3.Zero; |
364 | |||
365 | |||
366 | } | 407 | } |
408 | m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt.ToString()); | ||
409 | |||
410 | |||
367 | 411 | ||
368 | // Saves and gets assetID | 412 | // Saves and gets assetID |
369 | if (group.GetFromAssetID() == LLUUID.Zero) | 413 | if (group.GetFromAssetID() == LLUUID.Zero) |
@@ -1071,12 +1115,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1071 | if (group != null) | 1115 | if (group != null) |
1072 | { | 1116 | { |
1073 | LLVector3 oldPos = group.AbsolutePosition; | 1117 | LLVector3 oldPos = group.AbsolutePosition; |
1074 | if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos)) | 1118 | if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) |
1075 | { | 1119 | { |
1076 | group.SendGroupTerseUpdate(); | 1120 | group.SendGroupTerseUpdate(); |
1077 | return; | 1121 | return; |
1078 | } | 1122 | } |
1079 | if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1123 | if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) |
1080 | { | 1124 | { |
1081 | group.UpdateSinglePosition(pos, localID); | 1125 | group.UpdateSinglePosition(pos, localID); |
1082 | } | 1126 | } |
@@ -1102,12 +1146,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
1102 | } | 1146 | } |
1103 | else | 1147 | else |
1104 | { | 1148 | { |
1105 | if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos)) | 1149 | if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment) |
1106 | { | 1150 | { |
1107 | group.SendGroupTerseUpdate(); | 1151 | group.SendGroupTerseUpdate(); |
1108 | return; | 1152 | return; |
1109 | } | 1153 | } |
1110 | if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1154 | if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment) |
1111 | { | 1155 | { |
1112 | group.UpdateGroupPosition(pos); | 1156 | group.UpdateGroupPosition(pos); |
1113 | } | 1157 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index a3e26b4..b5e2c40 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1002,6 +1002,93 @@ namespace OpenSim.Region.Environment.Scenes | |||
1002 | } | 1002 | } |
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID) | ||
1006 | { | ||
1007 | SceneObjectGroup objectGroup = grp; | ||
1008 | if (objectGroup != null) | ||
1009 | { | ||
1010 | string sceneObjectXml = objectGroup.ToXmlString(); | ||
1011 | |||
1012 | CachedUserInfo userInfo = | ||
1013 | CommsManager.UserProfileCacheService.GetUserDetails(agentID); | ||
1014 | if (userInfo != null) | ||
1015 | { | ||
1016 | Queue<InventoryFolderImpl> searchfolders = new Queue<InventoryFolderImpl>(); | ||
1017 | searchfolders.Enqueue(userInfo.RootFolder); | ||
1018 | |||
1019 | LLUUID foundFolder = userInfo.RootFolder.ID; | ||
1020 | |||
1021 | // search through folders to find the asset. | ||
1022 | while (searchfolders.Count > 0) | ||
1023 | { | ||
1024 | |||
1025 | InventoryFolderImpl fld = searchfolders.Dequeue(); | ||
1026 | lock (fld) | ||
1027 | { | ||
1028 | if (fld != null) | ||
1029 | { | ||
1030 | if (fld.Items.ContainsKey(assetID)) | ||
1031 | { | ||
1032 | foundFolder = fld.ID; | ||
1033 | searchfolders.Clear(); | ||
1034 | break; | ||
1035 | } | ||
1036 | else | ||
1037 | { | ||
1038 | foreach (InventoryFolderImpl subfld in fld.SubFolders.Values) | ||
1039 | { | ||
1040 | searchfolders.Enqueue(subfld); | ||
1041 | } | ||
1042 | } | ||
1043 | } | ||
1044 | } | ||
1045 | } | ||
1046 | AssetBase asset = CreateAsset( | ||
1047 | objectGroup.GetPartName(objectGroup.LocalId), | ||
1048 | objectGroup.GetPartDescription(objectGroup.LocalId), | ||
1049 | (sbyte)InventoryType.Object, | ||
1050 | (sbyte)AssetType.Object, | ||
1051 | Helpers.StringToField(sceneObjectXml)); | ||
1052 | AssetCache.AddAsset(asset); | ||
1053 | |||
1054 | InventoryItemBase item = new InventoryItemBase(); | ||
1055 | item.Creator = objectGroup.RootPart.CreatorID; | ||
1056 | item.Owner = agentID; | ||
1057 | item.ID = assetID; | ||
1058 | item.AssetID = asset.FullID; | ||
1059 | item.Description = asset.Description; | ||
1060 | item.Name = asset.Name; | ||
1061 | item.AssetType = asset.Type; | ||
1062 | item.InvType = asset.InvType; | ||
1063 | |||
1064 | // Sticking it in root folder for now.. objects folder later? | ||
1065 | |||
1066 | item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID; | ||
1067 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | ||
1068 | if (agentID != objectGroup.RootPart.OwnerID) | ||
1069 | { | ||
1070 | item.BasePermissions = objectGroup.RootPart.NextOwnerMask; | ||
1071 | item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1072 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1073 | } | ||
1074 | else | ||
1075 | { | ||
1076 | item.BasePermissions = objectGroup.RootPart.BaseMask; | ||
1077 | item.CurrentPermissions = objectGroup.RootPart.OwnerMask; | ||
1078 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1079 | } | ||
1080 | |||
1081 | userInfo.AddItem(agentID, item); | ||
1082 | |||
1083 | // this gets called when the agent loggs off! | ||
1084 | if (remoteClient != null) | ||
1085 | { | ||
1086 | remoteClient.SendInventoryItemCreateUpdate(item); | ||
1087 | } | ||
1088 | |||
1089 | } | ||
1090 | } | ||
1091 | } | ||
1005 | public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId) | 1092 | public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId) |
1006 | { | 1093 | { |
1007 | SceneObjectGroup objectGroup = grp; | 1094 | SceneObjectGroup objectGroup = grp; |
@@ -1184,7 +1271,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1184 | } | 1271 | } |
1185 | 1272 | ||
1186 | rootPart.TrimPermissions(); | 1273 | rootPart.TrimPermissions(); |
1187 | group.ApplyPhysics(m_physicalPrim); | 1274 | |
1275 | if (!attachment) | ||
1276 | { | ||
1277 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
1278 | { | ||
1279 | group.RootPart.Shape.State = (byte)0; | ||
1280 | } | ||
1281 | group.ApplyPhysics(m_physicalPrim); | ||
1282 | } | ||
1283 | |||
1284 | |||
1188 | group.StartScripts(); | 1285 | group.StartScripts(); |
1189 | 1286 | ||
1190 | 1287 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a9fa93e..f94aec7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1471,6 +1471,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1471 | ScenePresence sp = GetScenePresence(grp.OwnerID); | 1471 | ScenePresence sp = GetScenePresence(grp.OwnerID); |
1472 | if (sp != null) | 1472 | if (sp != null) |
1473 | { | 1473 | { |
1474 | // hack assetID until we get assetID into the XML format. | ||
1475 | // LastOwnerID is used for group deeding, so when you do stuff | ||
1476 | // with the deeded object, it goes back to them | ||
1477 | |||
1478 | grp.SetFromAssetID(grp.RootPart.LastOwnerID); | ||
1474 | m_innerScene.AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition); | 1479 | m_innerScene.AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition); |
1475 | } | 1480 | } |
1476 | } | 1481 | } |
@@ -1560,6 +1565,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1560 | client.OnDeRezObject += DeRezObject; | 1565 | client.OnDeRezObject += DeRezObject; |
1561 | client.OnRezObject += RezObject; | 1566 | client.OnRezObject += RezObject; |
1562 | client.OnRezSingleAttachmentFromInv += m_innerScene.RezSingleAttachment; | 1567 | client.OnRezSingleAttachmentFromInv += m_innerScene.RezSingleAttachment; |
1568 | client.OnDetachAttachmentIntoInv += m_innerScene.DetachSingleAttachmentToInv; | ||
1563 | client.OnObjectAttach += m_innerScene.AttachObject; | 1569 | client.OnObjectAttach += m_innerScene.AttachObject; |
1564 | client.OnObjectDetach += m_innerScene.DetachObject; | 1570 | client.OnObjectDetach += m_innerScene.DetachObject; |
1565 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | 1571 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 2493ed8..ba318a8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -663,9 +663,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
663 | { | 663 | { |
664 | m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); | 664 | m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); |
665 | m_rootPart.PhysActor = null; | 665 | m_rootPart.PhysActor = null; |
666 | AbsolutePosition = AttachOffset; | 666 | |
667 | m_rootPart.m_attachedPos = AttachOffset; | ||
668 | } | 667 | } |
668 | |||
669 | AbsolutePosition = AttachOffset; | ||
670 | m_rootPart.m_attachedPos = AttachOffset; | ||
669 | m_rootPart.m_IsAttachment = true; | 671 | m_rootPart.m_IsAttachment = true; |
670 | 672 | ||
671 | m_rootPart.SetParentLocalId(avatar.LocalId); | 673 | m_rootPart.SetParentLocalId(avatar.LocalId); |
@@ -702,6 +704,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
702 | AttachToBackup(); | 704 | AttachToBackup(); |
703 | m_rootPart.ScheduleFullUpdate(); | 705 | m_rootPart.ScheduleFullUpdate(); |
704 | } | 706 | } |
707 | public void DetachToInventoryPrep() | ||
708 | { | ||
709 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar); | ||
710 | //LLVector3 detachedpos = new LLVector3(127f, 127f, 127f); | ||
711 | if (avatar != null) | ||
712 | { | ||
713 | //detachedpos = avatar.AbsolutePosition; | ||
714 | avatar.RemoveAttachment(this); | ||
715 | } | ||
716 | |||
717 | m_rootPart.m_attachedAvatar = LLUUID.Zero; | ||
718 | m_rootPart.SetParentLocalId(0); | ||
719 | //m_rootPart.SetAttachmentPoint((byte)0); | ||
720 | m_rootPart.m_IsAttachment = false; | ||
721 | AbsolutePosition = m_rootPart.m_attachedPos; | ||
722 | //m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); | ||
723 | //AttachToBackup(); | ||
724 | //m_rootPart.ScheduleFullUpdate(); | ||
725 | |||
726 | } | ||
705 | /// <summary> | 727 | /// <summary> |
706 | /// | 728 | /// |
707 | /// </summary> | 729 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 0849698..74e9cdc 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1906,6 +1906,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1906 | 1906 | ||
1907 | internal void Close() | 1907 | internal void Close() |
1908 | { | 1908 | { |
1909 | lock (m_attachments) | ||
1910 | { | ||
1911 | foreach (SceneObjectGroup grp in m_attachments) | ||
1912 | { | ||
1913 | // ControllingClient may be null at this point! | ||
1914 | m_scene.m_innerScene.DetachSingleAttachmentToInv(grp.GetFromAssetID(), ControllingClient); | ||
1915 | } | ||
1916 | m_attachments.Clear(); | ||
1917 | } | ||
1909 | lock (m_knownPrimUUID) | 1918 | lock (m_knownPrimUUID) |
1910 | { | 1919 | { |
1911 | m_knownPrimUUID.Clear(); | 1920 | m_knownPrimUUID.Clear(); |
@@ -1972,6 +1981,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1972 | gobj.RootPart.SetParentLocalId(0); | 1981 | gobj.RootPart.SetParentLocalId(0); |
1973 | gobj.RootPart.m_IsAttachment = false; | 1982 | gobj.RootPart.m_IsAttachment = false; |
1974 | gobj.AbsolutePosition = gobj.RootPart.m_attachedPos; | 1983 | gobj.AbsolutePosition = gobj.RootPart.m_attachedPos; |
1984 | gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); | ||
1975 | m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj); | 1985 | m_scene.CrossPrimGroupIntoNewRegion(regionHandle, gobj); |
1976 | } | 1986 | } |
1977 | } | 1987 | } |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 4dc13f5..9e57da5 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -60,6 +60,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
60 | public event SetAppearance OnSetAppearance; | 60 | public event SetAppearance OnSetAppearance; |
61 | public event AvatarNowWearing OnAvatarNowWearing; | 61 | public event AvatarNowWearing OnAvatarNowWearing; |
62 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 62 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
63 | public event UUIDNameRequest OnDetachAttachmentIntoInv; | ||
63 | public event ObjectAttach OnObjectAttach; | 64 | public event ObjectAttach OnObjectAttach; |
64 | public event ObjectDeselect OnObjectDetach; | 65 | public event ObjectDeselect OnObjectDetach; |
65 | public event StartAnim OnStartAnim; | 66 | public event StartAnim OnStartAnim; |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 5a5cf59..cf2e694 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -150,22 +150,22 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
150 | _velocity = new PhysicsVector(); | 150 | _velocity = new PhysicsVector(); |
151 | _position = pos; | 151 | _position = pos; |
152 | m_taintposition = pos; | 152 | m_taintposition = pos; |
153 | if (_position.X > 257) | 153 | //if (_position.X > 257) |
154 | { | 154 | //{ |
155 | _position.X = 257; | 155 | //_position.X = 257; |
156 | } | 156 | //} |
157 | if (_position.X < 0) | 157 | //if (_position.X < 0) |
158 | { | 158 | //{ |
159 | _position.X = 0; | 159 | //_position.X = 0; |
160 | } | 160 | //} |
161 | if (_position.Y > 257) | 161 | //if (_position.Y > 257) |
162 | { | 162 | //{ |
163 | _position.Y = 257; | 163 | //_position.Y = 257; |
164 | } | 164 | //} |
165 | if (_position.Y < 0) | 165 | //if (_position.Y < 0) |
166 | { | 166 | //{ |
167 | _position.Y = 0; | 167 | // _position.Y = 0; |
168 | } | 168 | //} |
169 | 169 | ||
170 | prim_geom = (IntPtr)0; | 170 | prim_geom = (IntPtr)0; |
171 | prev_geom = (IntPtr)0; | 171 | prev_geom = (IntPtr)0; |