mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
Disabled the CheckSum Server as it seems that isn't used by viewer 1.18.
Started to add support for asset uploads over CAPS (the asset is uploaded but seems to come out corrupt). Started to cleanup/rewrite the AssetCache. Fixed bug in MapBlock requests, where data for some regions wasn't being sent. Renamed PrimData's Texture to TextureEntry. most likely a few other small changes.
This commit is contained in:
@@ -491,7 +491,7 @@ namespace OpenSim
|
||||
/// <param name="avatarID"></param>
|
||||
/// <param name="avatarLocalID"></param>
|
||||
/// <param name="Pos"></param>
|
||||
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos)
|
||||
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry)
|
||||
{
|
||||
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||
//send a objectupdate packet with information about the clients avatar
|
||||
@@ -500,7 +500,7 @@ namespace OpenSim
|
||||
objupdate.RegionData.RegionHandle = regionHandle;
|
||||
objupdate.RegionData.TimeDilation = 64096;
|
||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket();
|
||||
objupdate.ObjectData[0] = this.CreateDefaultAvatarPacket(textureEntry);
|
||||
//give this avatar object a local id and assign the user a name
|
||||
|
||||
objupdate.ObjectData[0].ID = avatarLocalID;
|
||||
@@ -859,7 +859,7 @@ namespace OpenSim
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket()
|
||||
protected ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry)
|
||||
{
|
||||
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); // new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
|
||||
|
||||
@@ -873,6 +873,10 @@ namespace OpenSim
|
||||
objdata.OwnerID = LLUUID.Zero;
|
||||
objdata.Scale = new LLVector3(1, 1, 1);
|
||||
objdata.PCode = 47;
|
||||
if (textureEntry != null)
|
||||
{
|
||||
objdata.TextureEntry = textureEntry;
|
||||
}
|
||||
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
||||
libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
|
||||
pos.X = 100f;
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Assets;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Caches;
|
||||
using libsecondlife;
|
||||
@@ -258,6 +259,99 @@ namespace OpenSim
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//new class , not currently used.
|
||||
public class AssetXferUploader
|
||||
{
|
||||
private IClientAPI ourClient;
|
||||
|
||||
public bool UploadComplete = false;
|
||||
|
||||
public bool AddToInventory;
|
||||
public LLUUID InventFolder = LLUUID.Zero;
|
||||
|
||||
public uint XferID;
|
||||
public AssetBase Asset;
|
||||
public LLUUID TransactionID = LLUUID.Zero;
|
||||
|
||||
|
||||
public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data)
|
||||
{
|
||||
ourClient = remoteClient;
|
||||
Asset = new AssetBase();
|
||||
Asset.FullID = assetID;
|
||||
Asset.InvType = type;
|
||||
Asset.Type = type;
|
||||
Asset.Data = data;
|
||||
Asset.Name = "blank";
|
||||
Asset.Description = "empty";
|
||||
TransactionID = transaction;
|
||||
|
||||
if (Asset.Data.Length > 2)
|
||||
{
|
||||
this.SendCompleteMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ReqestStartXfer();
|
||||
}
|
||||
}
|
||||
|
||||
protected void SendCompleteMessage()
|
||||
{
|
||||
UploadComplete = true;
|
||||
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
|
||||
response.AssetBlock.Type = Asset.Type;
|
||||
response.AssetBlock.Success = true;
|
||||
response.AssetBlock.UUID = Asset.FullID;
|
||||
this.ourClient.OutPacket(response);
|
||||
|
||||
//TODO trigger event
|
||||
}
|
||||
|
||||
protected void ReqestStartXfer()
|
||||
{
|
||||
UploadComplete = false;
|
||||
XferID = Util.GetNextXferID();
|
||||
RequestXferPacket xfer = new RequestXferPacket();
|
||||
xfer.XferID.ID = XferID;
|
||||
xfer.XferID.VFileType = Asset.Type;
|
||||
xfer.XferID.VFileID = Asset.FullID;
|
||||
xfer.XferID.FilePath = 0;
|
||||
xfer.XferID.Filename = new byte[0];
|
||||
this.ourClient.OutPacket(xfer);
|
||||
}
|
||||
|
||||
public void HandleXferPacket(uint xferID, uint packetID, byte[] data)
|
||||
{
|
||||
if (XferID == xferID)
|
||||
{
|
||||
if (Asset.Data.Length > 1)
|
||||
{
|
||||
byte[] newArray = new byte[Asset.Data.Length + data.Length];
|
||||
Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length);
|
||||
Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length);
|
||||
Asset.Data = newArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] newArray = new byte[data.Length - 4];
|
||||
Array.Copy(data, 4, newArray, 0, data.Length - 4);
|
||||
Asset.Data = newArray;
|
||||
}
|
||||
|
||||
ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
|
||||
confirmXfer.XferID.ID = xferID;
|
||||
confirmXfer.XferID.Packet = packetID;
|
||||
this.ourClient.OutPacket(confirmXfer);
|
||||
|
||||
if ((packetID & 2147483648) != 0)
|
||||
{
|
||||
this.SendCompleteMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user