Atom/qingtao/image builder fixes (#6432)
* LYN-8837 o3de Material Editor - Texture Settings Editor - Hangs when converting texture (#6359) Fixed a editor hanging issue when preview texture with astc format (starts multiple job threads inside a job thread) Fixed an issue of changing texture setting didn't trigger image re-process. Fixed an issue with image asset which has texture setting may have dependency with wrong preset Added a EIF_HDR for source image in hdr format. Fixed astc compression issue which may wrongly compress image to HDR astc format Signed-off-by: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com> (cherry picked from commitd9f0a3012d) * ATOM-16958 [Image Builder] Alpha data would be removed for source image with alpha content (#6412) Fixed a regression issue with image builder which it can choose proper preset for images with alpha content. Signed-off-by: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com> (cherry picked from commitb640f6d691)
This commit is contained in:
@@ -74,7 +74,7 @@ namespace ImageProcessingAtom
|
||||
builderDescriptor.m_busId = azrtti_typeid<ImageBuilderWorker>();
|
||||
builderDescriptor.m_createJobFunction = AZStd::bind(&ImageBuilderWorker::CreateJobs, &m_imageBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
|
||||
builderDescriptor.m_processJobFunction = AZStd::bind(&ImageBuilderWorker::ProcessJob, &m_imageBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
|
||||
builderDescriptor.m_version = 26; // [ATOM-15086]
|
||||
builderDescriptor.m_version = 27; // [ATOM-16958]
|
||||
builderDescriptor.m_analysisFingerprint = ImageProcessingAtom::BuilderSettingManager::Instance()->GetAnalysisFingerprint();
|
||||
m_imageBuilder.BusConnect(builderDescriptor.m_busId);
|
||||
AssetBuilderSDK::AssetBuilderBus::Broadcast(&AssetBuilderSDK::AssetBuilderBusTraits::RegisterBuilderInformation, builderDescriptor);
|
||||
@@ -221,18 +221,19 @@ namespace ImageProcessingAtom
|
||||
m_isShuttingDown = true;
|
||||
}
|
||||
|
||||
PresetName GetImagePreset(const AZStd::string& filepath)
|
||||
PresetName GetImagePreset(const AZStd::string& imageFileFullPath)
|
||||
{
|
||||
// first let preset from asset info
|
||||
TextureSettings textureSettings;
|
||||
StringOutcome output = TextureSettings::LoadTextureSetting(filepath, textureSettings);
|
||||
AZStd::string settingFilePath = imageFileFullPath + TextureSettings::ExtensionName;
|
||||
TextureSettings::LoadTextureSetting(settingFilePath, textureSettings);
|
||||
|
||||
if (!textureSettings.m_preset.IsEmpty())
|
||||
{
|
||||
return textureSettings.m_preset;
|
||||
}
|
||||
|
||||
return BuilderSettingManager::Instance()->GetSuggestedPreset(filepath);
|
||||
return BuilderSettingManager::Instance()->GetSuggestedPreset(imageFileFullPath);
|
||||
}
|
||||
|
||||
void HandlePresetDependency(PresetName presetName, AZStd::vector<AssetBuilderSDK::SourceFileDependency>& sourceDependencyList)
|
||||
@@ -283,6 +284,10 @@ namespace ImageProcessingAtom
|
||||
return;
|
||||
}
|
||||
|
||||
// Full path of the image file
|
||||
AZStd::string fullPath;
|
||||
AzFramework::StringFunc::Path::Join(request.m_watchFolder.data(), request.m_sourceFile.data(), fullPath, true, true);
|
||||
|
||||
// Get the extension of the file
|
||||
AZStd::string ext;
|
||||
AzFramework::StringFunc::Path::GetExtension(request.m_sourceFile.c_str(), ext, false);
|
||||
@@ -305,13 +310,12 @@ namespace ImageProcessingAtom
|
||||
// add source dependency for .assetinfo file
|
||||
AssetBuilderSDK::SourceFileDependency sourceFileDependency;
|
||||
sourceFileDependency.m_sourceDependencyType = AssetBuilderSDK::SourceFileDependency::SourceFileDependencyType::Absolute;
|
||||
sourceFileDependency.m_sourceFileDependencyPath = request.m_sourceFile;
|
||||
AZ::StringFunc::Path::ReplaceExtension(sourceFileDependency.m_sourceFileDependencyPath, TextureSettings::ExtensionName);
|
||||
sourceFileDependency.m_sourceFileDependencyPath = fullPath + TextureSettings::ExtensionName;
|
||||
response.m_sourceFileDependencyList.push_back(sourceFileDependency);
|
||||
|
||||
// add source dependencies for .preset files
|
||||
// Get the preset for this file
|
||||
auto presetName = GetImagePreset(request.m_sourceFile);
|
||||
// Get the preset for this file
|
||||
auto presetName = GetImagePreset(fullPath.c_str());
|
||||
HandlePresetDependency(presetName, response.m_sourceFileDependencyList);
|
||||
|
||||
response.m_result = AssetBuilderSDK::CreateJobsResultCode::Success;
|
||||
|
||||
Reference in New Issue
Block a user