aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-10-30 02:25:25 +0100
committerMelanie2010-10-30 02:25:25 +0100
commitff7da2082d4d44b34c3ef312d5ec5e88c94931e1 (patch)
treeafd863eb3240e038bc10037cf4e2fc8a844fc1ea /OpenSim
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-ff7da2082d4d44b34c3ef312d5ec5e88c94931e1.zip
opensim-SC_OLD-ff7da2082d4d44b34c3ef312d5ec5e88c94931e1.tar.gz
opensim-SC_OLD-ff7da2082d4d44b34c3ef312d5ec5e88c94931e1.tar.bz2
opensim-SC_OLD-ff7da2082d4d44b34c3ef312d5ec5e88c94931e1.tar.xz
This commit fixes all the appearance related null refs. Still can't log in,
client displays a blank error box.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs9
-rw-r--r--OpenSim/Framework/AvatarWearable.cs2
-rw-r--r--OpenSim/Services/AvatarService/AvatarService.cs11
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs117
4 files changed, 80 insertions, 59 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index ee60622..1e003f7 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -111,6 +111,10 @@ namespace OpenSim.Framework
111 SetDefaultParams(); 111 SetDefaultParams();
112 SetHeight(); 112 SetHeight();
113 113
114 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
115 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
116 m_wearables[i] = new AvatarWearable();
117
114 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 118 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
115 } 119 }
116 120
@@ -172,10 +176,11 @@ namespace OpenSim.Framework
172 m_serial = appearance.Serial; 176 m_serial = appearance.Serial;
173 m_owner = appearance.Owner; 177 m_owner = appearance.Owner;
174 178
175 m_wearables = null; 179 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
180 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
181 m_wearables[i] = new AvatarWearable();
176 if (appearance.Wearables != null) 182 if (appearance.Wearables != null)
177 { 183 {
178 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 15 of these
179 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 184 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
180 SetWearable(i,appearance.Wearables[i]); 185 SetWearable(i,appearance.Wearables[i]);
181 } 186 }
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index 631971f..0a02dcf 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Framework
63 public static readonly int UNDERPANTS = 11; 63 public static readonly int UNDERPANTS = 11;
64 public static readonly int SKIRT = 12; 64 public static readonly int SKIRT = 12;
65 public static readonly int ALPHA = 13; 65 public static readonly int ALPHA = 13;
66 public static readonly int TATTOO = 15; 66 public static readonly int TATTOO = 14;
67 67
68 public static readonly int MAX_WEARABLES = 15; 68 public static readonly int MAX_WEARABLES = 15;
69 69
diff --git a/OpenSim/Services/AvatarService/AvatarService.cs b/OpenSim/Services/AvatarService/AvatarService.cs
index a8ad413..53ca7c8 100644
--- a/OpenSim/Services/AvatarService/AvatarService.cs
+++ b/OpenSim/Services/AvatarService/AvatarService.cs
@@ -51,8 +51,6 @@ namespace OpenSim.Services.AvatarService
51 m_log.Debug("[AVATAR SERVICE]: Starting avatar service"); 51 m_log.Debug("[AVATAR SERVICE]: Starting avatar service");
52 } 52 }
53 53
54 // Get|SetAppearance should preserve existing semantics
55 // until AvatarData can be removed completely
56 public AvatarAppearance GetAppearance(UUID principalID) 54 public AvatarAppearance GetAppearance(UUID principalID)
57 { 55 {
58 AvatarData avatar = GetAvatar(principalID); 56 AvatarData avatar = GetAvatar(principalID);
@@ -68,12 +66,15 @@ namespace OpenSim.Services.AvatarService
68 public AvatarData GetAvatar(UUID principalID) 66 public AvatarData GetAvatar(UUID principalID)
69 { 67 {
70 AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString()); 68 AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString());
71 if (av.Length == 0)
72 return null;
73
74 AvatarData ret = new AvatarData(); 69 AvatarData ret = new AvatarData();
75 ret.Data = new Dictionary<string,string>(); 70 ret.Data = new Dictionary<string,string>();
76 71
72 if (av.Length == 0)
73 {
74 ret.AvatarType = 1; // SL avatar
75 return ret;
76 }
77
77 foreach (AvatarBaseData b in av) 78 foreach (AvatarBaseData b in av)
78 { 79 {
79 if (b.Data["Name"] == "AvatarType") 80 if (b.Data["Name"] == "AvatarType")
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index a029fbc..186871a 100644
--- a/OpenSim/Services/Interfaces/IAvatarService.cs
+++ b/OpenSim/Services/Interfaces/IAvatarService.cs
@@ -190,60 +190,75 @@ namespace OpenSim.Services.Interfaces
190 AvatarAppearance appearance = new AvatarAppearance(owner); 190 AvatarAppearance appearance = new AvatarAppearance(owner);
191 try 191 try
192 { 192 {
193 appearance.Serial = Int32.Parse(Data["Serial"]); 193 if (Data.ContainsKey("Serial"))
194 appearance.Serial = Int32.Parse(Data["Serial"]);
194 195
195 // Wearables 196 // Wearables
196 appearance.Wearables[AvatarWearable.BODY].Wear( 197 if (Data.ContainsKey("BodyItem"))
197 UUID.Parse(Data["BodyItem"]), 198 appearance.Wearables[AvatarWearable.BODY].Wear(
198 UUID.Parse(Data["BodyAsset"])); 199 UUID.Parse(Data["BodyItem"]),
200 UUID.Parse(Data["BodyAsset"]));
201
202 if (Data.ContainsKey("SkinItem"))
203 appearance.Wearables[AvatarWearable.SKIN].Wear(
204 UUID.Parse(Data["SkinItem"]),
205 UUID.Parse(Data["SkinAsset"]));
206
207 if (Data.ContainsKey("HairItem"))
208 appearance.Wearables[AvatarWearable.HAIR].Wear(
209 UUID.Parse(Data["HairItem"]),
210 UUID.Parse(Data["HairAsset"]));
211
212 if (Data.ContainsKey("EyesItem"))
213 appearance.Wearables[AvatarWearable.EYES].Wear(
214 UUID.Parse(Data["EyesItem"]),
215 UUID.Parse(Data["EyesAsset"]));
216
217 if (Data.ContainsKey("ShirtItem"))
218 appearance.Wearables[AvatarWearable.SHIRT].Wear(
219 UUID.Parse(Data["ShirtItem"]),
220 UUID.Parse(Data["ShirtAsset"]));
221
222 if (Data.ContainsKey("PantsItem"))
223 appearance.Wearables[AvatarWearable.PANTS].Wear(
224 UUID.Parse(Data["PantsItem"]),
225 UUID.Parse(Data["PantsAsset"]));
226
227 if (Data.ContainsKey("ShoesItem"))
228 appearance.Wearables[AvatarWearable.SHOES].Wear(
229 UUID.Parse(Data["ShoesItem"]),
230 UUID.Parse(Data["ShoesAsset"]));
231
232 if (Data.ContainsKey("SocksItem"))
233 appearance.Wearables[AvatarWearable.SOCKS].Wear(
234 UUID.Parse(Data["SocksItem"]),
235 UUID.Parse(Data["SocksAsset"]));
236
237 if (Data.ContainsKey("JacketItem"))
238 appearance.Wearables[AvatarWearable.JACKET].Wear(
239 UUID.Parse(Data["JacketItem"]),
240 UUID.Parse(Data["JacketAsset"]));
241
242 if (Data.ContainsKey("GlovesItem"))
243 appearance.Wearables[AvatarWearable.GLOVES].Wear(
244 UUID.Parse(Data["GlovesItem"]),
245 UUID.Parse(Data["GlovesAsset"]));
246
247 if (Data.ContainsKey("UnderShirtItem"))
248 appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear(
249 UUID.Parse(Data["UnderShirtItem"]),
250 UUID.Parse(Data["UnderShirtAsset"]));
251
252 if (Data.ContainsKey("UnderPantsItem"))
253 appearance.Wearables[AvatarWearable.UNDERPANTS].Wear(
254 UUID.Parse(Data["UnderPantsItem"]),
255 UUID.Parse(Data["UnderPantsAsset"]));
256
257 if (Data.ContainsKey("SkirtItem"))
258 appearance.Wearables[AvatarWearable.SKIRT].Wear(
259 UUID.Parse(Data["SkirtItem"]),
260 UUID.Parse(Data["SkirtAsset"]));
199 261
200 appearance.Wearables[AvatarWearable.SKIN].Wear(
201 UUID.Parse(Data["SkinItem"]),
202 UUID.Parse(Data["SkinAsset"]));
203
204 appearance.Wearables[AvatarWearable.HAIR].Wear(
205 UUID.Parse(Data["HairItem"]),
206 UUID.Parse(Data["HairAsset"]));
207
208 appearance.Wearables[AvatarWearable.EYES].Wear(
209 UUID.Parse(Data["EyesItem"]),
210 UUID.Parse(Data["EyesAsset"]));
211
212 appearance.Wearables[AvatarWearable.SHIRT].Wear(
213 UUID.Parse(Data["ShirtItem"]),
214 UUID.Parse(Data["ShirtAsset"]));
215
216 appearance.Wearables[AvatarWearable.PANTS].Wear(
217 UUID.Parse(Data["PantsItem"]),
218 UUID.Parse(Data["PantsAsset"]));
219
220 appearance.Wearables[AvatarWearable.SHOES].Wear(
221 UUID.Parse(Data["ShoesItem"]),
222 UUID.Parse(Data["ShoesAsset"]));
223
224 appearance.Wearables[AvatarWearable.SOCKS].Wear(
225 UUID.Parse(Data["SocksItem"]),
226 UUID.Parse(Data["SocksAsset"]));
227
228 appearance.Wearables[AvatarWearable.JACKET].Wear(
229 UUID.Parse(Data["JacketItem"]),
230 UUID.Parse(Data["JacketAsset"]));
231
232 appearance.Wearables[AvatarWearable.GLOVES].Wear(
233 UUID.Parse(Data["GlovesItem"]),
234 UUID.Parse(Data["GlovesAsset"]));
235
236 appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear(
237 UUID.Parse(Data["UnderShirtItem"]),
238 UUID.Parse(Data["UnderShirtAsset"]));
239
240 appearance.Wearables[AvatarWearable.UNDERPANTS].Wear(
241 UUID.Parse(Data["UnderPantsItem"]),
242 UUID.Parse(Data["UnderPantsAsset"]));
243
244 appearance.Wearables[AvatarWearable.SKIRT].Wear(
245 UUID.Parse(Data["SkirtItem"]),
246 UUID.Parse(Data["SkirtAsset"]));
247 262
248 // Attachments 263 // Attachments
249 Dictionary<string, string> attchs = new Dictionary<string, string>(); 264 Dictionary<string, string> attchs = new Dictionary<string, string>();