Merge branch 'master' into careminster

avinationmerge
Melanie 2011-12-19 21:30:57 +00:00
commit efa4284391
8 changed files with 108 additions and 62 deletions

View File

@ -1545,7 +1545,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
options["profile"] = (string)requestData["profile"];
}
if (requestData["noassets"].ToString() == "true")
if ((string)requestData["noassets"] == "true")
{
options["noassets"] = (string)requestData["noassets"] ;
}

View File

@ -104,7 +104,7 @@ namespace OpenSim.Capabilities.Handlers
}
catch (Exception e)
{
m_log.Error("[UPLOAD BAKED TEXTURE HANDLER]: " + e.ToString());
m_log.ErrorFormat("[UPLOAD BAKED TEXTURE HANDLER]: {0}{1}", e.Message, e.StackTrace);
}
return null;
@ -117,7 +117,7 @@ namespace OpenSim.Capabilities.Handlers
/// <param name="data"></param>
private void BakedTextureUploaded(UUID assetID, byte[] data)
{
// m_log.WarnFormat("[CAPS]: 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

@ -264,10 +264,12 @@ namespace OpenSim.Framework
}
/// <summary>
/// Set up appearance textures.
/// Returns boolean that indicates whether the new entries actually change the
/// existing values.
/// Set up appearance texture ids.
/// </summary>
/// <returns>
/// True if any existing texture id was changed by the new data.
/// False if there were no changes or no existing texture ids.
/// </returns>
public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry)
{
if (textureEntry == null)
@ -284,25 +286,30 @@ namespace OpenSim.Framework
if (newface == null)
{
if (oldface == null) continue;
if (oldface == null)
continue;
}
else
{
if (oldface != null && oldface.TextureID == newface.TextureID) continue;
if (oldface != null && oldface.TextureID == newface.TextureID)
continue;
}
changed = true;
}
m_texture = textureEntry;
return changed;
}
/// <summary>
/// Set up visual parameters for the avatar and refresh the avatar height
/// Returns boolean that indicates whether the new entries actually change the
/// existing values.
/// </summary>
/// <returns>
/// True if any existing visual parameter was changed by the new data.
/// False if there were no changes or no existing visual parameters.
/// </returns>
public virtual bool SetVisualParams(byte[] visualParams)
{
if (visualParams == null)

View File

@ -452,6 +452,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public LLClientView(EndPoint remoteEP, Scene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo,
UUID agentId, UUID sessionId, uint circuitCode)
{
// DebugPacketLevel = 1;
RegisterInterface<IClientIM>(this);
RegisterInterface<IClientChat>(this);
RegisterInterface<IClientIPEndpoint>(this);
@ -4951,8 +4953,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
update.Scale = new Vector3(0.45f, 0.6f, 1.9f);
update.Text = Utils.EmptyBytes;
update.TextColor = new byte[4];
// Don't send texture anim for avatars - this has no meaning for them.
update.TextureAnim = Utils.EmptyBytes;
update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes;
// Don't send texture entry for avatars here - this is accomplished via the AvatarAppearance packet
update.TextureEntry = Utils.EmptyBytes;
// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes;
update.UpdateFlags = (uint)(
PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner |
PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer |
@ -6062,7 +6070,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// for the client session anyway, in order to protect ourselves against bad code in plugins
try
{
byte[] visualparams = new byte[appear.VisualParam.Length];
for (int i = 0; i < appear.VisualParam.Length; i++)
visualparams[i] = appear.VisualParam[i].ParamValue;
@ -11344,9 +11351,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>
/// Send a response back to a client when it asks the asset server (via the region server) if it has
/// its appearance texture cached.
///
/// At the moment, we always reply that there is no cached texture.
/// </summary>
/// <remarks>
/// At the moment, we always reply that there is no cached texture.
/// </remarks>
/// <param name="simclient"></param>
/// <param name="packet"></param>
/// <returns></returns>
@ -11356,7 +11364,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
if (cachedtex.AgentData.SessionID != SessionId) return false;
if (cachedtex.AgentData.SessionID != SessionId)
return false;
// TODO: don't create new blocks if recycling an old packet
cachedresp.AgentData.AgentID = AgentId;
@ -11754,6 +11763,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (DebugPacketLevel <= 50 && packet.Type == PacketType.ImprovedTerseObjectUpdate)
logPacket = false;
if (DebugPacketLevel <= 25 && packet.Type == PacketType.ObjectPropertiesFamily)
logPacket = false;
if (logPacket)
m_log.DebugFormat(
"[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}",
@ -11811,6 +11823,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (DebugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
logPacket = false;
if (DebugPacketLevel <= 25 && packet.Type == PacketType.RequestObjectPropertiesFamily)
logPacket = false;
if (logPacket)
m_log.DebugFormat(
"[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}",

View File

@ -26,16 +26,15 @@
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Text;
using System.Timers;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using System.Threading;
using System.Timers;
using System.Collections.Generic;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
@ -45,6 +44,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public const string BAKED_TEXTURES_REPORT_FORMAT = "{0,-9} {1}";
private Scene m_scene = null;
private int m_savetime = 5; // seconds to wait before saving changed appearance
@ -147,9 +149,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// Process the baked texture array
if (textureEntry != null)
{
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID);
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID);
// WriteBakedTexturesReport(sp, m_log.DebugFormat);
ValidateBakedTextureCache(sp, false);
// This appears to be set only in the final stage of the appearance
@ -254,9 +260,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
/// <summary>
/// Queue up a request to send appearance, makes it possible to
/// accumulate changes without sending out each one separately.
/// Queue up a request to send appearance.
/// </summary>
/// <remarks>
/// Makes it possible to accumulate changes without sending out each one separately.
/// </remarks>
/// <param name="agentId"></param>
public void QueueAppearanceSend(UUID agentid)
{
// m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
@ -404,10 +413,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
m_savequeue.Remove(avatarID);
}
}
}
if (m_savequeue.Count == 0 && m_sendqueue.Count == 0)
m_updateTimer.Stop();
// We must lock both queues here so that QueueAppearanceSave() or *Send() don't m_updateTimer.Start() on
// another thread inbetween the first count calls and m_updateTimer.Stop() on this thread.
lock (m_sendqueue)
if (m_savequeue.Count == 0 && m_sendqueue.Count == 0)
m_updateTimer.Stop();
}
}
private void SaveAppearance(UUID agentid)
@ -553,5 +565,37 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
}
#endregion
public void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction outputAction)
{
outputAction("For {0} in {1}", sp.Name, m_scene.RegionInfo.RegionName);
outputAction(BAKED_TEXTURES_REPORT_FORMAT, "Bake Type", "UUID");
Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp.UUID);
foreach (BakeType bt in bakedTextures.Keys)
{
string rawTextureID;
if (bakedTextures[bt] == null)
{
rawTextureID = "not set";
}
else
{
rawTextureID = bakedTextures[bt].TextureID.ToString();
if (m_scene.AssetService.Get(rawTextureID) == null)
rawTextureID += " (not found)";
else
rawTextureID += " (uploaded)";
}
outputAction(BAKED_TEXTURES_REPORT_FORMAT, bt, rawTextureID);
}
bool bakedTextureValid = m_scene.AvatarFactory.ValidateBakedTextureCache(sp);
outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
}
}
}

