From 1609e7eac0562cb011c8d29fb17f6062226f5c3a Mon Sep 17 00:00:00 2001 From: Dahlia Trimble Date: Fri, 29 May 2009 05:11:50 +0000 Subject: [PATCH] disable sculpt map caching until a better method of avoiding asset requests can be found --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 ++++---- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 +++- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 13 ++++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index a60ae83f6f..37ab581e81 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2967,10 +2967,10 @@ 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()))) + // part.SculptTextureCallback(part.Shape.SculptTexture, null); + //else m_scene.AssetService.Get( part.Shape.SculptTexture.ToString(), part, AssetReceived); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e71ce00028..093dd73adc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2268,8 +2268,10 @@ 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) 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 21f922f100..6832507771 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -71,6 +71,7 @@ namespace OpenSim.Region.Physics.Meshing private const string baseDir = null; //"rawFiles"; #endif + private bool cacheSculptMaps = false; private string decodedScultMapPath = "j2kDecodeCache"; private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh @@ -186,7 +187,7 @@ namespace OpenSim.Region.Physics.Meshing if (primShape.SculptData.Length == 0) return null; - if (primShape.SculptTexture != null) + if (cacheSculptMaps && primShape.SculptTexture != null) { decodedSculptFileName = System.IO.Path.Combine(decodedScultMapPath, "smap_" + primShape.SculptTexture.ToString()); try @@ -199,7 +200,7 @@ namespace OpenSim.Region.Physics.Meshing catch (Exception e) { m_log.Error("[SCULPT]: unable to load cached sculpt map " + decodedSculptFileName + " " + e.Message); - + } if (idata != null) m_log.Debug("[SCULPT]: loaded cached map asset for map ID: " + primShape.SculptTexture.ToString()); @@ -212,9 +213,11 @@ namespace OpenSim.Region.Physics.Meshing ManagedImage managedImage; // we never use this OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata); - //if (File.Exists(System.IO.Path.GetDirectoryName(decodedScultMapPath))) - try { idata.Save(decodedSculptFileName, ImageFormat.MemoryBmp); } - catch (Exception e) { m_log.Error("[SCULPT]: unable to cache sculpt map " + decodedSculptFileName + " " + e.Message); } + if (cacheSculptMaps) + { + try { idata.Save(decodedSculptFileName, ImageFormat.MemoryBmp); } + catch (Exception e) { m_log.Error("[SCULPT]: unable to cache sculpt map " + decodedSculptFileName + " " + e.Message); } + } } catch (DllNotFoundException) {