diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 37ab581e81..4446fa4987 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2967,10 +2967,13 @@ namespace OpenSim.Region.Framework.Scenes { if (part.Shape.SculptEntry && part.Shape.SculptTexture != UUID.Zero) { - //// check if a previously decoded sculpt map has been cached - //if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + part.Shape.SculptTexture.ToString()))) - // part.SculptTextureCallback(part.Shape.SculptTexture, null); - //else + // check if a previously decoded sculpt map has been cached + if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + part.Shape.SculptTexture.ToString()))) + { + m_log.Debug("[SCULPT]: found cached sculpt map - calling AssetReceived"); + part.SculptTextureCallback(part.Shape.SculptTexture, null); + } + else m_scene.AssetService.Get( part.Shape.SculptTexture.ToString(), part, AssetReceived); } @@ -2982,10 +2985,11 @@ namespace OpenSim.Region.Framework.Scenes protected void AssetReceived(string id, Object sender, AssetBase asset) { - if (asset != null) + SceneObjectPart sop = (SceneObjectPart)sender; + + if (sop != null) { - SceneObjectPart sop = (SceneObjectPart)sender; - if (sop != null) + if (asset != null) sop.SculptTextureCallback(asset.FullID, asset); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 093dd73adc..71d4d33971 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2269,9 +2269,9 @@ if (m_shape != null) { if (m_shape.SculptEntry) { // commented out for sculpt map caching test - null could mean a cached sculpt map has been found - if (texture != null) + //if (texture != null) { - //if (texture != null) + if (texture != null) m_shape.SculptData = texture.Data; if (PhysActor != null) diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 6832507771..f3e79c94cd 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.Physics.Meshing private const string baseDir = null; //"rawFiles"; #endif - private bool cacheSculptMaps = false; + private bool cacheSculptMaps = true; private string decodedScultMapPath = "j2kDecodeCache"; private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh @@ -184,8 +184,8 @@ namespace OpenSim.Region.Physics.Meshing if (primShape.SculptEntry) { - if (primShape.SculptData.Length == 0) - return null; + //if (primShape.SculptData.Length == 0) + // return null; if (cacheSculptMaps && primShape.SculptTexture != null) { @@ -196,6 +196,8 @@ namespace OpenSim.Region.Physics.Meshing { idata = Image.FromFile(decodedSculptFileName); } + else if (primShape.SculptData.Length == 0) + return null; } catch (Exception e) {