mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
* Added prototypical AvatarFactory module interface to load avatar parameters
* Added dump_assets_to_file option to enable asset dumping for debug * normalized some namespaces * InventoryFolder renamed to InventoryFolderImpl to
This commit is contained in:
13
OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
Normal file
13
OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Types;
|
||||
|
||||
namespace OpenSim.Region.Environment.Interfaces
|
||||
{
|
||||
public interface IAvatarFactory : IRegionModule
|
||||
{
|
||||
bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams);
|
||||
}
|
||||
}
|
||||
@@ -67,12 +67,18 @@ namespace OpenSim.Region.Environment
|
||||
{
|
||||
DynamicTextureModule dynamicModule = new DynamicTextureModule();
|
||||
LoadedSharedModules.Add(dynamicModule.Name, dynamicModule);
|
||||
|
||||
ChatModule chat = new ChatModule();
|
||||
LoadedSharedModules.Add(chat.Name, chat);
|
||||
|
||||
InstantMessageModule imMod = new InstantMessageModule();
|
||||
LoadedSharedModules.Add(imMod.Name, imMod);
|
||||
|
||||
LoadImageURLModule loadMod = new LoadImageURLModule();
|
||||
LoadedSharedModules.Add(loadMod.Name, loadMod);
|
||||
|
||||
AvatarFactoryModule avatarFactory = new AvatarFactoryModule();
|
||||
LoadedSharedModules.Add(avatarFactory.Name, avatarFactory);
|
||||
}
|
||||
|
||||
public void InitialiseSharedModules(Scene scene)
|
||||
|
||||
57
OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
Normal file
57
OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Modules
|
||||
{
|
||||
public class AvatarFactoryModule : IAvatarFactory
|
||||
{
|
||||
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams)
|
||||
{
|
||||
GetDefaultAvatarAppearance(out wearables, out visualParams);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource source)
|
||||
{
|
||||
scene.RegisterModuleInterface<IAvatarFactory>(this);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Default Avatar Factory"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
|
||||
{
|
||||
visualParams = new byte[218];
|
||||
for (int i = 0; i < 218; i++)
|
||||
{
|
||||
visualParams[i] = 100;
|
||||
}
|
||||
|
||||
wearables = AvatarWearable.DefaultWearables;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -126,7 +126,9 @@ namespace OpenSim.Region.Environment.Modules
|
||||
LLUUID fromAgentID = LLUUID.Zero;
|
||||
|
||||
if (e.Sender != null)
|
||||
{
|
||||
avatar = scene.GetScenePresence(e.Sender.AgentId);
|
||||
}
|
||||
|
||||
if (avatar != null)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,6 @@ using Axiom.Math;
|
||||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Communications.Caches;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Framework.Utilities;
|
||||
|
||||
@@ -50,6 +50,7 @@ using OpenSim.Region.Environment.Types;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using OpenSim.Region.Terrain;
|
||||
using Timer = System.Timers.Timer;
|
||||
using OpenSim.Region.Environment.Modules;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
@@ -90,11 +91,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
public IXfer XferManager;
|
||||
|
||||
private IHttpRequests m_httpRequestModule = null;
|
||||
private ISimChat m_simChatModule = null;
|
||||
private IXMLRPC m_xmlrpcModule = null;
|
||||
private IWorldComm m_worldCommModule = null;
|
||||
|
||||
private IHttpRequests m_httpRequestModule;
|
||||
private ISimChat m_simChatModule;
|
||||
private IXMLRPC m_xmlrpcModule;
|
||||
private IWorldComm m_worldCommModule;
|
||||
private IAvatarFactory m_AvatarFactory;
|
||||
|
||||
// Central Update Loop
|
||||
|
||||
@@ -165,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
|
||||
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
|
||||
ModuleLoader moduleLoader)
|
||||
ModuleLoader moduleLoader, bool dumpAssetsToFile)
|
||||
{
|
||||
updateLock = new Mutex(false);
|
||||
|
||||
@@ -205,6 +206,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
ScenePresence.LoadAnims();
|
||||
|
||||
httpListener = httpServer;
|
||||
m_dumpAssetsToFile = dumpAssetsToFile;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -215,7 +217,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
m_httpRequestModule = RequestModuleInterface<IHttpRequests>();
|
||||
m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
|
||||
m_worldCommModule = RequestModuleInterface<IWorldComm>();
|
||||
|
||||
XferManager = RequestModuleInterface<IXfer>();
|
||||
}
|
||||
|
||||
@@ -855,7 +856,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
ScenePresence newAvatar = null;
|
||||
|
||||
newAvatar = new ScenePresence(client, this, m_regInfo);
|
||||
byte[] visualParams;
|
||||
AvatarWearable[] wearables;
|
||||
|
||||
if( m_AvatarFactory == null || !m_AvatarFactory.TryGetIntialAvatarAppearance( client.AgentId, out wearables, out visualParams))
|
||||
{
|
||||
AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);
|
||||
}
|
||||
|
||||
newAvatar = new ScenePresence(client, this, m_regInfo, visualParams, wearables);
|
||||
newAvatar.IsChildAgent = child;
|
||||
|
||||
if (child)
|
||||
@@ -1096,7 +1105,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
//Console.WriteLine("new user, so creating caps handler for it");
|
||||
Caps cap =
|
||||
new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port,
|
||||
agent.CapsPath, agent.AgentID);
|
||||
agent.CapsPath, agent.AgentID, m_dumpAssetsToFile);
|
||||
|
||||
Util.SetCapsURL(agent.AgentID,
|
||||
"http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() +
|
||||
"/CAPS/" + agent.CapsPath + "0000/");
|
||||
@@ -1456,6 +1466,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
#region Script Engine
|
||||
|
||||
private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
|
||||
private bool m_dumpAssetsToFile;
|
||||
|
||||
public void AddScriptEngine(ScriptEngineInterface ScriptEngine, LogBase m_logger)
|
||||
{
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
private short m_updateCount = 0;
|
||||
|
||||
private Quaternion bodyRot;
|
||||
private byte[] visualParams;
|
||||
private AvatarWearable[] Wearables;
|
||||
private byte[] m_visualParams;
|
||||
private AvatarWearable[] m_wearables;
|
||||
private LLObject.TextureEntry m_textureEntry;
|
||||
|
||||
public bool IsRestrictedToRegion = false;
|
||||
@@ -90,10 +90,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
//public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>();
|
||||
|
||||
// private string m_currentQuadNode = " ";
|
||||
// private string m_currentQuadNode = " ";
|
||||
|
||||
// private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>();
|
||||
//private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>();
|
||||
// private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>();
|
||||
//private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>();
|
||||
|
||||
private UpdateQueue m_partsUpdateQueue = new UpdateQueue();
|
||||
private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>();
|
||||
@@ -173,8 +173,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
m_pos = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override LLVector3 Velocity
|
||||
{
|
||||
get
|
||||
@@ -220,14 +220,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
#region Constructor(s)
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="world"></param>
|
||||
/// <param name="clientThreads"></param>
|
||||
/// <param name="regionDat"></param>
|
||||
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo)
|
||||
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, AvatarWearable[] wearables)
|
||||
{
|
||||
m_scene = world;
|
||||
m_uuid = client.AgentId;
|
||||
@@ -240,13 +233,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
m_localId = m_scene.NextLocalId;
|
||||
AbsolutePosition = m_controllingClient.StartPos;
|
||||
|
||||
visualParams = new byte[218];
|
||||
for (int i = 0; i < 218; i++)
|
||||
{
|
||||
visualParams[i] = 100;
|
||||
}
|
||||
m_visualParams = visualParams;
|
||||
m_wearables = wearables;
|
||||
|
||||
Wearables = AvatarWearable.DefaultWearables;
|
||||
Animations = new AvatarAnimations();
|
||||
Animations.LoadAnims();
|
||||
|
||||
@@ -351,7 +340,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
AbsolutePosition = pos;
|
||||
|
||||
AddToPhysicalScene( );
|
||||
AddToPhysicalScene();
|
||||
m_physicsActor.Flying = isFlying;
|
||||
|
||||
|
||||
@@ -410,7 +399,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
for (int i = 0; i < visualParam.Length; i++)
|
||||
{
|
||||
visualParams[i] = visualParam[i].ParamValue;
|
||||
m_visualParams[i] = visualParam[i].ParamValue;
|
||||
}
|
||||
|
||||
SendAppearanceToAllOtherAgents();
|
||||
@@ -459,7 +448,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
Vector3 agent_control_v3 = new Vector3(0, 0, 0);
|
||||
Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
|
||||
bool oldflying = PhysicsActor.Flying;
|
||||
PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||
PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||
if (PhysicsActor.Flying != oldflying)
|
||||
{
|
||||
update_movementflag = true;
|
||||
@@ -470,23 +459,23 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
bodyRot = q;
|
||||
update_rotation = true;
|
||||
}
|
||||
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
|
||||
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
|
||||
{
|
||||
if ((flags & (uint) DCF) != 0)
|
||||
if ((flags & (uint)DCF) != 0)
|
||||
{
|
||||
DCFlagKeyPressed = true;
|
||||
agent_control_v3 += Dir_Vectors[i];
|
||||
if ((m_movementflag & (uint) DCF) == 0)
|
||||
if ((m_movementflag & (uint)DCF) == 0)
|
||||
{
|
||||
m_movementflag += (byte) (uint) DCF;
|
||||
m_movementflag += (byte)(uint)DCF;
|
||||
update_movementflag = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((m_movementflag & (uint) DCF) != 0)
|
||||
if ((m_movementflag & (uint)DCF) != 0)
|
||||
{
|
||||
m_movementflag -= (byte) (uint) DCF;
|
||||
m_movementflag -= (byte)(uint)DCF;
|
||||
update_movementflag = true;
|
||||
}
|
||||
}
|
||||
@@ -531,10 +520,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
|
||||
NewForce newVelocity = new NewForce();
|
||||
Vector3 direc = rotation*vec;
|
||||
Vector3 direc = rotation * vec;
|
||||
direc.Normalize();
|
||||
|
||||
direc = direc*((0.03f)*128f);
|
||||
direc = direc * ((0.03f) * 128f);
|
||||
if (m_physicsActor.Flying)
|
||||
direc *= 4;
|
||||
|
||||
@@ -619,7 +608,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
/// </summary>
|
||||
public void SendTerseUpdateToAllClients()
|
||||
{
|
||||
m_scene.Broadcast( SendTerseUpdateToClient );
|
||||
m_scene.Broadcast(SendTerseUpdateToClient);
|
||||
}
|
||||
|
||||
public void SendCoarseLocations()
|
||||
@@ -628,7 +617,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
List<ScenePresence> avatars = m_scene.GetAvatars();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
{
|
||||
if (avatars[i] != this )
|
||||
if (avatars[i] != this)
|
||||
{
|
||||
CoarseLocations.Add(avatars[i].AbsolutePosition);
|
||||
}
|
||||
@@ -642,7 +631,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
m_newCoarseLocations = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -695,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
/// <param name="OurClient"></param>
|
||||
public void SendOurAppearance(IClientAPI OurClient)
|
||||
{
|
||||
m_controllingClient.SendWearables(Wearables);
|
||||
m_controllingClient.SendWearables(m_wearables);
|
||||
|
||||
//this.SendFullUpdateToAllClients();
|
||||
//this.SendAppearanceToAllOtherAgents();
|
||||
@@ -734,7 +723,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
/// <param name="avatarInfo"></param>
|
||||
public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
|
||||
{
|
||||
avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, visualParams,
|
||||
avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams,
|
||||
m_textureEntry.ToBytes());
|
||||
}
|
||||
|
||||
@@ -793,9 +782,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
LLVector3 vel = Velocity;
|
||||
|
||||
float timeStep = 0.1f;
|
||||
pos2.X = pos2.X + (vel.X*timeStep);
|
||||
pos2.Y = pos2.Y + (vel.Y*timeStep);
|
||||
pos2.Z = pos2.Z + (vel.Z*timeStep);
|
||||
pos2.X = pos2.X + (vel.X * timeStep);
|
||||
pos2.Y = pos2.Y + (vel.Y * timeStep);
|
||||
pos2.Z = pos2.Z + (vel.Z * timeStep);
|
||||
|
||||
if ((pos2.X < 0) || (pos2.X > 256))
|
||||
{
|
||||
@@ -840,7 +829,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
}
|
||||
|
||||
LLVector3 vel = m_velocity;
|
||||
ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
|
||||
ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256));
|
||||
RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
|
||||
if (neighbourRegion != null)
|
||||
{
|
||||
@@ -940,7 +929,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
throw new Exception("Can't set Text on avatar.");
|
||||
}
|
||||
|
||||
public void AddToPhysicalScene( )
|
||||
public void AddToPhysicalScene()
|
||||
{
|
||||
PhysicsScene scene = m_scene.PhysScene;
|
||||
|
||||
@@ -948,7 +937,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
|
||||
AbsolutePosition.Z);
|
||||
|
||||
m_physicsActor = scene.AddAvatar(this.Firstname+"."+this.Lastname, pVec);
|
||||
m_physicsActor = scene.AddAvatar(this.Firstname + "." + this.Lastname, pVec);
|
||||
}
|
||||
|
||||
internal void Close()
|
||||
|
||||
Reference in New Issue
Block a user