Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2013-01-02 09:28:55 +01:00
commit 41a44d7165
14 changed files with 204 additions and 45 deletions

View File

@ -117,7 +117,7 @@ namespace OpenSim.Capabilities.Handlers
/// <param name="data"></param>
private void BakedTextureUploaded(UUID assetID, byte[] data)
{
// m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
AssetBase asset;
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());

View File

@ -66,7 +66,7 @@ namespace OpenSim.Framework
protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f);
protected float m_avatarFeetOffset = 0;
protected float m_avatarAnimOffset = 0;
protected WearableCacheItem[] cacheitems;
public virtual int Serial
{
get { return m_serial; }
@ -116,6 +116,12 @@ namespace OpenSim.Framework
set { m_avatarHeight = value; }
}
public virtual WearableCacheItem[] WearableCacheItems
{
get { return cacheitems; }
set { cacheitems = value; }
}
public AvatarAppearance()
{
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");

View File

@ -64,7 +64,7 @@ namespace OpenSim.Framework
public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes);
public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize);
public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems);
public delegate void StartAnim(IClientAPI remoteClient, UUID animID);

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenMetaverse;
namespace OpenSim.Framework
{
public class WearableCacheItem
{
public uint TextureIndex { get; set; }
public UUID CacheId { get; set; }
public UUID TextureID { get; set; }
}
}

View File

@ -461,6 +461,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
#endregion Properties
// ~LLClientView()
@ -585,6 +586,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Disable UDP handling for this client
m_udpClient.Shutdown();
//m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
//GC.Collect();
//m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
@ -2750,8 +2752,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
return;
}
int WearableOut = 0;
bool isWearable = false;
if (req.AssetInf != null)
isWearable =
((AssetType) req.AssetInf.Type ==
AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing);
//m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable);
//if (isWearable)
// m_log.Debug((AssetType)req.AssetInf.Type);
//m_log.Debug("sending asset " + req.RequestAssetID);
TransferInfoPacket Transfer = new TransferInfoPacket();
Transfer.TransferInfo.ChannelType = 2;
Transfer.TransferInfo.Status = 0;
@ -2773,7 +2788,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
Transfer.TransferInfo.TransferID = req.TransferRequestID;
Transfer.Header.Zerocoded = true;
OutPacket(Transfer, ThrottleOutPacketType.Asset);
OutPacket(Transfer, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset);
if (req.NumPackets == 1)
{
@ -2784,7 +2799,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TransferPacket.TransferData.Data = req.AssetInf.Data;
TransferPacket.TransferData.Status = 1;
TransferPacket.Header.Zerocoded = true;
OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset);
}
else
{
@ -2817,7 +2832,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TransferPacket.TransferData.Status = 1;
}
TransferPacket.Header.Zerocoded = true;
OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset);
processedLength += chunkSize;
packetNumber++;
@ -3572,24 +3587,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count];
AgentWearablesUpdatePacket.WearableDataBlock awb;
int idx = 0;
for (int i = 0; i < wearables.Length; i++)
{
for (int j = 0; j < wearables[i].Count; j++)
{
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType = (byte)i;
awb.AssetID = wearables[i][j].AssetID;
awb.ItemID = wearables[i][j].ItemID;
aw.WearableData[idx] = awb;
idx++;
// m_log.DebugFormat(
// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
// awb.ItemID, awb.AssetID, i, Name);
}
}
for (int i = 0; i < wearables.Length; i++)
{
for (int j = 0; j < wearables[i].Count; j++)
{
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType = (byte) i;
awb.AssetID = wearables[i][j].AssetID;
awb.ItemID = wearables[i][j].ItemID;
aw.WearableData[idx] = awb;
idx++;
OutPacket(aw, ThrottleOutPacketType.Task);
// m_log.DebugFormat(
// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
// awb.ItemID, awb.AssetID, i, Name);
}
}
OutPacket(aw, ThrottleOutPacketType.State);
}
public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
@ -3614,7 +3630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
avp.Sender.IsTrial = false;
avp.Sender.ID = agentID;
//m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
OutPacket(avp, ThrottleOutPacketType.Task);
OutPacket(avp, ThrottleOutPacketType.State);
}
public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
@ -6282,12 +6298,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
byte[] visualparams = new byte[appear.VisualParam.Length];
for (int i = 0; i < appear.VisualParam.Length; i++)
visualparams[i] = appear.VisualParam[i].ParamValue;
//var b = appear.WearableData[0];
Primitive.TextureEntry te = null;
if (appear.ObjectData.TextureEntry.Length > 1)
te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
handlerSetAppearance(sender, te, visualparams,avSize);
WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length];
for (int i=0; i<appear.WearableData.Length;i++)
cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)};
handlerSetAppearance(sender, te, visualparams,avSize, cacheitems);
}
catch (Exception e)
{
@ -7798,6 +7821,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// surrounding scene
if ((ImageType)block.Type == ImageType.Baked)
args.Priority *= 2.0f;
int wearableout = 0;
ImageManager.EnqueueReq(args);
}
@ -11688,6 +11712,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (cachedtex.AgentData.SessionID != SessionId)
return false;
// TODO: don't create new blocks if recycling an old packet
cachedresp.AgentData.AgentID = AgentId;
cachedresp.AgentData.SessionID = m_sessionId;
@ -11696,6 +11721,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
cachedresp.WearableData =
new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
//IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>();
// var item = fac.GetBakedTextureFaces(AgentId);
//WearableCacheItem[] items = fac.GetCachedItems(AgentId);
IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
if (cache == null)
{
@ -11703,7 +11732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
cachedresp.WearableData[i].TextureID = UUID.Zero;
cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
cachedresp.WearableData[i].HostName = new byte[0];
}
}
@ -11713,10 +11742,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
if(cache.Check(cachedtex.WearableData[i].ID.ToString()))
if (cache.Check(cachedtex.WearableData[i].ID.ToString()))
cachedresp.WearableData[i].TextureID = UUID.Zero;
//UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
else
cachedresp.WearableData[i].TextureID = UUID.Zero;
cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
cachedresp.WearableData[i].HostName = new byte[0];
}
}

