diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 55e4b40..3874c47 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,11 +471,9 @@ 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 | |||
462 | int count = wearable.Count; | 474 | int count = wearable.Count; |
463 | if (count > AvatarWearable.MAX_WEARABLES) | 475 | if (count > AvatarWearable.MAX_WEARABLES) |
464 | count = AvatarWearable.MAX_WEARABLES; | 476 | count = AvatarWearable.MAX_WEARABLES; |
465 | |||
466 | for (int i = 0; i < count; i++) | 477 | for (int i = 0; i < count; i++) |
467 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); | 478 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); |
468 | } | 479 | } |
@@ -721,6 +732,13 @@ namespace OpenSim.Framework | |||
721 | } | 732 | } |
722 | data["textures"] = textures; | 733 | data["textures"] = textures; |
723 | 734 | ||
735 | if (m_cacheitems != null) | ||
736 | { | ||
737 | OSDArray baked = WearableCacheItem.BakedToOSD(m_cacheitems); | ||
738 | if (baked != null) | ||
739 | data["bakedcache"] = baked; | ||
740 | } | ||
741 | |||
724 | // Visual Parameters | 742 | // Visual Parameters |
725 | OSDBinary visualparams = new OSDBinary(m_visualparams); | 743 | OSDBinary visualparams = new OSDBinary(m_visualparams); |
726 | data["visualparams"] = visualparams; | 744 | data["visualparams"] = visualparams; |
@@ -787,6 +805,12 @@ namespace OpenSim.Framework | |||
787 | m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures"); | 805 | m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures"); |
788 | } | 806 | } |
789 | 807 | ||
808 | if ((data != null) && (data["bakedcache"] != null) && (data["bakedcache"]).Type == OSDType.Array) | ||
809 | { | ||
810 | OSDArray bakedOSDArray = (OSDArray)(data["bakedcache"]); | ||
811 | m_cacheitems = WearableCacheItem.BakedFromOSD(bakedOSDArray); | ||
812 | } | ||
813 | |||
790 | // Visual Parameters | 814 | // Visual Parameters |
791 | SetDefaultParams(); | 815 | SetDefaultParams(); |
792 | if ((data != null) && (data["visualparams"] != null)) | 816 | if ((data != null) && (data["visualparams"] != null)) |