From 7cc906213795fbe4878c0cfb8351272e847617e9 Mon Sep 17 00:00:00 2001
From: diva
Date: Tue, 17 Feb 2009 00:35:52 +0000
Subject: 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).
---
OpenSim/Region/Framework/Scenes/Scene.cs | 40 +++++++------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 75 ++++++++++++++++++++----
2 files changed, 87 insertions(+), 28 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
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
///
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
{
- AvatarAppearance appearance = new AvatarAppearance();
- //GetAvatarAppearance(client, out appearance);
+ AvatarAppearance appearance = null;
+ GetAvatarAppearance(client, out appearance);
ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
//avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
@@ -2104,23 +2104,29 @@ namespace OpenSim.Region.Framework.Scenes
///
public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
{
- appearance = new AvatarAppearance();
-
- try
- {
- if (m_AvatarFactory != null)
- {
- if (m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
- return;
- }
- }
- catch (Exception e)
+ AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
+ appearance = aCircuit.Appearance;
+ if (appearance == null)
{
- m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}",
- client.Name, e);
+ m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName);
+ appearance = new AvatarAppearance();
}
-
- m_log.Warn("[APPEARANCE]: Appearance not found, returning default");
+
+ //try
+ //{
+ // if (m_AvatarFactory != null)
+ // {
+ // if (m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
+ // return;
+ // }
+ //}
+ //catch (Exception e)
+ //{
+ // m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}",
+ // client.Name, e);
+ //}
+
+ //m_log.Warn("[APPEARANCE]: Appearance not found, returning default");
}
///
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
// Moved this from SendInitialData to ensure that m_appearance is initialized
// before the inventory is processed in MakeRootAgent. This fixes a race condition
// related to the handling of attachments
- m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
+ //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
if (pos.X < 0 || pos.X > Constants.RegionSize || pos.Y < 0 || pos.Y > Constants.RegionSize || pos.Z < 0)
{
Vector3 emergencyPos = new Vector3(128, 128, 128);
m_log.WarnFormat(
- "[SCENE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
+ "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}",
pos, Name, UUID, emergencyPos);
pos = emergencyPos;
@@ -845,8 +845,17 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = pos;
AddToPhysicalScene(isFlying);
- if ((m_appearance != null) && (m_appearance.AvatarHeight > 0))
- SetHeight(m_appearance.AvatarHeight);
+ if (m_appearance != null)
+ {
+ if (m_appearance.AvatarHeight > 0)
+ SetHeight(m_appearance.AvatarHeight);
+ }
+ else
+ {
+ m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName);
+ // emergency; this really shouldn't happen
+ m_appearance = new AvatarAppearance();
+ }
// Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
// 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
cAgent.Position = m_pos;
cAgent.Velocity = m_velocity;
cAgent.Center = m_CameraCenter;
- cAgent.Size = new Vector3(0, 0, m_avHeight);
+ // Don't copy the size; it is inferred from apearance parameters
+ //cAgent.Size = new Vector3(0, 0, m_avHeight);
cAgent.AtAxis = m_CameraAtAxis;
cAgent.LeftAxis = m_CameraLeftAxis;
cAgent.UpAxis = m_CameraUpAxis;
@@ -2605,13 +2615,37 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.AlwaysRun = m_setAlwaysRun;
- //cAgent.AgentTextures = ???
//cAgent.GroupID = ??
// Groups???
// Animations???
- cAgent.VisualParams = m_appearance.VisualParams;
+ try
+ {
+ int i = 0;
+ UUID[] textures = new UUID[m_appearance.Wearables.Length * 2];
+ foreach (AvatarWearable aw in m_appearance.Wearables)
+ {
+ if (aw != null)
+ {
+ textures[i++] = aw.ItemID;
+ textures[i++] = aw.AssetID;
+ }
+ else
+ m_log.DebugFormat("[SCENE PRESENCE]: Null wearable in CopyTo");
+ }
+ cAgent.AgentTextures = textures;
+ cAgent.VisualParams = m_appearance.VisualParams;
+ }
+ catch (Exception e)
+ {
+ m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
+ }
+ //cAgent.GroupID = ??
+ // Groups???
+
+ // Animations???
+
}
public void CopyFrom(AgentData cAgent)
@@ -2622,7 +2656,7 @@ namespace OpenSim.Region.Framework.Scenes
m_pos = cAgent.Position;
m_velocity = cAgent.Velocity;
m_CameraCenter = cAgent.Center;
- m_avHeight = cAgent.Size.Z;
+ //m_avHeight = cAgent.Size.Z;
m_CameraAtAxis = cAgent.AtAxis;
m_CameraLeftAxis = cAgent.LeftAxis;
m_CameraUpAxis = cAgent.UpAxis;
@@ -2634,20 +2668,39 @@ namespace OpenSim.Region.Framework.Scenes
m_headrotation = cAgent.HeadRotation;
m_bodyRot = cAgent.BodyRotation;
- m_AgentControlFlags = cAgent.ControlFlags; // We need more flags!
+ m_AgentControlFlags = cAgent.ControlFlags;
if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
m_godlevel = cAgent.GodLevel;
m_setAlwaysRun = cAgent.AlwaysRun;
- //cAgent.AgentTextures = ???
+ uint i = 0;
+ AvatarWearable[] wearables = new AvatarWearable[cAgent.AgentTextures.Length / 2];
+ Primitive.TextureEntry te = new Primitive.TextureEntry(UUID.Random());
+ try
+ {
+ for (uint n = 0; n < cAgent.AgentTextures.Length; n += 2)
+ {
+ UUID itemId = cAgent.AgentTextures[n];
+ UUID assetId = cAgent.AgentTextures[n + 1];
+ wearables[i] = new AvatarWearable(itemId, assetId);
+ te.CreateFace(i++).TextureID = assetId;
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
+ }
+ //m_appearance.Texture = te;
+ m_appearance.Wearables = wearables;
+ //m_appearance.VisualParams = cAgent.VisualParams;
+ m_appearance.SetAppearance(te.ToBytes(), new List(cAgent.VisualParams));
//cAgent.GroupID = ??
//Groups???
// Animations???
- m_appearance.VisualParams = cAgent.VisualParams;
}
#endregion Child Agent Updates
--
cgit v1.1