aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJonathan Freedman2010-10-29 23:58:14 -0400
committerJonathan Freedman2010-10-29 23:58:14 -0400
commitc8d65c359ffcccf2e0fb61fcc31c45072f14b773 (patch)
tree0d5e0fe48ababacd820479f95b3ab2239ec2c84d /OpenSim/Framework
parentMerge branch 'master' into mantis5110 (diff)
parentRename the new default texture to be consistent with the others (diff)
downloadopensim-SC_OLD-c8d65c359ffcccf2e0fb61fcc31c45072f14b773.zip
opensim-SC_OLD-c8d65c359ffcccf2e0fb61fcc31c45072f14b773.tar.gz
opensim-SC_OLD-c8d65c359ffcccf2e0fb61fcc31c45072f14b773.tar.bz2
opensim-SC_OLD-c8d65c359ffcccf2e0fb61fcc31c45072f14b773.tar.xz
Merge branch 'master' into mantis5110
Conflicts: OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs135
1 files changed, 116 insertions, 19 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index e66a1e7..a4bb765 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -35,6 +35,104 @@ using log4net;
35 35
36namespace OpenSim.Framework 36namespace OpenSim.Framework
37{ 37{
38 // A special dictionary for avatar appearance
39 public struct LayerItem
40 {
41 public UUID ItemID;
42 public UUID AssetID;
43
44 public LayerItem(UUID itemID, UUID assetID)
45 {
46 ItemID = itemID;
47 AssetID = assetID;
48 }
49 }
50
51 public class Layer
52 {
53 protected int m_layerType;
54 protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>();
55 protected List<UUID> m_ids = new List<UUID>();
56
57 public Layer(int type)
58 {
59 m_layerType = type;
60 }
61
62 public int LayerType
63 {
64 get { return m_layerType; }
65 }
66
67 public int Count
68 {
69 get { return m_ids.Count; }
70 }
71
72 public void Add(UUID itemID, UUID assetID)
73 {
74 if (m_items.ContainsKey(itemID))
75 return;
76 if (m_ids.Count >= 5)
77 return;
78
79 m_ids.Add(itemID);
80 m_items[itemID] = assetID;
81 }
82
83 public void Wear(UUID itemID, UUID assetID)
84 {
85 Clear();
86 Add(itemID, assetID);
87 }
88
89 public void Clear()
90 {
91 m_ids.Clear();
92 m_items.Clear();
93 }
94
95 public void RemoveItem(UUID itemID)
96 {
97 if (m_items.ContainsKey(itemID))
98 {
99 m_ids.Remove(itemID);
100 m_items.Remove(itemID);
101 }
102 }
103
104 public void RemoveAsset(UUID assetID)
105 {
106 UUID itemID = UUID.Zero;
107
108 foreach (KeyValuePair<UUID, UUID> kvp in m_items)
109 {
110 if (kvp.Value == assetID)
111 {
112 itemID = kvp.Key;
113 break;
114 }
115 }
116
117 if (itemID != UUID.Zero)
118 {
119 m_ids.Remove(itemID);
120 m_items.Remove(itemID);
121 }
122 }
123
124 public LayerItem this [int idx]
125 {
126 get
127 {
128 if (idx >= m_ids.Count || idx < 0)
129 return new LayerItem(UUID.Zero, UUID.Zero);
130
131 return new LayerItem(m_ids[idx], m_items[m_ids[idx]]);
132 }
133 }
134 }
135
38 /// <summary> 136 /// <summary>
39 /// Contains the Avatar's Appearance and methods to manipulate the appearance. 137 /// Contains the Avatar's Appearance and methods to manipulate the appearance.
40 /// </summary> 138 /// </summary>
@@ -45,6 +143,7 @@ namespace OpenSim.Framework
45 public readonly static int VISUALPARAM_COUNT = 218; 143 public readonly static int VISUALPARAM_COUNT = 218;
46 144
47 public readonly static int TEXTURE_COUNT = 21; 145 public readonly static int TEXTURE_COUNT = 21;
146 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
48 147
49 protected UUID m_owner; 148 protected UUID m_owner;
50 protected int m_serial = 1; 149 protected int m_serial = 1;
@@ -347,14 +446,8 @@ namespace OpenSim.Framework
347 protected virtual void SetDefaultTexture() 446 protected virtual void SetDefaultTexture()
348 { 447 {
349 m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); 448 m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
350 // The initialization of these seems to force a rebake regardless of whether it is needed 449 for (uint i = 0; i < TEXTURE_COUNT; i++)
351 // m_textures.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); 450 m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE);
352 // m_textures.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID;
353 // m_textures.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID;
354 // m_textures.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77");
355 // m_textures.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B");
356 // m_textures.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010");
357 // m_textures.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011");
358 } 451 }
359 452
360 /// <summary> 453 /// <summary>
@@ -371,7 +464,7 @@ namespace OpenSim.Framework
371 // made. We determine if any of the textures actually 464 // made. We determine if any of the textures actually
372 // changed to know if the appearance should be saved later 465 // changed to know if the appearance should be saved later
373 bool changed = false; 466 bool changed = false;
374 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) 467 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
375 { 468 {
376 Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i]; 469 Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i];
377 Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i]; 470 Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i];
@@ -385,7 +478,6 @@ namespace OpenSim.Framework
385 if (oldface != null && oldface.TextureID == newface.TextureID) continue; 478 if (oldface != null && oldface.TextureID == newface.TextureID) continue;
386 } 479 }
387 480
388 m_texture.FaceTextures[i] = (newface != null) ? new Primitive.TextureEntryFace(newface) : null;
389 changed = true; 481 changed = true;
390// DEBUG ON 482// DEBUG ON
391 if (newface != null) 483 if (newface != null)
@@ -393,6 +485,7 @@ namespace OpenSim.Framework
393// DEBUG OFF 485// DEBUG OFF
394 } 486 }
395 487
488 m_texture = textureEntry;
396 return changed; 489 return changed;
397 } 490 }
398 491
@@ -415,8 +508,8 @@ namespace OpenSim.Framework
415 if (visualParams[i] != m_visualparams[i]) 508 if (visualParams[i] != m_visualparams[i])
416 { 509 {
417// DEBUG ON 510// DEBUG ON
418 m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", 511// m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}",
419 i,m_visualparams[i],visualParams[i]); 512// i,m_visualparams[i],visualParams[i]);
420// DEBUG OFF 513// DEBUG OFF
421 m_visualparams[i] = visualParams[i]; 514 m_visualparams[i] = visualParams[i];
422 changed = true; 515 changed = true;
@@ -581,6 +674,8 @@ namespace OpenSim.Framework
581 m_attachments.Clear(); 674 m_attachments.Clear();
582 } 675 }
583 676
677 #region Packing Functions
678
584 /// <summary> 679 /// <summary>
585 /// Create an OSDMap from the appearance data 680 /// Create an OSDMap from the appearance data
586 /// </summary> 681 /// </summary>
@@ -605,7 +700,7 @@ namespace OpenSim.Framework
605 if (m_texture.FaceTextures[i] != null) 700 if (m_texture.FaceTextures[i] != null)
606 textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID)); 701 textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID));
607 else 702 else
608 textures.Add(OSD.FromUUID(UUID.Zero)); 703 textures.Add(OSD.FromUUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
609 } 704 }
610 data["textures"] = textures; 705 data["textures"] = textures;
611 706
@@ -657,12 +752,10 @@ namespace OpenSim.Framework
657 OSDArray textures = (OSDArray)(data["textures"]); 752 OSDArray textures = (OSDArray)(data["textures"]);
658 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++) 753 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++)
659 { 754 {
755 UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE;
660 if (textures[i] != null) 756 if (textures[i] != null)
661 { 757 textureID = textures[i].AsUUID();
662 UUID textureID = textures[i].AsUUID(); 758 m_texture.CreateFace((uint)i).TextureID = new UUID(textureID);
663 if (textureID != UUID.Zero)
664 m_texture.CreateFace((uint)i).TextureID = textureID;
665 }
666 } 759 }
667 } 760 }
668 else 761 else
@@ -697,6 +790,9 @@ namespace OpenSim.Framework
697 } 790 }
698 } 791 }
699 792
793 #endregion
794
795 #region VPElement
700 796
701 /// <summary> 797 /// <summary>
702 /// Viewer Params Array Element for AgentSetAppearance 798 /// Viewer Params Array Element for AgentSetAppearance
@@ -1460,5 +1556,6 @@ namespace OpenSim.Framework
1460 SKIRT_SKIRT_GREEN = 216, 1556 SKIRT_SKIRT_GREEN = 216,
1461 SKIRT_SKIRT_BLUE = 217 1557 SKIRT_SKIRT_BLUE = 217
1462 } 1558 }
1559 #endregion
1463 } 1560 }
1464} \ No newline at end of file 1561}