From f97278610c2ab9717b32b9c64bc5865b0b47dd41 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 4 Jul 2011 17:54:14 +0300 Subject: Fixed updating avatar appearance Signed-off-by: root --- OpenSim/Framework/AvatarAppearance.cs | 4 +++- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 27 ++++++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 5a6b265..716baab 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -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>(); 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++) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 75dbeb8..9037c80 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -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) @@ -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) -- cgit v1.1 From 56830bfe07234b0f4b48737a921cc6eae68d9a39 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 12 Jul 2011 12:56:34 +0300 Subject: When handling SetAppearance packet, always save the appearance; not only if the texture was changed --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 9037c80..995a552 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -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()); -- cgit v1.1 From 71ef4a8fb3f582ee76ceb1ec613b32ad2e4bc058 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 18 Jul 2011 12:32:32 +0300 Subject: When an uncached asset is requested multiple times concurrently, only load it once Signed-off-by: root --- .../Connectors/Asset/AssetServiceConnector.cs | 58 ++++++++++++++++++---- 1 file changed, 49 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index f1da4fa..fdab254 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs @@ -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 m_AssetHandlers = new Dictionary(); + + public AssetServicesConnector() { } @@ -178,23 +185,56 @@ namespace OpenSim.Services.Connectors if (asset == null) { - bool result = false; - - AsynchronousRestObjectRequester. - MakeRequest("GET", uri, 0, + lock (m_AssetHandlers) + { + AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); + + 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("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); } -- cgit v1.1 From 02e54c57c4901167779f07ed3e89fb1d24ffc22a Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Fri, 22 Jul 2011 11:33:00 +0300 Subject: Generate the initial maptile asynchronously Signed-off-by: Melanie --- .../CoreModules/World/WorldMap/WorldMapModule.cs | 10 ++++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 6e142bb..fac2dab 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -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 diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6e66632..32a2887 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -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 - if (m_generateMaptiles) + GridRegion region = new GridRegion(RegionInfo); + string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); + if (error != String.Empty) { - RegenerateMaptile(null, null); + throw new Exception(error); } - else + + // 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) { - 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); + }); } } -- cgit v1.1 From 6ac0bc72592b5fe338c98d3acfc973faed321d14 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 22 Jul 2011 12:36:05 +0100 Subject: Thank you, Michelle Argus, for a patch that adds reading the agent limit from XML properly. --- OpenSim/Framework/RegionInfo.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 4c007d6..0e41535 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -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); -- cgit v1.1