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.
This commit is contained in:
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

@@ -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;