Skip to content

Commit 60dc006

Browse files
committed
Additional debug logging when decoding fails for textures/images
1 parent 849a1b5 commit 60dc006

10 files changed

Lines changed: 1061 additions & 1033 deletions

File tree

WhiteCore/Framework/SceneInfo/UuidGatherer.cs

100755100644
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,9 @@ protected void GetWearableAssetUuids (UUID wearableAssetUuid, IDictionary<UUID,
282282
if (null != assetBase) {
283283
//MainConsole.Instance.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data));
284284
AssetWearable wearableAsset = new AssetBodypart (wearableAssetUuid, assetBase.Data);
285-
wearableAsset.Decode ();
285+
if (!wearableAsset.Decode ()) {
286+
MainConsole.Instance.DebugFormat("[Wearable]: Unable to decode wearable {0}", wearableAssetUuid.ToString());
287+
}
286288

287289
//MainConsole.Instance.DebugFormat(
288290
// "[Archiver]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count);

WhiteCore/Modules/Agent/J2KDecoder/J2KDecoderModule.cs

100755100644
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,16 @@ public bool Decode (UUID assetID, byte [] j2kData)
138138

139139
public Image DecodeToImage (byte [] j2kData)
140140
{
141-
if (m_useCSJ2K)
142-
return J2kImage.FromBytes (j2kData);
141+
Image image;
142+
if (m_useCSJ2K) {
143+
image = J2kImage.FromBytes(j2kData);
144+
return image;
145+
}
143146

144147
// decode using OpenJpeg
145148
ManagedImage mimage;
146-
Image image;
149+
147150
if (OpenJPEG.DecodeToImage (j2kData, out mimage, out image)) {
148-
mimage = null;
149151
return image;
150152
}
151153

WhiteCore/Modules/World/WorldMap/MapImageModule.cs

100755100644
Lines changed: 356 additions & 347 deletions
Large diffs are not rendered by default.

WhiteCore/Modules/World/WorldMap/TexturedMapTileRenderer.cs

100755100644
Lines changed: 113 additions & 112 deletions
Large diffs are not rendered by default.

WhiteCore/Modules/World/WorldMap/WarpTileRenderer.cs

Lines changed: 252 additions & 252 deletions
Large diffs are not rendered by default.

WhiteCore/Physics/Meshing/Meshmerizer.cs

100755100644
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,10 @@ Mesh GenerateFromPrimSculptData (string primName, PrimitiveBaseShape primShape,
549549
try {
550550
//idata = m_j2kDecoder.DecodeToImage (primShape.SculptData);
551551
ManagedImage mImage;
552-
OpenJPEG.DecodeToImage (primShape.SculptData, out mImage);
552+
if (!OpenJPEG.DecodeToImage(primShape.SculptData, out mImage)) {
553+
MainConsole.Instance.WarnFormat("[Sculpt]: OpenJPEG was not able to decode the scuplt data for {0}. Ignoring.", primName);
554+
return null;
555+
}
553556

554557
if (mImage == null) {
555558
// In some cases it seems that the decode can return a null bitmap without throwing an exception

WhiteCore/ScriptEngine/DotNetEngine/CompilerTools/Minimodule/InventoryItem.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ public UUID AssetID
7878
asset.Dispose ();
7979

8080
result.AssetData = assetData;
81-
result.Decode();
81+
if (!result.Decode()) {
82+
MainConsole.Instance.ErrorFormat("[MRM] Asset {0} was not able to be decoded", AssetID.ToString());
83+
}
8284
return result;
8385
}
8486

WhiteCore/Services/GenericServices/CapsService/CAPModules/Services/AssetCAPS.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,10 @@ byte [] ConvertTextureData (AssetBase texture, string format)
377377
try {
378378
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
379379
image = m_j2kDecoder.DecodeToImage (texture.Data);
380-
if (image == null)
381-
return data;
380+
if (image == null) {
381+
MainConsole.Instance.DebugFormat("[AssetCAPS]: Unable to decode texture {0}", texture.ID);
382+
return data;
383+
}
382384

383385
// Save to bitmap
384386
image = new Bitmap (image);

WhiteCore/Services/GenericServices/ExternalHandlers/AgentAppearance/AgentAppearanceService.cs

100755100644
Lines changed: 100 additions & 95 deletions
Large diffs are not rendered by default.

WhiteCore/Services/GenericServices/ExternalHandlers/Map/MapService.cs

100755100644
Lines changed: 220 additions & 218 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)