mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
Merge branch 'master' into mantis5110
Conflicts: OpenSim/Region/Framework/Scenes/ScenePresence.cs
This commit is contained in:
@@ -296,7 +296,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// ChatToClientsEvent is triggered via ChatModule (or
|
||||
/// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
|
||||
/// received chat message if they satisfy various conditions (within audible range, etc.)
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public delegate void ChatToClientsEvent(
|
||||
UUID senderID, HashSet<UUID> receiverIDs,
|
||||
string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
|
||||
@@ -1636,8 +1636,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
|
||||
{
|
||||
|
||||
@@ -119,7 +119,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
protected IXMLRPC m_xmlrpcModule;
|
||||
protected IWorldComm m_worldCommModule;
|
||||
protected IAvatarFactory m_AvatarFactory;
|
||||
protected IConfigSource m_config;
|
||||
protected IRegionSerialiserModule m_serialiser;
|
||||
protected IDialogModule m_dialogModule;
|
||||
@@ -399,11 +398,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public IAttachmentsModule AttachmentsModule { get; set; }
|
||||
|
||||
public IAvatarFactory AvatarFactory
|
||||
{
|
||||
get { return m_AvatarFactory; }
|
||||
}
|
||||
|
||||
public ICapabilitiesModule CapsModule
|
||||
{
|
||||
get { return m_capsModule; }
|
||||
@@ -1159,7 +1153,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
|
||||
m_worldCommModule = RequestModuleInterface<IWorldComm>();
|
||||
XferManager = RequestModuleInterface<IXfer>();
|
||||
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
|
||||
AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
|
||||
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
|
||||
m_dialogModule = RequestModuleInterface<IDialogModule>();
|
||||
@@ -3278,7 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Do the work necessary to initiate a new user connection for a particular scene.
|
||||
/// At the moment, this consists of setting up the caps infrastructure
|
||||
@@ -3290,6 +3282,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns>True if the region accepts this agent. False if it does not. False will
|
||||
/// also return a reason.</returns>
|
||||
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
|
||||
{
|
||||
return NewUserConnection(agent, teleportFlags, out reason, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Do the work necessary to initiate a new user connection for a particular scene.
|
||||
/// At the moment, this consists of setting up the caps infrastructure
|
||||
/// The return bool should allow for connections to be refused, but as not all calling paths
|
||||
/// take proper notice of it let, we allowed banned users in still.
|
||||
/// </summary>
|
||||
/// <param name="agent">CircuitData of the agent who is connecting</param>
|
||||
/// <param name="reason">Outputs the reason for the false response on this string</param>
|
||||
/// <param name="requirePresenceLookup">True for normal presence. False for NPC
|
||||
/// or other applications where a full grid/Hypergrid presence may not be required.</param>
|
||||
/// <returns>True if the region accepts this agent. False if it does not. False will
|
||||
/// also return a reason.</returns>
|
||||
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
|
||||
{
|
||||
bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
|
||||
(teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
|
||||
@@ -3339,16 +3348,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (sp == null) // We don't have an [child] agent here already
|
||||
{
|
||||
|
||||
try
|
||||
if (requirePresenceLookup)
|
||||
{
|
||||
if (!VerifyUserPresence(agent, out reason))
|
||||
try
|
||||
{
|
||||
if (!VerifyUserPresence(agent, out reason))
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString());
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[CONNECTION BEGIN]: Exception verifying presence " + e.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
@@ -406,11 +406,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
|
||||
{
|
||||
EntityBase entity;
|
||||
if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
|
||||
if (!Entities.TryGetValue(uuid, out entity) || (!(entity is SceneObjectGroup)))
|
||||
return false;
|
||||
|
||||
SceneObjectGroup grp = (SceneObjectGroup)entity;
|
||||
|
||||
if (entity == null)
|
||||
return false;
|
||||
|
||||
if (!resultOfObjectLinked)
|
||||
{
|
||||
m_numPrim -= grp.PrimCount;
|
||||
|
||||
@@ -75,7 +75,6 @@ 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 Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
|
||||
private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
|
||||
@@ -137,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private SendCourseLocationsMethod m_sendCourseLocationsMethod;
|
||||
|
||||
private bool m_startAnimationSet;
|
||||
|
||||
//private Vector3 m_requestedSitOffset = new Vector3();
|
||||
|
||||
private Vector3 m_LastFinitePos;
|
||||
@@ -713,13 +710,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SetDirectionVectors();
|
||||
}
|
||||
|
||||
/*
|
||||
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
|
||||
AvatarWearable[] wearables)
|
||||
: this(client, world, reginfo)
|
||||
{
|
||||
m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams);
|
||||
}
|
||||
|
||||
*/
|
||||
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
|
||||
: this(client, world, reginfo)
|
||||
{
|
||||
@@ -733,8 +731,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void RegisterToEvents()
|
||||
{
|
||||
m_controllingClient.OnRequestWearables += SendWearables;
|
||||
m_controllingClient.OnSetAppearance += SetAppearance;
|
||||
m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
|
||||
//m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
|
||||
m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
|
||||
@@ -1068,7 +1064,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Sets avatar height in the phyiscs plugin
|
||||
/// </summary>
|
||||
internal void SetHeight(float height)
|
||||
public void SetHeight(float height)
|
||||
{
|
||||
m_avHeight = height;
|
||||
if (PhysicsActor != null && !IsChildAgent)
|
||||
@@ -1133,7 +1129,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (friendsModule != null)
|
||||
friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2392,9 +2387,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (m_appearance.Texture == null)
|
||||
return;
|
||||
|
||||
Vector3 pos = m_pos;
|
||||
pos.Z += m_appearance.HipOffset;
|
||||
|
||||
if (IsChildAgent)
|
||||
{
|
||||
m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data");
|
||||
return;
|
||||
}
|
||||
|
||||
remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this);
|
||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
||||
}
|
||||
@@ -2437,6 +2435,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
// only send update from root agents to other clients; children are only "listening posts"
|
||||
if (IsChildAgent)
|
||||
{
|
||||
m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent");
|
||||
return;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
@@ -2460,29 +2464,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// the inventory arrives
|
||||
// m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
|
||||
|
||||
Vector3 pos = m_pos;
|
||||
pos.Z += m_appearance.HipOffset;
|
||||
|
||||
m_controllingClient.SendAvatarDataImmediate(this);
|
||||
m_controllingClient.SendAppearance(m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
|
||||
|
||||
SendInitialFullUpdateToAllClients();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tell the client for this scene presence what items it should be wearing now
|
||||
/// </summary>
|
||||
public void SendWearables()
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name);
|
||||
|
||||
ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void SendAppearanceToAllOtherAgents()
|
||||
{
|
||||
// DEBUG ON
|
||||
m_log.WarnFormat("[SP] Send appearance from {0} to all other agents",m_uuid);
|
||||
// DEBUG OFF
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||
@@ -2502,87 +2497,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="avatar"></param>
|
||||
public void SendAppearanceToOtherAgent(ScenePresence avatar)
|
||||
{
|
||||
// DEBUG ON
|
||||
m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
|
||||
// DEBUG OFF
|
||||
avatar.ControllingClient.SendAppearance(
|
||||
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set appearance data (textureentry and slider settings) received from the client
|
||||
/// </summary>
|
||||
/// <param name="texture"></param>
|
||||
/// <param name="visualParam"></param>
|
||||
public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
|
||||
{
|
||||
if (m_physicsActor != null)
|
||||
{
|
||||
if (!IsChildAgent)
|
||||
{
|
||||
// This may seem like it's redundant, remove the avatar from the physics scene
|
||||
// just to add it back again, but it saves us from having to update
|
||||
// 3 variables 10 times a second.
|
||||
bool flyingTemp = m_physicsActor.Flying;
|
||||
RemoveFromPhysicalScene();
|
||||
//m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
|
||||
|
||||
//PhysicsActor = null;
|
||||
|
||||
AddToPhysicalScene(flyingTemp);
|
||||
}
|
||||
}
|
||||
|
||||
#region Bake Cache Check
|
||||
|
||||
if (textureEntry != null)
|
||||
{
|
||||
for (int i = 0; i < BAKE_INDICES.Length; i++)
|
||||
{
|
||||
int j = BAKE_INDICES[i];
|
||||
Primitive.TextureEntryFace face = textureEntry.FaceTextures[j];
|
||||
|
||||
if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
|
||||
{
|
||||
if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
|
||||
{
|
||||
m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name);
|
||||
this.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion Bake Cache Check
|
||||
|
||||
m_appearance.SetAppearance(textureEntry, visualParams);
|
||||
if (m_appearance.AvatarHeight > 0)
|
||||
SetHeight(m_appearance.AvatarHeight);
|
||||
|
||||
// This is not needed, because only the transient data changed
|
||||
//AvatarData adata = new AvatarData(m_appearance);
|
||||
//m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
|
||||
|
||||
SendAppearanceToAllOtherAgents();
|
||||
if (!m_startAnimationSet)
|
||||
{
|
||||
Animator.UpdateMovementAnimations();
|
||||
m_startAnimationSet = true;
|
||||
}
|
||||
|
||||
Vector3 pos = m_pos;
|
||||
pos.Z += m_appearance.HipOffset;
|
||||
|
||||
m_controllingClient.SendAvatarDataImmediate(this);
|
||||
}
|
||||
|
||||
public void SetWearable(int wearableId, AvatarWearable wearable)
|
||||
{
|
||||
m_appearance.SetWearable(wearableId, wearable);
|
||||
AvatarData adata = new AvatarData(m_appearance);
|
||||
m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
|
||||
m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
|
||||
}
|
||||
|
||||
// Because appearance setting is in a module, we actually need
|
||||
// to give it access to our appearance directly, otherwise we
|
||||
// get a synchronization issue.
|
||||
@@ -3017,6 +2938,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
cAgent.AlwaysRun = m_setAlwaysRun;
|
||||
|
||||
cAgent.Appearance = new AvatarAppearance(m_appearance);
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
// We might not pass the Wearables in all cases...
|
||||
@@ -3056,14 +2980,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
//m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
|
||||
int i = 0;
|
||||
AttachmentData[] attachs = new AttachmentData[attPoints.Count];
|
||||
AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count];
|
||||
foreach (int point in attPoints)
|
||||
{
|
||||
attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
|
||||
attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
|
||||
}
|
||||
cAgent.Attachments = attachs;
|
||||
}
|
||||
|
||||
*/
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
ControllerData[] controls = new ControllerData[scriptedcontrols.Count];
|
||||
@@ -3090,6 +3014,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void CopyFrom(AgentData cAgent)
|
||||
{
|
||||
// DEBUG ON
|
||||
m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
|
||||
// DEBUG OFF
|
||||
m_originRegionID = cAgent.RegionID;
|
||||
|
||||
m_callbackURI = cAgent.CallbackURI;
|
||||
@@ -3115,6 +3042,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_godLevel = cAgent.GodLevel;
|
||||
m_setAlwaysRun = cAgent.AlwaysRun;
|
||||
|
||||
m_appearance = new AvatarAppearance(cAgent.Appearance);
|
||||
|
||||
/*
|
||||
uint i = 0;
|
||||
try
|
||||
{
|
||||
@@ -3127,15 +3057,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
UUID assetId = cAgent.Wearables[n + 1];
|
||||
wears[i++] = new AvatarWearable(itemId, assetId);
|
||||
}
|
||||
m_appearance.Wearables = wears;
|
||||
Primitive.TextureEntry te;
|
||||
// m_appearance.Wearables = wears;
|
||||
Primitive.TextureEntry textures = null;
|
||||
if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1)
|
||||
te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
|
||||
else
|
||||
te = AvatarAppearance.GetDefaultTexture();
|
||||
if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
|
||||
cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams();
|
||||
m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone());
|
||||
textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length);
|
||||
|
||||
byte[] visuals = null;
|
||||
|
||||
if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
|
||||
visuals = (byte[])cAgent.VisualParams.Clone();
|
||||
|
||||
m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -3148,14 +3080,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (cAgent.Attachments != null)
|
||||
{
|
||||
m_appearance.ClearAttachments();
|
||||
foreach (AttachmentData att in cAgent.Attachments)
|
||||
foreach (AvatarAttachment att in cAgent.Attachments)
|
||||
{
|
||||
m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
*/
|
||||
try
|
||||
{
|
||||
lock (scriptedcontrols)
|
||||
@@ -3724,15 +3656,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return;
|
||||
}
|
||||
|
||||
List<int> attPoints = m_appearance.GetAttachedPoints();
|
||||
foreach (int p in attPoints)
|
||||
List<AvatarAttachment> attachments = m_appearance.GetAttachments();
|
||||
foreach (AvatarAttachment attach in attachments)
|
||||
{
|
||||
if (m_isDeleted)
|
||||
return;
|
||||
|
||||
UUID itemID = m_appearance.GetAttachedItem(p);
|
||||
int p = attach.AttachPoint;
|
||||
UUID itemID = attach.ItemID;
|
||||
|
||||
//UUID assetID = m_appearance.GetAttachedAsset(p);
|
||||
//UUID assetID = attach.AssetID;
|
||||
// For some reason assetIDs are being written as Zero's in the DB -- need to track tat down
|
||||
// But they're not used anyway, the item is being looked up for now, so let's proceed.
|
||||
//if (UUID.Zero == assetID)
|
||||
|
||||
@@ -804,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||
{
|
||||
byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
|
||||
shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
|
||||
shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
|
||||
}
|
||||
|
||||
private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader)
|
||||
|
||||
Reference in New Issue
Block a user