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).

0.6.3-post-fixes
diva 2009-02-17 00:35:52 +00:00
parent d97dd2bdb4
commit 7cc9062137
10 changed files with 121 additions and 29 deletions

View File

@ -35,6 +35,7 @@ namespace OpenSim.Framework
public class AgentCircuitData public class AgentCircuitData
{ {
public UUID AgentID; public UUID AgentID;
public AvatarAppearance Appearance;
public UUID BaseFolder; public UUID BaseFolder;
public string CapsPath = String.Empty; public string CapsPath = String.Empty;
public Dictionary<ulong, string> ChildrenCapSeeds; public Dictionary<ulong, string> ChildrenCapSeeds;

View File

@ -103,6 +103,13 @@ namespace OpenSim.Framework
} }
} }
public AgentCircuitData GetAgentCircuitData(uint circuitCode)
{
AgentCircuitData agentCircuit = null;
AgentCircuits.TryGetValue(circuitCode, out agentCircuit);
return agentCircuit;
}
public void UpdateAgentData(AgentCircuitData agentData) public void UpdateAgentData(AgentCircuitData agentData)
{ {
if (AgentCircuits.ContainsKey((uint) agentData.circuitcode)) if (AgentCircuits.ContainsKey((uint) agentData.circuitcode))

View File

@ -286,7 +286,7 @@ namespace OpenSim.Framework
+ 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height
+ 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length
- m_avatarHeight / 2) * 0.3f - 0.04f; - m_avatarHeight / 2) * 0.3f - 0.04f;
//System.Console.WriteLine("Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); //System.Console.WriteLine("[APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset);
} }
public virtual void SetWearable(int wearableId, AvatarWearable wearable) public virtual void SetWearable(int wearableId, AvatarWearable wearable)

View File

@ -42,6 +42,7 @@ namespace OpenSim.Framework
public UUID SecureSession = UUID.Zero; public UUID SecureSession = UUID.Zero;
public UUID Session; public UUID Session;
public Vector3 StartPos; public Vector3 StartPos;
public AvatarAppearance Appearance;
public Login() public Login()
{ {

View File

@ -396,6 +396,16 @@ namespace OpenSim.Grid.UserServer
loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString(); loginParams["regionhandle"] = user.CurrentAgent.Handle.ToString();
loginParams["caps_path"] = capsPath; loginParams["caps_path"] = capsPath;
// Get appearance
AvatarAppearance appearance = m_userManager.GetUserAppearance(user.ID);
if (appearance != null)
{
loginParams["appearance"] = appearance.ToHashTable();
m_log.DebugFormat("[LOGIN]: Found appearance for {0}, {1}", user.FirstName, user.SurName);
}
else
m_log.DebugFormat("[LOGIN]: Appearance not for {0}, {1}", user.FirstName, user.SurName);
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();
SendParams.Add(loginParams); SendParams.Add(loginParams);

View File

@ -441,6 +441,13 @@ namespace OpenSim.Region.Communications.Local
agent.InventoryFolder = loginData.InventoryFolder; agent.InventoryFolder = loginData.InventoryFolder;
agent.startpos = loginData.StartPos; agent.startpos = loginData.StartPos;
agent.CapsPath = loginData.CapsPath; agent.CapsPath = loginData.CapsPath;
if (agent.Appearance != null)
agent.Appearance = loginData.Appearance;
else
{
m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
agent.Appearance = new AvatarAppearance();
}
TriggerExpectUser(regionHandle, agent); TriggerExpectUser(regionHandle, agent);
} }

View File

@ -359,6 +359,9 @@ namespace OpenSim.Region.Communications.Local
loginParams.StartPos = user.CurrentAgent.Position; loginParams.StartPos = user.CurrentAgent.Position;
loginParams.CapsPath = capsPath; loginParams.CapsPath = capsPath;
// Appearance
loginParams.Appearance = m_userManager.GetUserAppearance(user.ID);
if (m_gridService.RegionLoginsEnabled) if (m_gridService.RegionLoginsEnabled)
{ {
handlerLoginToRegion = OnLoginToRegion; handlerLoginToRegion = OnLoginToRegion;

View File

@ -610,9 +610,13 @@ namespace OpenSim.Region.Communications.OGS1
agentData.lastname = (string) requestData["lastname"]; agentData.lastname = (string) requestData["lastname"];
agentData.AgentID = new UUID((string) requestData["agent_id"]); agentData.AgentID = new UUID((string) requestData["agent_id"]);
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
agentData.CapsPath = (string) requestData["caps_path"]; agentData.CapsPath = (string)requestData["caps_path"];
ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
// Appearance
if (requestData["appearance"] != null)
agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]);
m_log.DebugFormat( m_log.DebugFormat(
"[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}", "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}",
agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode); agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode);