View File

@ -31,9 +31,10 @@ using OpenSim.Framework;
namespace OpenSim.Region.Framework.Interfaces
{
public delegate void ReportOutputAction(string format, params object[] args);
public interface IAvatarFactoryModule
{
void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
/// <summary>
@ -63,5 +64,13 @@ namespace OpenSim.Region.Framework.Interfaces
bool ValidateBakedTextureCache(IScenePresence sp);
void QueueAppearanceSend(UUID agentid);
void QueueAppearanceSave(UUID agentid);
/// <summary>
/// Get a report about the current state of a scene presence's baked appearance textures.
/// </summary>
/// <param name="sp"></param>
/// <param name="reportOutputAction"></param>
/// <returns></returns>
void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction reportOutputAction);
}
}

View File

@ -2554,7 +2554,10 @@ namespace OpenSim.Region.Framework.Scenes
// again here... this comes after the cached appearance check because the avatars
// appearance goes into the avatar update packet
SendAvatarDataToAllAgents();
SendAppearanceToAgent(this);
// Sending us our own appearance does not seem to be necessary, and the viewer warns in the log if you do
// this.
// SendAppearanceToAgent(this);
// If we are using the the cached appearance then send it out to everyone
if (cachedappearance)
@ -2689,7 +2692,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendAppearanceToAgent(ScenePresence avatar)
{
// m_log.DebugFormat(
// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAppearance(
UUID, Appearance.VisualParams, Appearance.Texture.GetBytes());

View File

@ -50,8 +50,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public const string SHOW_APPEARANCE_FORMAT = "{0,-9} {1}";
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
// private IAvatarFactoryModule m_avatarFactory;
@ -197,37 +195,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
{
ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
if (sp != null && !sp.IsChildAgent)
{
MainConsole.Instance.OutputFormat("For {0} in {1}", sp.Name, scene.RegionInfo.RegionName);
MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, "Bake Type", "UUID");
Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures
= scene.AvatarFactory.GetBakedTextureFaces(sp.UUID);
foreach (BakeType bt in bakedTextures.Keys)
{
string rawTextureID;
if (bakedTextures[bt] == null)
{
rawTextureID = "not set";
}
else
{
rawTextureID = bakedTextures[bt].TextureID.ToString();
if (scene.AssetService.Get(rawTextureID) == null)
rawTextureID += " (not found)";
else
rawTextureID += " (uploaded)";
}
MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, bt, rawTextureID);
}
bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp);
MainConsole.Instance.OutputFormat(
"{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
}
scene.AvatarFactory.WriteBakedTexturesReport(sp, MainConsole.Instance.OutputFormat);
}
else
{