aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authordiva2009-02-17 00:35:52 +0000
committerdiva2009-02-17 00:35:52 +0000
commit7cc906213795fbe4878c0cfb8351272e847617e9 (patch)
tree861e1562c10feb985e2e04536d1268f993761ab6
parentcleanup (diff)
downloadopensim-SC_OLD-7cc906213795fbe4878c0cfb8351272e847617e9.zip
opensim-SC_OLD-7cc906213795fbe4878c0cfb8351272e847617e9.tar.gz
opensim-SC_OLD-7cc906213795fbe4878c0cfb8351272e847617e9.tar.bz2
opensim-SC_OLD-7cc906213795fbe4878c0cfb8351272e847617e9.tar.xz
Major change to how appearance is managed, including changes in login and user service/server. Appearance is now sent by the user service/server along with all other loginparams. Regions don't query the user service for appearance anymore. The appearance is passed along from region to region as the avie moves around. And, as before, it's stored back with the user service as the client changes the avie's appearance. Child agents have default appearances that are set to the actual appearance when the avie moves to that region. (as before, child agents are invisible and non-physical).
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs1
-rw-r--r--OpenSim/Framework/AgentCircuitManager.cs7
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs2
-rw-r--r--OpenSim/Framework/Login.cs1
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs10
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs7
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs3
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs75
10 files changed, 122 insertions, 30 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 1c37601..bcd4c09 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -35,6 +35,7 @@ namespace OpenSim.Framework
35 public class AgentCircuitData 35 public class AgentCircuitData
36 { 36 {
37 public UUID AgentID; 37 public UUID AgentID;
38 public AvatarAppearance Appearance;
38 public UUID BaseFolder; 39 public UUID BaseFolder;
39 public string CapsPath = String.Empty; 40 public string CapsPath = String.Empty;
40 public Dictionary<ulong, string> ChildrenCapSeeds; 41 public Dictionary<ulong, string> ChildrenCapSeeds;
diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs
index 56b40bd..cf333af 100644
--- a/OpenSim/Framework/AgentCircuitManager.cs
+++ b/OpenSim/Framework/AgentCircuitManager.cs
@@ -103,6 +103,13 @@ namespace OpenSim.Framework
103 } 103 }
104 } 104 }
105 105
106 public AgentCircuitData GetAgentCircuitData(uint circuitCode)
107 {
108 AgentCircuitData agentCircuit = null;
109 AgentCircuits.TryGetValue(circuitCode, out agentCircuit);
110 return agentCircuit;
111 }
112
106 public void UpdateAgentData(AgentCircuitData agentData) 113 public void UpdateAgentData(AgentCircuitData agentData)
107 { 114 {
108 if (AgentCircuits.ContainsKey((uint) agentData.circuitcode)) 115 if (AgentCircuits.ContainsKey((uint) agentData.circuitcode))
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index ad95f78..52041bb 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Framework
286 + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height 286 + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height
287 + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length 287 + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length
288 - m_avatarHeight / 2) * 0.3f - 0.04f; 288 - m_avatarHeight / 2) * 0.3f - 0.04f;
289 //System.Console.WriteLine("Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); 289 //System.Console.WriteLine("[APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset);
290 } 290 }
291 291
292 public virtual void SetWearable(int wearableId, AvatarWearable wearable) 292 public virtual void SetWearable(int wearableId, AvatarWearable wearable)
diff --git a/OpenSim/Framework/Login.cs b/OpenSim/Framework/Login.cs
index 61fffd2..5913c4b 100644
--- a/OpenSim/Framework/Login.cs
+++ b/OpenSim/Framework/Login.cs
@@ -42,6 +42,7 @@ namespace OpenSim.Framework
42 public UUID SecureSession = UUID.Zero; 42 public UUID SecureSession = UUID.Zero;
43 public UUID Session; 43 public UUID Session;
44 public Vector3 StartPos; 44 public Vector3 StartPos;
45 public AvatarAppearance Appearance;
45 46
46 public Login() 47 public Login()
47 { 48 {
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index d069e1a..4878c03 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -396,6 +396,16 @@ namespace OpenSim.Grid.UserServer
396 loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString(); 396 loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString();
397 loginParams["caps_path"] = capsPath; 397 loginParams["caps_path"] = capsPath;
398 398
399 // Get appearance
400 AvatarAppearance appearance = m_userManager.GetUserAppearance(user.ID);
401 if (appearance != null)
402 {
403 loginParams["appearance"] = appearance.ToHashTable();
404 m_log.DebugFormat("[LOGIN]: Found appearance for {0}, {1}", user.FirstName, user.SurName);
405 }
406 else
407 m_log.DebugFormat("[LOGIN]: Appearance not for {0}, {1}", user.FirstName, user.SurName);
408
399 ArrayList SendParams = new ArrayList(); 409 ArrayList SendParams = new ArrayList();
400 SendParams.Add(loginParams); 410 SendParams.Add(loginParams);
401 411
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 5df3c34..7ca29ca 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -441,6 +441,13 @@ namespace OpenSim.Region.Communications.Local
441 agent.InventoryFolder = loginData.InventoryFolder; 441 agent.InventoryFolder = loginData.InventoryFolder;
442 agent.startpos = loginData.StartPos; 442 agent.startpos = loginData.StartPos;
443 agent.CapsPath = loginData.CapsPath; 443 agent.CapsPath = loginData.CapsPath;
444 if (agent.Appearance != null)
445 agent.Appearance = loginData.Appearance;
446 else
447 {
448 m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
449 agent.Appearance = new AvatarAppearance();
450 }
444 451
445 TriggerExpectUser(regionHandle, agent); 452 TriggerExpectUser(regionHandle, agent);
446 } 453 }
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 5de812c..4e0ed13 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -359,6 +359,9 @@ namespace OpenSim.Region.Communications.Local
359 loginParams.StartPos = user.CurrentAgent.Position; 359 loginParams.StartPos = user.CurrentAgent.Position;
360 loginParams.CapsPath = capsPath; 360 loginParams.CapsPath = capsPath;
361 361
362 // Appearance
363 loginParams.Appearance = m_userManager.GetUserAppearance(user.ID);
364
362 if (m_gridService.RegionLoginsEnabled) 365 if (m_gridService.RegionLoginsEnabled)
363 { 366 {
364 handlerLoginToRegion = OnLoginToRegion; 367 handlerLoginToRegion = OnLoginToRegion;
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 0ec19a8..1da7621 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -610,9 +610,13 @@ namespace OpenSim.Region.Communications.OGS1
610 agentData.lastname = (string) requestData["lastname"]; 610 agentData.lastname = (string) requestData["lastname"];
611 agentData.AgentID = new UUID((string) requestData["agent_id"]); 611 agentData.AgentID = new UUID((string) requestData["agent_id"]);
612 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 612 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
613 agentData.CapsPath = (string) requestData["caps_path"]; 613 agentData.CapsPath = (string)requestData["caps_path"];
614 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); 614 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
615 615
616 // Appearance
617 if (requestData["appearance"] != null)
618 agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]);
619
616 m_log.DebugFormat( 620 m_log.DebugFormat(
617 "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}", 621 "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}",
618 agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode); 622 agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c3ab5e9..5badd2d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2089,8 +2089,8 @@ namespace OpenSim.Region.Framework.Scenes
2089 /// <returns></returns> 2089 /// <returns></returns>
2090 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) 2090 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
2091 { 2091 {
2092 AvatarAppearance appearance = new AvatarAppearance(); 2092 AvatarAppearance appearance = null;
2093 //GetAvatarAppearance(client, out appearance); 2093 GetAvatarAppearance(client, out appearance);
2094 2094
2095 ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); 2095 ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
2096 //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); 2096 //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
@@ -2104,23 +2104,29 @@ namespace OpenSim.Region.Framework.Scenes
2104 /// <param name="appearance"></param> 2104 /// <param name="appearance"></param>
2105 public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) 2105 public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
2106 { 2106 {
2107 appearance = new AvatarAppearance(); 2107 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2108 2108 appearance = aCircuit.Appearance;
2109 try 2109 if (appearance == null)
2110 {
2111 if (m_AvatarFactory != null)
2112 {
2113 if (m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
2114 return;
2115 }
2116 }
2117 catch (Exception e)
2118 { 2110 {
2119 m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}", 2111 m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName);
2120 client.Name, e); 2112 appearance = new AvatarAppearance();
2121 } 2113 }
2122 2114
2123 m_log.Warn("[APPEARANCE]: Appearance not found, returning default"); 2115 //try
2116 //{
2117 // if (m_AvatarFactory != null)
2118 // {
2119 // if (m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
2120 // return;
2121 // }
2122 //}
2123 //catch (Exception e)
2124 //{
2125 // m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}",
2126 // client.Name, e);
2127 //}
2128
2129 //m_log.Warn("[APPEARANCE]: Appearance not found, returning default");
2124 } 2130 }
2125 2131
2126 /// <summary> 2132 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 42a429d..f06afc0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -816,14 +816,14 @@ namespace OpenSim.Region.Framework.Scenes
816 // Moved this from SendInitialData to ensure that m_appearance is initialized 816 // Moved this from SendInitialData to ensure that m_appearance is initialized
817 // before the inventory is processed in MakeRootAgent. This fixes a race condition 817 // before the inventory is processed in MakeRootAgent. This fixes a race condition
818 // related to the handling of attachments 818 // related to the handling of attachments
819 m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 819 //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
820 820
821 if (pos.X < 0 || pos.X > Constants.RegionSize || pos.Y < 0 || pos.Y > Constants.RegionSize || pos.Z < 0) 821 if (pos.X < 0 || pos.X > Constants.RegionSize || pos.Y < 0 || pos.Y > Constants.RegionSize || pos.Z < 0)
822 { 822 {
823 Vector3 emergencyPos = new Vector3(128, 128, 128); 823 Vector3 emergencyPos = new Vector3(128, 128, 128);
824 824
825 m_log.WarnFormat( 825 m_log.WarnFormat(
826 "[SCENE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 826 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
827 pos, Name, UUID, emergencyPos); 827 pos, Name, UUID, emergencyPos);
828 828
829 pos = emergencyPos; 829 pos = emergencyPos;
@@ -845,8 +845,17 @@ namespace OpenSim.Region.Framework.Scenes
845 AbsolutePosition = pos; 845 AbsolutePosition = pos;
846 846
847 AddToPhysicalScene(isFlying); 847 AddToPhysicalScene(isFlying);
848 if ((m_appearance != null) && (m_appearance.AvatarHeight > 0)) 848 if (m_appearance != null)
849 SetHeight(m_appearance.AvatarHeight); 849 {
850 if (m_appearance.AvatarHeight > 0)
851 SetHeight(m_appearance.AvatarHeight);
852 }
853 else
854 {
855 m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName);
856 // emergency; this really shouldn't happen
857 m_appearance = new AvatarAppearance();
858 }
850 859
851 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 860 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
852 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 861 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
@@ -2573,7 +2582,8 @@ namespace OpenSim.Region.Framework.Scenes
2573 cAgent.Position = m_pos; 2582 cAgent.Position = m_pos;
2574 cAgent.Velocity = m_velocity; 2583 cAgent.Velocity = m_velocity;
2575 cAgent.Center = m_CameraCenter; 2584 cAgent.Center = m_CameraCenter;
2576 cAgent.Size = new Vector3(0, 0, m_avHeight); 2585 // Don't copy the size; it is inferred from apearance parameters
2586 //cAgent.Size = new Vector3(0, 0, m_avHeight);
2577 cAgent.AtAxis = m_CameraAtAxis; 2587 cAgent.AtAxis = m_CameraAtAxis;
2578 cAgent.LeftAxis = m_CameraLeftAxis; 2588 cAgent.LeftAxis = m_CameraLeftAxis;
2579 cAgent.UpAxis = m_CameraUpAxis; 2589 cAgent.UpAxis = m_CameraUpAxis;
@@ -2605,13 +2615,37 @@ namespace OpenSim.Region.Framework.Scenes
2605 2615
2606 cAgent.AlwaysRun = m_setAlwaysRun; 2616 cAgent.AlwaysRun = m_setAlwaysRun;
2607 2617
2608 //cAgent.AgentTextures = ???
2609 //cAgent.GroupID = ?? 2618 //cAgent.GroupID = ??
2610 // Groups??? 2619 // Groups???
2611 2620
2612 // Animations??? 2621 // Animations???
2613 2622
2614 cAgent.VisualParams = m_appearance.VisualParams; 2623 try
2624 {
2625 int i = 0;
2626 UUID[] textures = new UUID[m_appearance.Wearables.Length * 2];
2627 foreach (AvatarWearable aw in m_appearance.Wearables)
2628 {
2629 if (aw != null)
2630 {
2631 textures[i++] = aw.ItemID;
2632 textures[i++] = aw.AssetID;
2633 }
2634 else
2635 m_log.DebugFormat("[SCENE PRESENCE]: Null wearable in CopyTo");
2636 }
2637 cAgent.AgentTextures = textures;
2638 cAgent.VisualParams = m_appearance.VisualParams;
2639 }
2640 catch (Exception e)
2641 {
2642 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
2643 }
2644 //cAgent.GroupID = ??
2645 // Groups???
2646
2647 // Animations???
2648
2615 } 2649 }
2616 2650
2617 public void CopyFrom(AgentData cAgent) 2651 public void CopyFrom(AgentData cAgent)
@@ -2622,7 +2656,7 @@ namespace OpenSim.Region.Framework.Scenes
2622 m_pos = cAgent.Position; 2656 m_pos = cAgent.Position;
2623 m_velocity = cAgent.Velocity; 2657 m_velocity = cAgent.Velocity;
2624 m_CameraCenter = cAgent.Center; 2658 m_CameraCenter = cAgent.Center;
2625 m_avHeight = cAgent.Size.Z; 2659 //m_avHeight = cAgent.Size.Z;
2626 m_CameraAtAxis = cAgent.AtAxis; 2660 m_CameraAtAxis = cAgent.AtAxis;
2627 m_CameraLeftAxis = cAgent.LeftAxis; 2661 m_CameraLeftAxis = cAgent.LeftAxis;
2628 m_CameraUpAxis = cAgent.UpAxis; 2662 m_CameraUpAxis = cAgent.UpAxis;
@@ -2634,20 +2668,39 @@ namespace OpenSim.Region.Framework.Scenes
2634 2668
2635 m_headrotation = cAgent.HeadRotation; 2669 m_headrotation = cAgent.HeadRotation;
2636 m_bodyRot = cAgent.BodyRotation; 2670 m_bodyRot = cAgent.BodyRotation;
2637 m_AgentControlFlags = cAgent.ControlFlags; // We need more flags! 2671 m_AgentControlFlags = cAgent.ControlFlags;
2638 2672
2639 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) 2673 if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
2640 m_godlevel = cAgent.GodLevel; 2674 m_godlevel = cAgent.GodLevel;
2641 m_setAlwaysRun = cAgent.AlwaysRun; 2675 m_setAlwaysRun = cAgent.AlwaysRun;
2642 2676
2643 //cAgent.AgentTextures = ??? 2677 uint i = 0;
2678 AvatarWearable[] wearables = new AvatarWearable[cAgent.AgentTextures.Length / 2];
2679 Primitive.TextureEntry te = new Primitive.TextureEntry(UUID.Random());
2680 try
2681 {
2682 for (uint n = 0; n < cAgent.AgentTextures.Length; n += 2)
2683 {
2684 UUID itemId = cAgent.AgentTextures[n];
2685 UUID assetId = cAgent.AgentTextures[n + 1];
2686 wearables[i] = new AvatarWearable(itemId, assetId);
2687 te.CreateFace(i++).TextureID = assetId;
2688 }
2689 }
2690 catch (Exception e)
2691 {
2692 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
2693 }
2694 //m_appearance.Texture = te;
2695 m_appearance.Wearables = wearables;
2696 //m_appearance.VisualParams = cAgent.VisualParams;
2697 m_appearance.SetAppearance(te.ToBytes(), new List<byte>(cAgent.VisualParams));
2644 2698
2645 //cAgent.GroupID = ?? 2699 //cAgent.GroupID = ??
2646 //Groups??? 2700 //Groups???
2647 2701
2648 // Animations??? 2702 // Animations???
2649 2703
2650 m_appearance.VisualParams = cAgent.VisualParams;
2651 } 2704 }
2652 2705
2653 #endregion Child Agent Updates 2706 #endregion Child Agent Updates