Skip to content

Commit

Permalink
PopcornFX Gem 2.15.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ValPKFX committed Jul 12, 2023
1 parent 70a79ae commit 2d26496
Show file tree
Hide file tree
Showing 28 changed files with 319 additions and 385 deletions.
8 changes: 4 additions & 4 deletions Code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://www.popcornfx.com/terms-and-conditions/
#----------------------------------------------------------------------------

set(POPCORNFX_VERSION 2.15.10)
set(POPCORNFX_VERSION 2.15.11)
set(POPCORNFX_LICENSE O3DE)

if (PK_O3DE_MAJOR_VERSION GREATER_EQUAL 2205)
Expand Down Expand Up @@ -107,6 +107,8 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS)
AUTORCC
FILES_CMAKE
popcornfx_editor_files.cmake
popcornfx_previewer_files.cmake
popcornfx_files.cmake
COMPILE_DEFINITIONS
PRIVATE
QT_NO_KEYWORDS
Expand All @@ -132,12 +134,10 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS)
ly_add_target(
NAME PopcornFX.Builders GEM_MODULE
NAMESPACE Gem
AUTOUIC
AUTOMOC
AUTORCC
FILES_CMAKE
popcornfx_builder_files.cmake
popcornfx_editor_files.cmake # Note: pipeline tools need access to editor components in order to process .prefabs
popcornfx_files.cmake
COMPILE_DEFINITIONS
PRIVATE
QT_NO_KEYWORDS
Expand Down
4 changes: 2 additions & 2 deletions Code/Platform/Linux/PAL_linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}-linux)
set(pk_package_hash 195cb537bdf4147538af99fabcf13341f74f131762186516181c81b8a3f20e8a)
set(pk_package_id anpBXLEaRkRPUNLg)
set(pk_package_hash 666d30bba7f388c9b8fc3bcefa8fe6ecf88a09f6cf339dfe9f8d30c2ad5fda35)
set(pk_package_id 9j6nNhHhrGhVnMQ9)

ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash})
pk_download_package_ifn(${package_name} ${pk_package_id})
Expand Down
4 changes: 2 additions & 2 deletions Code/Platform/Mac/PAL_mac.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 a2a37e432615ff52c44be3872a99b91436e058de7a03ce6635b11d19c7c829ba)
set(pk_package_id Zk6TtUCj3yvdrZ2M)
set(pk_package_hash 349c7353edafd11a57dda8a618e6b46af6c7e6c5523b2095b010f937dd3dcabc)
set(pk_package_id NbWmnKRsCrBPC2wT)

ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash})
pk_download_package_ifn(${package_name} ${pk_package_id})
Expand Down
4 changes: 2 additions & 2 deletions Code/Platform/Windows/PAL_windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 19c81d872eda9e95b5edcfd0639fef29e8ec8f99af0d977b8135efbe35c888ce)
set(pk_package_id fJS7uvtcq7zAM4cn)
set(pk_package_hash a0724256da4f5b6579ee4a0f6fa530e5e66d3b5477349f882868a532ffb096f9)
set(pk_package_id naaNqU85MNZ3ewDg)

ly_associate_package(PACKAGE_NAME ${package_name} TARGETS PopcornFX PACKAGE_HASH ${pk_package_hash})
pk_download_package_ifn(${package_name} ${pk_package_id})
Expand Down
27 changes: 0 additions & 27 deletions Code/Source/Asset/PopcornFXAsset.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,6 @@ namespace PopcornFX {
AZStd::string m_Path;
};

class PopcornFXAssetPKMM
: public AZ::Data::AssetData
{
public:

AZ_RTTI(PopcornFXAssetPKMM, "{4AD0B88D-4138-4A42-986B-D021995B2250}", AZ::Data::AssetData);
AZ_CLASS_ALLOCATOR(PopcornFXAssetPKMM, AZ::SystemAllocator, 0);
};

