diff options
author | Justin Clark-Casey (justincc) | 2011-09-09 00:29:59 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-09-09 00:38:04 +0100 |
commit | 086bf9f15db05ca2be1cf0dda24f8ee7a368988d (patch) | |
tree | 54cf631d998183bb893e644fd4daf1e49bd11b3e | |
parent | Fix test failure. Oversight in setting up the tests themselves. (diff) | |
download | opensim-SC_OLD-086bf9f15db05ca2be1cf0dda24f8ee7a368988d.zip opensim-SC_OLD-086bf9f15db05ca2be1cf0dda24f8ee7a368988d.tar.gz opensim-SC_OLD-086bf9f15db05ca2be1cf0dda24f8ee7a368988d.tar.bz2 opensim-SC_OLD-086bf9f15db05ca2be1cf0dda24f8ee7a368988d.tar.xz |
Save the default terrain texture UUIDs for a new region instead of leaving them as UUID.Zero.
Leaving them at UUID.Zero meant that when a viewer 2 logged into a region that had been freshly created, it received UUID.Zero for these textures, and hence display the land as plain white.
On a simulator restart, the problem would go away since when the database adapators loaded the new region settings, RegionSettings itself has code to use default textures instead of UUID.Zero.
This commit resolves the problem by saving the default texture UUIDs instead of Zero.
However, we currently have to do this in a roundabout way by resaving once the RegionSettings have been created by the database for the first time. This needless complexity should be addressed.
This change will also have the effect of replacing any existing UUID.Zero terrain textures with the default ones.
However, this shouldn't have any effect since the UUID.Zeros were already being replaced in memory with those same UUIDs.
4 files changed, 43 insertions, 5 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 105a1e0..e1b4fe7 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -47,7 +47,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps; | |||
47 | 47 | ||
48 | namespace OpenSim.Capabilities.Handlers | 48 | namespace OpenSim.Capabilities.Handlers |
49 | { | 49 | { |
50 | |||
51 | public class GetTextureHandler : BaseStreamHandler | 50 | public class GetTextureHandler : BaseStreamHandler |
52 | { | 51 | { |
53 | private static readonly ILog m_log = | 52 | private static readonly ILog m_log = |
@@ -67,7 +66,6 @@ namespace OpenSim.Capabilities.Handlers | |||
67 | 66 | ||
68 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 67 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
69 | { | 68 | { |
70 | |||
71 | // Try to parse the texture ID from the request URL | 69 | // Try to parse the texture ID from the request URL |
72 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 70 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
73 | string textureStr = query.GetOne("texture_id"); | 71 | string textureStr = query.GetOne("texture_id"); |
@@ -85,6 +83,8 @@ namespace OpenSim.Capabilities.Handlers | |||
85 | UUID textureID; | 83 | UUID textureID; |
86 | if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID)) | 84 | if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID)) |
87 | { | 85 | { |
86 | // m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID); | ||
87 | |||
88 | string[] formats; | 88 | string[] formats; |
89 | if (format != null && format != string.Empty) | 89 | if (format != null && format != string.Empty) |
90 | { | 90 | { |
@@ -105,7 +105,6 @@ namespace OpenSim.Capabilities.Handlers | |||
105 | if (FetchTexture(httpRequest, httpResponse, textureID, f)) | 105 | if (FetchTexture(httpRequest, httpResponse, textureID, f)) |
106 | break; | 106 | break; |
107 | } | 107 | } |
108 | |||
109 | } | 108 | } |
110 | else | 109 | else |
111 | { | 110 | { |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 96ecea6..6d14b82 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -1209,7 +1209,6 @@ namespace OpenSim.Data.MySQL | |||
1209 | return prim; | 1209 | return prim; |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | |||
1213 | /// <summary> | 1212 | /// <summary> |
1214 | /// Build a prim inventory item from the persisted data. | 1213 | /// Build a prim inventory item from the persisted data. |
1215 | /// </summary> | 1214 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index d0605e3..94c1417 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -968,6 +968,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
968 | args.terrainDetail2 = Scene.RegionInfo.RegionSettings.TerrainTexture3; | 968 | args.terrainDetail2 = Scene.RegionInfo.RegionSettings.TerrainTexture3; |
969 | args.terrainDetail3 = Scene.RegionInfo.RegionSettings.TerrainTexture4; | 969 | args.terrainDetail3 = Scene.RegionInfo.RegionSettings.TerrainTexture4; |
970 | 970 | ||
971 | m_log.DebugFormat("[ESTATE MANAGEMENT MODULE]: Sending terrain texture 1 {0} for region {1}", args.terrainDetail0, Scene.RegionInfo.RegionName); | ||
972 | m_log.DebugFormat("[ESTATE MANAGEMENT MODULE]: Sending terrain texture 2 {0} for region {1}", args.terrainDetail1, Scene.RegionInfo.RegionName); | ||
973 | m_log.DebugFormat("[ESTATE MANAGEMENT MODULE]: Sending terrain texture 3 {0} for region {1}", args.terrainDetail2, Scene.RegionInfo.RegionName); | ||
974 | m_log.DebugFormat("[ESTATE MANAGEMENT MODULE]: Sending terrain texture 4 {0} for region {1}", args.terrainDetail3, Scene.RegionInfo.RegionName); | ||
975 | |||
971 | remoteClient.SendRegionHandshake(Scene.RegionInfo,args); | 976 | remoteClient.SendRegionHandshake(Scene.RegionInfo,args); |
972 | } | 977 | } |
973 | 978 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d3de37d..f86b3b6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -588,7 +588,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
588 | #region Region Settings | 588 | #region Region Settings |
589 | 589 | ||
590 | // Load region settings | 590 | // Load region settings |
591 | m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); | 591 | // LoadRegionSettings creates new region settings in persistence if they don't already exist for this region. |
592 | // However, in this case, the default textures are not set in memory properly, so we need to do it here and | ||
593 | // resave. | ||
594 | // FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new | ||
595 | // region is set up and avoid these gyrations. | ||
596 | RegionSettings rs = simDataService.LoadRegionSettings(m_regInfo.RegionID); | ||
597 | bool updatedTerrainTextures = false; | ||
598 | if (rs.TerrainTexture1 == UUID.Zero) | ||
599 | { | ||
600 | rs.TerrainTexture1 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_1; | ||
601 | updatedTerrainTextures = true; | ||
602 | } | ||
603 | |||
604 | if (rs.TerrainTexture2 == UUID.Zero) | ||
605 | { | ||
606 | rs.TerrainTexture2 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_2; | ||
607 | updatedTerrainTextures = true; | ||
608 | } | ||
609 | |||
610 | if (rs.TerrainTexture3 == UUID.Zero) | ||
611 | { | ||
612 | rs.TerrainTexture3 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_3; | ||
613 | updatedTerrainTextures = true; | ||
614 | } | ||
615 | |||
616 | if (rs.TerrainTexture4 == UUID.Zero) | ||
617 | { | ||
618 | rs.TerrainTexture4 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_4; | ||
619 | updatedTerrainTextures = true; | ||
620 | } | ||
621 | |||
622 | if (updatedTerrainTextures) | ||
623 | rs.Save(); | ||
624 | |||
625 | m_regInfo.RegionSettings = rs; | ||
626 | |||
592 | if (estateDataService != null) | 627 | if (estateDataService != null) |
593 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); | 628 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); |
594 | 629 | ||