public AvatarAppearance(AvatarAppearance appearance, bool copyWearables)
{
// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");
if (appearance == null)
{
m_serial = 1;
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++)
SetWearable(i, appearance.Wearables[i]);
}
m_texture = null;
if (appearance.Texture != null)
{
byte[] tbytes = appearance.Texture.GetBytes();
m_texture = new Primitive.TextureEntry(tbytes, 0, tbytes.Length);
}
m_visualparams = null;
if (appearance.VisualParams != null)
m_visualparams = (byte[])appearance.VisualParams.Clone();
// Copy the attachment, force append mode since that ensures consistency
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
foreach (AvatarAttachment attachment in appearance.GetAttachments())
AppendAttachment(new AvatarAttachment(attachment));
}