View File

@ -2089,8 +2089,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
{ {
AvatarAppearance appearance = new AvatarAppearance(); AvatarAppearance appearance = null;
//GetAvatarAppearance(client, out appearance); GetAvatarAppearance(client, out appearance);
ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
//avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
@ -2104,23 +2104,29 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="appearance"></param> /// <param name="appearance"></param>
public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
{ {
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
appearance = aCircuit.Appearance;
if (appearance == null)
{
m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName);
appearance = new AvatarAppearance(); appearance = new AvatarAppearance();
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"); //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");
} }
/// <summary> /// <summary>

View File

@ -816,14 +816,14 @@ namespace OpenSim.Region.Framework.Scenes
// Moved this from SendInitialData to ensure that m_appearance is initialized // Moved this from SendInitialData to ensure that m_appearance is initialized
// before the inventory is processed in MakeRootAgent. This fixes a race condition // before the inventory is processed in MakeRootAgent. This fixes a race condition
// related to the handling of attachments // 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) 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); Vector3 emergencyPos = new Vector3(128, 128, 128);
m_log.WarnFormat( 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, Name, UUID, emergencyPos);
pos = emergencyPos; pos = emergencyPos;
@ -845,8 +845,17 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = pos; AbsolutePosition = pos;
AddToPhysicalScene(isFlying); AddToPhysicalScene(isFlying);
if ((m_appearance != null) && (m_appearance.AvatarHeight > 0)) if (m_appearance != null)
{
if (m_appearance.AvatarHeight > 0)
SetHeight(m_appearance.AvatarHeight); 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 // 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 // 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.Position = m_pos;
cAgent.Velocity = m_velocity; cAgent.Velocity = m_velocity;
cAgent.Center = m_CameraCenter; 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.AtAxis = m_CameraAtAxis;
cAgent.LeftAxis = m_CameraLeftAxis; cAgent.LeftAxis = m_CameraLeftAxis;
cAgent.UpAxis = m_CameraUpAxis; cAgent.UpAxis = m_CameraUpAxis;
@ -2605,14 +2615,38 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.AlwaysRun = m_setAlwaysRun; cAgent.AlwaysRun = m_setAlwaysRun;
//cAgent.AgentTextures = ???
//cAgent.GroupID = ?? //cAgent.GroupID = ??
// Groups??? // Groups???
// Animations??? // Animations???
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; 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) public void CopyFrom(AgentData cAgent)
{ {
@ -2622,7 +2656,7 @@ namespace OpenSim.Region.Framework.Scenes
m_pos = cAgent.Position; m_pos = cAgent.Position;
m_velocity = cAgent.Velocity; m_velocity = cAgent.Velocity;
m_CameraCenter = cAgent.Center; m_CameraCenter = cAgent.Center;
m_avHeight = cAgent.Size.Z; //m_avHeight = cAgent.Size.Z;
m_CameraAtAxis = cAgent.AtAxis; m_CameraAtAxis = cAgent.AtAxis;
m_CameraLeftAxis = cAgent.LeftAxis; m_CameraLeftAxis = cAgent.LeftAxis;
m_CameraUpAxis = cAgent.UpAxis; m_CameraUpAxis = cAgent.UpAxis;
@ -2634,20 +2668,39 @@ namespace OpenSim.Region.Framework.Scenes
m_headrotation = cAgent.HeadRotation; m_headrotation = cAgent.HeadRotation;
m_bodyRot = cAgent.BodyRotation; 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))) if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID)))
m_godlevel = cAgent.GodLevel; m_godlevel = cAgent.GodLevel;
m_setAlwaysRun = cAgent.AlwaysRun; 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<byte>(cAgent.VisualParams));
//cAgent.GroupID = ?? //cAgent.GroupID = ??
//Groups??? //Groups???
// Animations??? // Animations???
m_appearance.VisualParams = cAgent.VisualParams;
} }
#endregion Child Agent Updates #endregion Child Agent Updates