View File

@ -140,18 +140,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
/// <param name="sp"></param>
/// <param name="texture"></param>
/// <param name="visualParam"></param>
public void SetAppearance(IScenePresence sp, AvatarAppearance appearance)
public void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems)
{
SetAppearance(sp, appearance.Texture, appearance.VisualParams);
SetAppearance(sp, appearance.Texture, appearance.VisualParams, cacheItems);
}
public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize)
public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
{
float oldoff = sp.Appearance.AvatarFeetOffset;
Vector3 oldbox = sp.Appearance.AvatarBoxSize;
SetAppearance(sp, textureEntry, visualParams);
SetAppearance(sp, textureEntry, visualParams, cacheItems);
sp.Appearance.SetSize(avSize);
float off = sp.Appearance.AvatarFeetOffset;
@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
/// <param name="sp"></param>
/// <param name="texture"></param>
/// <param name="visualParam"></param>
public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams)
public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems)
{
// m_log.DebugFormat(
// "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}",
@ -205,11 +205,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// ((ScenePresence)sp).SetSize(box,off);
}
//if (cacheItems.Length > 0)
//{
sp.Appearance.WearableCacheItems = cacheItems;
//}
// Process the baked texture array
if (textureEntry != null)
{
// m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
@ -278,6 +281,19 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
return GetBakedTextureFaces(sp);
}
public WearableCacheItem[] GetCachedItems(UUID agentId)
{
ScenePresence sp = m_scene.GetScenePresence(agentId);
Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp);
WearableCacheItem[] items = sp.Appearance.WearableCacheItems;
//foreach (WearableCacheItem item in items)
//{
//}
return items;
}
public bool SaveBakedTextures(UUID agentId)
{
ScenePresence sp = m_scene.GetScenePresence(agentId);
@ -660,12 +676,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
/// <param name="client"></param>
/// <param name="texture"></param>
/// <param name="visualParam"></param>
private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize)
private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
{
// m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId);
ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
if (sp != null)
SetAppearance(sp, textureEntry, visualParams,avSize);
SetAppearance(sp, textureEntry, visualParams,avSize, cacheItems);
else
m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId);
}

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
for (byte i = 0; i < visualParams.Length; i++)
visualParams[i] = i;
afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams);
afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams, new WearableCacheItem[0]);
// TODO: Check baked texture
Assert.AreEqual(visualParams, sp.Appearance.VisualParams);
@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
eyesFace.TextureID = eyesTextureId;
afm.SetAppearance(sp, bakedTextureEntry, visualParams);
afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]);
afm.SaveBakedTextures(userId);
// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId);

