diff options
author | Robert Adams | 2013-12-17 06:18:13 -0800 |
---|---|---|
committer | Robert Adams | 2013-12-17 06:18:13 -0800 |
commit | 6937eec2588fab5e73c3ddc74c4ddc1bb35e7527 (patch) | |
tree | 4372b6dfa7f2e277312c0547a099f6ffeea6e91f /OpenSim/Framework | |
parent | varregion: rename 'LegacyRegionLocX' back to 'RegionLocX' and same for Y and Z. (diff) | |
parent | Fix issue with editing notes for other avatars (diff) | |
download | opensim-SC_OLD-6937eec2588fab5e73c3ddc74c4ddc1bb35e7527.zip opensim-SC_OLD-6937eec2588fab5e73c3ddc74c4ddc1bb35e7527.tar.gz opensim-SC_OLD-6937eec2588fab5e73c3ddc74c4ddc1bb35e7527.tar.bz2 opensim-SC_OLD-6937eec2588fab5e73c3ddc74c4ddc1bb35e7527.tar.xz |
Merge branch 'master' into varregion
Add new region crossing code to varregion
Conflicts:
OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 313 | ||||
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 18 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/IImprovedAssetCache.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/ILandObject.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/SLUtil.cs | 30 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/UserProfiles.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/WearableCacheItem.cs | 157 |
9 files changed, 419 insertions, 115 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 157feb5..b7a0adf 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -40,8 +40,17 @@ namespace OpenSim.Framework | |||
40 | /// </summary> | 40 | /// </summary> |
41 | public class AvatarAppearance | 41 | public class AvatarAppearance |
42 | { | 42 | { |
43 | // SL box diferent to size | ||
44 | const float AVBOXAJUST = 0.2f; | ||
45 | // constrains for ubitode physics | ||
46 | const float AVBOXMINX = 0.2f; | ||
47 | const float AVBOXMINY = 0.3f; | ||
48 | const float AVBOXMINZ = 1.2f; | ||
49 | |||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 51 | ||
52 | // this is viewer capabilities and weared things dependent | ||
53 | // should be only used as initial default value ( V1 viewers ) | ||
45 | public readonly static int VISUALPARAM_COUNT = 218; | 54 | public readonly static int VISUALPARAM_COUNT = 218; |
46 | 55 | ||
47 | public readonly static int TEXTURE_COUNT = 21; | 56 | public readonly static int TEXTURE_COUNT = 21; |
@@ -53,7 +62,12 @@ namespace OpenSim.Framework | |||
53 | protected AvatarWearable[] m_wearables; | 62 | protected AvatarWearable[] m_wearables; |
54 | protected Dictionary<int, List<AvatarAttachment>> m_attachments; | 63 | protected Dictionary<int, List<AvatarAttachment>> m_attachments; |
55 | protected float m_avatarHeight = 0; | 64 | protected float m_avatarHeight = 0; |
56 | protected UUID[] m_texturehashes; | 65 | protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); // sl Z cloud value |
66 | protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); | ||
67 | protected float m_avatarFeetOffset = 0; | ||
68 | protected float m_avatarAnimOffset = 0; | ||
69 | protected WearableCacheItem[] m_cacheitems; | ||
70 | protected bool m_cacheItemsDirty = true; | ||
57 | 71 | ||
58 | public virtual int Serial | 72 | public virtual int Serial |
59 | { | 73 | { |
@@ -67,6 +81,21 @@ namespace OpenSim.Framework | |||
67 | set { m_visualparams = value; } | 81 | set { m_visualparams = value; } |
68 | } | 82 | } |
69 | 83 | ||
84 | public virtual Vector3 AvatarSize | ||
85 | { | ||
86 | get { return m_avatarSize; } | ||
87 | } | ||
88 | |||
89 | public virtual Vector3 AvatarBoxSize | ||
90 | { | ||
91 | get { return m_avatarBoxSize; } | ||
92 | } | ||
93 | |||
94 | public virtual float AvatarFeetOffset | ||
95 | { | ||
96 | get { return m_avatarFeetOffset + m_avatarAnimOffset; } | ||
97 | } | ||
98 | |||
70 | public virtual Primitive.TextureEntry Texture | 99 | public virtual Primitive.TextureEntry Texture |
71 | { | 100 | { |
72 | get { return m_texture; } | 101 | get { return m_texture; } |
@@ -88,6 +117,18 @@ namespace OpenSim.Framework | |||
88 | get { return m_avatarHeight; } | 117 | get { return m_avatarHeight; } |
89 | set { m_avatarHeight = value; } | 118 | set { m_avatarHeight = value; } |
90 | } | 119 | } |
120 | |||
121 | public virtual WearableCacheItem[] WearableCacheItems | ||
122 | { | ||
123 | get { return m_cacheitems; } | ||
124 | set { m_cacheitems = value; } | ||
125 | } | ||
126 | |||
127 | public virtual bool WearableCacheItemsDirty | ||
128 | { | ||
129 | get { return m_cacheItemsDirty; } | ||
130 | set { m_cacheItemsDirty = value; } | ||
131 | } | ||
91 | 132 | ||
92 | public AvatarAppearance() | 133 | public AvatarAppearance() |
93 | { | 134 | { |
@@ -97,10 +138,9 @@ namespace OpenSim.Framework | |||
97 | SetDefaultWearables(); | 138 | SetDefaultWearables(); |
98 | SetDefaultTexture(); | 139 | SetDefaultTexture(); |
99 | SetDefaultParams(); | 140 | SetDefaultParams(); |
100 | SetHeight(); | 141 | // SetHeight(); |
142 | SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
101 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 143 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
102 | |||
103 | ResetTextureHashes(); | ||
104 | } | 144 | } |
105 | 145 | ||
106 | public AvatarAppearance(OSDMap map) | 146 | public AvatarAppearance(OSDMap map) |
@@ -108,7 +148,35 @@ namespace OpenSim.Framework | |||
108 | // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); | 148 | // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); |
109 | 149 | ||
110 | Unpack(map); | 150 | Unpack(map); |
111 | SetHeight(); | 151 | // SetHeight(); done in Unpack |
152 | } | ||
153 | |||
154 | public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) | ||
155 | { | ||
156 | // m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance"); | ||
157 | |||
158 | m_serial = 0; | ||
159 | |||
160 | if (wearables != null) | ||
161 | m_wearables = wearables; | ||
162 | else | ||
163 | SetDefaultWearables(); | ||
164 | |||
165 | if (textureEntry != null) | ||
166 | m_texture = textureEntry; | ||
167 | else | ||
168 | SetDefaultTexture(); | ||
169 | |||
170 | if (visualParams != null) | ||
171 | m_visualparams = visualParams; | ||
172 | else | ||
173 | SetDefaultParams(); | ||
174 | |||
175 | // SetHeight(); | ||
176 | if(m_avatarHeight == 0) | ||
177 | SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
178 | |||
179 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | ||
112 | } | 180 | } |
113 | 181 | ||
114 | public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) | 182 | public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) |
@@ -125,11 +193,10 @@ namespace OpenSim.Framework | |||
125 | SetDefaultWearables(); | 193 | SetDefaultWearables(); |
126 | SetDefaultTexture(); | 194 | SetDefaultTexture(); |
127 | SetDefaultParams(); | 195 | SetDefaultParams(); |
128 | SetHeight(); | 196 | // SetHeight(); |
197 | SetSize(new Vector3(0.45f, 0.6f, 1.9f)); | ||
129 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 198 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
130 | 199 | ||
131 | ResetTextureHashes(); | ||
132 | |||
133 | return; | 200 | return; |
134 | } | 201 | } |
135 | 202 | ||
@@ -145,10 +212,6 @@ namespace OpenSim.Framework | |||
145 | SetWearable(i,appearance.Wearables[i]); | 212 | SetWearable(i,appearance.Wearables[i]); |
146 | } | 213 | } |
147 | 214 | ||
148 | m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; | ||
149 | for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) | ||
150 | m_texturehashes[i] = new UUID(appearance.m_texturehashes[i]); | ||
151 | |||
152 | m_texture = null; | 215 | m_texture = null; |
153 | if (appearance.Texture != null) | 216 | if (appearance.Texture != null) |
154 | { | 217 | { |
@@ -160,7 +223,8 @@ namespace OpenSim.Framework | |||
160 | if (appearance.VisualParams != null) | 223 | if (appearance.VisualParams != null) |
161 | m_visualparams = (byte[])appearance.VisualParams.Clone(); | 224 | m_visualparams = (byte[])appearance.VisualParams.Clone(); |
162 | 225 | ||
163 | m_avatarHeight = appearance.m_avatarHeight; | 226 | // m_avatarHeight = appearance.m_avatarHeight; |
227 | SetSize(appearance.AvatarSize); | ||
164 | 228 | ||
165 | // Copy the attachment, force append mode since that ensures consistency | 229 | // Copy the attachment, force append mode since that ensures consistency |
166 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 230 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
@@ -183,37 +247,6 @@ namespace OpenSim.Framework | |||
183 | } | 247 | } |
184 | } | 248 | } |
185 | 249 | ||
186 | public void ResetTextureHashes() | ||
187 | { | ||
188 | m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; | ||
189 | for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) | ||
190 | m_texturehashes[i] = UUID.Zero; | ||
191 | } | ||
192 | |||
193 | public UUID GetTextureHash(int textureIndex) | ||
194 | { | ||
195 | return m_texturehashes[NormalizeBakedTextureIndex(textureIndex)]; | ||
196 | } | ||
197 | |||
198 | public void SetTextureHash(int textureIndex, UUID textureHash) | ||
199 | { | ||
200 | m_texturehashes[NormalizeBakedTextureIndex(textureIndex)] = new UUID(textureHash); | ||
201 | } | ||
202 | |||
203 | /// <summary> | ||
204 | /// Normalizes the texture index to the actual bake index, this is done to | ||
205 | /// accommodate older viewers that send the BAKE_INDICES index rather than | ||
206 | /// the actual texture index | ||
207 | /// </summary> | ||
208 | private int NormalizeBakedTextureIndex(int textureIndex) | ||
209 | { | ||
210 | // Earlier viewer send the index into the baked index array, just trying to be careful here | ||
211 | if (textureIndex < BAKE_INDICES.Length) | ||
212 | return BAKE_INDICES[textureIndex]; | ||
213 | |||
214 | return textureIndex; | ||
215 | } | ||
216 | |||
217 | public void ClearWearables() | 250 | public void ClearWearables() |
218 | { | 251 | { |
219 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; | 252 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; |
@@ -237,7 +270,12 @@ namespace OpenSim.Framework | |||
237 | m_serial = 0; | 270 | m_serial = 0; |
238 | 271 | ||
239 | SetDefaultTexture(); | 272 | SetDefaultTexture(); |
240 | ResetTextureHashes(); | 273 | |
274 | //for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
275 | // { | ||
276 | // int idx = BAKE_INDICES[i]; | ||
277 | // m_texture.FaceTextures[idx].TextureID = UUID.Zero; | ||
278 | // } | ||
241 | } | 279 | } |
242 | 280 | ||
243 | protected virtual void SetDefaultParams() | 281 | protected virtual void SetDefaultParams() |
@@ -249,6 +287,21 @@ namespace OpenSim.Framework | |||
249 | // } | 287 | // } |
250 | } | 288 | } |
251 | 289 | ||
290 | /// <summary> | ||
291 | /// Invalidate all of the baked textures in the appearance, useful | ||
292 | /// if you know that none are valid | ||
293 | /// </summary> | ||
294 | public virtual void ResetBakedTextures() | ||
295 | { | ||
296 | SetDefaultTexture(); | ||
297 | |||
298 | //for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
299 | // { | ||
300 | // int idx = BAKE_INDICES[i]; | ||
301 | // m_texture.FaceTextures[idx].TextureID = UUID.Zero; | ||
302 | // } | ||
303 | } | ||
304 | |||
252 | protected virtual void SetDefaultTexture() | 305 | protected virtual void SetDefaultTexture() |
253 | { | 306 | { |
254 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); | 307 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); |
@@ -313,22 +366,33 @@ namespace OpenSim.Framework | |||
313 | // made. We determine if any of the visual parameters actually | 366 | // made. We determine if any of the visual parameters actually |
314 | // changed to know if the appearance should be saved later | 367 | // changed to know if the appearance should be saved later |
315 | bool changed = false; | 368 | bool changed = false; |
316 | for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) | 369 | |
370 | int newsize = visualParams.Length; | ||
371 | |||
372 | if (newsize != m_visualparams.Length) | ||
373 | { | ||
374 | changed = true; | ||
375 | m_visualparams = (byte[])visualParams.Clone(); | ||
376 | } | ||
377 | else | ||
317 | { | 378 | { |
318 | if (visualParams[i] != m_visualparams[i]) | 379 | |
380 | for (int i = 0; i < newsize; i++) | ||
319 | { | 381 | { |
320 | // DEBUG ON | 382 | if (visualParams[i] != m_visualparams[i]) |
321 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", | 383 | { |
322 | // i,m_visualparams[i],visualParams[i]); | 384 | // DEBUG ON |
323 | // DEBUG OFF | 385 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", |
324 | m_visualparams[i] = visualParams[i]; | 386 | // i,m_visualparams[i],visualParams[i]); |
325 | changed = true; | 387 | // DEBUG OFF |
388 | m_visualparams[i] = visualParams[i]; | ||
389 | changed = true; | ||
390 | } | ||
326 | } | 391 | } |
327 | } | 392 | } |
328 | |||
329 | // Reset the height if the visual parameters actually changed | 393 | // Reset the height if the visual parameters actually changed |
330 | if (changed) | 394 | // if (changed) |
331 | SetHeight(); | 395 | // SetHeight(); |
332 | 396 | ||
333 | return changed; | 397 | return changed; |
334 | } | 398 | } |
@@ -344,6 +408,7 @@ namespace OpenSim.Framework | |||
344 | /// </summary> | 408 | /// </summary> |
345 | public virtual void SetHeight() | 409 | public virtual void SetHeight() |
346 | { | 410 | { |
411 | /* | ||
347 | // Start with shortest possible female avatar height | 412 | // Start with shortest possible female avatar height |
348 | m_avatarHeight = 1.14597f; | 413 | m_avatarHeight = 1.14597f; |
349 | // Add offset for male avatars | 414 | // Add offset for male avatars |
@@ -356,6 +421,35 @@ namespace OpenSim.Framework | |||
356 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f | 421 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f |
357 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f | 422 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f |
358 | + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; | 423 | + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; |
424 | */ | ||
425 | } | ||
426 | |||
427 | public void SetSize(Vector3 avSize) | ||
428 | { | ||
429 | if (avSize.X > 32f) | ||
430 | avSize.X = 32f; | ||
431 | else if (avSize.X < 0.1f) | ||
432 | avSize.X = 0.1f; | ||
433 | |||
434 | if (avSize.Y > 32f) | ||
435 | avSize.Y = 32f; | ||
436 | else if (avSize.Y < 0.1f) | ||
437 | avSize.Y = 0.1f; | ||
438 | if (avSize.Z > 32f) | ||
439 | avSize.Z = 32f; | ||
440 | else if (avSize.Z < 0.1f) | ||
441 | avSize.Z = 0.1f; | ||
442 | |||
443 | m_avatarSize = avSize; | ||
444 | m_avatarBoxSize = avSize; | ||
445 | m_avatarBoxSize.Z += AVBOXAJUST; | ||
446 | if (m_avatarBoxSize.X < AVBOXMINX) | ||
447 | m_avatarBoxSize.X = AVBOXMINX; | ||
448 | if (m_avatarBoxSize.Y < AVBOXMINY) | ||
449 | m_avatarBoxSize.Y = AVBOXMINY; | ||
450 | if (m_avatarBoxSize.Z < AVBOXMINZ) | ||
451 | m_avatarBoxSize.Z = AVBOXMINZ; | ||
452 | m_avatarHeight = m_avatarSize.Z; | ||
359 | } | 453 | } |
360 | 454 | ||
361 | public virtual void SetWearable(int wearableId, AvatarWearable wearable) | 455 | public virtual void SetWearable(int wearableId, AvatarWearable wearable) |
@@ -386,7 +480,8 @@ namespace OpenSim.Framework | |||
386 | } | 480 | } |
387 | 481 | ||
388 | s += "Visual Params: "; | 482 | s += "Visual Params: "; |
389 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | 483 | // for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) |
484 | for (uint j = 0; j < m_visualparams.Length; j++) | ||
390 | s += String.Format("{0},",m_visualparams[j]); | 485 | s += String.Format("{0},",m_visualparams[j]); |
391 | s += "\n"; | 486 | s += "\n"; |
392 | 487 | ||
@@ -402,18 +497,16 @@ namespace OpenSim.Framework | |||
402 | /// </remarks> | 497 | /// </remarks> |
403 | public List<AvatarAttachment> GetAttachments() | 498 | public List<AvatarAttachment> GetAttachments() |
404 | { | 499 | { |
405 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | ||
406 | |||
407 | lock (m_attachments) | 500 | lock (m_attachments) |
408 | { | 501 | { |
502 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | ||
409 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 503 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
410 | { | 504 | { |
411 | foreach (AvatarAttachment attach in kvp.Value) | 505 | foreach (AvatarAttachment attach in kvp.Value) |
412 | alist.Add(new AvatarAttachment(attach)); | 506 | alist.Add(new AvatarAttachment(attach)); |
413 | } | 507 | } |
414 | } | 508 | return alist; |
415 | 509 | } | |
416 | return alist; | ||
417 | } | 510 | } |
418 | 511 | ||
419 | internal void AppendAttachment(AvatarAttachment attach) | 512 | internal void AppendAttachment(AvatarAttachment attach) |
@@ -557,7 +650,6 @@ namespace OpenSim.Framework | |||
557 | return kvp.Key; | 650 | return kvp.Key; |
558 | } | 651 | } |
559 | } | 652 | } |
560 | |||
561 | return 0; | 653 | return 0; |
562 | } | 654 | } |
563 | 655 | ||
@@ -607,12 +699,6 @@ namespace OpenSim.Framework | |||
607 | data["serial"] = OSD.FromInteger(m_serial); | 699 | data["serial"] = OSD.FromInteger(m_serial); |
608 | data["height"] = OSD.FromReal(m_avatarHeight); | 700 | data["height"] = OSD.FromReal(m_avatarHeight); |
609 | 701 | ||
610 | // Hashes | ||
611 | OSDArray hashes = new OSDArray(AvatarAppearance.TEXTURE_COUNT); | ||
612 | for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) | ||
613 | hashes.Add(OSD.FromUUID(m_texturehashes[i])); | ||
614 | data["hashes"] = hashes; | ||
615 | |||
616 | // Wearables | 702 | // Wearables |
617 | OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); | 703 | OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); |
618 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 704 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
@@ -634,12 +720,14 @@ namespace OpenSim.Framework | |||
634 | OSDBinary visualparams = new OSDBinary(m_visualparams); | 720 | OSDBinary visualparams = new OSDBinary(m_visualparams); |
635 | data["visualparams"] = visualparams; | 721 | data["visualparams"] = visualparams; |
636 | 722 | ||
637 | // Attachments | 723 | lock (m_attachments) |
638 | List<AvatarAttachment> attachments = GetAttachments(); | 724 | { |
639 | OSDArray attachs = new OSDArray(attachments.Count); | 725 | // Attachments |
640 | foreach (AvatarAttachment attach in GetAttachments()) | 726 | OSDArray attachs = new OSDArray(m_attachments.Count); |
641 | attachs.Add(attach.Pack()); | 727 | foreach (AvatarAttachment attach in GetAttachments()) |
642 | data["attachments"] = attachs; | 728 | attachs.Add(attach.Pack()); |
729 | data["attachments"] = attachs; | ||
730 | } | ||
643 | 731 | ||
644 | return data; | 732 | return data; |
645 | } | 733 | } |
@@ -653,29 +741,11 @@ namespace OpenSim.Framework | |||
653 | if ((data != null) && (data["serial"] != null)) | 741 | if ((data != null) && (data["serial"] != null)) |
654 | m_serial = data["serial"].AsInteger(); | 742 | m_serial = data["serial"].AsInteger(); |
655 | if ((data != null) && (data["height"] != null)) | 743 | if ((data != null) && (data["height"] != null)) |
656 | m_avatarHeight = (float)data["height"].AsReal(); | 744 | // m_avatarHeight = (float)data["height"].AsReal(); |
745 | SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal())); | ||
657 | 746 | ||
658 | try | 747 | try |
659 | { | 748 | { |
660 | // Hashes | ||
661 | m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT]; | ||
662 | if ((data != null) && (data["hashes"] != null) && (data["hashes"]).Type == OSDType.Array) | ||
663 | { | ||
664 | OSDArray hashes = (OSDArray)(data["hashes"]); | ||
665 | for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) | ||
666 | { | ||
667 | UUID hashID = UUID.Zero; | ||
668 | if (i < hashes.Count && hashes[i] != null) | ||
669 | hashID = hashes[i].AsUUID(); | ||
670 | m_texturehashes[i] = hashID; | ||
671 | } | ||
672 | } | ||
673 | else | ||
674 | { | ||
675 | for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) | ||
676 | m_texturehashes[i] = UUID.Zero; | ||
677 | } | ||
678 | |||
679 | // Wearables | 749 | // Wearables |
680 | SetDefaultWearables(); | 750 | SetDefaultWearables(); |
681 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) | 751 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) |
@@ -1505,7 +1575,58 @@ namespace OpenSim.Framework | |||
1505 | SHAPE_EYELID_INNER_CORNER_UP = 214, | 1575 | SHAPE_EYELID_INNER_CORNER_UP = 214, |
1506 | SKIRT_SKIRT_RED = 215, | 1576 | SKIRT_SKIRT_RED = 215, |
1507 | SKIRT_SKIRT_GREEN = 216, | 1577 | SKIRT_SKIRT_GREEN = 216, |
1508 | SKIRT_SKIRT_BLUE = 217 | 1578 | SKIRT_SKIRT_BLUE = 217, |
1579 | |||
1580 | /// <summary> | ||
1581 | /// Avatar Physics section. These are 0 type visual params which get transmitted. | ||
1582 | /// </summary> | ||
1583 | |||
1584 | /// <summary> | ||
1585 | /// Breast Part 1 | ||
1586 | /// </summary> | ||
1587 | BREAST_PHYSICS_MASS = 218, | ||
1588 | BREAST_PHYSICS_GRAVITY = 219, | ||
1589 | BREAST_PHYSICS_DRAG = 220, | ||
1590 | BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221, | ||
1591 | BREAST_PHYSICS_UPDOWN_SPRING = 222, | ||
1592 | BREAST_PHYSICS_UPDOWN_GAIN = 223, | ||
1593 | BREAST_PHYSICS_UPDOWN_DAMPING = 224, | ||
1594 | BREAST_PHYSICS_INOUT_MAX_EFFECT = 225, | ||
1595 | BREAST_PHYSICS_INOUT_SPRING = 226, | ||
1596 | BREAST_PHYSICS_INOUT_GAIN = 227, | ||
1597 | BREAST_PHYSICS_INOUT_DAMPING = 228, | ||
1598 | /// <summary> | ||
1599 | /// Belly | ||
1600 | /// </summary> | ||
1601 | BELLY_PHYISCS_MASS = 229, | ||
1602 | BELLY_PHYSICS_GRAVITY = 230, | ||
1603 | BELLY_PHYSICS_DRAG = 231, | ||
1604 | BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232, | ||
1605 | BELLY_PHYSICS_UPDOWN_SPRING = 233, | ||
1606 | BELLY_PHYSICS_UPDOWN_GAIN = 234, | ||
1607 | BELLY_PHYSICS_UPDOWN_DAMPING = 235, | ||
1608 | |||
1609 | /// <summary> | ||
1610 | /// Butt | ||
1611 | /// </summary> | ||
1612 | BUTT_PHYSICS_MASS = 236, | ||
1613 | BUTT_PHYSICS_GRAVITY = 237, | ||
1614 | BUTT_PHYSICS_DRAG = 238, | ||
1615 | BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239, | ||
1616 | BUTT_PHYSICS_UPDOWN_SPRING = 240, | ||
1617 | BUTT_PHYSICS_UPDOWN_GAIN = 241, | ||
1618 | BUTT_PHYSICS_UPDOWN_DAMPING = 242, | ||
1619 | BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243, | ||
1620 | BUTT_PHYSICS_LEFTRIGHT_SPRING = 244, | ||
1621 | BUTT_PHYSICS_LEFTRIGHT_GAIN = 245, | ||
1622 | BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246, | ||
1623 | /// <summary> | ||
1624 | /// Breast Part 2 | ||
1625 | /// </summary> | ||
1626 | BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, | ||
1627 | BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, | ||
1628 | BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, | ||
1629 | BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250 | ||
1509 | } | 1630 | } |
1510 | #endregion | 1631 | #endregion |
1511 | } | 1632 | } |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 18d008c..2a8e67d 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -230,12 +230,14 @@ namespace OpenSim.Framework | |||
230 | 230 | ||
231 | public class ControllerData | 231 | public class ControllerData |
232 | { | 232 | { |
233 | public UUID ObjectID; | ||
233 | public UUID ItemID; | 234 | public UUID ItemID; |
234 | public uint IgnoreControls; | 235 | public uint IgnoreControls; |
235 | public uint EventControls; | 236 | public uint EventControls; |
236 | 237 | ||
237 | public ControllerData(UUID item, uint ignore, uint ev) | 238 | public ControllerData(UUID obj, UUID item, uint ignore, uint ev) |
238 | { | 239 | { |
240 | ObjectID = obj; | ||
239 | ItemID = item; | 241 | ItemID = item; |
240 | IgnoreControls = ignore; | 242 | IgnoreControls = ignore; |
241 | EventControls = ev; | 243 | EventControls = ev; |
@@ -249,6 +251,7 @@ namespace OpenSim.Framework | |||
249 | public OSDMap PackUpdateMessage() | 251 | public OSDMap PackUpdateMessage() |
250 | { | 252 | { |
251 | OSDMap controldata = new OSDMap(); | 253 | OSDMap controldata = new OSDMap(); |
254 | controldata["object"] = OSD.FromUUID(ObjectID); | ||
252 | controldata["item"] = OSD.FromUUID(ItemID); | 255 | controldata["item"] = OSD.FromUUID(ItemID); |
253 | controldata["ignore"] = OSD.FromInteger(IgnoreControls); | 256 | controldata["ignore"] = OSD.FromInteger(IgnoreControls); |
254 | controldata["event"] = OSD.FromInteger(EventControls); | 257 | controldata["event"] = OSD.FromInteger(EventControls); |
@@ -259,6 +262,8 @@ namespace OpenSim.Framework | |||
259 | 262 | ||
260 | public void UnpackUpdateMessage(OSDMap args) | 263 | public void UnpackUpdateMessage(OSDMap args) |
261 | { | 264 | { |
265 | if (args["object"] != null) | ||
266 | ObjectID = args["object"].AsUUID(); | ||
262 | if (args["item"] != null) | 267 | if (args["item"] != null) |
263 | ItemID = args["item"].AsUUID(); | 268 | ItemID = args["item"].AsUUID(); |
264 | if (args["ignore"] != null) | 269 | if (args["ignore"] != null) |
@@ -317,6 +322,8 @@ namespace OpenSim.Framework | |||
317 | public Animation AnimState = null; | 322 | public Animation AnimState = null; |
318 | 323 | ||
319 | public UUID GranterID; | 324 | public UUID GranterID; |
325 | public UUID ParentPart; | ||
326 | public Vector3 SitOffset; | ||
320 | 327 | ||
321 | // Appearance | 328 | // Appearance |
322 | public AvatarAppearance Appearance; | 329 | public AvatarAppearance Appearance; |
@@ -488,6 +495,10 @@ namespace OpenSim.Framework | |||
488 | } | 495 | } |
489 | args["attach_objects"] = attObjs; | 496 | args["attach_objects"] = attObjs; |
490 | } | 497 | } |
498 | |||
499 | args["parent_part"] = OSD.FromUUID(ParentPart); | ||
500 | args["sit_offset"] = OSD.FromString(SitOffset.ToString()); | ||
501 | |||
491 | return args; | 502 | return args; |
492 | } | 503 | } |
493 | 504 | ||
@@ -719,6 +730,11 @@ namespace OpenSim.Framework | |||
719 | } | 730 | } |
720 | } | 731 | } |
721 | } | 732 | } |
733 | |||
734 | if (args["parent_part"] != null) | ||
735 | ParentPart = args["parent_part"].AsUUID(); | ||
736 | if (args["sit_offset"] != null) | ||
737 | Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset); | ||
722 | } | 738 | } |
723 | 739 | ||
724 | public AgentData() | 740 | public AgentData() |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 98358e5..e36edb2 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Framework | |||
66 | 66 | ||
67 | public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest); | 67 | public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest); |
68 | 68 | ||
69 | public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, List<CachedTextureRequestArg> cachedTextureData); | 69 | public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems); |
70 | 70 | ||
71 | public delegate void StartAnim(IClientAPI remoteClient, UUID animID); | 71 | public delegate void StartAnim(IClientAPI remoteClient, UUID animID); |
72 | 72 | ||
diff --git a/OpenSim/Framework/IImprovedAssetCache.cs b/OpenSim/Framework/IImprovedAssetCache.cs index 251215a..a0b8b55 100644 --- a/OpenSim/Framework/IImprovedAssetCache.cs +++ b/OpenSim/Framework/IImprovedAssetCache.cs | |||
@@ -33,6 +33,7 @@ namespace OpenSim.Framework | |||
33 | { | 33 | { |
34 | void Cache(AssetBase asset); | 34 | void Cache(AssetBase asset); |
35 | AssetBase Get(string id); | 35 | AssetBase Get(string id); |
36 | bool Check(string id); | ||
36 | void Expire(string id); | 37 | void Expire(string id); |
37 | void Clear(); | 38 | void Clear(); |
38 | } | 39 | } |
diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 4f98d7b..7a24d1e 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs | |||
@@ -70,6 +70,7 @@ namespace OpenSim.Framework | |||
70 | void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); | 70 | void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); |
71 | bool IsEitherBannedOrRestricted(UUID avatar); | 71 | bool IsEitherBannedOrRestricted(UUID avatar); |
72 | bool IsBannedFromLand(UUID avatar); | 72 | bool IsBannedFromLand(UUID avatar); |
73 | bool CanBeOnThisLand(UUID avatar, float posHeight); | ||
73 | bool IsRestrictedFromLand(UUID avatar); | 74 | bool IsRestrictedFromLand(UUID avatar); |
74 | bool IsInLandAccessList(UUID avatar); | 75 | bool IsInLandAccessList(UUID avatar); |
75 | void SendLandUpdateToClient(IClientAPI remote_client); | 76 | void SendLandUpdateToClient(IClientAPI remote_client); |
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index 537de7a..cb73e8f 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs | |||
@@ -247,12 +247,18 @@ namespace OpenSim.Framework | |||
247 | /// <returns></returns> | 247 | /// <returns></returns> |
248 | public static List<string> ParseNotecardToList(string rawInput) | 248 | public static List<string> ParseNotecardToList(string rawInput) |
249 | { | 249 | { |
250 | string[] input = rawInput.Replace("\r", "").Split('\n'); | 250 | string[] input; |
251 | int idx = 0; | 251 | int idx = 0; |
252 | int level = 0; | 252 | int level = 0; |
253 | List<string> output = new List<string>(); | 253 | List<string> output = new List<string>(); |
254 | string[] words; | 254 | string[] words; |
255 | 255 | ||
256 | //The Linden format always ends with a } after the input data. | ||
257 | //Strip off trailing } so there is nothing after the input data. | ||
258 | int i = rawInput.LastIndexOf("}"); | ||
259 | rawInput = rawInput.Remove(i, rawInput.Length-i); | ||
260 | input = rawInput.Replace("\r", "").Split('\n'); | ||
261 | |||
256 | while (idx < input.Length) | 262 | while (idx < input.Length) |
257 | { | 263 | { |
258 | if (input[idx] == "{") | 264 | if (input[idx] == "{") |
@@ -287,24 +293,18 @@ namespace OpenSim.Framework | |||
287 | break; | 293 | break; |
288 | if (words[0] == "Text") | 294 | if (words[0] == "Text") |
289 | { | 295 | { |
290 | int len = int.Parse(words[2]); | 296 | idx++; //Now points to first line of notecard text |
291 | idx++; | ||
292 | 297 | ||
293 | int count = -1; | 298 | //Number of lines in notecard. |
299 | int lines = input.Length - idx; | ||
300 | int line = 0; | ||
294 | 301 | ||
295 | while (count < len && idx < input.Length) | 302 | while (line < lines) |
296 | { | 303 | { |
297 | // int l = input[idx].Length; | 304 | // m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", input[idx]); |
298 | string ln = input[idx]; | 305 | output.Add(input[idx]); |
299 | |||
300 | int need = len-count-1; | ||
301 | if (ln.Length > need) | ||
302 | ln = ln.Substring(0, need); | ||
303 | |||
304 | // m_log.DebugFormat("[PARSE NOTECARD]: Adding line {0}", ln); | ||
305 | output.Add(ln); | ||
306 | count += ln.Length + 1; | ||
307 | idx++; | 306 | idx++; |
307 | line++; | ||
308 | } | 308 | } |
309 | 309 | ||
310 | return output; | 310 | return output; |
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 4ab6908..566772d 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -135,8 +135,8 @@ namespace OpenSim.Framework.Servers | |||
135 | 135 | ||
136 | TimeSpan timeTaken = DateTime.Now - m_startuptime; | 136 | TimeSpan timeTaken = DateTime.Now - m_startuptime; |
137 | 137 | ||
138 | m_log.InfoFormat( | 138 | MainConsole.Instance.OutputFormat( |
139 | "[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED.", | 139 | "PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED. Non-script portion of startup took {0}m {1}s.", |
140 | timeTaken.Minutes, timeTaken.Seconds); | 140 | timeTaken.Minutes, timeTaken.Seconds); |
141 | } | 141 | } |
142 | 142 | ||
diff --git a/OpenSim/Framework/UserProfiles.cs b/OpenSim/Framework/UserProfiles.cs index 6133591..492f6b9 100644 --- a/OpenSim/Framework/UserProfiles.cs +++ b/OpenSim/Framework/UserProfiles.cs | |||
@@ -90,6 +90,14 @@ namespace OpenSim.Framework | |||
90 | public UUID TargetId; | 90 | public UUID TargetId; |
91 | public string Notes; | 91 | public string Notes; |
92 | } | 92 | } |
93 | |||
94 | public class UserPreferences | ||
95 | { | ||
96 | public UUID UserId; | ||
97 | public bool IMViaEmail = false; | ||
98 | public bool Visible = false; | ||
99 | public string EMail = string.Empty; | ||
100 | } | ||
93 | 101 | ||
94 | public class UserAccountProperties | 102 | public class UserAccountProperties |
95 | { | 103 | { |
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs new file mode 100644 index 0000000..1aecf79 --- /dev/null +++ b/OpenSim/Framework/WearableCacheItem.cs | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.StructuredData; | ||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | [Serializable] | ||
36 | public class WearableCacheItem | ||
37 | { | ||
38 | public uint TextureIndex { get; set; } | ||
39 | public UUID CacheId { get; set; } | ||
40 | public UUID TextureID { get; set; } | ||
41 | public AssetBase TextureAsset { get; set; } | ||
42 | |||
43 | |||
44 | public static WearableCacheItem[] GetDefaultCacheItem() | ||
45 | { | ||
46 | int itemmax = 21; | ||
47 | WearableCacheItem[] retitems = new WearableCacheItem[itemmax]; | ||
48 | for (uint i=0;i<itemmax;i++) | ||
49 | retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i + 1}; | ||
50 | return retitems; | ||
51 | } | ||
52 | public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache) | ||
53 | { | ||
54 | List<WearableCacheItem> ret = new List<WearableCacheItem>(); | ||
55 | if (pInput.Type == OSDType.Array) | ||
56 | { | ||
57 | OSDArray itemarray = (OSDArray) pInput; | ||
58 | foreach (OSDMap item in itemarray) | ||
59 | { | ||
60 | ret.Add(new WearableCacheItem() | ||
61 | { | ||
62 | TextureIndex = item["textureindex"].AsUInteger(), | ||
63 | CacheId = item["cacheid"].AsUUID(), | ||
64 | TextureID = item["textureid"].AsUUID() | ||
65 | }); | ||
66 | |||
67 | if (dataCache != null && item.ContainsKey("assetdata")) | ||
68 | { | ||
69 | AssetBase asset = new AssetBase(item["textureid"].AsUUID(),"BakedTexture",(sbyte)AssetType.Texture,UUID.Zero.ToString()); | ||
70 | asset.Temporary = true; | ||
71 | asset.Data = item["assetdata"].AsBinary(); | ||
72 | dataCache.Cache(asset); | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | else if (pInput.Type == OSDType.Map) | ||
77 | { | ||
78 | OSDMap item = (OSDMap) pInput; | ||
79 | ret.Add(new WearableCacheItem(){ | ||
80 | TextureIndex = item["textureindex"].AsUInteger(), | ||
81 | CacheId = item["cacheid"].AsUUID(), | ||
82 | TextureID = item["textureid"].AsUUID() | ||
83 | }); | ||
84 | if (dataCache != null && item.ContainsKey("assetdata")) | ||
85 | { | ||
86 | string assetCreator = item["assetcreator"].AsString(); | ||
87 | string assetName = item["assetname"].AsString(); | ||
88 | AssetBase asset = new AssetBase(item["textureid"].AsUUID(), assetName, (sbyte)AssetType.Texture, assetCreator); | ||
89 | asset.Temporary = true; | ||
90 | asset.Data = item["assetdata"].AsBinary(); | ||
91 | dataCache.Cache(asset); | ||
92 | } | ||
93 | } | ||
94 | else | ||
95 | { | ||
96 | return new WearableCacheItem[0]; | ||
97 | } | ||
98 | return ret.ToArray(); | ||
99 | |||
100 | } | ||
101 | public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache) | ||
102 | { | ||
103 | OSDArray arr = new OSDArray(); | ||
104 | foreach (WearableCacheItem item in pcacheItems) | ||
105 | { | ||
106 | OSDMap itemmap = new OSDMap(); | ||
107 | itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex)); | ||
108 | itemmap.Add("cacheid", OSD.FromUUID(item.CacheId)); | ||
109 | itemmap.Add("textureid", OSD.FromUUID(item.TextureID)); | ||
110 | if (dataCache != null) | ||
111 | { | ||
112 | if (dataCache.Check(item.TextureID.ToString())) | ||
113 | { | ||
114 | AssetBase assetItem = dataCache.Get(item.TextureID.ToString()); | ||
115 | if (assetItem != null) | ||
116 | { | ||
117 | itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); | ||
118 | itemmap.Add("assetcreator", OSD.FromString(assetItem.CreatorID)); | ||
119 | itemmap.Add("assetname", OSD.FromString(assetItem.Name)); | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | arr.Add(itemmap); | ||
124 | } | ||
125 | return arr; | ||
126 | } | ||
127 | public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems) | ||
128 | { | ||
129 | for (int i = 0; i < pcacheItems.Length; i++) | ||
130 | { | ||
131 | if (pcacheItems[i].TextureIndex == pTextureIndex) | ||
132 | return pcacheItems[i]; | ||
133 | } | ||
134 | return null; | ||
135 | } | ||
136 | public static WearableCacheItem SearchTextureCacheId(UUID pCacheId, WearableCacheItem[] pcacheItems) | ||
137 | { | ||
138 | for (int i = 0; i < pcacheItems.Length; i++) | ||
139 | { | ||
140 | if (pcacheItems[i].CacheId == pCacheId) | ||
141 | return pcacheItems[i]; | ||
142 | } | ||
143 | return null; | ||
144 | } | ||
145 | public static WearableCacheItem SearchTextureTextureId(UUID pTextureId, WearableCacheItem[] pcacheItems) | ||
146 | { | ||
147 | for (int i = 0; i < pcacheItems.Length; i++) | ||
148 | { | ||
149 | if (pcacheItems[i].TextureID == pTextureId) | ||
150 | return pcacheItems[i]; | ||
151 | } | ||
152 | return null; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | |||
157 | } | ||