Adding appearance and animations
parent
2283b85bcf
commit
82a71fb7e2
|
@ -577,6 +577,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
public event BakeTerrain OnBakeTerrain;
|
||||
public event EstateChangeInfo OnEstateChangeInfo;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
|
||||
|
|
|
@ -223,6 +223,7 @@ namespace OpenSim.Client.Sirikata.ClientStack
|
|||
public event BakeTerrain OnBakeTerrain;
|
||||
public event EstateChangeInfo OnEstateChangeInfo;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
|
||||
|
|
|
@ -226,6 +226,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
|||
public event BakeTerrain OnBakeTerrain = delegate { };
|
||||
public event EstateChangeInfo OnEstateChangeInfo = delegate { };
|
||||
public event SetAppearance OnSetAppearance = delegate { };
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw = delegate { };
|
||||
public event AvatarNowWearing OnAvatarNowWearing = delegate { };
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv = delegate { return new UUID(); };
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv = delegate { };
|
||||
|
|
|
@ -382,6 +382,8 @@ namespace OpenSim.Framework
|
|||
m_texture = textureEntry;
|
||||
if (visualParams != null)
|
||||
m_visualparams = visualParams;
|
||||
if (m_visualparams == null)
|
||||
return;
|
||||
|
||||
m_avatarHeight = 1.23077f // Shortest possible avatar height
|
||||
+ 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace OpenSim.Framework
|
|||
public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes);
|
||||
|
||||
public delegate void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams);
|
||||
public delegate void SetAppearanceRaw(IClientAPI sender, UUID agentID, byte[] vp, Primitive.TextureEntry te);
|
||||
|
||||
public delegate void StartAnim(IClientAPI remoteClient, UUID animID);
|
||||
|
||||
|
@ -865,6 +866,7 @@ namespace OpenSim.Framework
|
|||
event EstateChangeInfo OnEstateChangeInfo;
|
||||
// [Obsolete("LLClientView Specific.")]
|
||||
event SetAppearance OnSetAppearance;
|
||||
event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
// [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")]
|
||||
event AvatarNowWearing OnAvatarNowWearing;
|
||||
event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
|
|
|
@ -120,6 +120,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public event Action<IClientAPI> OnRegionHandShakeReply;
|
||||
public event GenericCall2 OnRequestWearables;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
|
||||
|
@ -5606,7 +5607,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
#endregion
|
||||
|
||||
SetAppearance handlerSetAppearance = OnSetAppearance;
|
||||
if (handlerSetAppearance != null)
|
||||
SetAppearanceRaw handlerSetAppearanceRaw = OnSetAppearanceRaw;
|
||||
//if (handlerSetAppearance != null)
|
||||
{
|
||||
// Temporarily protect ourselves from the mantis #951 failure.
|
||||
// However, we could do this for several other handlers where a failure isn't terminal
|
||||
|
@ -5622,7 +5624,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (appear.ObjectData.TextureEntry.Length > 1)
|
||||
te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
|
||||
|
||||
if (handlerSetAppearance != null)
|
||||
handlerSetAppearance(te, visualparams);
|
||||
if (handlerSetAppearanceRaw != null)
|
||||
handlerSetAppearanceRaw(this, AgentId, visualparams, te);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
public event ModifyTerrain OnModifyTerrain;
|
||||
public event BakeTerrain OnBakeTerrain;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
|
||||
|
|
|
@ -121,6 +121,7 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
RemoveLocalClient(kvp.Key, m_scene);
|
||||
// Remove the agent update handler from the client
|
||||
kvp.Value.OnAgentUpdateRaw -= HandleAgentUpdateRaw;
|
||||
kvp.Value.OnSetAppearanceRaw -= HandleSetAppearanceRaw;
|
||||
}
|
||||
}
|
||||
// Close the connection
|
||||
|
@ -515,6 +516,7 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
// Register for interesting client events which will be forwarded to auth sim
|
||||
// These are the raw packet data blocks from the client, intercepted and sent up to the sim
|
||||
client.OnAgentUpdateRaw += HandleAgentUpdateRaw;
|
||||
client.OnSetAppearanceRaw += HandleSetAppearanceRaw;
|
||||
client.OnChatFromClientRaw += HandleChatFromClientRaw;
|
||||
}
|
||||
|
||||
|
@ -536,6 +538,18 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentUpdate, agentData));
|
||||
}
|
||||
|
||||
public void HandleSetAppearanceRaw(object sender, UUID agentID, byte[] vp, Primitive.TextureEntry te)
|
||||
{
|
||||
if (te != null)
|
||||
{
|
||||
OSDMap data = new OSDMap(2);
|
||||
data["id"] = OSDUUID.FromUUID(agentID);
|
||||
data["vp"] = new OSDBinary(vp);
|
||||
data["te"] = te.GetOSD();
|
||||
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AvatarAppearance, OSDParser.SerializeJsonString(data)));
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleChatFromClientRaw(object sender, byte[] chatData)
|
||||
{
|
||||
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.ChatFromClient, chatData));
|
||||
|
|
|
@ -288,6 +288,44 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
}
|
||||
return HandlerFailure(msg, "Could not deserialize JSON data.");
|
||||
|
||||
}
|
||||
case RegionSyncMessage.MsgType.AvatarAppearance:
|
||||
{
|
||||
OSDMap data = DeserializeMessage(msg);
|
||||
if (data != null)
|
||||
{
|
||||
UUID agentID = data["id"].AsUUID();
|
||||
|
||||
if (agentID != null && agentID != UUID.Zero)
|
||||
{
|
||||
ScenePresence presence;
|
||||
if (m_scene.TryGetScenePresence(agentID, out presence))
|
||||
{
|
||||
string name = presence.Name;
|
||||
Primitive.TextureEntry te = Primitive.TextureEntry.FromOSD(data["te"]);
|
||||
byte[] vp = data["vp"].AsBinary();
|
||||
|
||||
byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
|
||||
for (int i = 0; i < BAKE_INDICES.Length; i++)
|
||||
{
|
||||
int j = BAKE_INDICES[i];
|
||||
Primitive.TextureEntryFace face = te.FaceTextures[j];
|
||||
if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
||||
if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
|
||||
HandlerDebug(msg, "Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + name);
|
||||
}
|
||||
|
||||
presence.SetAppearance(te, vp);
|
||||
return HandlerDebug(msg, String.Format("Agent \"{0}\" ({1}) updated their appearance.", name, agentID));
|
||||
}
|
||||
else
|
||||
{
|
||||
return HandlerFailure(msg, String.Format("Agent {0} not found in the scene.", agentID));
|
||||
}
|
||||
}
|
||||
}
|
||||
return HandlerFailure(msg, "Could not deserialize JSON data.");
|
||||
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
|
|
@ -33,6 +33,8 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
RemovedObject, // objects
|
||||
NewAvatar, // avatars
|
||||
UpdatedAvatar, // avatars
|
||||
AnimateAvatar,
|
||||
AvatarAppearance,
|
||||
RemovedAvatar, // avatars
|
||||
ChatFromSim,
|
||||
// BIDIR
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
// The list is read most of the time and only updated when a new client manager
|
||||
// connects, so we just replace the list when it changes. Iterators on this
|
||||
// list need to be able to handle if an element is shutting down.
|
||||
private object m_clientview_lock = new object();
|
||||
private HashSet<RegionSyncClientView> m_client_views = new HashSet<RegionSyncClientView>();
|
||||
|
||||
// Check if any of the client views are in a connected state
|
||||
|
@ -55,27 +56,36 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
// Add the client view to the list and increment synced client counter
|
||||
public void AddSyncedClient(RegionSyncClientView rscv)
|
||||
{
|
||||
HashSet<RegionSyncClientView> newlist = new HashSet<RegionSyncClientView>(m_client_views);
|
||||
lock (m_clientview_lock)
|
||||
{
|
||||
HashSet<RegionSyncClientView> currentlist = m_client_views;
|
||||
HashSet<RegionSyncClientView> newlist = new HashSet<RegionSyncClientView>(currentlist);
|
||||
newlist.Add(rscv);
|
||||
// Threads holding the previous version of the list can keep using it since
|
||||
// they will not hold it for long and get a new copy next time they need to iterate
|
||||
Interlocked.Exchange<HashSet<RegionSyncClientView>>(ref m_client_views, newlist);
|
||||
m_client_views = newlist;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the client view from the list and decrement synced client counter
|
||||
public void RemoveSyncedClient(RegionSyncClientView rscv)
|
||||
{
|
||||
HashSet<RegionSyncClientView> newlist = new HashSet<RegionSyncClientView>(m_client_views);
|
||||
lock (m_clientview_lock)
|
||||
{
|
||||
HashSet<RegionSyncClientView> currentlist = m_client_views;
|
||||
HashSet<RegionSyncClientView> newlist = new HashSet<RegionSyncClientView>(currentlist);
|
||||
newlist.Remove(rscv);
|
||||
// Threads holding the previous version of the list can keep using it since
|
||||
// they will not hold it for long and get a new copy next time they need to iterate
|
||||
Interlocked.Exchange<HashSet<RegionSyncClientView>>(ref m_client_views, newlist);
|
||||
m_client_views = newlist;
|
||||
}
|
||||
}
|
||||
|
||||
public void ReportStats()
|
||||
{
|
||||
// We should be able to safely iterate over our reference to the list since
|
||||
// the only places which change it will replace it with an updated version
|
||||
m_log.Error("SERVER, MSGIN, MSGOUT, BYTESIN, BYTESOUT");
|
||||
foreach (RegionSyncClientView rscv in m_client_views)
|
||||
{
|
||||
m_log.ErrorFormat("{0}: {1}", rscv.Description, rscv.GetStats());
|
||||
|
@ -160,9 +170,6 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
public void Broadcast(RegionSyncMessage msg)
|
||||
{
|
||||
List<RegionSyncClientView> closed = null;
|
||||
//lock (m_client_views)
|
||||
{
|
||||
//m_log.WarnFormat("[REGION SYNC SERVER] Broadcasting {0} to all connected RegionSyncClients", msg.ToString());
|
||||
foreach (RegionSyncClientView client in m_client_views)
|
||||
{
|
||||
// If connected, send the message.
|
||||
|
@ -186,5 +193,4 @@ namespace OpenSim.Region.Examples.RegionSyncModule
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
|||
public event ModifyTerrain OnModifyTerrain;
|
||||
public event BakeTerrain OnBakeTerrain;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
|
||||
|
|
|
@ -724,6 +724,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// TODO: Change default to true once the feature is supported
|
||||
m_usePreJump = startupConfig.GetBoolean("enableprejump", false);
|
||||
|
||||
m_maxNonphys = 256f;
|
||||
m_maxPhys = 256f;
|
||||
|
||||
/*
|
||||
m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
|
||||
if (RegionInfo.NonphysPrimMax > 0)
|
||||
{
|
||||
|
@ -736,6 +740,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
m_maxPhys = RegionInfo.PhysPrimMax;
|
||||
}
|
||||
*/
|
||||
|
||||
// Here, if clamping is requested in either global or
|
||||
// local config, it will be used
|
||||
|
@ -1595,7 +1600,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
List<UUID> resultIds = new List<UUID>();
|
||||
List<Vector3> resultLocations = new List<Vector3>();
|
||||
|
||||
/*
|
||||
ForEachScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
if (sp.IsChildAgent)
|
||||
|
@ -1603,6 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
resultIds.Add(sp.UUID);
|
||||
resultLocations.Add(sp.AbsolutePosition);
|
||||
});
|
||||
*/
|
||||
ids = resultIds;
|
||||
locations = resultLocations;
|
||||
|
||||
|
@ -2704,6 +2710,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
GetAvatarAppearance(client, out appearance);
|
||||
presence.Appearance = appearance;
|
||||
|
||||
// REGION SYNC
|
||||
// The owner is not being set properly when there is no circuit. Hmmm
|
||||
presence.Appearance.Owner = presence.UUID;
|
||||
|
||||
presence.initializeScenePresence(client, RegionInfo, this);
|
||||
|
||||
m_sceneGraph.AddScenePresence(presence);
|
||||
|
|
|
@ -68,7 +68,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#region Fields
|
||||
|
||||
protected Dictionary<UUID, ScenePresence> m_scenePresences = new Dictionary<UUID, ScenePresence>();
|
||||
protected object m_presenceLock = new object();
|
||||
protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>();
|
||||
protected ScenePresence[] m_scenePresenceArray = new ScenePresence[0];
|
||||
|
||||
// SceneObjects is not currently populated or used.
|
||||
|
@ -132,10 +133,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
protected internal void Close()
|
||||
{
|
||||
lock (m_scenePresences)
|
||||
lock (m_presenceLock)
|
||||
{
|
||||
m_scenePresences.Clear();
|
||||
m_scenePresenceArray = new ScenePresence[0];
|
||||
Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>();
|
||||
ScenePresence[] newarray = new ScenePresence[0];
|
||||
m_scenePresenceMap = newmap;
|
||||
m_scenePresenceArray = newarray;
|
||||
}
|
||||
|
||||
lock (m_dictionary_lock)
|
||||
|
@ -518,34 +521,39 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
Entities[presence.UUID] = presence;
|
||||
|
||||
lock (m_scenePresences)
|
||||
lock (m_presenceLock)
|
||||
{
|
||||
if (!m_scenePresences.ContainsKey(presence.UUID))
|
||||
// We are going to swap the map and array references with modified copies
|
||||
Dictionary<UUID, ScenePresence> newmap;
|
||||
ScenePresence[] newarray;
|
||||
if (m_scenePresenceMap.ContainsKey(presence.UUID))
|
||||
{
|
||||
m_scenePresences.Add(presence.UUID, presence);
|
||||
|
||||
// Create a new array of ScenePresence references
|
||||
int oldLength = m_scenePresenceArray.Length;
|
||||
ScenePresence[] newArray = new ScenePresence[oldLength + 1];
|
||||
Array.Copy(m_scenePresenceArray, newArray, oldLength);
|
||||
newArray[oldLength] = presence;
|
||||
m_scenePresenceArray = newArray;
|
||||
// copy the map and update the presence reference
|
||||
newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
|
||||
m_scenePresenceMap[presence.UUID] = presence;
|
||||
// copy the array and update the presence reference
|
||||
newarray = new ScenePresence[m_scenePresenceArray.Length];
|
||||
for(int i = 0; i < m_scenePresenceArray.Length; ++i)
|
||||
{
|
||||
if(m_scenePresenceArray[i].UUID == presence.UUID)
|
||||
newarray[i] = presence;
|
||||
else
|
||||
newarray[i] = m_scenePresenceArray[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scenePresences[presence.UUID] = presence;
|
||||
|
||||
// Do a linear search through the array of ScenePresence references
|
||||
// and update the modified entry
|
||||
for (int i = 0; i < m_scenePresenceArray.Length; i++)
|
||||
{
|
||||
if (m_scenePresenceArray[i].UUID == presence.UUID)
|
||||
{
|
||||
m_scenePresenceArray[i] = presence;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// copy the map and add the new presence reference
|
||||
newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
|
||||
newmap[presence.UUID] = presence;
|
||||
// Copy the array and add the new presence reference
|
||||
int oldLength = m_scenePresenceArray.Length;
|
||||
newarray = new ScenePresence[oldLength+1];
|
||||
Array.Copy(m_scenePresenceArray, newarray, oldLength);
|
||||
newarray[oldLength] = presence;
|
||||
}
|
||||
m_scenePresenceMap = newmap;
|
||||
m_scenePresenceArray = newarray;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,25 +569,30 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
agentID);
|
||||
}
|
||||
|
||||
lock (m_scenePresences)
|
||||
lock (m_presenceLock)
|
||||
{
|
||||
if (m_scenePresences.Remove(agentID))
|
||||
// Copy the map
|
||||
Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
|
||||
// Remove the presence reference from the dictionary
|
||||
if (newmap.Remove(agentID))
|
||||
{
|
||||
// Copy all of the elements from the previous array
|
||||
// into the new array except the removed element
|
||||
int oldLength = m_scenePresenceArray.Length;
|
||||
ScenePresence[] newArray = new ScenePresence[oldLength - 1];
|
||||
ScenePresence[] newarray = new ScenePresence[oldLength - 1];
|
||||
int j = 0;
|
||||
for (int i = 0; i < m_scenePresenceArray.Length; i++)
|
||||
for (int i = 0; i < oldLength; ++i)
|
||||
{
|
||||
ScenePresence presence = m_scenePresenceArray[i];
|
||||
if (presence.UUID != agentID)
|
||||
{
|
||||
newArray[j] = presence;
|
||||
newarray[j] = presence;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
m_scenePresenceArray = newArray;
|
||||
// Swap out the dictionary and list with new references
|
||||
m_scenePresenceMap = newmap;
|
||||
m_scenePresenceArray = newarray;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -698,16 +711,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request a copy of m_scenePresences in this World
|
||||
/// Get a reference to the scene presence list. Changes to the list will be done in a copy
|
||||
/// There is no guarantee that presences will remain in the scene after the list is returned.
|
||||
/// This list should remain private to SceneGraph. Callers wishing to iterate should instead
|
||||
/// pass a delegate to ForEachScenePresence.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<ScenePresence> GetScenePresences()
|
||||
private ScenePresence[] GetScenePresences()
|
||||
{
|
||||
lock (m_scenePresences)
|
||||
return new List<ScenePresence>(m_scenePresenceArray);
|
||||
return m_scenePresenceArray;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -717,12 +729,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>null if the presence was not found</returns>
|
||||
protected internal ScenePresence GetScenePresence(UUID agentID)
|
||||
{
|
||||
ScenePresence sp;
|
||||
lock (m_scenePresences)
|
||||
{
|
||||
m_scenePresences.TryGetValue(agentID, out sp);
|
||||
}
|
||||
return sp;
|
||||
Dictionary<UUID, ScenePresence> presences = m_scenePresenceMap;
|
||||
ScenePresence presence;
|
||||
presences.TryGetValue(agentID, out presence);
|
||||
return presence;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -733,10 +743,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>null if the presence was not found</returns>
|
||||
protected internal ScenePresence GetScenePresence(string firstName, string lastName)
|
||||
{
|
||||
foreach (ScenePresence presence in GetScenePresences())
|
||||
ScenePresence[] presences = GetScenePresences();
|
||||
for(int i = 0; i < presences.Length; ++i)
|
||||
{
|
||||
if (presence.Firstname == firstName && presence.Lastname == lastName)
|
||||
return presence;
|
||||
if (presences[i].Firstname == firstName && presences[i].Lastname == lastName)
|
||||
return presences[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -748,29 +759,31 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>null if the presence was not found</returns>
|
||||
protected internal ScenePresence GetScenePresence(uint localID)
|
||||
{
|
||||
foreach (ScenePresence presence in GetScenePresences())
|
||||
if (presence.LocalId == localID)
|
||||
return presence;
|
||||
ScenePresence[] presences = GetScenePresences();
|
||||
for (int i = 0; i < presences.Length; ++i)
|
||||
{
|
||||
if (presences[i].LocalId == localID)
|
||||
return presences[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected internal bool TryGetScenePresence(UUID agentID, out ScenePresence avatar)
|
||||
{
|
||||
lock (m_scenePresences)
|
||||
{
|
||||
m_scenePresences.TryGetValue(agentID, out avatar);
|
||||
}
|
||||
Dictionary<UUID, ScenePresence> presences = m_scenePresenceMap;
|
||||
presences.TryGetValue(agentID, out avatar);
|
||||
return (avatar != null);
|
||||
}
|
||||
|
||||
protected internal bool TryGetAvatarByName(string name, out ScenePresence avatar)
|
||||
{
|
||||
avatar = null;
|
||||
foreach (ScenePresence presence in GetScenePresences())
|
||||
ScenePresence[] presences = GetScenePresences();
|
||||
for(int i = 0; i < presences.Length; ++i )
|
||||
{
|
||||
if (String.Compare(name, presence.ControllingClient.Name, true) == 0)
|
||||
if (String.Compare(name, presences[i].ControllingClient.Name, true) == 0)
|
||||
{
|
||||
avatar = presence;
|
||||
avatar = presences[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1036,12 +1049,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
});
|
||||
Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction);
|
||||
*/
|
||||
// For now, perform actiona serially
|
||||
foreach (ScenePresence sp in GetScenePresences())
|
||||
// For now, perform actions serially
|
||||
ScenePresence[] presences = GetScenePresences();
|
||||
for(int i = 0; i < presences.Length; ++i)
|
||||
{
|
||||
ScenePresence presence = presences[i];
|
||||
try
|
||||
{
|
||||
action(sp);
|
||||
action(presence);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
|
||||
// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
|
||||
private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
|
||||
private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
|
||||
private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
|
||||
|
||||
|
@ -672,6 +672,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
|
||||
CreateSceneViewer();
|
||||
m_animator = new ScenePresenceAnimator(this);
|
||||
|
||||
Primitive.TextureEntry te = AvatarAppearance.GetDefaultTexture();
|
||||
byte[] vp = AvatarAppearance.GetDefaultVisualParams();
|
||||
m_appearance = new AvatarAppearance(UUID);
|
||||
m_appearance.SetAppearance(te, vp);
|
||||
}
|
||||
|
||||
private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this()
|
||||
|
@ -722,13 +727,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
AvatarWearable[] wearables)
|
||||
: this(client, world, reginfo)
|
||||
{
|
||||
m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams);
|
||||
//m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams);
|
||||
}
|
||||
|
||||
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
|
||||
: this(client, world, reginfo)
|
||||
{
|
||||
m_appearance = appearance;
|
||||
//m_appearance = appearance;
|
||||
}
|
||||
|
||||
private void CreateSceneViewer()
|
||||
|
@ -738,14 +743,17 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void RegisterToEvents()
|
||||
{
|
||||
m_controllingClient.OnRequestWearables += SendWearables;
|
||||
// REGION SYNC
|
||||
if (!m_scene.IsSyncedClient())
|
||||
{
|
||||
m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
|
||||
}
|
||||
|
||||
m_controllingClient.OnSetAppearance += SetAppearance;
|
||||
m_controllingClient.OnRequestWearables += SendWearables;
|
||||
m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
|
||||
//m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
|
||||
|
||||
// REGION SYNC
|
||||
if(!m_scene.IsSyncedClient())
|
||||
m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
|
||||
m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit;
|
||||
m_controllingClient.OnAgentSit += HandleAgentSit;
|
||||
m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
|
||||
|
@ -2443,11 +2451,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void SendCoarseLocations()
|
||||
{
|
||||
SendCoarseLocationsDefault(m_scene.RegionInfo.originRegionID, this);
|
||||
/*
|
||||
SendCourseLocationsMethod d = m_sendCourseLocationsMethod;
|
||||
if (d != null)
|
||||
{
|
||||
d.Invoke(m_scene.RegionInfo.originRegionID, this);
|
||||
}
|
||||
* */
|
||||
}
|
||||
|
||||
public void SetSendCourseLocationMethod(SendCourseLocationsMethod d)
|
||||
|
@ -2463,7 +2474,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
List<Vector3> CoarseLocations = new List<Vector3>();
|
||||
// This is not cheap to compile this list of locations.
|
||||
// It should ideally be done once and then sent to every client rather than compiled for each client
|
||||
m_scene.GetCoarseLocations(out AvatarUUIDs, out CoarseLocations);
|
||||
//m_scene.GetCoarseLocations(out AvatarUUIDs, out CoarseLocations);
|
||||
AvatarUUIDs.Add(UUID);
|
||||
CoarseLocations.Add(AbsolutePosition);
|
||||
m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
@ -2602,6 +2615,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="avatar"></param>
|
||||
public void SendAppearanceToOtherAgent(ScenePresence avatar)
|
||||
{
|
||||
//m_log.WarnFormat("{0} sending appearance to {1}, owner={2}", UUID, avatar.UUID, m_appearance.Owner);
|
||||
m_appearance.Owner = UUID;
|
||||
avatar.ControllingClient.SendAppearance(
|
||||
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
|
||||
}
|
||||
|
|
|
@ -659,6 +659,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
public event BakeTerrain OnBakeTerrain;
|
||||
public event EstateChangeInfo OnEstateChangeInfo;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
|
||||
|
|
|
@ -168,6 +168,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
public event RezObject OnRezObject;
|
||||
public event ModifyTerrain OnModifyTerrain;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
|
||||
|
|
|
@ -204,6 +204,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
public string Store(AssetBase asset)
|
||||
{
|
||||
/*
|
||||
if (asset.Temporary || asset.Local)
|
||||
{
|
||||
if (m_Cache != null)
|
||||
|
@ -211,6 +212,8 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
return asset.ID;
|
||||
}
|
||||
* */
|
||||
m_Cache.Cache(asset);
|
||||
|
||||
string uri = m_ServerURI + "/assets/";
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
}
|
||||
|
||||
// Local asset handling
|
||||
if (asset.Local)
|
||||
/*if (asset.Local)
|
||||
{
|
||||
if (!storedInCache)
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
|||
}
|
||||
|
||||
return asset.ID;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Distinguish public and private assets
|
||||
bool isPublic = true;
|
||||
|
|
|
@ -74,6 +74,7 @@ namespace OpenSim.Tests.Common.Mock
|
|||
public event ModifyTerrain OnModifyTerrain;
|
||||
public event BakeTerrain OnBakeTerrain;
|
||||
public event SetAppearance OnSetAppearance;
|
||||
public event SetAppearanceRaw OnSetAppearanceRaw;
|
||||
public event AvatarNowWearing OnAvatarNowWearing;
|
||||
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
|
||||
public event RezMultipleAttachmentsFromInv OnRezMultipleAttachmentsFromInv;
|
||||
|
|
Loading…
Reference in New Issue