class PopcornFXAssetPKAN
: public AZ::Data::AssetData
{
public:

AZ_RTTI(PopcornFXAssetPKAN, "{9AA19C85-B18C-4245-831D-E589582E4B9D}", AZ::Data::AssetData);
AZ_CLASS_ALLOCATOR(PopcornFXAssetPKAN, AZ::SystemAllocator, 0);
};

class PopcornFXAssetPKVF
: public AZ::Data::AssetData
{
Expand All @@ -69,13 +51,4 @@ namespace PopcornFX {
AZ_CLASS_ALLOCATOR(PopcornFXAssetPKVF, AZ::SystemAllocator, 0);
};

/*class PopcornFXAssetPKFM
: public AZ::Data::AssetData
{
public:
AZ_RTTI(PopcornFXAssetPKFM, "{}", AZ::Data::AssetData);
AZ_CLASS_ALLOCATOR(PopcornFXAssetPKFM, AZ::SystemAllocator, 0);
};*/

}
5 changes: 0 additions & 5 deletions Code/Source/Asset/PopcornFXAssetBuilderComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ void PopcornFXBuilderComponent::Activate()
builderDescriptor.m_patterns.emplace_back(AssetBuilderSDK::AssetBuilderPattern("*.pkfx", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
builderDescriptor.m_patterns.emplace_back(AssetBuilderSDK::AssetBuilderPattern("*.fga", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));

#if 0
builderDescriptor.m_patterns.emplace_back(AssetBuilderSDK::AssetBuilderPattern("*.ttf", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
builderDescriptor.m_patterns.emplace_back(AssetBuilderSDK::AssetBuilderPattern("*.otf", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
#endif

builderDescriptor.m_busId = azrtti_typeid<PopcornFXBuilderWorker>();
builderDescriptor.m_createJobFunction = AZStd::bind(&PopcornFXBuilderWorker::CreateJobs, &m_PKBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
builderDescriptor.m_processJobFunction = AZStd::bind(&PopcornFXBuilderWorker::ProcessJob, &m_PKBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
Expand Down
50 changes: 14 additions & 36 deletions Code/Source/Asset/PopcornFXAssetBuilderWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,20 @@ void PopcornFXBuilderWorker::CreateJobs(const AssetBuilderSDK::CreateJobsRequest
for (const AssetBuilderSDK::PlatformInfo &platformInfo : request.m_enabledPlatforms)
{
AssetBuilderSDK::JobDescriptor descriptor;
descriptor.m_jobKey = "PK_MainAsset";
descriptor.m_jobKey = "PopcornFX Effect";
descriptor.SetPlatformIdentifier(platformInfo.m_identifier.c_str());

response.m_createJobOutputs.push_back(descriptor);
}
response.m_result = AssetBuilderSDK::CreateJobsResultCode::Success;
return;
}
else if (AZ::StringFunc::Equal(ext.c_str(), "pkfbx") ||
//AZ::StringFunc::Equal(ext.c_str(), "ttf") ||
//AZ::StringFunc::Equal(ext.c_str(), "otf") ||
AZ::StringFunc::Equal(ext.c_str(), "fga"))
else if (AZ::StringFunc::Equal(ext.c_str(), "fga"))
{
for (const AssetBuilderSDK::PlatformInfo &platformInfo : request.m_enabledPlatforms)
{
AssetBuilderSDK::JobDescriptor descriptor;
descriptor.m_jobKey = "PK_Dependency";
descriptor.m_jobKey = "PopcornFX VectorField";
descriptor.SetPlatformIdentifier(platformInfo.m_identifier.c_str());
response.m_createJobOutputs.push_back(descriptor);
}
Expand All @@ -114,18 +111,14 @@ void PopcornFXBuilderWorker::ProcessJob(const AssetBuilderSDK::ProcessJobRequest

AZ::StringFunc::Path::GetExtension(request.m_sourceFile.c_str(), ext, false);

const bool isDepend = //AZ::StringFunc::Equal(ext.c_str(), "ttf") ||
//AZ::StringFunc::Equal(ext.c_str(), "otf") ||
AZ::StringFunc::Equal(ext.c_str(), "fga");

if (!AZ::StringFunc::Equal(ext.c_str(), "pkfx") &&
!isDepend)
!AZ::StringFunc::Equal(ext.c_str(), "fga"))
{
AZ_Warning("PopcornFX", false, "Wrong file type for job '%s', ignoring.", request.m_fullPath.c_str());
return;
}
if (!(AZ::StringFunc::Equal(request.m_jobDescription.m_jobKey.c_str(), "PK_MainAsset")
|| AZ::StringFunc::Equal(request.m_jobDescription.m_jobKey.c_str(), "PK_Dependency")))
if (!(AZ::StringFunc::Equal(request.m_jobDescription.m_jobKey.c_str(), "PopcornFX Effect")
|| AZ::StringFunc::Equal(request.m_jobDescription.m_jobKey.c_str(), "PopcornFX VectorField")))
{
AZ_Warning("PopcornFX", false, "Wrong job description for job '%s', ignoring.", request.m_fullPath.c_str());
return;
Expand All @@ -148,40 +141,25 @@ void PopcornFXBuilderWorker::ProcessJob(const AssetBuilderSDK::ProcessJobRequest
if (virtualPath.empty())
return;

// Source -> Baked extension fixup
// The asset baker processes some source files (.ttf, .fbx, .fga, ..) and procudes baked files for those (.pkfm, .pkmm, .pkvf, ..)
// We need to trick the asset processor by fixing m_outputProducts, otherwise it'll fail copying the processed file from temp folder to final cache folder.

AssetBuilderSDK::JobProduct jobProduct{ virtualPath };
if (isDepend)
if (AZ::StringFunc::Equal(ext.c_str(), "pkfx"))
{
jobProduct.m_productAssetType = AZ::AzTypeInfo<PopcornFXAsset>::Uuid();
jobProduct.m_dependenciesHandled = true;
}
else
{
AZ::IO::LocalFileIO fileIO;
AZStd::string buildPath = request.m_tempDirPath + "/" + AZStd::string(request.m_sourceFile);
AZStd::string buildPath = request.m_tempDirPath + "/" + virtualPath;

AZ::StringFunc::Path::ReplaceExtension(buildPath, "pkmm");
if (fileIO.Exists(buildPath.c_str()))
{
AZ::StringFunc::Path::ReplaceExtension(jobProduct.m_productFileName, "pkmm");
jobProduct.m_productAssetType = AZ::AzTypeInfo<PopcornFXAssetPKMM>::Uuid();
}
AZ::StringFunc::Path::ReplaceExtension(buildPath, "pkan");
if (fileIO.Exists(buildPath.c_str()))
{
AZ::StringFunc::Path::ReplaceExtension(jobProduct.m_productFileName, "pkan");
jobProduct.m_productAssetType = AZ::AzTypeInfo<PopcornFXAssetPKAN>::Uuid();
}
AZ::StringFunc::Path::ReplaceExtension(buildPath, "pkvf");
if (fileIO.Exists(buildPath.c_str()))
{
AZ::StringFunc::Path::ReplaceExtension(jobProduct.m_productFileName, "pkvf");
jobProduct.m_productAssetType = AZ::AzTypeInfo<PopcornFXAssetPKVF>::Uuid();
jobProduct.m_dependenciesHandled = true;
}
}
else
{
jobProduct.m_productAssetType = AZ::AzTypeInfo<PopcornFXAsset>::Uuid();
jobProduct.m_dependenciesHandled = true; // We've output the dependencies immediately above so it's OK to tell the AP we've handled dependencies
}
response.m_outputProducts.push_back(jobProduct);
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
}
Expand Down
Loading

0 comments on commit 2d26496

Please sign in to comment.