From 8fc970822e088a40f9ba179b9b6749462d924fc0 Mon Sep 17 00:00:00 2001 From: PopcornFX Bot Date: Fri, 13 Sep 2024 12:21:34 +0200 Subject: [PATCH] PopcornFX Gem 2.20.1 --- Code/CMakeLists.txt | 2 +- Code/Platform/Linux/PAL_linux.cmake | 8 +-- Code/Platform/Mac/PAL_mac.cmake | 4 +- Code/Platform/Windows/PAL_windows.cmake | 4 +- Code/Source/Integration/Editor/PackLoader.cpp | 70 +++++++++++++------ .../Preloader/PopcornFXRendererLoader.cpp | 1 + .../Previewer/PopcornFXEffectPreviewer.cpp | 12 ++-- README.md | 2 +- gem.json | 8 +-- 9 files changed, 72 insertions(+), 39 deletions(-) diff --git a/Code/CMakeLists.txt b/Code/CMakeLists.txt index 3eebade..adfa4ff 100644 --- a/Code/CMakeLists.txt +++ b/Code/CMakeLists.txt @@ -3,7 +3,7 @@ # https://www.popcornfx.com/terms-and-conditions/ #---------------------------------------------------------------------------- -set(POPCORNFX_VERSION 2.20.0) +set(POPCORNFX_VERSION 2.20.1) set(POPCORNFX_LICENSE O3DE) o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_name}") diff --git a/Code/Platform/Linux/PAL_linux.cmake b/Code/Platform/Linux/PAL_linux.cmake index 69a7410..68b3daf 100644 --- a/Code/Platform/Linux/PAL_linux.cmake +++ b/Code/Platform/Linux/PAL_linux.cmake @@ -6,12 +6,12 @@ set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages") if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-linux) - set(pk_package_hash ac6f32f010c4673e836195891eec2b6c7d0eda319028f83c47d3e2f183bc5bab) - set(pk_package_id ULXePOUoS6FLJFVq) + set(pk_package_hash 37caeb9bd6fa8b89820dfd3f27fb91207834b169c3ed6942f9fb9c0b65683838) + set(pk_package_id UsqgOwkkPIotbGLE) elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-linux-aarch64) - set(pk_package_hash ac6f32f010c4673e836195891eec2b6c7d0eda319028f83c47d3e2f183bc5bab_ARM64) - set(pk_package_id ULXePOUoS6FLJFVq_ARM64) + set(pk_package_hash 37caeb9bd6fa8b89820dfd3f27fb91207834b169c3ed6942f9fb9c0b65683838_ARM64) + set(pk_package_id UsqgOwkkPIotbGLE_ARM64) else() message(FATAL_ERROR "Unsupported linux architecture ${CMAKE_SYSTEM_PROCESSOR}") endif() diff --git a/Code/Platform/Mac/PAL_mac.cmake b/Code/Platform/Mac/PAL_mac.cmake index 7e964e3..9c0812e 100644 --- a/Code/Platform/Mac/PAL_mac.cmake +++ b/Code/Platform/Mac/PAL_mac.cmake @@ -5,8 +5,8 @@ set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages") set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-mac) -set(pk_package_hash e66f6aceb7a5e19d77a1138f9175c0be96f3689166a3e224ab8550e9380448d8) -set(pk_package_id 81pLLJxsVi4w3k7w) +set(pk_package_hash 269f82977c7bc3cf5c113627ecd8c26b2a1548f72e2b27734a84f531cafa082e) +set(pk_package_id or2If26Gt6FboQ5x) ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash}) pk_download_package_ifn(${package_name} ${pk_package_id}) diff --git a/Code/Platform/Windows/PAL_windows.cmake b/Code/Platform/Windows/PAL_windows.cmake index ed76618..35cd238 100644 --- a/Code/Platform/Windows/PAL_windows.cmake +++ b/Code/Platform/Windows/PAL_windows.cmake @@ -5,8 +5,8 @@ set(LY_PACKAGE_SERVER_URLS ${LY_PACKAGE_SERVER_URLS} "https://downloads.popcornfx.com/o3de-packages") set(package_name PopcornFX-${POPCORNFX_VERSION}-${POPCORNFX_LICENSE}-windows) -set(pk_package_hash ac6800c08e7f5809bbe49c779e91d91ae238471f6db293b99a45034fd49ef51d) -set(pk_package_id m70mDawO2bZQXsWK) +set(pk_package_hash 3a9c25da7fe7c58f7cbfb278c63e9806faba5f5cbbd8e25337235e4de1c3ddad) +set(pk_package_id bzoBrc2Rvgs8eSMs) ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash}) pk_download_package_ifn(${package_name} ${pk_package_id}) diff --git a/Code/Source/Integration/Editor/PackLoader.cpp b/Code/Source/Integration/Editor/PackLoader.cpp index 9e6ffbe..6f1c37a 100644 --- a/Code/Source/Integration/Editor/PackLoader.cpp +++ b/Code/Source/Integration/Editor/PackLoader.cpp @@ -77,23 +77,21 @@ namespace PopcornFX return false; } - AZStd::string FindMatchingPkproj(const AZStd::string &assetPath) + bool IsRelativeTo(const AZStd::string &path, const AZStd::string &base) { - AZ::IO::FixedMaxPath projectPath = AZ::Utils::GetProjectPath(); - - AZStd::string folderPath = assetPath; - AZ::StringFunc::Path::StripFullName(folderPath); - AZ::StringFunc::Path::Normalize(folderPath); + AZStd::string pathLower = path; + AZStd::string baseLower = base; - AZ::Outcome, AZStd::string> searchResult = AzFramework::FileFunc::FindFilesInPath(projectPath.c_str(), "*", true); + // Fix for linux + AZStd::to_lower(pathLower.begin(), pathLower.end()); + AZStd::to_lower(baseLower.begin(), baseLower.end()); - if (!searchResult.IsSuccess()) - return ""; - - const AZStd::list &pkprojList = searchResult.GetValue(); + return AZ::IO::PathView(pathLower).IsRelativeTo(AZ::IO::PathView(baseLower)); + } - AZStd::string pkProjPath; - for (const auto& path : pkprojList) + AZStd::string GetMatchingPkprojInList(const AZStd::string &assetFolderPath, const AZStd::list &fileList) + { + for (const auto& path : fileList) { if (path.ends_with(".pkproj")) { @@ -102,15 +100,48 @@ namespace PopcornFX if (!GetProjectSettings(path, rootPath, dummy)) return ""; - AZStd::to_lower(rootPath.begin(), rootPath.end()); - AZStd::to_lower(folderPath.begin(), folderPath.end()); - const AZ::IO::PathView pathView(folderPath); - if (pathView.IsRelativeTo(AZ::IO::PathView(rootPath))) + if (IsRelativeTo(assetFolderPath, rootPath)) return path; } } return ""; } + + AZStd::string FindMatchingPkproj(const AZStd::string &assetPath) + { + AZStd::string projectPath = AZ::Utils::GetProjectPath().c_str(); + AZ::StringFunc::Path::Normalize(projectPath); + + AZStd::string folderPath = assetPath; + AZ::StringFunc::Path::StripFullName(folderPath); + AZ::StringFunc::Path::Normalize(folderPath); + + if (!IsRelativeTo(folderPath, projectPath)) + return ""; + + // Search in parents folders first + AZStd::string currentPath = folderPath; + while (true) + { + AZ::Outcome, AZStd::string> searchResult = AzFramework::FileFunc::FindFilesInPath(currentPath, "*.pkproj", false); + if (searchResult.IsSuccess()) + { + AZStd::string pkprojPath = GetMatchingPkprojInList(folderPath, searchResult.GetValue()); + if (!pkprojPath.empty()) + return pkprojPath; + } + if (currentPath == projectPath) + break; + AZ::StringFunc::Path::StripFullName(currentPath); + } + + // Not found in the parents folders, search in the whole project as backup + AZ::Outcome, AZStd::string> searchResult = AzFramework::FileFunc::FindFilesInPath(projectPath, "*", true); + if (!searchResult.IsSuccess()) + return ""; + + return GetMatchingPkprojInList(folderPath, searchResult.GetValue()); + } bool GetProjectSettingsThumbnailsPath(const AZStd::string &projectFilePath, AZStd::string &outRootDir, AZStd::string &outThumbnailsPath) { @@ -260,10 +291,7 @@ namespace PopcornFX AZ::StringFunc::Path::Normalize(folderPath); folderPath = CFilePath::Relativize(projectPath.c_str(), folderPath.c_str()).Data(); - AZStd::to_lower(rootPath.begin(), rootPath.end()); - AZStd::to_lower(folderPath.begin(), folderPath.end()); - const AZ::IO::PathView pathView(folderPath); - if (pathView.IsRelativeTo(AZ::IO::PathView(rootPath))) + if (IsRelativeTo(folderPath, rootPath)) return false; } diff --git a/Code/Source/Integration/Preloader/PopcornFXRendererLoader.cpp b/Code/Source/Integration/Preloader/PopcornFXRendererLoader.cpp index 1d89e1e..61edc5d 100644 --- a/Code/Source/Integration/Preloader/PopcornFXRendererLoader.cpp +++ b/Code/Source/Integration/Preloader/PopcornFXRendererLoader.cpp @@ -256,6 +256,7 @@ void PopcornFXRendererLoader::_OnAssetReady(AZ::Data::Asset SAssetDependencies *dependencies = m_Assets.Find(asset.GetId()); if (dependencies == null) return; + dependencies->m_AssetRef = asset; if (asset.GetType() == azrtti_typeid()) { diff --git a/Code/Source/Previewer/PopcornFXEffectPreviewer.cpp b/Code/Source/Previewer/PopcornFXEffectPreviewer.cpp index 375e4c2..20b0260 100644 --- a/Code/Source/Previewer/PopcornFXEffectPreviewer.cpp +++ b/Code/Source/Previewer/PopcornFXEffectPreviewer.cpp @@ -80,10 +80,14 @@ void PopcornFXEffectPreviewer::Display(const AzToolsFramework::AssetBrowser::Ass void PopcornFXEffectPreviewer::DisplayProduct(const AzToolsFramework::AssetBrowser::ProductAssetBrowserEntry *product) { AZStd::string thumbnailPath; - AZStd::string pkProjPathCache; - PopcornFX::PopcornFXIntegrationBus::BroadcastResult(pkProjPathCache, &PopcornFX::PopcornFXIntegrationBus::Handler::GetPkProjPathCache); - PopcornFX::PopcornFXIntegrationBus::Broadcast(&PopcornFX::PopcornFXIntegrationBus::Handler::GetThumbnailPathForAsset, product->GetFullPath(), thumbnailPath, pkProjPathCache); - PopcornFX::PopcornFXIntegrationBus::Broadcast(&PopcornFX::PopcornFXIntegrationBus::Handler::SetPkProjPathCache, pkProjPathCache); + AzToolsFramework::AssetBrowser::AssetBrowserEntry *parent = product->GetParent(); + if (parent != nullptr) + { + AZStd::string pkProjPathCache; + PopcornFX::PopcornFXIntegrationBus::BroadcastResult(pkProjPathCache, &PopcornFX::PopcornFXIntegrationBus::Handler::GetPkProjPathCache); + PopcornFX::PopcornFXIntegrationBus::Broadcast(&PopcornFX::PopcornFXIntegrationBus::Handler::GetThumbnailPathForAsset, parent->GetFullPath(), thumbnailPath, pkProjPathCache); + PopcornFX::PopcornFXIntegrationBus::Broadcast(&PopcornFX::PopcornFXIntegrationBus::Handler::SetPkProjPathCache, pkProjPathCache); + } CreateAndDisplayTextureItemAsync( [thumbnailPath] diff --git a/README.md b/README.md index dd212b4..40b3163 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # O3DE PopcornFX Plugin Integrates the **PopcornFX Runtime SDK** into **O3DE** as a Gem. -* **Version:** `v2.20.0` +* **Version:** `v2.20.1` * **O3DE:** `23.05`, `23.10` * **Supported platforms:** `Windows`, `MacOS`, `Linux`, `iOS`, `Android` diff --git a/gem.json b/gem.json index 7a634a6..5c1e66b 100644 --- a/gem.json +++ b/gem.json @@ -1,13 +1,13 @@ { "gem_name": "PopcornFX", - "display_name": "PopcornFX 2.20.0", + "display_name": "PopcornFX 2.20.1", "license": "Community", "license_url": "https://www.popcornfx.com/popcornfx-community-license", "origin": "Persistant Studios - popcornfx.com", "repo_uri": "https://downloads.popcornfx.com/o3de-repo", - "origin_uri": "https://downloads.popcornfx.com/o3de-repo/PopcornFX-2.20/O3DE_PopcornFXGem_v2.20.0_Win64_Linux64_LinuxARM64_Mac64.zip", - "version": "2.20.0", - "last_updated": "2024-08-30", + "origin_uri": "https://downloads.popcornfx.com/o3de-repo/PopcornFX-2.20/O3DE_PopcornFXGem_v2.20.1_Win64_Linux64_LinuxARM64_Mac64.zip", + "version": "2.20.1", + "last_updated": "2024-09-13", "type": "Code", "summary": "The PopcornFX Gem provides real-time FX solution for particle effects.", "canonical_tags": [