From 911e63765c7cea748b5ae2227f5c1d6ff131d329 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 27 Apr 2008 20:10:28 +0000 Subject: * 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. --- .../Region/Environment/Scenes/Scene.Inventory.cs | 99 +++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs') 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 } } } + public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID) + { + SceneObjectGroup objectGroup = grp; + if (objectGroup != null) + { + string sceneObjectXml = objectGroup.ToXmlString(); + + CachedUserInfo userInfo = + CommsManager.UserProfileCacheService.GetUserDetails(agentID); + if (userInfo != null) + { + Queue searchfolders = new Queue(); + searchfolders.Enqueue(userInfo.RootFolder); + + LLUUID foundFolder = userInfo.RootFolder.ID; + + // search through folders to find the asset. + while (searchfolders.Count > 0) + { + + InventoryFolderImpl fld = searchfolders.Dequeue(); + lock (fld) + { + if (fld != null) + { + if (fld.Items.ContainsKey(assetID)) + { + foundFolder = fld.ID; + searchfolders.Clear(); + break; + } + else + { + foreach (InventoryFolderImpl subfld in fld.SubFolders.Values) + { + searchfolders.Enqueue(subfld); + } + } + } + } + } + AssetBase asset = CreateAsset( + objectGroup.GetPartName(objectGroup.LocalId), + objectGroup.GetPartDescription(objectGroup.LocalId), + (sbyte)InventoryType.Object, + (sbyte)AssetType.Object, + Helpers.StringToField(sceneObjectXml)); + AssetCache.AddAsset(asset); + + InventoryItemBase item = new InventoryItemBase(); + item.Creator = objectGroup.RootPart.CreatorID; + item.Owner = agentID; + item.ID = assetID; + item.AssetID = asset.FullID; + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; + item.InvType = asset.InvType; + + // Sticking it in root folder for now.. objects folder later? + + item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID; + item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; + if (agentID != objectGroup.RootPart.OwnerID) + { + item.BasePermissions = objectGroup.RootPart.NextOwnerMask; + item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; + item.NextPermissions = objectGroup.RootPart.NextOwnerMask; + } + else + { + item.BasePermissions = objectGroup.RootPart.BaseMask; + item.CurrentPermissions = objectGroup.RootPart.OwnerMask; + item.NextPermissions = objectGroup.RootPart.NextOwnerMask; + } + + userInfo.AddItem(agentID, item); + + // this gets called when the agent loggs off! + if (remoteClient != null) + { + remoteClient.SendInventoryItemCreateUpdate(item); + } + + } + } + } public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId) { SceneObjectGroup objectGroup = grp; @@ -1184,7 +1271,17 @@ namespace OpenSim.Region.Environment.Scenes } rootPart.TrimPermissions(); - group.ApplyPhysics(m_physicalPrim); + + if (!attachment) + { + if (group.RootPart.Shape.PCode == (byte)PCode.Prim) + { + group.RootPart.Shape.State = (byte)0; + } + group.ApplyPhysics(m_physicalPrim); + } + + group.StartScripts(); -- cgit v1.1