Taking Prims (SceneObjectGroups) in and out of inventory should now work and if left in inventory will still be there after restarts. (as with the rest of inventory it will only fully work in standalone mode with account authentication turned on).
parent
915f8cc1a1
commit
531f64a53b
|
@ -137,6 +137,16 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AssetBase GetAsset(LLUUID assetID, bool isTexture)
|
||||||
|
{
|
||||||
|
AssetBase asset = GetAsset(assetID);
|
||||||
|
if (asset == null)
|
||||||
|
{
|
||||||
|
this._assetServer.RequestAsset(assetID, isTexture);
|
||||||
|
}
|
||||||
|
return asset;
|
||||||
|
}
|
||||||
|
|
||||||
public void AddAsset(AssetBase asset)
|
public void AddAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
// Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
|
// Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
|
||||||
|
@ -241,44 +251,51 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
if (IsTexture)
|
if (IsTexture)
|
||||||
{
|
{
|
||||||
// Console.WriteLine("asset recieved from asset server");
|
// Console.WriteLine("asset recieved from asset server");
|
||||||
|
|
||||||
TextureImage image = new TextureImage(asset);
|
TextureImage image = new TextureImage(asset);
|
||||||
this.Textures.Add(image.FullID, image);
|
if (!this.Textures.ContainsKey(image.FullID))
|
||||||
if (this.RequestedTextures.ContainsKey(image.FullID))
|
|
||||||
{
|
{
|
||||||
AssetRequest req = this.RequestedTextures[image.FullID];
|
this.Textures.Add(image.FullID, image);
|
||||||
req.ImageInfo = image;
|
if (this.RequestedTextures.ContainsKey(image.FullID))
|
||||||
if (image.Data.LongLength > 600)
|
|
||||||
{
|
{
|
||||||
//over 600 bytes so split up file
|
AssetRequest req = this.RequestedTextures[image.FullID];
|
||||||
req.NumPackets = 1 + (int)(image.Data.Length - 600 ) / 1000;
|
req.ImageInfo = image;
|
||||||
|
if (image.Data.LongLength > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req.NumPackets = 1;
|
||||||
|
}
|
||||||
|
this.RequestedTextures.Remove(image.FullID);
|
||||||
|
this.TextureRequests.Add(req);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
req.NumPackets = 1;
|
|
||||||
}
|
|
||||||
this.RequestedTextures.Remove(image.FullID);
|
|
||||||
this.TextureRequests.Add(req);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AssetInfo assetInf = new AssetInfo(asset);
|
AssetInfo assetInf = new AssetInfo(asset);
|
||||||
this.Assets.Add(assetInf.FullID, assetInf);
|
if (!this.Assets.ContainsKey(assetInf.FullID))
|
||||||
if (this.RequestedAssets.ContainsKey(assetInf.FullID))
|
|
||||||
{
|
{
|
||||||
AssetRequest req = this.RequestedAssets[assetInf.FullID];
|
this.Assets.Add(assetInf.FullID, assetInf);
|
||||||
req.AssetInf = assetInf;
|
if (this.RequestedAssets.ContainsKey(assetInf.FullID))
|
||||||
if (assetInf.Data.LongLength > 600)
|
|
||||||
{
|
{
|
||||||
//over 600 bytes so split up file
|
AssetRequest req = this.RequestedAssets[assetInf.FullID];
|
||||||
req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
|
req.AssetInf = assetInf;
|
||||||
|
if (assetInf.Data.LongLength > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req.NumPackets = 1;
|
||||||
|
}
|
||||||
|
this.RequestedAssets.Remove(assetInf.FullID);
|
||||||
|
this.AssetRequests.Add(req);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
req.NumPackets = 1;
|
|
||||||
}
|
|
||||||
this.RequestedAssets.Remove(assetInf.FullID);
|
|
||||||
this.AssetRequests.Add(req);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,13 +105,27 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateItem(LLUUID userID, InventoryItemBase itemInfo)
|
public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
|
||||||
{
|
{
|
||||||
if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
|
if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
|
||||||
{
|
{
|
||||||
this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo);
|
this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteItem(LLUUID userID, InventoryItemBase item)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
|
||||||
|
{
|
||||||
|
result = RootFolder.DeleteItem(item.inventoryID);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
this.m_parentCommsManager.InventoryServer.DeleteInventoryItem(userID, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,26 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
return base2;
|
return base2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteItem(LLUUID itemID)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
if (this.Items.ContainsKey(itemID))
|
||||||
|
{
|
||||||
|
Items.Remove(itemID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
foreach (InventoryFolder folder in this.SubFolders.Values)
|
||||||
|
{
|
||||||
|
found = folder.DeleteItem(itemID);
|
||||||
|
if (found == true)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public InventoryFolder HasSubFolder(LLUUID folderID)
|
public InventoryFolder HasSubFolder(LLUUID folderID)
|
||||||
{
|
{
|
||||||
InventoryFolder returnFolder = null;
|
InventoryFolder returnFolder = null;
|
||||||
|
|
|
@ -16,5 +16,6 @@ namespace OpenSim.Framework.Communications
|
||||||
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
|
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
|
||||||
void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
|
void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
|
||||||
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
|
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,6 +319,15 @@ namespace OpenSim.Framework.Data.MySQL
|
||||||
addInventoryItem(item);
|
addInventoryItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
public void deleteInventoryItem(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new inventory folder
|
/// Creates a new inventory folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -446,6 +446,23 @@ namespace OpenSim.Framework.Data.SQLite
|
||||||
this.addItem(item);
|
this.addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
public void deleteInventoryItem(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||||
|
|
||||||
|
DataRow inventoryRow = inventoryItemTable.Rows.Find(item.inventoryID);
|
||||||
|
if (inventoryRow != null)
|
||||||
|
{
|
||||||
|
inventoryRow.Delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.invItemsDa.Update(ds, "inventoryitems");
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new folder specified by folder
|
/// Adds a new folder specified by folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -201,6 +201,12 @@ namespace OpenSim.Framework.Data
|
||||||
/// <param name="item">The updated item</param>
|
/// <param name="item">The updated item</param>
|
||||||
void updateInventoryItem(InventoryItemBase item);
|
void updateInventoryItem(InventoryItemBase item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
void deleteInventoryItem(InventoryItemBase item);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new folder specified by folder
|
/// Adds a new folder specified by folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace OpenSim.Framework.Interfaces
|
||||||
{
|
{
|
||||||
public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
|
public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
|
||||||
public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message); // Cut down from full list
|
public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message); // Cut down from full list
|
||||||
public delegate void RezObject(AssetBase primAsset, LLVector3 pos);
|
public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
|
||||||
public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
|
public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
|
||||||
public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
|
public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
|
||||||
public delegate void StartAnim(LLUUID animID, int seq);
|
public delegate void StartAnim(LLUUID animID, int seq);
|
||||||
|
@ -210,6 +210,7 @@ namespace OpenSim.Framework.Interfaces
|
||||||
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
|
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
|
||||||
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
|
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
|
||||||
void SendInventoryItemUpdate(InventoryItemBase Item);
|
void SendInventoryItemUpdate(InventoryItemBase Item);
|
||||||
|
void SendRemoveInventoryItem(LLUUID itemID);
|
||||||
void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
|
void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
|
||||||
|
|
||||||
void SendNameReply(LLUUID profileId, string firstname, string lastname);
|
void SendNameReply(LLUUID profileId, string firstname, string lastname);
|
||||||
|
|
|
@ -138,6 +138,7 @@ namespace OpenSim.Framework
|
||||||
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){}
|
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){}
|
||||||
public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item){}
|
public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item){}
|
||||||
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
|
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
|
||||||
|
public virtual void SendRemoveInventoryItem(LLUUID itemID) { }
|
||||||
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
|
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
|
||||||
|
|
||||||
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
|
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){}
|
||||||
|
|
|
@ -124,6 +124,14 @@ namespace OpenSim.Framework.InventoryServiceBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteItem(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
|
{
|
||||||
|
plugin.Value.deleteInventoryItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -630,6 +630,18 @@ namespace OpenSim.Region.ClientStack
|
||||||
OutPacket(InventoryReply);
|
OutPacket(InventoryReply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendRemoveInventoryItem(LLUUID itemID)
|
||||||
|
{
|
||||||
|
RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
|
||||||
|
remove.AgentData.AgentID = this.AgentID;
|
||||||
|
remove.AgentData.SessionID = this.SessionID;
|
||||||
|
remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1];
|
||||||
|
remove.InventoryData[0] = new RemoveInventoryItemPacket.InventoryDataBlock();
|
||||||
|
remove.InventoryData[0].ItemID = itemID;
|
||||||
|
|
||||||
|
OutPacket(remove);
|
||||||
|
}
|
||||||
|
|
||||||
public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
|
public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
|
||||||
{
|
{
|
||||||
ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
|
ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
|
||||||
|
|
|
@ -45,12 +45,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
get { return m_moneyBalance; }
|
get { return m_moneyBalance; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddMoney( int debit )
|
public bool AddMoney(int debit)
|
||||||
{
|
{
|
||||||
if( m_moneyBalance + debit >= 0 )
|
if (m_moneyBalance + debit >= 0)
|
||||||
{
|
{
|
||||||
m_moneyBalance += debit;
|
m_moneyBalance += debit;
|
||||||
SendMoneyBalance( LLUUID.Zero, true, Helpers.StringToField("Poof Poof!"), m_moneyBalance );
|
SendMoneyBalance(LLUUID.Zero, true, Helpers.StringToField("Poof Poof!"), m_moneyBalance);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -126,21 +126,9 @@ namespace OpenSim.Region.ClientStack
|
||||||
break;
|
break;
|
||||||
case PacketType.RezObject:
|
case PacketType.RezObject:
|
||||||
RezObjectPacket rezPacket = (RezObjectPacket)Pack;
|
RezObjectPacket rezPacket = (RezObjectPacket)Pack;
|
||||||
AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID);
|
if (OnRezObject != null)
|
||||||
if (inven != null)
|
|
||||||
{
|
{
|
||||||
if (inven.InventoryItems.ContainsKey(rezPacket.InventoryData.ItemID))
|
this.OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd);
|
||||||
{
|
|
||||||
AssetBase asset = this.m_assetCache.GetAsset(inven.InventoryItems[rezPacket.InventoryData.ItemID].AssetID);
|
|
||||||
if (asset != null)
|
|
||||||
{
|
|
||||||
if (OnRezObject != null)
|
|
||||||
{
|
|
||||||
this.OnRezObject(asset, rezPacket.RezData.RayEnd);
|
|
||||||
this.m_inventoryCache.DeleteInventoryItem(this, rezPacket.InventoryData.ItemID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.DeRezObject:
|
case PacketType.DeRezObject:
|
||||||
|
|
|
@ -63,5 +63,10 @@ namespace OpenSim.Region.Communications.Local
|
||||||
{
|
{
|
||||||
this.AddItem(item);
|
this.AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||||
|
{
|
||||||
|
this.deleteItem(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,5 +29,10 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ using OpenSim.Framework.Interfaces;
|
||||||
using OpenSim.Framework.Types;
|
using OpenSim.Framework.Types;
|
||||||
using OpenSim.Framework.Communications.Caches;
|
using OpenSim.Framework.Communications.Caches;
|
||||||
using OpenSim.Framework.Data;
|
using OpenSim.Framework.Data;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Scenes
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
|
@ -206,22 +207,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="primAsset"></param>
|
|
||||||
/// <param name="pos"></param>
|
|
||||||
public void RezObject(AssetBase primAsset, LLVector3 pos)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="packet"></param>
|
/// <param name="packet"></param>
|
||||||
/// <param name="simClient"></param>
|
/// <param name="simClient"></param>
|
||||||
public void DeRezObject(Packet packet, IClientAPI simClient)
|
public void DeRezObject(Packet packet, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
|
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet;
|
||||||
|
|
||||||
|
@ -246,17 +237,44 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
if (selectedEnt != null)
|
if (selectedEnt != null)
|
||||||
{
|
{
|
||||||
if (PermissionsMngr.CanDeRezObject(simClient.AgentId, selectedEnt.m_uuid))
|
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId,((SceneObjectGroup)selectedEnt).UUID))
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = this.RequestAvatarList();
|
string sceneObjectXml = ((SceneObjectGroup)selectedEnt).ToXmlString();
|
||||||
foreach (ScenePresence avatar in avatars)
|
CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
|
||||||
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
avatar.ControllingClient.SendKillObject(this.m_regionHandle, selectedEnt.LocalId);
|
AssetBase asset = new AssetBase();
|
||||||
|
asset.Name = ((SceneObjectGroup)selectedEnt).GetPartName(selectedEnt.LocalId);
|
||||||
|
asset.Description = ((SceneObjectGroup)selectedEnt).GetPartDescription(selectedEnt.LocalId);
|
||||||
|
asset.InvType = 6;
|
||||||
|
asset.Type = 6;
|
||||||
|
asset.FullID = LLUUID.Random();
|
||||||
|
asset.Data = Helpers.StringToField(sceneObjectXml);
|
||||||
|
this.assetCache.AddAsset(asset);
|
||||||
|
|
||||||
|
|
||||||
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
item.avatarID = remoteClient.AgentId;
|
||||||
|
item.creatorsID = remoteClient.AgentId;
|
||||||
|
item.inventoryID = LLUUID.Random();
|
||||||
|
item.assetID = asset.FullID;
|
||||||
|
item.inventoryDescription = asset.Description;
|
||||||
|
item.inventoryName = asset.Name;
|
||||||
|
item.assetType = asset.Type;
|
||||||
|
item.invType = asset.InvType;
|
||||||
|
item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
|
||||||
|
item.inventoryCurrentPermissions = 2147483647;
|
||||||
|
item.inventoryNextPermissions = 2147483647;
|
||||||
|
|
||||||
|
userInfo.AddItem(remoteClient.AgentId, item);
|
||||||
|
remoteClient.SendInventoryItemUpdate(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((SceneObjectGroup)selectedEnt).DeleteGroup();
|
||||||
|
|
||||||
lock (Entities)
|
lock (Entities)
|
||||||
{
|
{
|
||||||
Entities.Remove(selectedEnt.m_uuid);
|
Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,6 +282,45 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
|
||||||
|
{
|
||||||
|
CachedUserInfo userInfo = commsManager.UserProfiles.GetUserDetails(remoteClient.AgentId);
|
||||||
|
if (userInfo != null)
|
||||||
|
{
|
||||||
|
if(userInfo.RootFolder != null)
|
||||||
|
{
|
||||||
|
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
AssetBase rezAsset = this.assetCache.GetAsset(item.assetID, false);
|
||||||
|
if (rezAsset != null)
|
||||||
|
{
|
||||||
|
this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
|
||||||
|
userInfo.DeleteItem(remoteClient.AgentId, item);
|
||||||
|
remoteClient.SendRemoveInventoryItem(itemID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rezAsset = this.assetCache.GetAsset(item.assetID, false);
|
||||||
|
if (rezAsset != null)
|
||||||
|
{
|
||||||
|
this.AddRezObject(Util.FieldToString(rezAsset.Data), pos);
|
||||||
|
userInfo.DeleteItem(remoteClient.AgentId, item);
|
||||||
|
remoteClient.SendRemoveInventoryItem(itemID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddRezObject(string xmlData, LLVector3 pos)
|
||||||
|
{
|
||||||
|
SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData);
|
||||||
|
this.AddEntity(group);
|
||||||
|
group.Pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -301,11 +358,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
this.Entities.Add(copy.UUID, copy);
|
this.Entities.Add(copy.UUID, copy);
|
||||||
|
|
||||||
copy.ScheduleGroupForFullUpdate();
|
copy.ScheduleGroupForFullUpdate();
|
||||||
/* List<ScenePresence> avatars = this.RequestAvatarList();
|
/* List<ScenePresence> avatars = this.RequestAvatarList();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Count; i++)
|
||||||
{
|
{
|
||||||
// copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
|
// copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -620,7 +677,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (hasPrim != false)
|
if (hasPrim != false)
|
||||||
{
|
{
|
||||||
((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot);
|
((SceneObjectGroup)ent).UpdateGroupRotation(pos, rot);
|
||||||
// prim.UpdateGroupMouseRotation(pos, rot);
|
// prim.UpdateGroupMouseRotation(pos, rot);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -665,7 +722,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (ent is SceneObjectGroup)
|
if (ent is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
// prim = ((SceneObject)ent).HasChildPrim(localID);
|
// prim = ((SceneObject)ent).HasChildPrim(localID);
|
||||||
if (prim != null)
|
if (prim != null)
|
||||||
{
|
{
|
||||||
prim.UpdateSingleRotation(rot);
|
prim.UpdateSingleRotation(rot);
|
||||||
|
@ -692,7 +749,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (hasPrim != false)
|
if (hasPrim != false)
|
||||||
{
|
{
|
||||||
((SceneObjectGroup)ent).Resize(scale, localID);
|
((SceneObjectGroup)ent).Resize(scale, localID);
|
||||||
// prim.ResizeGoup(scale);
|
// prim.ResizeGoup(scale);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -538,7 +538,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void AddEntity(SceneObjectGroup sceneObject)
|
public void AddEntity(SceneObjectGroup sceneObject)
|
||||||
{
|
{
|
||||||
Entities.Add(sceneObject.UUID, sceneObject);
|
if(!Entities.ContainsKey(sceneObject.UUID))
|
||||||
|
{
|
||||||
|
Entities.Add(sceneObject.UUID, sceneObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveEntity(SceneObjectGroup sceneObject)
|
public void RemoveEntity(SceneObjectGroup sceneObject)
|
||||||
|
@ -604,6 +607,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
client.OnObjectDeselect += DeselectPrim;
|
client.OnObjectDeselect += DeselectPrim;
|
||||||
client.OnGrabUpdate += MoveObject;
|
client.OnGrabUpdate += MoveObject;
|
||||||
client.OnDeRezObject += DeRezObject;
|
client.OnDeRezObject += DeRezObject;
|
||||||
|
client.OnRezObject += RezObject;
|
||||||
client.OnNameFromUUIDRequest += commsManager.HandleUUIDNameRequest;
|
client.OnNameFromUUIDRequest += commsManager.HandleUUIDNameRequest;
|
||||||
client.OnObjectDescription += PrimDescription;
|
client.OnObjectDescription += PrimDescription;
|
||||||
client.OnObjectName += PrimName;
|
client.OnObjectName += PrimName;
|
||||||
|
@ -1114,7 +1118,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
this.assetCache.AddAsset(asset);
|
this.assetCache.AddAsset(asset);
|
||||||
|
|
||||||
item.assetID = asset.FullID;
|
item.assetID = asset.FullID;
|
||||||
userInfo.updateItem(remoteClient.AgentId, item);
|
userInfo.UpdateItem(remoteClient.AgentId, item);
|
||||||
|
|
||||||
// remoteClient.SendInventoryItemUpdate(item);
|
// remoteClient.SendInventoryItemUpdate(item);
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
get { return m_rootPart.OwnerID; }
|
get { return m_rootPart.OwnerID; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get { return m_rootPart.Text; }
|
||||||
|
set { m_rootPart.Text = value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Added because the Parcel code seems to use it
|
/// Added because the Parcel code seems to use it
|
||||||
/// but not sure a object should have this
|
/// but not sure a object should have this
|
||||||
|
@ -143,19 +149,40 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
StringReader sr = new StringReader(xmlData);
|
StringReader sr = new StringReader(xmlData);
|
||||||
XmlTextReader reader = new XmlTextReader(sr);
|
XmlTextReader reader = new XmlTextReader(sr);
|
||||||
|
reader.Read();
|
||||||
reader.ReadStartElement("SceneObjectGroup");
|
reader.ReadStartElement("SceneObjectGroup");
|
||||||
reader.ReadStartElement("RootPart");
|
reader.ReadStartElement("RootPart");
|
||||||
this.m_rootPart = SceneObjectPart.FromXml(reader);
|
this.m_rootPart = SceneObjectPart.FromXml(reader);
|
||||||
reader.ReadEndElement();
|
reader.ReadEndElement();
|
||||||
//TODO: read and create rest of the parts
|
|
||||||
reader.ReadEndElement();
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
switch (reader.NodeType)
|
||||||
|
{
|
||||||
|
case XmlNodeType.Element:
|
||||||
|
if (reader.Name == "Part")
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
SceneObjectPart Part = SceneObjectPart.FromXml(reader);
|
||||||
|
Part.LocalID = m_scene.PrimIDAllocate();
|
||||||
|
this.AddPart(Part);
|
||||||
|
Part.RegionHandle = m_regionHandle;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case XmlNodeType.EndElement:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
|
this.m_rootPart.SetParent(this);
|
||||||
this.m_parts.Add(m_rootPart.UUID, m_rootPart);
|
this.m_parts.Add(m_rootPart.UUID, m_rootPart);
|
||||||
this.m_rootPart.LocalID = m_scene.PrimIDAllocate();
|
this.m_rootPart.LocalID = m_scene.PrimIDAllocate();
|
||||||
|
this.m_rootPart.ParentID = 0;
|
||||||
this.m_rootPart.RegionHandle = m_regionHandle;
|
this.m_rootPart.RegionHandle = m_regionHandle;
|
||||||
|
this.UpdateParentIDs();
|
||||||
m_scene.EventManager.OnBackup += this.ProcessBackup;
|
m_scene.EventManager.OnBackup += this.ProcessBackup;
|
||||||
|
this.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -192,6 +219,17 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
|
writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
|
||||||
m_rootPart.ToXml(writer);
|
m_rootPart.ToXml(writer);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
|
||||||
|
foreach (SceneObjectPart part in this.m_parts.Values)
|
||||||
|
{
|
||||||
|
if (part.UUID != this.m_rootPart.UUID)
|
||||||
|
{
|
||||||
|
writer.WriteStartElement(String.Empty, "Part", String.Empty);
|
||||||
|
part.ToXml(writer);
|
||||||
|
writer.WriteEndElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writer.WriteEndElement();
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
// System.Console.WriteLine("prim: " + sw.ToString());
|
// System.Console.WriteLine("prim: " + sw.ToString());
|
||||||
|
@ -477,13 +515,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Text
|
|
||||||
{
|
|
||||||
get { return m_rootPart.Text; }
|
|
||||||
set { m_rootPart.Text = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void SetPartText(string text, uint localID)
|
public void SetPartText(string text, uint localID)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = this.GetChildPrim(localID);
|
SceneObjectPart part = this.GetChildPrim(localID);
|
||||||
|
@ -502,6 +533,26 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetPartName(uint localID)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = this.GetChildPrim(localID);
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
return part.PartName;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetPartDescription(uint localID)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = this.GetChildPrim(localID);
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
return part.Description;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -598,7 +649,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
SceneObjectPart part = this.GetChildPrim(localID);
|
SceneObjectPart part = this.GetChildPrim(localID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
if (part.UUID== this.m_rootPart.UUID)
|
if (part.UUID == this.m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
this.UpdateRootPosition(pos);
|
this.UpdateRootPosition(pos);
|
||||||
}
|
}
|
||||||
|
@ -805,7 +856,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public override void UpdateMovement()
|
public override void UpdateMovement()
|
||||||
{
|
{
|
||||||
foreach( SceneObjectPart part in m_parts.Values )
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
part.UpdateMovement();
|
part.UpdateMovement();
|
||||||
}
|
}
|
||||||
|
@ -858,7 +909,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateText( string text )
|
public void UpdateText(string text)
|
||||||
{
|
{
|
||||||
m_rootPart.Text = text;
|
m_rootPart.Text = text;
|
||||||
m_rootPart.ScheduleTerseUpdate();
|
m_rootPart.ScheduleTerseUpdate();
|
||||||
|
@ -866,7 +917,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient)
|
public void ObjectGrabHandler(uint localId, LLVector3 offsetPos, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
if( m_rootPart.LocalID == localId )
|
if (m_rootPart.LocalID == localId)
|
||||||
{
|
{
|
||||||
OnGrabGroup(offsetPos, remoteClient);
|
OnGrabGroup(offsetPos, remoteClient);
|
||||||
}
|
}
|
||||||
|
@ -886,5 +937,18 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteGroup()
|
||||||
|
{
|
||||||
|
m_scene.EventManager.OnBackup -= this.ProcessBackup;
|
||||||
|
foreach (SceneObjectPart part in this.m_parts.Values)
|
||||||
|
{
|
||||||
|
List<ScenePresence> avatars = this.RequestSceneAvatars();
|
||||||
|
for (int i = 0; i < avatars.Count; i++)
|
||||||
|
{
|
||||||
|
avatars[i].ControllingClient.SendKillObject(this.m_regionHandle, part.LocalID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,7 @@ namespace SimpleApp
|
||||||
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { }
|
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { }
|
||||||
public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { }
|
public virtual void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) { }
|
||||||
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
|
public virtual void SendInventoryItemUpdate(InventoryItemBase Item) { }
|
||||||
|
public virtual void SendRemoveInventoryItem(LLUUID itemID) { }
|
||||||
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
|
public virtual void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) { }
|
||||||
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { }
|
public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue