Merge branch 'master' into bulletsim

This commit is contained in:
Mic Bowman
2011-07-22 09:02:32 -07:00
10 changed files with 125 additions and 67 deletions

View File

@@ -196,6 +196,9 @@ namespace OpenSim.Framework
if (appearance.VisualParams != null)
m_visualparams = (byte[])appearance.VisualParams.Clone();
m_avatarHeight = appearance.m_avatarHeight;
m_hipOffset = appearance.m_hipOffset;
// Copy the attachment, force append mode since that ensures consistency
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
foreach (AvatarAttachment attachment in appearance.GetAttachments())
@@ -237,7 +240,6 @@ namespace OpenSim.Framework
{
m_serial = 0;
SetDefaultParams();
SetDefaultTexture();
//for (int i = 0; i < BAKE_INDICES.Length; i++)

View File

@@ -760,7 +760,10 @@ namespace OpenSim.Framework
"Clamp prims to max size", "false", true);
configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Max objects this sim will hold", "0", true);
"Max objects this sim will hold", "15000", true);
configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Max avatars this sim will hold", "100", true);
configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
"Scope ID for this region", UUID.Zero.ToString(), true);

View File

@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
changed = sp.Appearance.SetVisualParams(visualParams);
if (sp.Appearance.AvatarHeight > 0)
sp.SetHeight(sp.Appearance.AvatarHeight);
}
}
// Process the baked texture array
if (textureEntry != null)
@@ -224,12 +224,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// update transaction. In theory, we should be able to do an immediate
// appearance send and save here.
// save only if there were changes, send no matter what (doesn't hurt to send twice)
if (changed)
QueueAppearanceSave(client.AgentId);
QueueAppearanceSend(client.AgentId);
}
// save only if there were changes, send no matter what (doesn't hurt to send twice)
if (changed)
QueueAppearanceSave(client.AgentId);
QueueAppearanceSend(client.AgentId);
}
// m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
@@ -387,11 +387,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId);
// we need to clean out the existing textures
sp.Appearance.ResetAppearance();
sp.Appearance.ResetAppearance();
// operate on a copy of the appearance so we don't have to lock anything
// operate on a copy of the appearance so we don't have to lock anything yet
AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < AvatarWearable.MAX_WEARABLES)
@@ -403,12 +403,19 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// This could take awhile since it needs to pull inventory
SetAppearanceAssets(sp.UUID, ref avatAppearance);
// could get fancier with the locks here, but in the spirit of "last write wins"
// this should work correctly, also, we don't need to send the appearance here
// since the "iswearing" will trigger a new set of visual param and baked texture changes
// when those complete, the new appearance will be sent
sp.Appearance = avatAppearance;
QueueAppearanceSave(client.AgentId);
lock (m_setAppearanceLock)
{
// Update only those fields that we have changed. This is important because the viewer
// often sends AvatarIsWearing and SetAppearance packets at once, and AvatarIsWearing
// shouldn't overwrite the changes made in SetAppearance.
sp.Appearance.Wearables = avatAppearance.Wearables;
sp.Appearance.Texture = avatAppearance.Texture;
// We don't need to send the appearance here since the "iswearing" will trigger a new set
// of visual param and baked texture changes. When those complete, the new appearance will be sent
QueueAppearanceSave(client.AgentId);
}
}
private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)

View File

@@ -1110,14 +1110,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (data == null)
return;
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE");
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random();
UUID terrainImageID = UUID.Random();
AssetBase asset = new AssetBase(
m_scene.RegionInfo.RegionSettings.TerrainImageID,
terrainImageID,
"terrainImage_" + m_scene.RegionInfo.RegionID.ToString(),
(sbyte)AssetType.Texture,
m_scene.RegionInfo.RegionID.ToString());
@@ -1129,6 +1127,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// Store the new one
m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID);
m_scene.AssetService.Store(asset);
// Switch to the new one
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID;
m_scene.RegionInfo.RegionSettings.Save();
// Delete the old one

View File

@@ -1672,20 +1672,20 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.SetScene(this);
// If we generate maptiles internally at all, the maptile generator
// will register the region. If not, do it here
GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
if (error != String.Empty)
{
throw new Exception(error);
}
// Generate the maptile asynchronously, because sometimes it can be very slow and we
// don't want this to delay starting the region.
if (m_generateMaptiles)
{
RegenerateMaptile(null, null);
}
else
{
GridRegion region = new GridRegion(RegionInfo);
string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
if (error != String.Empty)
{
throw new Exception(error);
}
Util.FireAndForget(delegate {
RegenerateMaptile(null, null);
});
}
}

View File

@@ -48,6 +48,13 @@ namespace OpenSim.Services.Connectors
private string m_ServerURI = String.Empty;
private IImprovedAssetCache m_Cache = null;
private delegate void AssetRetrievedEx(AssetBase asset);
// Keeps track of concurrent requests for the same asset, so that it's only loaded once.
// Maps: Asset ID -> Handlers which will be called when the asset has been loaded
private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>();
public AssetServicesConnector()
{
}
@@ -178,23 +185,56 @@ namespace OpenSim.Services.Connectors
if (asset == null)
{
bool result = false;
lock (m_AssetHandlers)
{
AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); });
AsynchronousRestObjectRequester.
MakeRequest<int, AssetBase>("GET", uri, 0,
AssetRetrievedEx handlers;
if (m_AssetHandlers.TryGetValue(id, out handlers))
{
// Someone else is already loading this asset. It will notify our handler when done.
handlers += handlerEx;
return true;
}
// Load the asset ourselves
handlers += handlerEx;
m_AssetHandlers.Add(id, handlers);
}
bool success = false;
try
{
AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0,
delegate(AssetBase a)
{
if (m_Cache != null)
m_Cache.Cache(a);
handler(id, sender, a);
result = true;
});
return result;
AssetRetrievedEx handlers;
lock (m_AssetHandlers)
{
handlers = m_AssetHandlers[id];
m_AssetHandlers.Remove(id);
}
handlers.Invoke(a);
});
success = true;
}
finally
{
if (!success)
{
lock (m_AssetHandlers)
{
m_AssetHandlers.Remove(id);
}
}
}
}
else
{
//Util.FireAndForget(delegate { handler(id, sender, asset); });
handler(id, sender, asset);
}