Skip to content

Commit

Permalink
Merge pull request #804 from elrond79/pr/image_extension_case_insensi…
Browse files Browse the repository at this point in the history
…tive

[imaging] make image extension case-insensitive

(Internal change: 2034668)
  • Loading branch information
pixar-oss committed Jan 29, 2020
2 parents 6e5db1e + 131e93d commit 9b616ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 15 additions & 9 deletions pxr/imaging/glf/imageRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ GlfImageRegistry::_ConstructImage(std::string const & filename)
static GlfImageSharedPtr NULL_IMAGE;

// Lookup the plug-in type name based on the filename.
TfToken fileExtension(ArGetResolver().GetExtension(filename));
TfToken fileExtension(
TfStringToLower(ArGetResolver().GetExtension(filename)));

TfType const & pluginType = _typeMap->Find(fileExtension);

if (!pluginType) {
// Unknown prim type.
TF_DEBUG(GLF_DEBUG_TEXTURE_IMAGE_PLUGINS).Msg(
"[PluginLoad] Unknown image type '%s'\n",
fileExtension.GetText());
"[PluginLoad] Unknown image type '%s' for file '%s'\n",
fileExtension.GetText(),
filename.c_str());
return NULL_IMAGE;
}

Expand All @@ -92,26 +94,30 @@ GlfImageRegistry::_ConstructImage(std::string const & filename)
GlfImageFactoryBase* factory = pluginType.GetFactory<GlfImageFactoryBase>();
if (!factory) {
TF_CODING_ERROR("[PluginLoad] Cannot manufacture type '%s' "
"for image type '%s'\n",
"for image type '%s' for file '%s'\n",
pluginType.GetTypeName().c_str(),
fileExtension.GetText());
fileExtension.GetText(),
filename.c_str());

return NULL_IMAGE;
}

GlfImageSharedPtr instance = factory->New();
if (!instance) {
TF_CODING_ERROR("[PluginLoad] Cannot construct instance of type '%s' "
"for image type '%s'\n",
"for image type '%s' for file '%s'\n",
pluginType.GetTypeName().c_str(),
fileExtension.GetText());
fileExtension.GetText(),
filename.c_str());
return NULL_IMAGE;
}

TF_DEBUG(GLF_DEBUG_TEXTURE_IMAGE_PLUGINS).Msg(
"[PluginLoad] Loaded plugin '%s' for image type '%s'\n",
"[PluginLoad] Loaded plugin '%s' for image type '%s' for "
"file '%s'\n",
pluginType.GetTypeName().c_str(),
fileExtension.GetText());
fileExtension.GetText(),
filename.c_str());

return instance;
}
Expand Down
2 changes: 1 addition & 1 deletion pxr/usd/usdUtils/complianceChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def __init__(self, verbose):

def _CheckTexture(self, texAssetPath):
self._Msg("Checking texture <%s>." % texAssetPath)
texFileExt = Ar.GetResolver().GetExtension(texAssetPath)
texFileExt = Ar.GetResolver().GetExtension(texAssetPath).lower()
if texFileExt in \
TextureChecker._unsupportedImageFormats:
self._AddFailedCheck("Found texture file '%s' with unsupported "
Expand Down

0 comments on commit 9b616ed

Please sign in to comment.