diff options
author | opensim mirror account | 2010-10-30 12:10:13 -0700 |
---|---|---|
committer | opensim mirror account | 2010-10-30 12:10:13 -0700 |
commit | 0ae4774ce50555a7641bc13d616d184935bdb15b (patch) | |
tree | 039f29d92aee894bcd525cf2c7d5d23e8efc1a08 /OpenSim | |
parent | Merge branch 'master' of /var/git/opensim/ (diff) | |
parent | Move physics actor creation to after SetHeight to try and prevent (diff) | |
download | opensim-SC-0ae4774ce50555a7641bc13d616d184935bdb15b.zip opensim-SC-0ae4774ce50555a7641bc13d616d184935bdb15b.tar.gz opensim-SC-0ae4774ce50555a7641bc13d616d184935bdb15b.tar.bz2 opensim-SC-0ae4774ce50555a7641bc13d616d184935bdb15b.tar.xz |
Merge branch 'master' of /var/git/opensim/
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/Resources/Avatar.migrations | 8 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 40 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarWearable.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 22 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IAvatarService.cs | 105 |
7 files changed, 165 insertions, 60 deletions
diff --git a/OpenSim/Data/MySQL/Resources/Avatar.migrations b/OpenSim/Data/MySQL/Resources/Avatar.migrations index 8d0eee6..f7cf176 100644 --- a/OpenSim/Data/MySQL/Resources/Avatar.migrations +++ b/OpenSim/Data/MySQL/Resources/Avatar.migrations | |||
@@ -10,3 +10,11 @@ CREATE TABLE Avatars ( | |||
10 | KEY(PrincipalID)); | 10 | KEY(PrincipalID)); |
11 | 11 | ||
12 | COMMIT; | 12 | COMMIT; |
13 | |||
14 | :VERSION 2 | ||
15 | |||
16 | BEGIN; | ||
17 | |||
18 | alter table Avatars change column Value Value text; | ||
19 | |||
20 | COMMIT; | ||
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 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d7458b7..4aa19d1 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -5734,6 +5734,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5734 | AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); | 5734 | AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); |
5735 | for (int i = 0; i < nowWearing.WearableData.Length; i++) | 5735 | for (int i = 0; i < nowWearing.WearableData.Length; i++) |
5736 | { | 5736 | { |
5737 | m_log.DebugFormat("[XXX]: Wearable type {0} item {1}", nowWearing.WearableData[i].WearableType, nowWearing.WearableData[i].ItemID); | ||
5737 | AvatarWearingArgs.Wearable wearable = | 5738 | AvatarWearingArgs.Wearable wearable = |
5738 | new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, | 5739 | new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, |
5739 | nowWearing.WearableData[i].WearableType); | 5740 | nowWearing.WearableData[i].WearableType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 6cbd8bd..7f482cb 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -356,17 +356,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
356 | 356 | ||
357 | // m_log.WarnFormat("[AVATAR FACTORY MODULE]: AvatarIsWearing called for {0}",client.AgentId); | 357 | // m_log.WarnFormat("[AVATAR FACTORY MODULE]: AvatarIsWearing called for {0}",client.AgentId); |
358 | 358 | ||
359 | AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance); | 359 | AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false); |
360 | 360 | ||
361 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 361 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
362 | { | 362 | { |
363 | if (wear.Type < AvatarWearable.MAX_WEARABLES) | 363 | if (wear.Type < AvatarWearable.MAX_WEARABLES) |
364 | { | 364 | avatAppearance.Wearables[wear.Type].Add(wear.ItemID,UUID.Zero); |
365 | AvatarWearable newWearable = new AvatarWearable(wear.ItemID,UUID.Zero); | ||
366 | avatAppearance.SetWearable(wear.Type, newWearable); | ||
367 | } | ||
368 | } | 365 | } |
369 | 366 | ||
367 | avatAppearance.GetAssetsFrom(sp.Appearance); | ||
368 | |||
370 | // This could take awhile since it needs to pull inventory | 369 | // This could take awhile since it needs to pull inventory |
371 | SetAppearanceAssets(sp.UUID, ref avatAppearance); | 370 | SetAppearanceAssets(sp.UUID, ref avatAppearance); |
372 | 371 | ||
@@ -384,6 +383,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
384 | { | 383 | { |
385 | for (int j = 0 ; j < appearance.Wearables[j].Count ; j ++ ) | 384 | for (int j = 0 ; j < appearance.Wearables[j].Count ; j ++ ) |
386 | { | 385 | { |
386 | if (appearance.Wearables[i][j].ItemID == UUID.Zero) | ||
387 | continue; | ||
388 | |||
389 | // Ignore ruth's assets | ||
390 | if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) | ||
391 | continue; | ||
387 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); | 392 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); |
388 | baseItem = invService.GetItem(baseItem); | 393 | baseItem = invService.GetItem(baseItem); |
389 | 394 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 52e7462..8defe68 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -858,17 +858,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
858 | } | 858 | } |
859 | AbsolutePosition = pos; | 859 | AbsolutePosition = pos; |
860 | 860 | ||
861 | AddToPhysicalScene(isFlying); | ||
862 | |||
863 | if (m_forceFly) | ||
864 | { | ||
865 | m_physicsActor.Flying = true; | ||
866 | } | ||
867 | else if (m_flyDisabled) | ||
868 | { | ||
869 | m_physicsActor.Flying = false; | ||
870 | } | ||
871 | |||
872 | if (m_appearance != null) | 861 | if (m_appearance != null) |
873 | { | 862 | { |
874 | if (m_appearance.AvatarHeight > 0) | 863 | if (m_appearance.AvatarHeight > 0) |
@@ -881,6 +870,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
881 | m_appearance = new AvatarAppearance(UUID); | 870 | m_appearance = new AvatarAppearance(UUID); |
882 | } | 871 | } |
883 | 872 | ||
873 | AddToPhysicalScene(isFlying); | ||
874 | |||
875 | if (m_forceFly) | ||
876 | { | ||
877 | m_physicsActor.Flying = true; | ||
878 | } | ||
879 | else if (m_flyDisabled) | ||
880 | { | ||
881 | m_physicsActor.Flying = false; | ||
882 | } | ||
883 | |||
884 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | 884 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying |
885 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent | 885 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent |
886 | // elsewhere anyway | 886 | // elsewhere anyway |
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index 186871a..860a13b 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,17 @@ 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 | // Legacy Wearables |
197 | if (Data.ContainsKey("BodyItem")) | 197 | if (Data.ContainsKey("BodyItem")) |
198 | appearance.Wearables[AvatarWearable.BODY].Wear( | 198 | appearance.Wearables[AvatarWearable.BODY].Wear( |
199 | UUID.Parse(Data["BodyItem"]), | 199 | UUID.Parse(Data["BodyItem"]), |
@@ -260,6 +260,35 @@ namespace OpenSim.Services.Interfaces | |||
260 | UUID.Parse(Data["SkirtAsset"])); | 260 | UUID.Parse(Data["SkirtAsset"])); |
261 | 261 | ||
262 | 262 | ||
263 | if (Data.ContainsKey("VisualParams")) | ||
264 | { | ||
265 | string[] vps = Data["VisualParams"].Split(new char[] {','}); | ||
266 | byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT]; | ||
267 | |||
268 | for (int i = 0 ; i < vps.Length && i < binary.Length ; i++) | ||
269 | binary[i] = (byte)Convert.ToInt32(vps[i]); | ||
270 | |||
271 | appearance.VisualParams = binary; | ||
272 | } | ||
273 | |||
274 | // New style wearables | ||
275 | foreach (KeyValuePair<string, string> _kvp in Data) | ||
276 | { | ||
277 | if (_kvp.Key.StartsWith("Wearable ")) | ||
278 | { | ||
279 | string wearIndex = _kvp.Key.Substring(9); | ||
280 | string[] wearIndices = wearIndex.Split(new char[] {':'}); | ||
281 | int index = Convert.ToInt32(wearIndices[0]); | ||
282 | |||
283 | string[] ids = _kvp.Value.Split(new char[] {':'}); | ||
284 | UUID itemID = new UUID(ids[0]); | ||
285 | UUID assetID = new UUID(ids[1]); | ||
286 | |||
287 | appearance.Wearables[index].Add(itemID, assetID); | ||
288 | } | ||
289 | } | ||
290 | |||
291 | |||
263 | // Attachments | 292 | // Attachments |
264 | Dictionary<string, string> attchs = new Dictionary<string, string>(); | 293 | Dictionary<string, string> attchs = new Dictionary<string, string>(); |
265 | foreach (KeyValuePair<string, string> _kvp in Data) | 294 | foreach (KeyValuePair<string, string> _kvp in Data) |
@@ -278,6 +307,26 @@ namespace OpenSim.Services.Interfaces | |||
278 | 307 | ||
279 | appearance.SetAttachment(point,uuid,UUID.Zero); | 308 | appearance.SetAttachment(point,uuid,UUID.Zero); |
280 | } | 309 | } |
310 | |||
311 | if (appearance.Wearables[AvatarWearable.BODY].Count == 0) | ||
312 | appearance.Wearables[AvatarWearable.BODY].Wear( | ||
313 | AvatarWearable.DefaultWearables[ | ||
314 | AvatarWearable.BODY][0]); | ||
315 | |||
316 | if (appearance.Wearables[AvatarWearable.SKIN].Count == 0) | ||
317 | appearance.Wearables[AvatarWearable.SKIN].Wear( | ||
318 | AvatarWearable.DefaultWearables[ | ||
319 | AvatarWearable.SKIN][0]); | ||
320 | |||
321 | if (appearance.Wearables[AvatarWearable.HAIR].Count == 0) | ||
322 | appearance.Wearables[AvatarWearable.HAIR].Wear( | ||
323 | AvatarWearable.DefaultWearables[ | ||
324 | AvatarWearable.HAIR][0]); | ||
325 | |||
326 | if (appearance.Wearables[AvatarWearable.EYES].Count == 0) | ||
327 | appearance.Wearables[AvatarWearable.EYES].Wear( | ||
328 | AvatarWearable.DefaultWearables[ | ||
329 | AvatarWearable.EYES][0]); | ||
281 | } | 330 | } |
282 | catch | 331 | catch |
283 | { | 332 | { |