View File

@ -35,8 +35,8 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IAvatarFactoryModule
{
void SetAppearance(IScenePresence sp, AvatarAppearance appearance);
void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems);
void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems);
/// <summary>
/// Send the appearance of an avatar to others in the scene.
@ -52,6 +52,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns>An empty list if this agent has no baked textures (e.g. because it's a child agent)</returns>
Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId);
WearableCacheItem[] GetCachedItems(UUID agentId);
/// <summary>
/// Save the baked textures for the given agent permanently in the asset database.
/// </summary>

View File

@ -0,0 +1,19 @@
////////////////////////////////////////////////////////////////
//
// (c) 2009, 2010 Careminster Limited and Melanie Thielker
//
// All rights reserved
//
using System;
using Nini.Config;
using OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Services.Interfaces
{
public interface IBakedTextureModule
{
AssetBase[] Get(UUID id);
void Store(UUID id, AssetBase[] data);
}
}

View File

@ -925,6 +925,33 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
UUID groupUUID = UUID.Zero;
string GroupName = string.Empty;
ulong groupPowers = 0;
// ----------------------------------
// Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status
try
{
if (gm != null)
{
groupUUID = ControllingClient.ActiveGroupId;
GroupRecord record = gm.GetGroupRecord(groupUUID);
if (record != null)
GroupName = record.GroupName;
GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid);
if (groupMembershipData != null)
groupPowers = groupMembershipData.GroupPowers;
}
ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName,
Grouptitle);
}
catch (Exception e)
{
m_log.Debug("[AGENTUPDATE]: " + e.ToString());
}
// ------------------------------------
if (ParentID == 0)
{
// Moved this from SendInitialData to ensure that Appearance is initialized

View File

@ -911,7 +911,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
// Mimicking LLClientView which gets always set appearance from client.
AvatarAppearance appearance;
m_scene.GetAvatarAppearance(this, out appearance);
OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone(),appearance.AvatarSize);
OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone(),appearance.AvatarSize, new WearableCacheItem[0]);
}
public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)

View File

@ -108,7 +108,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
// ScenePresence.SendInitialData() to reset our entire appearance.
m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
m_afMod.SetAppearance(sp, originalTe, null);
m_afMod.SetAppearance(sp, originalTe, null, new WearableCacheItem[0] );
UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);

View File

@ -0,0 +1,17 @@
////////////////////////////////////////////////////////////////
//
// (c) 2009, 2010 Careminster Limited and Melanie Thielker
//
// All rights reserved
//
using System;
using Nini.Config;
namespace OpenSim.Services.Interfaces
{
public interface IBakedTextureService
{
string Get(string id);
void Store(string id, string data);
}
}

View File

@ -144,7 +144,7 @@ namespace OpenSim.Tests.Performance
// ScenePresence.SendInitialData() to reset our entire appearance.
scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
afm.SetAppearance(sp, originalTe, null);
afm.SetAppearance(sp, originalTe, null, new WearableCacheItem[0]);
INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();