Get rid of AvatarAppearance.Owner to simplify the code.

This is not used for anything - appearances are always properties of objects with ids (ScenePresence, AgentCircuitData) and just has the potential to get out of sync when the appearance is cloned.
bulletsim
Justin Clark-Casey (justincc) 2011-08-02 00:13:04 +01:00
parent 59f548cda8
commit b6ac1c46cd
15 changed files with 38 additions and 53 deletions

View File

@ -488,11 +488,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.userAppearance.AvatarHeight = (float) Convert.ToDouble(xml.Value);
indata = true;
}
if (xml.MoveToAttribute("Owner"))
{
rdata.userAppearance.Owner = (UUID)xml.Value;
indata = true;
}
// if (xml.MoveToAttribute("Owner"))
// {
// rdata.userAppearance.Owner = (UUID)xml.Value;
// indata = true;
// }
if (xml.MoveToAttribute("Serial"))
{
rdata.userAppearance.Serial = Convert.ToInt32(xml.Value);
@ -747,8 +747,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.writer.WriteStartElement("Appearance");
rdata.writer.WriteAttributeString("Height", rdata.userAppearance.AvatarHeight.ToString());
if (rdata.userAppearance.Owner != UUID.Zero)
rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
// if (rdata.userAppearance.Owner != UUID.Zero)
// rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
rdata.writer.WriteAttributeString("Serial", rdata.userAppearance.Serial.ToString());
/*

View File

@ -296,11 +296,12 @@ namespace OpenSim.Framework
if (args["start_pos"] != null)
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
m_log.InfoFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos);
try {
try
{
// Unpack various appearance elements
Appearance = new AvatarAppearance(AgentID);
Appearance = new AvatarAppearance();
// Eventually this code should be deprecated, use full appearance
// packing in packed_appearance
@ -313,7 +314,9 @@ namespace OpenSim.Framework
m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
}
else
m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
{
m_log.Warn("[AGENTCIRCUITDATA]: failed to find a valid packed_appearance");
}
}
catch (Exception e)
{

View File

@ -47,7 +47,6 @@ namespace OpenSim.Framework
public readonly static int TEXTURE_COUNT = 21;
public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
protected UUID m_owner;
protected int m_serial = 0;
protected byte[] m_visualparams;
protected Primitive.TextureEntry m_texture;
@ -56,12 +55,6 @@ namespace OpenSim.Framework
protected float m_avatarHeight = 0;
protected float m_hipOffset = 0;
public virtual UUID Owner
{
get { return m_owner; }
set { m_owner = value; }
}
public virtual int Serial
{
get { return m_serial; }
@ -101,38 +94,31 @@ namespace OpenSim.Framework
get { return m_hipOffset; }
}
public AvatarAppearance() : this(UUID.Zero) {}
public AvatarAppearance(UUID owner)
public AvatarAppearance()
{
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner);
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");
m_serial = 0;
m_owner = owner;
SetDefaultWearables();
SetDefaultTexture();
SetDefaultParams();
SetHeight();
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
}
public AvatarAppearance(UUID avatarID, OSDMap map)
public AvatarAppearance(OSDMap map)
{
// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID);
// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap");
m_owner = avatarID;
Unpack(map);
SetHeight();
}
public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
{
// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID);
// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance");
m_serial = 0;
m_owner = avatarID;
if (wearables != null)
m_wearables = wearables;
@ -165,24 +151,21 @@ namespace OpenSim.Framework
if (appearance == null)
{
m_serial = 0;
m_owner = UUID.Zero;
SetDefaultWearables();
SetDefaultTexture();
SetDefaultParams();
SetHeight();
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
return;
}
m_serial = appearance.Serial;
m_owner = appearance.Owner;
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
m_wearables[i] = new AvatarWearable();
if (copyWearables && (appearance.Wearables != null))
{
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)

View File

@ -593,7 +593,7 @@ namespace OpenSim.Framework
// AgentTextures[i++] = o.AsUUID();
//}
Appearance = new AvatarAppearance(AgentID);
Appearance = new AvatarAppearance();
// The code to unpack textures, visuals, wearables and attachments
// should be removed; packed appearance contains the full appearance
@ -635,7 +635,7 @@ namespace OpenSim.Framework
// end of code to remove
if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
else
m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");

View File

@ -64,7 +64,7 @@ namespace OpenSim.Framework.Tests
SecureSessionId = UUID.Random();
SessionId = UUID.Random();
AvAppearance = new AvatarAppearance(AgentId);
AvAppearance = new AvatarAppearance();
VisualParams = new byte[218];
//body

View File

@ -68,7 +68,7 @@ namespace OpenSim.Framework.Tests
m_agentCircuitData1 = new AgentCircuitData();
m_agentCircuitData1.AgentID = AgentId1;
m_agentCircuitData1.Appearance = new AvatarAppearance(AgentId1);
m_agentCircuitData1.Appearance = new AvatarAppearance();
m_agentCircuitData1.BaseFolder = BaseFolder;
m_agentCircuitData1.CapsPath = CapsPath;
m_agentCircuitData1.child = false;
@ -83,7 +83,7 @@ namespace OpenSim.Framework.Tests
m_agentCircuitData2 = new AgentCircuitData();
m_agentCircuitData2.AgentID = AgentId2;
m_agentCircuitData2.Appearance = new AvatarAppearance(AgentId2);
m_agentCircuitData2.Appearance = new AvatarAppearance();
m_agentCircuitData2.BaseFolder = BaseFolder;
m_agentCircuitData2.CapsPath = CapsPath;
m_agentCircuitData2.child = false;

View File

@ -3079,7 +3079,7 @@ namespace OpenSim.Region.Framework.Scenes
if (aCircuit == null)
{
m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance.");
appearance = new AvatarAppearance(client.AgentId);
appearance = new AvatarAppearance();
return;
}
@ -3087,7 +3087,7 @@ namespace OpenSim.Region.Framework.Scenes
if (appearance == null)
{
m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName);
appearance = new AvatarAppearance(client.AgentId);
appearance = new AvatarAppearance();
}
}

View File

@ -916,7 +916,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName);
// emergency; this really shouldn't happen
m_appearance = new AvatarAppearance(UUID);
m_appearance = new AvatarAppearance();
}
AddToPhysicalScene(isFlying);
@ -2651,7 +2651,7 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAppearance(
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
}
// Because appearance setting is in a module, we actually need

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.OptionalModules.Framework.Monitoring
{
protected Scene m_scene;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string Name { get { return "Services Health Monitoring Module"; } }

View File

@ -93,7 +93,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
AvatarAppearance originalAppearance = GetAppearance(cloneAppearanceFrom, scene);
AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true);
npcAppearance.Owner = acd.AgentID;
acd.Appearance = npcAppearance;
// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++)

View File

@ -54,7 +54,7 @@ namespace OpenSim.Services.AvatarService
public AvatarAppearance GetAppearance(UUID principalID)
{
AvatarData avatar = GetAvatar(principalID);
return avatar.ToAvatarAppearance(principalID);
return avatar.ToAvatarAppearance();
}
public bool SetAppearance(UUID principalID, AvatarAppearance appearance)

View File

@ -89,7 +89,7 @@ namespace OpenSim.Services.Connectors
public AvatarAppearance GetAppearance(UUID userID)
{
AvatarData avatar = GetAvatar(userID);
return avatar.ToAvatarAppearance(userID);
return avatar.ToAvatarAppearance();
}
public bool SetAppearance(UUID userID, AvatarAppearance appearance)

View File

@ -213,7 +213,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
wearables[11] = new AvatarWearable(map["UnderpantsItem"].AsUUID(), map["UnderpantsAsset"].AsUUID());
wearables[12] = new AvatarWearable(map["SkirtItem"].AsUUID(), map["SkirtAsset"].AsUUID());
AvatarAppearance appearance = new AvatarAppearance(userID);
AvatarAppearance appearance = new AvatarAppearance();
appearance.Wearables = wearables;
appearance.AvatarHeight = (float)map["Height"].AsReal();
@ -257,7 +257,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (avatar.AvatarType == 1) // LLAvatar
{
AvatarAppearance appearance = avatar.ToAvatarAppearance(userID);
AvatarAppearance appearance = avatar.ToAvatarAppearance();
OSDMap map = new OSDMap();

View File

@ -180,9 +180,9 @@ namespace OpenSim.Services.Interfaces
}
}
public AvatarAppearance ToAvatarAppearance(UUID owner)
public AvatarAppearance ToAvatarAppearance()
{
AvatarAppearance appearance = new AvatarAppearance(owner);
AvatarAppearance appearance = new AvatarAppearance();
if (Data.Count == 0)
return appearance;

View File

@ -785,7 +785,7 @@ namespace OpenSim.Services.LLLoginService
if (avatar != null)
aCircuit.Appearance = new AvatarAppearance(avatar);
else
aCircuit.Appearance = new AvatarAppearance(account.PrincipalID);
aCircuit.Appearance = new AvatarAppearance();
//aCircuit.BaseFolder = irrelevant
aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();