aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Interfaces
diff options
context:
space:
mode:
authorJonathan Freedman2010-10-30 18:28:07 -0400
committerJonathan Freedman2010-10-30 18:28:07 -0400
commit95a0ea78f9604e8b4fcf0617c0943fe0486f4d08 (patch)
tree04358e5eb88e47a320f87ff8fc9f27276bbf4697 /OpenSim/Services/Interfaces
parentMerge branch 'master' into mantis5110 (diff)
parentFixed: ToAvatarAppearance wasn't retrieving the AvatarHeight. (diff)
downloadopensim-SC_OLD-95a0ea78f9604e8b4fcf0617c0943fe0486f4d08.zip
opensim-SC_OLD-95a0ea78f9604e8b4fcf0617c0943fe0486f4d08.tar.gz
opensim-SC_OLD-95a0ea78f9604e8b4fcf0617c0943fe0486f4d08.tar.bz2
opensim-SC_OLD-95a0ea78f9604e8b4fcf0617c0943fe0486f4d08.tar.xz
Merge branch 'master' into mantis5110
Diffstat (limited to 'OpenSim/Services/Interfaces')
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs108
1 files changed, 80 insertions, 28 deletions
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index 186871a..d7af562 100644
--- a/OpenSim/Services/Interfaces/IAvatarService.cs
+++ b/OpenSim/Services/Interfaces/IAvatarService.cs
@@ -149,33 +149,28 @@ namespace OpenSim.Services.Interfaces
149 Data["Serial"] = appearance.Serial.ToString(); 149 Data["Serial"] = appearance.Serial.ToString();
150 // Wearables 150 // Wearables
151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); 151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
152 Data["BodyItem"] = appearance.Wearables[AvatarWearable.BODY][0].ItemID.ToString(); 152
153 Data["EyesItem"] = appearance.Wearables[AvatarWearable.EYES][0].ItemID.ToString(); 153 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++)
154 Data["GlovesItem"] = appearance.Wearables[AvatarWearable.GLOVES][0].ItemID.ToString(); 154 {
155 Data["HairItem"] = appearance.Wearables[AvatarWearable.HAIR][0].ItemID.ToString(); 155 for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
156 Data["JacketItem"] = appearance.Wearables[AvatarWearable.JACKET][0].ItemID.ToString(); 156 {
157 Data["PantsItem"] = appearance.Wearables[AvatarWearable.PANTS][0].ItemID.ToString(); 157 string fieldName = String.Format("Wearable {0}:{1}", i, j);
158 Data["ShirtItem"] = appearance.Wearables[AvatarWearable.SHIRT][0].ItemID.ToString(); 158 Data[fieldName] = String.Format("{0}:{1}",
159 Data["ShoesItem"] = appearance.Wearables[AvatarWearable.SHOES][0].ItemID.ToString(); 159 appearance.Wearables[i][j].ItemID.ToString(),
160 Data["SkinItem"] = appearance.Wearables[AvatarWearable.SKIN][0].ItemID.ToString(); 160 appearance.Wearables[i][j].AssetID.ToString());
161 Data["SkirtItem"] = appearance.Wearables[AvatarWearable.SKIRT][0].ItemID.ToString(); 161 }
162 Data["SocksItem"] = appearance.Wearables[AvatarWearable.SOCKS][0].ItemID.ToString(); 162 }
163 Data["UnderPantsItem"] = appearance.Wearables[AvatarWearable.UNDERPANTS][0].ItemID.ToString(); 163
164 Data["UnderShirtItem"] = appearance.Wearables[AvatarWearable.UNDERSHIRT][0].ItemID.ToString(); 164 // Visual Params
165 165 string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT];
166 Data["BodyAsset"] = appearance.Wearables[AvatarWearable.BODY][0].AssetID.ToString(); 166 byte[] binary = appearance.VisualParams;
167 Data["EyesAsset"] = appearance.Wearables[AvatarWearable.EYES][0].AssetID.ToString(); 167
168 Data["GlovesAsset"] = appearance.Wearables[AvatarWearable.GLOVES][0].AssetID.ToString(); 168 for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++)
169 Data["HairAsset"] = appearance.Wearables[AvatarWearable.HAIR][0].AssetID.ToString(); 169 {
170 Data["JacketAsset"] = appearance.Wearables[AvatarWearable.JACKET][0].AssetID.ToString(); 170 vps[i] = binary[i].ToString();
171 Data["PantsAsset"] = appearance.Wearables[AvatarWearable.PANTS][0].AssetID.ToString(); 171 }
172 Data["ShirtAsset"] = appearance.Wearables[AvatarWearable.SHIRT][0].AssetID.ToString(); 172
173 Data["ShoesAsset"] = appearance.Wearables[AvatarWearable.SHOES][0].AssetID.ToString(); 173 Data["VisualParams"] = String.Join(",", vps);
174 Data["SkinAsset"] = appearance.Wearables[AvatarWearable.SKIN][0].AssetID.ToString();
175 Data["SkirtAsset"] = appearance.Wearables[AvatarWearable.SKIRT][0].AssetID.ToString();
176 Data["SocksAsset"] = appearance.Wearables[AvatarWearable.SOCKS][0].AssetID.ToString();
177 Data["UnderPantsAsset"] = appearance.Wearables[AvatarWearable.UNDERPANTS][0].AssetID.ToString();
178 Data["UnderShirtAsset"] = appearance.Wearables[AvatarWearable.UNDERSHIRT][0].AssetID.ToString();
179 174
180 // Attachments 175 // Attachments
181 List<AvatarAttachment> attachments = appearance.GetAttachments(); 176 List<AvatarAttachment> attachments = appearance.GetAttachments();
@@ -188,12 +183,20 @@ namespace OpenSim.Services.Interfaces
188 public AvatarAppearance ToAvatarAppearance(UUID owner) 183 public AvatarAppearance ToAvatarAppearance(UUID owner)
189 { 184 {
190 AvatarAppearance appearance = new AvatarAppearance(owner); 185 AvatarAppearance appearance = new AvatarAppearance(owner);
186
187 if (Data.Count == 0)
188 return appearance;
189
190 appearance.ClearWearables();
191 try 191 try
192 { 192 {
193 if (Data.ContainsKey("Serial")) 193 if (Data.ContainsKey("Serial"))
194 appearance.Serial = Int32.Parse(Data["Serial"]); 194 appearance.Serial = Int32.Parse(Data["Serial"]);
195 195
196 // Wearables 196 if (Data.ContainsKey("AvatarHeight"))
197 appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]);
198
199 // Legacy Wearables
197 if (Data.ContainsKey("BodyItem")) 200 if (Data.ContainsKey("BodyItem"))
198 appearance.Wearables[AvatarWearable.BODY].Wear( 201 appearance.Wearables[AvatarWearable.BODY].Wear(
199 UUID.Parse(Data["BodyItem"]), 202 UUID.Parse(Data["BodyItem"]),
@@ -260,6 +263,35 @@ namespace OpenSim.Services.Interfaces
260 UUID.Parse(Data["SkirtAsset"])); 263 UUID.Parse(Data["SkirtAsset"]));
261 264
262 265
266 if (Data.ContainsKey("VisualParams"))
267 {
268 string[] vps = Data["VisualParams"].Split(new char[] {','});
269 byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT];
270
271 for (int i = 0 ; i < vps.Length && i < binary.Length ; i++)
272 binary[i] = (byte)Convert.ToInt32(vps[i]);
273
274 appearance.VisualParams = binary;
275 }
276
277 // New style wearables
278 foreach (KeyValuePair<string, string> _kvp in Data)
279 {
280 if (_kvp.Key.StartsWith("Wearable "))
281 {
282 string wearIndex = _kvp.Key.Substring(9);
283 string[] wearIndices = wearIndex.Split(new char[] {':'});
284 int index = Convert.ToInt32(wearIndices[0]);
285
286 string[] ids = _kvp.Value.Split(new char[] {':'});
287 UUID itemID = new UUID(ids[0]);
288 UUID assetID = new UUID(ids[1]);
289
290 appearance.Wearables[index].Add(itemID, assetID);
291 }
292 }
293
294
263 // Attachments 295 // Attachments
264 Dictionary<string, string> attchs = new Dictionary<string, string>(); 296 Dictionary<string, string> attchs = new Dictionary<string, string>();
265 foreach (KeyValuePair<string, string> _kvp in Data) 297 foreach (KeyValuePair<string, string> _kvp in Data)
@@ -278,6 +310,26 @@ namespace OpenSim.Services.Interfaces
278 310
279 appearance.SetAttachment(point,uuid,UUID.Zero); 311 appearance.SetAttachment(point,uuid,UUID.Zero);
280 } 312 }
313
314 if (appearance.Wearables[AvatarWearable.BODY].Count == 0)
315 appearance.Wearables[AvatarWearable.BODY].Wear(
316 AvatarWearable.DefaultWearables[
317 AvatarWearable.BODY][0]);
318
319 if (appearance.Wearables[AvatarWearable.SKIN].Count == 0)
320 appearance.Wearables[AvatarWearable.SKIN].Wear(
321 AvatarWearable.DefaultWearables[
322 AvatarWearable.SKIN][0]);
323
324 if (appearance.Wearables[AvatarWearable.HAIR].Count == 0)
325 appearance.Wearables[AvatarWearable.HAIR].Wear(
326 AvatarWearable.DefaultWearables[
327 AvatarWearable.HAIR][0]);
328
329 if (appearance.Wearables[AvatarWearable.EYES].Count == 0)
330 appearance.Wearables[AvatarWearable.EYES].Wear(
331 AvatarWearable.DefaultWearables[
332 AvatarWearable.EYES][0]);
281 } 333 }
282 catch 334 catch
283 { 335 {