diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 40 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarWearable.cs | 34 |
2 files changed, 58 insertions, 16 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index f0d8335..d0a22b2 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -150,7 +150,11 @@ namespace OpenSim.Framework | |||
150 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 150 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
151 | } | 151 | } |
152 | 152 | ||
153 | public AvatarAppearance(AvatarAppearance appearance) | 153 | public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) |
154 | { | ||
155 | } | ||
156 | |||
157 | public AvatarAppearance(AvatarAppearance appearance, bool copyWearables) | ||
154 | { | 158 | { |
155 | // m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); | 159 | // m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); |
156 | 160 | ||
@@ -175,7 +179,7 @@ namespace OpenSim.Framework | |||
175 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; | 179 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; |
176 | for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) | 180 | for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) |
177 | m_wearables[i] = new AvatarWearable(); | 181 | m_wearables[i] = new AvatarWearable(); |
178 | if (appearance.Wearables != null) | 182 | if (copyWearables && (appearance.Wearables != null)) |
179 | { | 183 | { |
180 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 184 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
181 | SetWearable(i,appearance.Wearables[i]); | 185 | SetWearable(i,appearance.Wearables[i]); |
@@ -198,6 +202,28 @@ namespace OpenSim.Framework | |||
198 | AppendAttachment(new AvatarAttachment(attachment)); | 202 | AppendAttachment(new AvatarAttachment(attachment)); |
199 | } | 203 | } |
200 | 204 | ||
205 | public void GetAssetsFrom(AvatarAppearance app) | ||
206 | { | ||
207 | for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) | ||
208 | { | ||
209 | for (int j = 0 ; j < m_wearables[i].Count ; j++) | ||
210 | { | ||
211 | UUID itemID = m_wearables[i][j].ItemID; | ||
212 | UUID assetID = app.Wearables[i].GetAsset(itemID); | ||
213 | |||
214 | if (assetID != UUID.Zero) | ||
215 | m_wearables[i].Add(itemID, assetID); | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | |||
220 | public void ClearWearables() | ||
221 | { | ||
222 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; | ||
223 | for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) | ||
224 | m_wearables[i] = new AvatarWearable(); | ||
225 | } | ||
226 | |||
201 | protected virtual void SetDefaultWearables() | 227 | protected virtual void SetDefaultWearables() |
202 | { | 228 | { |
203 | m_wearables = AvatarWearable.DefaultWearables; | 229 | m_wearables = AvatarWearable.DefaultWearables; |
@@ -205,11 +231,11 @@ namespace OpenSim.Framework | |||
205 | 231 | ||
206 | protected virtual void SetDefaultParams() | 232 | protected virtual void SetDefaultParams() |
207 | { | 233 | { |
208 | m_visualparams = new byte[VISUALPARAM_COUNT]; | 234 | m_visualparams = new byte[] { 56,23,66,0,0,25,0,124,107,0,0,91,137,36,180,79,78,20,32,255,0,63,137,137,63,122,0,71,127,94,63,0,150,150,150,17,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,78,0,0,0,0,0,0,0,0,0,145,216,133,0,0,0,219,107,150,150,165,135,0,150,150,150,63,112,155,150,150,150,150,150,150,150,150,150,150,150,0,0,0,0,188,255,91,219,124,0,150,127,165,127,127,127,127,59,63,107,71,68,89,33,79,114,178,127,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,0,85,131,117,127,147,163,104,0,140,18,0,107,130,0,150,150,198,0,0,40,38,91,165,209,198,127,127,153,204,51,51,150,150,255,204,0,150,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,22,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 }; |
209 | for (int i = 0; i < VISUALPARAM_COUNT; i++) | 235 | // for (int i = 0; i < VISUALPARAM_COUNT; i++) |
210 | { | 236 | // { |
211 | m_visualparams[i] = 150; | 237 | // m_visualparams[i] = 150; |
212 | } | 238 | // } |
213 | } | 239 | } |
214 | 240 | ||
215 | protected virtual void SetDefaultTexture() | 241 | protected virtual void SetDefaultTexture() |
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 0a02dcf..efec50b 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs | |||
@@ -82,12 +82,13 @@ namespace OpenSim.Framework | |||
82 | public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); | 82 | public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); |
83 | public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); | 83 | public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); |
84 | 84 | ||
85 | public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8"); | 85 | // public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8"); |
86 | public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594"); | 86 | // public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594"); |
87 | 87 | ||
88 | public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1"); | 88 | // public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1"); |
89 | public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007"); | 89 | // public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007"); |
90 | 90 | ||
91 | private static AvatarWearable[] defaultWearables = null; | ||
91 | 92 | ||
92 | protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>(); | 93 | protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>(); |
93 | protected List<UUID> m_ids = new List<UUID>(); | 94 | protected List<UUID> m_ids = new List<UUID>(); |
@@ -152,6 +153,11 @@ namespace OpenSim.Framework | |||
152 | m_items[itemID] = assetID; | 153 | m_items[itemID] = assetID; |
153 | } | 154 | } |
154 | 155 | ||
156 | public void Wear(WearableItem item) | ||
157 | { | ||
158 | Wear(item.ItemID, item.AssetID); | ||
159 | } | ||
160 | |||
155 | public void Wear(UUID itemID, UUID assetID) | 161 | public void Wear(UUID itemID, UUID assetID) |
156 | { | 162 | { |
157 | Clear(); | 163 | Clear(); |
@@ -204,11 +210,21 @@ namespace OpenSim.Framework | |||
204 | } | 210 | } |
205 | } | 211 | } |
206 | 212 | ||
213 | public UUID GetAsset(UUID itemID) | ||
214 | { | ||
215 | if (!m_items.ContainsKey(itemID)) | ||
216 | return UUID.Zero; | ||
217 | return m_items[itemID]; | ||
218 | } | ||
219 | |||
207 | public static AvatarWearable[] DefaultWearables | 220 | public static AvatarWearable[] DefaultWearables |
208 | { | 221 | { |
209 | get | 222 | get |
210 | { | 223 | { |
211 | AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these | 224 | if (defaultWearables != null) |
225 | return defaultWearables; | ||
226 | |||
227 | defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these | ||
212 | for (int i = 0; i < MAX_WEARABLES; i++) | 228 | for (int i = 0; i < MAX_WEARABLES; i++) |
213 | { | 229 | { |
214 | defaultWearables[i] = new AvatarWearable(); | 230 | defaultWearables[i] = new AvatarWearable(); |
@@ -229,11 +245,11 @@ namespace OpenSim.Framework | |||
229 | // Pants | 245 | // Pants |
230 | defaultWearables[PANTS].Add(DEFAULT_PANTS_ITEM, DEFAULT_PANTS_ASSET); | 246 | defaultWearables[PANTS].Add(DEFAULT_PANTS_ITEM, DEFAULT_PANTS_ASSET); |
231 | 247 | ||
232 | // Alpha | 248 | // // Alpha |
233 | defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); | 249 | // defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); |
234 | 250 | ||
235 | // Tattoo | 251 | // // Tattoo |
236 | defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); | 252 | // defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); |
237 | 253 | ||
238 | return defaultWearables; | 254 | return defaultWearables; |
239 | } | 255 | } |