* 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.
This commit is contained in:
Teravus Ovares
2008-04-27 20:10:28 +00:00
parent 56497c9615
commit 911e63765c
10 changed files with 241 additions and 34 deletions

View File

@@ -304,7 +304,9 @@ namespace OpenSim.Region.Environment.Scenes
if (((SceneObjectGroup)obj).LocalId == objectLocalID)
{
SceneObjectGroup group = (SceneObjectGroup)obj;
group.DetachToGround();
//group.DetachToGround();
DetachSingleAttachmentToInv(group.GetFromAssetID(),remoteClient);
}
}
}
@@ -339,6 +341,33 @@ namespace OpenSim.Region.Environment.Scenes
}
// What makes this method odd and unique is it tries to detach using an LLUUID.... Yay for standards.
// To LocalId or LLUUID, *THAT* is the question. How now Brown LLUUID??
public void DetachSingleAttachmentToInv(LLUUID itemID, IClientAPI remoteClient)
{
if (itemID == LLUUID.Zero) // If this happened, someone made a mistake....
return;
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase obj in EntityList)
{
if (obj is SceneObjectGroup)
{
if (((SceneObjectGroup)obj).GetFromAssetID() == itemID)
{
SceneObjectGroup group = (SceneObjectGroup)obj;
group.DetachToInventoryPrep();
m_log.Debug("[DETACH]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(),group.OwnerID);
m_parentScene.DeleteSceneObjectGroup(group);
}
}
}
}
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, LLVector3 attachPos)
{
List<EntityBase> EntityList = GetEntities();
@@ -349,22 +378,37 @@ namespace OpenSim.Region.Environment.Scenes
if (((SceneObjectGroup)obj).LocalId == objectLocalID)
{
SceneObjectGroup group = (SceneObjectGroup)obj;
// If the attachment point isn't the same as the one previously used
// set it's offset position = 0 so that it appears on the attachment point
// and not in a weird location somewhere unknown.
if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
{
attachPos = LLVector3.Zero;
}
// AttachmentPt 0 means the client chose to 'wear' the attachment.
if (AttachmentPt == 0)
{
// Check object for stored attachment point
AttachmentPt = (uint)group.GetAttachmentPoint();
// if we still didn't find a suitable attachment point.......
if (AttachmentPt == 0)
{
AttachmentPt = (uint)AttachmentPoint.LeftHand;
attachPos = LLVector3.Zero;
}
}
// if we still didn't find a suitable attachment point.......
if (AttachmentPt == 0)
{
// Stick it on left hand with Zero Offset from the attachment point.
AttachmentPt = (uint)AttachmentPoint.LeftHand;
attachPos = LLVector3.Zero;
}
m_log.Debug("[ATTACH]: Using attachpoint: " + AttachmentPt.ToString());
// Saves and gets assetID
if (group.GetFromAssetID() == LLUUID.Zero)
{
@@ -1071,12 +1115,12 @@ namespace OpenSim.Region.Environment.Scenes
if (group != null)
{
LLVector3 oldPos = group.AbsolutePosition;
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos))
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
{
group.SendGroupTerseUpdate();
return;
}
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
{
group.UpdateSinglePosition(pos, localID);
}
@@ -1102,12 +1146,12 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos))
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
{
group.SendGroupTerseUpdate();
return;
}
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
{
group.UpdateGroupPosition(pos);
}