Merge branch 'master' into mantis5110

Conflicts:
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
This commit is contained in:
Jonathan Freedman
2010-10-29 23:58:14 -04:00
9 changed files with 304 additions and 82 deletions

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IAvatarFactory
{
bool ValidateBakedTextureCache(IClientAPI client);
void QueueAppearanceSend(UUID agentid);
void QueueAppearanceSave(UUID agentid);
}
}

View File

@@ -119,6 +119,7 @@ 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;
@@ -398,6 +399,11 @@ namespace OpenSim.Region.Framework.Scenes
public IAttachmentsModule AttachmentsModule { get; set; }
public IAvatarFactory AvatarFactory
{
get { return m_AvatarFactory; }
}
public ICapabilitiesModule CapsModule
{
get { return m_capsModule; }
@@ -1153,6 +1159,7 @@ 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>();

View File

@@ -704,20 +704,14 @@ namespace OpenSim.Region.Framework.Scenes
// we created a new ScenePresence (a new child agent) in a fresh region.
// Request info about all the (root) agents in this region
// Note: This won't send data *to* other clients in that region (children don't send)
// MIC: This gets called again in CompleteMovement
SendInitialFullUpdateToAllClients();
RegisterToEvents();
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)
{
@@ -1081,7 +1075,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void CompleteMovement(IClientAPI client)
{
//m_log.Debug("[SCENE PRESENCE]: CompleteMovement");
// DEBUG ON
m_log.WarnFormat("[SCENE PRESENCE]: CompleteMovement for {0}",UUID);
// DEBUG OFF
Vector3 look = Velocity;
if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -2381,12 +2377,20 @@ namespace OpenSim.Region.Framework.Scenes
// 2 stage check is needed.
if (remoteAvatar == null)
return;
IClientAPI cl=remoteAvatar.ControllingClient;
if (cl == null)
return;
if (m_appearance.Texture == null)
return;
if (LocalId == remoteAvatar.LocalId)
{
m_log.WarnFormat("[SP] An agent is attempting to send data to itself; {0}",UUID);
return;
}
if (IsChildAgent)
{
m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data");
@@ -2407,20 +2411,23 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
++avUpdates;
// only send if this is the root (children are only "listening posts" in a foreign region)
// Don't update ourselves
if (avatar.LocalId == LocalId)
return;
// If this is a root agent, then get info about the avatar
if (!IsChildAgent)
{
SendFullUpdateToOtherClient(avatar);
}
if (avatar.LocalId != LocalId)
// If the other avatar is a root
if (!avatar.IsChildAgent)
{
if (!avatar.IsChildAgent)
{
avatar.SendFullUpdateToOtherClient(this);
avatar.SendAppearanceToOtherAgent(this);
avatar.Animator.SendAnimPackToClient(ControllingClient);
}
avatar.SendFullUpdateToOtherClient(this);
avatar.SendAppearanceToOtherAgent(this);
avatar.Animator.SendAnimPackToClient(ControllingClient);
}
});
@@ -2465,7 +2472,19 @@ namespace OpenSim.Region.Framework.Scenes
// m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
m_controllingClient.SendAvatarDataImmediate(this);
m_controllingClient.SendAppearance(m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
if (m_scene.AvatarFactory != null)
{
if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient))
{
m_log.WarnFormat("[SP] baked textures are in the ache for {0}",Name);
m_controllingClient.SendAppearance(
m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
}
}
else
{
m_log.WarnFormat("[SP] AvatarFactory not set");
}
SendInitialFullUpdateToAllClients();
}
@@ -2497,9 +2516,16 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="avatar"></param>
public void SendAppearanceToOtherAgent(ScenePresence avatar)
{
if (LocalId == avatar.LocalId)
{
m_log.WarnFormat("[SP] An agent is attempting to send data to itself; {0}",UUID);
return;
}
// DEBUG ON
m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
// 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());
}
@@ -2898,7 +2924,7 @@ namespace OpenSim.Region.Framework.Scenes
public void CopyTo(AgentData cAgent)
{
cAgent.CallbackURI = m_callbackURI;
cAgent.AgentID = UUID;
cAgent.RegionID = Scene.RegionInfo.RegionID;