aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/AvatarAppearance.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/AvatarAppearance.cs')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs49
1 files changed, 44 insertions, 5 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 69113b1..72c6bfc 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -53,7 +53,11 @@ namespace OpenSim.Framework
53 // should be only used as initial default value ( V1 viewers ) 53 // should be only used as initial default value ( V1 viewers )
54 public readonly static int VISUALPARAM_COUNT = 218; 54 public readonly static int VISUALPARAM_COUNT = 218;
55 55
56 public readonly static int TEXTURE_COUNT = 21; 56// public readonly static int TEXTURE_COUNT = 21
57 // 21 bad, make it be updated as libovm gets update
58 // also keeping in sync with it
59 public readonly static int TEXTURE_COUNT = Primitive.TextureEntry.MAX_FACES;
60
57 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; 61 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
58 62
59 protected int m_serial = 0; 63 protected int m_serial = 0;
@@ -179,11 +183,16 @@ namespace OpenSim.Framework
179 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 183 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
180 } 184 }
181 185
182 public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) 186 public AvatarAppearance(AvatarAppearance appearance): this(appearance, true,true)
183 { 187 {
184 } 188 }
185 189
186 public AvatarAppearance(AvatarAppearance appearance, bool copyWearables) 190 public AvatarAppearance(AvatarAppearance appearance, bool copyWearables)
191 : this(appearance, copyWearables, true)
192 {
193 }
194
195 public AvatarAppearance(AvatarAppearance appearance, bool copyWearables, bool copyBaked)
187 { 196 {
188// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); 197// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");
189 198
@@ -217,6 +226,10 @@ namespace OpenSim.Framework
217 { 226 {
218 byte[] tbytes = appearance.Texture.GetBytes(); 227 byte[] tbytes = appearance.Texture.GetBytes();
219 m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length); 228 m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length);
229 if (copyBaked && appearance.m_cacheitems != null)
230 m_cacheitems = (WearableCacheItem[])appearance.m_cacheitems.Clone();
231 else
232 m_cacheitems = null;
220 } 233 }
221 234
222 m_visualparams = null; 235 m_visualparams = null;
@@ -458,7 +471,10 @@ namespace OpenSim.Framework
458// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); 471// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
459// DEBUG OFF 472// DEBUG OFF
460 m_wearables[wearableId].Clear(); 473 m_wearables[wearableId].Clear();
461 for (int i = 0; i < wearable.Count; i++) 474 int count = wearable.Count;
475 if (count > AvatarWearable.MAX_WEARABLES)
476 count = AvatarWearable.MAX_WEARABLES;
477 for (int i = 0; i < count; i++)
462 m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); 478 m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID);
463 } 479 }
464 480
@@ -722,6 +738,13 @@ namespace OpenSim.Framework
722 } 738 }
723 data["textures"] = textures; 739 data["textures"] = textures;
724 740
741 if (m_cacheitems != null)
742 {
743 OSDArray baked = WearableCacheItem.BakedToOSD(m_cacheitems);
744 if (baked != null)
745 data["bakedcache"] = baked;
746 }
747
725 // Visual Parameters 748 // Visual Parameters
726 OSDBinary visualparams = new OSDBinary(m_visualparams); 749 OSDBinary visualparams = new OSDBinary(m_visualparams);
727 data["visualparams"] = visualparams; 750 data["visualparams"] = visualparams;
@@ -757,7 +780,12 @@ namespace OpenSim.Framework
757 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) 780 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
758 { 781 {
759 OSDArray wears = (OSDArray)(data["wearables"]); 782 OSDArray wears = (OSDArray)(data["wearables"]);
760 for (int i = 0; i < wears.Count; i++) 783
784 int count = wears.Count;
785 if (count > AvatarWearable.MAX_WEARABLES)
786 count = AvatarWearable.MAX_WEARABLES;
787
788 for (int i = 0; i < count; i++)
761 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); 789 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
762 } 790 }
763 else 791 else
@@ -783,6 +811,12 @@ namespace OpenSim.Framework
783 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures"); 811 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures");
784 } 812 }
785 813
814 if ((data != null) && (data["bakedcache"] != null) && (data["bakedcache"]).Type == OSDType.Array)
815 {
816 OSDArray bakedOSDArray = (OSDArray)(data["bakedcache"]);
817 m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray);
818 }
819
786 // Visual Parameters 820 // Visual Parameters
787 SetDefaultParams(); 821 SetDefaultParams();
788 if ((data != null) && (data["visualparams"] != null)) 822 if ((data != null) && (data["visualparams"] != null))
@@ -1632,7 +1666,12 @@ namespace OpenSim.Framework
1632 BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, 1666 BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247,
1633 BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, 1667 BREAST_PHYSICS_LEFTRIGHT_SPRING= 248,
1634 BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, 1668 BREAST_PHYSICS_LEFTRIGHT_GAIN = 249,
1635 BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250 1669 BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250,
1670
1671 // Ubit: 07/96/2013 new parameters
1672 _APPEARANCEMESSAGE_VERSION = 251, //ID 11000
1673
1674 SHAPE_HOVER = 252, //ID 11001
1636 } 1675 }
1637 #endregion 1676 #endregion
1638 } 1677 }