aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authordiva2009-02-23 00:51:31 +0000
committerdiva2009-02-23 00:51:31 +0000
commit20eb8e54ac511b5e8988cb3c3701c824b41170c4 (patch)
tree4e65467f0cf78f5757306500a8d551e635e5ae58 /OpenSim/Region/Framework
parentMantis#3218. Thank you kindly, TLaukkan (Tommil) for a patch that: (diff)
downloadopensim-SC-20eb8e54ac511b5e8988cb3c3701c824b41170c4.zip
opensim-SC-20eb8e54ac511b5e8988cb3c3701c824b41170c4.tar.gz
opensim-SC-20eb8e54ac511b5e8988cb3c3701c824b41170c4.tar.bz2
opensim-SC-20eb8e54ac511b5e8988cb3c3701c824b41170c4.tar.xz
A little bit more tweaking with appearance. Now passing both the wearables and the textures referred to in the Texture faces of AvatarAppearance. The textures are still not being acted upon on the other side, but they will.
Note: will make avies coming from older sims casper or grey. Upgrade! Related to mantis #3204.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs91
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs50
2 files changed, 75 insertions, 66 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
index 38eceb1..be3069a 100644
--- a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
+++ b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs
@@ -207,39 +207,6 @@ namespace OpenSim.Region.Framework.Scenes
207 } 207 }
208 } 208 }
209 209
210 //public class AgentAnimationData
211 //{
212 // public UUID Animation;
213 // public UUID ObjectID;
214
215 // public AgentAnimationData(UUID anim, UUID obj)
216 // {
217 // Animation = anim;
218 // ObjectID = obj;
219 // }
220
221 // public AgentAnimationData(OSDMap args)
222 // {
223 // UnpackUpdateMessage(args);
224 // }
225
226 // public OSDMap PackUpdateMessage()
227 // {
228 // OSDMap anim = new OSDMap();
229 // anim["animation"] = OSD.FromUUID(Animation);
230 // anim["object_id"] = OSD.FromUUID(ObjectID);
231 // return anim;
232 // }
233
234 // public void UnpackUpdateMessage(OSDMap args)
235 // {
236 // if (args["animation"] != null)
237 // Animation = args["animation"].AsUUID();
238 // if (args["object_id"] != null)
239 // ObjectID = args["object_id"].AsUUID();
240 // }
241 //}
242
243 public class AgentData : IAgentData 210 public class AgentData : IAgentData
244 { 211 {
245 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 212 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -276,16 +243,17 @@ namespace OpenSim.Region.Framework.Scenes
276 public bool AlwaysRun; 243 public bool AlwaysRun;
277 public UUID PreyAgent; 244 public UUID PreyAgent;
278 public Byte AgentAccess; 245 public Byte AgentAccess;
279 public UUID[] AgentTextures;
280 public UUID ActiveGroupID; 246 public UUID ActiveGroupID;
281 247
282 public AgentGroupData[] Groups; 248 public AgentGroupData[] Groups;
283 public Animation[] Anims; 249 public Animation[] Anims;
284 250
285 public UUID GranterID; 251 public UUID GranterID;
286 public Dictionary<string, string> NVPairs;
287 252
253 // Appearance
254 public UUID[] AgentTextures;
288 public byte[] VisualParams; 255 public byte[] VisualParams;
256 public UUID[] Wearables;
289 257
290 public string CallbackURI; 258 public string CallbackURI;
291 259
@@ -325,14 +293,6 @@ namespace OpenSim.Region.Framework.Scenes
325 args["prey_agent"] = OSD.FromUUID(PreyAgent); 293 args["prey_agent"] = OSD.FromUUID(PreyAgent);
326 args["agent_access"] = OSD.FromString(AgentAccess.ToString()); 294 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
327 295
328 if ((AgentTextures != null) && (AgentTextures.Length > 0))
329 {
330 OSDArray textures = new OSDArray(AgentTextures.Length);
331 foreach (UUID uuid in AgentTextures)
332 textures.Add(OSD.FromUUID(uuid));
333 args["agent_textures"] = textures;
334 }
335
336 args["active_group_id"] = OSD.FromUUID(ActiveGroupID); 296 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
337 297
338 if ((Groups != null) && (Groups.Length > 0)) 298 if ((Groups != null) && (Groups.Length > 0))
@@ -351,10 +311,26 @@ namespace OpenSim.Region.Framework.Scenes
351 args["animations"] = anims; 311 args["animations"] = anims;
352 } 312 }
353 313
314 if ((AgentTextures != null) && (AgentTextures.Length > 0))
315 {
316 OSDArray textures = new OSDArray(AgentTextures.Length);
317 foreach (UUID uuid in AgentTextures)
318 textures.Add(OSD.FromUUID(uuid));
319 args["agent_textures"] = textures;
320 }
321
354 if ((VisualParams != null) && (VisualParams.Length > 0)) 322 if ((VisualParams != null) && (VisualParams.Length > 0))
355 args["visual_params"] = OSD.FromBinary(VisualParams); 323 args["visual_params"] = OSD.FromBinary(VisualParams);
356 324
357 // Last few fields are still missing: granter and NVPais 325 // We might not pass this in all cases...
326 if ((Wearables != null) && (Wearables.Length > 0))
327 {
328 OSDArray wears = new OSDArray(Wearables.Length);
329 foreach (UUID uuid in Wearables)
330 wears.Add(OSD.FromUUID(uuid));
331 args["wearables"] = wears;
332 }
333
358 334
359 if ((CallbackURI != null) && (!CallbackURI.Equals(""))) 335 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
360 args["callback_uri"] = OSD.FromString(CallbackURI); 336 args["callback_uri"] = OSD.FromString(CallbackURI);
@@ -441,15 +417,6 @@ namespace OpenSim.Region.Framework.Scenes
441 if (args["agent_access"] != null) 417 if (args["agent_access"] != null)
442 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess); 418 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
443 419
444 if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
445 {
446 OSDArray textures = (OSDArray)(args["agent_textures"]);
447 AgentTextures = new UUID[textures.Count];
448 int i = 0;
449 foreach (OSD o in textures)
450 AgentTextures[i++] = o.AsUUID();
451 }
452
453 if (args["active_group_id"] != null) 420 if (args["active_group_id"] != null)
454 ActiveGroupID = args["active_group_id"].AsUUID(); 421 ActiveGroupID = args["active_group_id"].AsUUID();
455 422
@@ -481,9 +448,27 @@ namespace OpenSim.Region.Framework.Scenes
481 } 448 }
482 } 449 }
483 450
451 if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
452 {
453 OSDArray textures = (OSDArray)(args["agent_textures"]);
454 AgentTextures = new UUID[textures.Count];
455 int i = 0;
456 foreach (OSD o in textures)
457 AgentTextures[i++] = o.AsUUID();
458 }
459
484 if (args["visual_params"] != null) 460 if (args["visual_params"] != null)
485 VisualParams = args["visual_params"].AsBinary(); 461 VisualParams = args["visual_params"].AsBinary();
486 462
463 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
464 {
465 OSDArray wears = (OSDArray)(args["wearables"]);
466 Wearables = new UUID[wears.Count];
467 int i = 0;
468 foreach (OSD o in wears)
469 Wearables[i++] = o.AsUUID();
470 }
471
487 if (args["callback_uri"] != null) 472 if (args["callback_uri"] != null)
488 CallbackURI = args["callback_uri"].AsString(); 473 CallbackURI = args["callback_uri"].AsString();
489 } 474 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index dd8c719..85437f6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2646,20 +2646,43 @@ namespace OpenSim.Region.Framework.Scenes
2646 2646
2647 try 2647 try
2648 { 2648 {
2649 // We might not pass the Wearables in all cases...
2650 // They're only needed so that persistent changes to the appearance
2651 // are preserved in the new region where the user is moving to.
2652 // But in Hypergrid we might not let this happen.
2649 int i = 0; 2653 int i = 0;
2650 UUID[] textures = new UUID[m_appearance.Wearables.Length * 2]; 2654 UUID[] wears = new UUID[m_appearance.Wearables.Length * 2];
2651 foreach (AvatarWearable aw in m_appearance.Wearables) 2655 foreach (AvatarWearable aw in m_appearance.Wearables)
2652 { 2656 {
2653 if (aw != null) 2657 if (aw != null)
2654 { 2658 {
2655 textures[i++] = aw.ItemID; 2659 wears[i++] = aw.ItemID;
2656 textures[i++] = aw.AssetID; 2660 wears[i++] = aw.AssetID;
2657 } 2661 }
2658 else 2662 else
2659 m_log.DebugFormat("[SCENE PRESENCE]: Null wearable in CopyTo"); 2663 {
2664 wears[i++] = UUID.Zero;
2665 wears[i++] = UUID.Zero;
2666 }
2660 } 2667 }
2661 cAgent.AgentTextures = textures; 2668 cAgent.Wearables = wears;
2669
2662 cAgent.VisualParams = m_appearance.VisualParams; 2670 cAgent.VisualParams = m_appearance.VisualParams;
2671
2672 // Textures is not really needed in the base case, I think. But it's handy for
2673 // the Hypergrid and other decentralized models, so that we know which
2674 // textures to fecth from the user's asset server.
2675 i = 0;
2676 UUID[] textures = new UUID[m_appearance.Texture.FaceTextures.Length];
2677 foreach (Primitive.TextureEntryFace face in m_appearance.Texture.FaceTextures)
2678 {
2679 if (face != null)
2680 textures[i] = face.TextureID;
2681 else
2682 textures[i] = UUID.Zero;
2683 ++i;
2684 }
2685 cAgent.AgentTextures = textures;
2663 } 2686 }
2664 catch (Exception e) 2687 catch (Exception e)
2665 { 2688 {
@@ -2707,18 +2730,19 @@ namespace OpenSim.Region.Framework.Scenes
2707 uint i = 0; 2730 uint i = 0;
2708 try 2731 try
2709 { 2732 {
2710 AvatarWearable[] wearables = new AvatarWearable[cAgent.AgentTextures.Length / 2]; 2733 AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
2711 for (uint n = 0; n < cAgent.AgentTextures.Length; n += 2) 2734 for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
2712 { 2735 {
2713 UUID itemId = cAgent.AgentTextures[n]; 2736 UUID itemId = cAgent.Wearables[n];
2714 UUID assetId = cAgent.AgentTextures[n + 1]; 2737 UUID assetId = cAgent.Wearables[n + 1];
2715 wearables[i++] = new AvatarWearable(itemId, assetId); 2738 wears[i++] = new AvatarWearable(itemId, assetId);
2716 //te.CreateFace(i++).TextureID = assetId;
2717 } 2739 }
2718 m_appearance.Wearables = wearables; 2740 m_appearance.Wearables = wears;
2719 2741
2720 // We're setting it here to default, but the viewer will soon send a SetAppearance that will 2742 // We're setting it here to default, but the viewer will soon send a SetAppearance that will
2721 // set things straight. We should probably pass these textures too... 2743 // set things straight. We should probably parse these textures too, we have them...
2744 // In any case, the least we need to do is to check if this is HG and fetch the textures
2745 // so that they can then be distributed to the other clients that ask for them later.
2722 Primitive.TextureEntry te = AvatarAppearance.GetDefaultTexture(); //new Primitive.TextureEntry(UUID.Random()); 2746 Primitive.TextureEntry te = AvatarAppearance.GetDefaultTexture(); //new Primitive.TextureEntry(UUID.Random());
2723 2747
2724 m_appearance.SetAppearance(te.ToBytes(), new List<byte>(cAgent.VisualParams)); 2748 m_appearance.SetAppearance(te.ToBytes(), new List<byte>(cAgent.VisualParams));