From f4a83d9de3ab19107f5159bb73260ee09e9ba17b Mon Sep 17 00:00:00 2001 From: PopcornFX Bot Date: Thu, 26 Oct 2023 15:17:50 +0200 Subject: [PATCH] PopcornFX Plugin v2.15.15 --- Download_SDK_Desktop.bat | 2 +- Download_SDK_Mobile.bat | 2 +- PopcornFX.uplugin | 4 +- README.md | 4 +- Shaders/Private/PopcornFXVertexFactory.ush | 23 +- .../Private/Assets/PopcornFXEffect.cpp | 1 - .../Private/Assets/PopcornFXFile.cpp | 4 +- .../Assets/PopcornFXRendererMaterial.cpp | 6 +- .../Attributes/PopcornFXAttributeList.cpp | 19 +- .../PopcornFXAttributeSamplerSkinnedMesh.cpp | 20 +- .../PopcornFXDependencyModuleLevelEditor.cpp | 36 +-- .../PopcornFXDetailsAttributeList.cpp | 56 ++--- .../Private/Editor/EditorHelpers.cpp | 4 +- .../Private/Editor/PopcornFXEffectEditor.cpp | 4 +- .../PopcornFXCustomizationAssetDep.cpp | 20 +- ...PopcornFXCustomizationRendererMaterial.cpp | 4 +- ...cornFXCustomizationSubRendererMaterial.cpp | 8 +- .../Private/GPUSim/PopcornFXGPUSim_D3D12.cpp | 4 +- .../GPUSim/PopcornFXSortComputeShader.cpp | 14 +- .../Private/HUD/PopcornFXHUDProfiler.cpp | 228 ++++++++++++++---- .../Private/Internal/ParticleScene.cpp | 56 +++-- .../Private/Internal/ParticleScene.h | 12 +- .../Private/Platforms/PopcornFXPlatform.h | 4 +- .../Platforms/PopcornFXPlatformCommon.cpp | 4 +- Source/PopcornFX/Private/PopcornFXSDK.h | 3 + .../PopcornFX/Private/PopcornFXSettings.cpp | 4 + .../Private/PopcornFXSettingsEditor.cpp | 1 + .../Private/PopcornFXSettingsEditor.h | 4 + .../Render/BatchDrawer_Billboard_CPU.cpp | 4 +- .../Render/BatchDrawer_Billboard_GPU.cpp | 4 +- .../Private/Render/BatchDrawer_Light.cpp | 4 +- .../Private/Render/BatchDrawer_Ribbon_CPU.cpp | 14 +- .../Private/Render/BatchDrawer_Ribbon_CPU.h | 2 + .../Render/BatchDrawer_SkeletalMesh_CPU.cpp | 10 +- .../Render/BatchDrawer_Triangle_CPU.cpp | 4 +- .../Private/Render/PopcornFXVertexFactory.h | 2 + .../Private/World/PopcornFXEmitter.cpp | 2 +- .../World/PopcornFXEmitterComponent.cpp | 28 ++- .../World/PopcornFXWaitForSceneActor.cpp | 2 +- .../PopcornFX/Public/PopcornFXAttributeList.h | 11 +- .../Public/PopcornFXEmitterComponent.h | 1 + Source/PopcornFX/Public/PopcornFXSettings.h | 16 ++ .../Public/PopcornFXVersionGenerated.h | 4 +- .../Nodes/PopcornFXNode_DynamicField.cpp | 4 +- .../Private/PopcornFXEmitterFactory.cpp | 4 +- .../Private/PopcornFXFileFactory.cpp | 4 +- .../Private/PopcornFXFileReimportFactory.cpp | 4 +- 47 files changed, 451 insertions(+), 224 deletions(-) diff --git a/Download_SDK_Desktop.bat b/Download_SDK_Desktop.bat index fd01711..3859284 100644 --- a/Download_SDK_Desktop.bat +++ b/Download_SDK_Desktop.bat @@ -6,7 +6,7 @@ setlocal bitsadmin /reset bitsadmin /create third_party_download_desktop -bitsadmin /addfile third_party_download_desktop https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.15.14_Win64_Linux64_Mac64.7z "%~dp0\_PopcornFX_Runtime_SDK_Desktop.7z" +bitsadmin /addfile third_party_download_desktop https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.18.1_Win64_Linux64_Mac64.7z "%~dp0\_PopcornFX_Runtime_SDK_Desktop.7z" bitsadmin /setpriority third_party_download_desktop "FOREGROUND" bitsadmin /resume third_party_download_desktop diff --git a/Download_SDK_Mobile.bat b/Download_SDK_Mobile.bat index b843981..413964c 100644 --- a/Download_SDK_Mobile.bat +++ b/Download_SDK_Mobile.bat @@ -6,7 +6,7 @@ setlocal bitsadmin /reset bitsadmin /create third_party_download_mobile -bitsadmin /addfile third_party_download_mobile https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.15.14_iOS_Android.7z "%~dp0\_PopcornFX_Runtime_SDK_Mobile.7z" +bitsadmin /addfile third_party_download_mobile https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.18.1_iOS_Android.7z "%~dp0\_PopcornFX_Runtime_SDK_Mobile.7z" bitsadmin /setpriority third_party_download_mobile "FOREGROUND" bitsadmin /resume third_party_download_mobile diff --git a/PopcornFX.uplugin b/PopcornFX.uplugin index 3cf9ec4..35c37b5 100644 --- a/PopcornFX.uplugin +++ b/PopcornFX.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, - "Version": 21514, - "VersionName": "2.15.14", + "Version": 21801, + "VersionName": "2.18.1", "FriendlyName": "PopcornFX", "Description": "PopcornFX Realtime Particle Solution integration into Unreal Engine", "Category": "PopcornFX", diff --git a/README.md b/README.md index d4331be..a519317 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Unreal Engine PopcornFX Plugin Integrates the **PopcornFX Runtime SDK** into **Unreal Engine 4** and **Unreal Engine 5** as a Plugin. -* **Version:** `v2.15.14` -* **Unreal Engine:** `4.27`, `5.0`, `5.1`, `5.2` and `5.3` +* **Version:** `v2.18.1` +* **Unreal Engine:** `4.27`, `5.1`, `5.2` and `5.3` * **Supported platforms:** `Windows`, `MacOS`, `Linux`, `iOS`, `Android`, `PS4`, `PS5`, `XboxOne`, `Xbox Series`, `Switch` [Contact-us](http://www.popcornfx.com/contact-us/) to request access to the plugin for consoles. diff --git a/Shaders/Private/PopcornFXVertexFactory.ush b/Shaders/Private/PopcornFXVertexFactory.ush index 878fe9b..eeb1c1e 100644 --- a/Shaders/Private/PopcornFXVertexFactory.ush +++ b/Shaders/Private/PopcornFXVertexFactory.ush @@ -265,8 +265,10 @@ FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput In Intermediates.SceneData = VF_GPUSCENE_GET_INTERMEDIATES(Input); #endif // (ENGINE_MAJOR_VERSION == 5) - uint vertexID = Input.VertexId; - uint particleID = 0; + uint particleID = 0; + const int vertexID = Input.VertexId; + const int vpp = PopcornFXBillboardVSUniforms.VPP; // Note: if tube/multiplane with differing vertex count end up being batched, this won't work. + const int vppHalf = vpp / 2 - 1; switch (PopcornFXBillboardVSUniforms.RendererType) { case Renderer_Billboard: @@ -279,9 +281,20 @@ FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput In } case Renderer_Ribbon: { - // First two vertices within a quad: grab the current particle, last two: grab the next one - // Clamps to the total particle count to avoid overflowing the GPU sim buffers - particleID = min(vertexID / 4 + saturate((int)vertexID % 4 - 1), PopcornFXBillboardVSUniforms.TotalParticleCount - 1); + if (vertexID < PopcornFXBillboardVSUniforms.TubesPlanesOffset * 4) // No tube/multiplane batching yet with quad bb modes, but this might come. + { + // First two vertices within a quad: grab the current particle, last two: grab the next one + // Clamps to the total particle count to avoid overflowing the GPU sim buffers + particleID = min(vertexID / 4 + saturate(vertexID % 4 - 1), PopcornFXBillboardVSUniforms.TotalParticleCount - 1); + } + else + { + // First n (n being segmentCount/planeCount + 1) vertices: grab the current particle, last n: grab the next one + // Clamps to the total particle count to avoid overflowing the GPU sim buffers + particleID = min(PopcornFXBillboardVSUniforms.TubesPlanesOffset + (vertexID - (PopcornFXBillboardVSUniforms.TubesPlanesOffset * 4)) / vpp + + saturate(vertexID % vpp - vppHalf), + PopcornFXBillboardVSUniforms.TotalParticleCount - 1); + } break; } case Renderer_Triangle: diff --git a/Source/PopcornFX/Private/Assets/PopcornFXEffect.cpp b/Source/PopcornFX/Private/Assets/PopcornFXEffect.cpp index 5d1d3db..d5b3af6 100644 --- a/Source/PopcornFX/Private/Assets/PopcornFXEffect.cpp +++ b/Source/PopcornFX/Private/Assets/PopcornFXEffect.cpp @@ -808,7 +808,6 @@ bool UPopcornFXEffect::_BakeFile(const FString &srcFilePath, FString &outBakedFi return false; cookery.MapOven("pkfx", ovenIdParticle); cookery.m_DstPackPaths.PushBack(defaultTarget); - cookery.m_PreferredSimLocation = PopcornFX::SSimDispatchHint::Location_CPU; // Only compile gpu sim bytecodes for layers set to run on GPU cookery.AddOvenFlags(PopcornFX::COven::Flags_BakeMemoryVersion); if (!forEditor) diff --git a/Source/PopcornFX/Private/Assets/PopcornFXFile.cpp b/Source/PopcornFX/Private/Assets/PopcornFXFile.cpp index 04bfff4..b608621 100644 --- a/Source/PopcornFX/Private/Assets/PopcornFXFile.cpp +++ b/Source/PopcornFX/Private/Assets/PopcornFXFile.cpp @@ -17,11 +17,11 @@ #include "UObject/LinkerLoad.h" #if WITH_EDITOR # include "Factories/TextureFactory.h" -# if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +# if (ENGINE_MAJOR_VERSION == 5) # include "AssetRegistry/AssetRegistryModule.h" # else # include "AssetRegistryModule.h" -# endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +# endif // (ENGINE_MAJOR_VERSION == 5) # include "EditorReimportHandler.h" #endif // WITH_EDITOR diff --git a/Source/PopcornFX/Private/Assets/PopcornFXRendererMaterial.cpp b/Source/PopcornFX/Private/Assets/PopcornFXRendererMaterial.cpp index 2d64073..23364fe 100644 --- a/Source/PopcornFX/Private/Assets/PopcornFXRendererMaterial.cpp +++ b/Source/PopcornFX/Private/Assets/PopcornFXRendererMaterial.cpp @@ -15,7 +15,7 @@ #include "Engine/Texture2D.h" #include "Engine/StaticMesh.h" #include "Engine/SkeletalMesh.h" -#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # include "Engine/SkinnedAssetCommon.h" #endif #include "MaterialShared.h" @@ -90,7 +90,7 @@ namespace for (int32 i = 0; i < params.StaticSwitchParameters.Num(); ++i) { FStaticSwitchParameter ¶m = params.StaticSwitchParameters[i]; -#elif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 1) +#elif (ENGINE_MAJOR_VERSION == 5) for (int32 i = 0; i < params.EditorOnly.StaticSwitchParameters.Num(); ++i) { FStaticSwitchParameter ¶m = params.EditorOnly.StaticSwitchParameters[i]; @@ -98,7 +98,7 @@ namespace for (int32 i = 0; i < params.StaticSwitchParameters.Num(); ++i) { FStaticSwitchParameter ¶m = params.StaticSwitchParameters[i]; -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif if (param.ParameterInfo.Name == name) { diff --git a/Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp b/Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp index 9642083..c243a44 100644 --- a/Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp +++ b/Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp @@ -34,8 +34,8 @@ DEFINE_LOG_CATEGORY_STATIC(LogPopcornFXAttributeList, Log, All); #if WITH_EDITOR template float UPopcornFXAttributeList::GetAttributeDim(uint32, uint32); template int32 UPopcornFXAttributeList::GetAttributeDim(uint32, uint32); -template void UPopcornFXAttributeList::SetAttributeDim(uint32, uint32, float); -template void UPopcornFXAttributeList::SetAttributeDim(uint32, uint32, int32); +template void UPopcornFXAttributeList::SetAttributeDim(uint32, uint32, float, bool); +template void UPopcornFXAttributeList::SetAttributeDim(uint32, uint32, int32, bool); #endif // WITH_EDITOR //---------------------------------------------------------------------------- @@ -1141,11 +1141,12 @@ void UPopcornFXAttributeList::GetAttribute(uint32 attributeId, FPopcornFXAttribu //---------------------------------------------------------------------------- -void UPopcornFXAttributeList::SetAttribute(uint32 attributeId, const FPopcornFXAttributeValue &value) +void UPopcornFXAttributeList::SetAttribute(uint32 attributeId, const FPopcornFXAttributeValue &value, bool fromUI/* = false*/) { #if WITH_EDITOR if (!PK_VERIFY(attributeId < (u32)m_Attributes.Num())) return; + m_RestartEmitter |= fromUI && FPopcornFXPlugin::Get().SettingsEditor()->bRestartEmitterWhenAttributesChanged; #else check(attributeId < (u32)m_Attributes.Num()); #endif @@ -1221,7 +1222,7 @@ float UPopcornFXAttributeList::GetAttributeQuaternionDim(uint32 attributeId, uin //---------------------------------------------------------------------------- -void UPopcornFXAttributeList::SetAttributeQuaternionDim(uint32 attributeId, uint32 dim, float value) +void UPopcornFXAttributeList::SetAttributeQuaternionDim(uint32 attributeId, uint32 dim, float value, bool fromUI/* = false*/) { #if WITH_EDITOR if (!PK_VERIFY(attributeId < (u32)m_Attributes.Num())) @@ -1244,13 +1245,13 @@ void UPopcornFXAttributeList::SetAttributeQuaternionDim(uint32 attributeId, uint newValue.m_Data32f[2] = quaternion.Z; newValue.m_Data32f[3] = quaternion.W; - SetAttribute(attributeId, *reinterpret_cast(&newValue)); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day + SetAttribute(attributeId, *reinterpret_cast(&newValue), fromUI); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day } //---------------------------------------------------------------------------- template -void UPopcornFXAttributeList::SetAttributeDim(uint32 attributeId, uint32 dim, _Scalar value) +void UPopcornFXAttributeList::SetAttributeDim(uint32 attributeId, uint32 dim, _Scalar value, bool fromUI/* = false*/) { #if WITH_EDITOR if (!PK_VERIFY(attributeId < (u32)m_Attributes.Num())) @@ -1262,13 +1263,13 @@ void UPopcornFXAttributeList::SetAttributeDim(uint32 attributeId, uint32 dim, _S PopcornFX::SAttributesContainer_SAttrib newValue = AttributeRawDataAttributes(this)[attributeId]; newValue.Get<_Scalar>()[dim] = value; - SetAttribute(attributeId, *reinterpret_cast(&newValue)); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day + SetAttribute(attributeId, *reinterpret_cast(&newValue), fromUI); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day } //---------------------------------------------------------------------------- template <> -void UPopcornFXAttributeList::SetAttributeDim(uint32 attributeId, uint32 dim, bool value) +void UPopcornFXAttributeList::SetAttributeDim(uint32 attributeId, uint32 dim, bool value, bool fromUI/* = false*/) { #if WITH_EDITOR if (!PK_VERIFY(attributeId < (u32)m_Attributes.Num())) @@ -1280,7 +1281,7 @@ void UPopcornFXAttributeList::SetAttributeDim(uint32 attributeId, uint32 d PopcornFX::SAttributesContainer_SAttrib newValue = AttributeRawDataAttributes(this)[attributeId]; reinterpret_cast(newValue.Get())[dim] = value; - SetAttribute(attributeId, *reinterpret_cast(&newValue)); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day + SetAttribute(attributeId, *reinterpret_cast(&newValue), fromUI); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day } #endif // WITH_EDITOR diff --git a/Source/PopcornFX/Private/Attributes/PopcornFXAttributeSamplerSkinnedMesh.cpp b/Source/PopcornFX/Private/Attributes/PopcornFXAttributeSamplerSkinnedMesh.cpp index 515de11..09728f2 100644 --- a/Source/PopcornFX/Private/Attributes/PopcornFXAttributeSamplerSkinnedMesh.cpp +++ b/Source/PopcornFX/Private/Attributes/PopcornFXAttributeSamplerSkinnedMesh.cpp @@ -625,11 +625,11 @@ namespace { const TArray &GetMasterBoneMap(const USkinnedMeshComponent *skinnedMesh) { -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) return skinnedMesh->GetLeaderBoneMap(); #else return skinnedMesh->GetMasterBoneMap(); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) } const TArray &GetSections(const FSkeletalMeshLODRenderData *lodRenderData) @@ -672,11 +672,11 @@ namespace m_SkinnedMeshComponent = skinnedMesh; if (m_SkinnedMeshComponent == null) return false; -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) m_SkeletalMesh = Cast(m_SkinnedMeshComponent->GetSkinnedAsset()); #else m_SkeletalMesh = m_SkinnedMeshComponent->SkeletalMesh; -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) if (m_SkeletalMesh == null) return false; @@ -743,19 +743,19 @@ namespace } } -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) const USkinnedMeshComponent *masterPoseComponent = buildDesc.m_SkinnedMeshComponent->LeaderPoseComponent.Get(); #else const USkinnedMeshComponent *masterPoseComponent = buildDesc.m_SkinnedMeshComponent->MasterPoseComponent.Get(); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) const bool hasMasterPoseComponent = masterPoseComponent != null; if (hasMasterPoseComponent) { -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) PK_ASSERT(GetMasterBoneMap(buildDesc.m_SkinnedMeshComponent).Num() == SkeletalMeshRefSkeleton(Cast(buildDesc.m_SkinnedMeshComponent->GetSkinnedAsset())).GetNum()); #else PK_ASSERT(GetMasterBoneMap(buildDesc.m_SkinnedMeshComponent).Num() == SkeletalMeshRefSkeleton(buildDesc.m_SkinnedMeshComponent->SkeletalMesh).GetNum()); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) } PK_ONLY_IF_ASSERTS(u32 totalVertices = 0); @@ -899,11 +899,11 @@ bool UPopcornFXAttributeSamplerSkinnedMesh::BuildInitialPose() if (buildDesc.m_LODRenderData->SkinWeightVertexBuffer.GetBoneInfluenceType() == UnlimitedBoneInfluence) { -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) UE_LOG(LogPopcornFXAttributeSamplerSkinned, Warning, TEXT("Cannot build mesh '%s' for sampling: Unlimited bone influences not supported for sampling"), *buildDesc.m_SkinnedMeshComponent->GetSkinnedAsset()->GetName()); #else UE_LOG(LogPopcornFXAttributeSamplerSkinned, Warning, TEXT("Cannot build mesh '%s' for sampling: Unlimited bone influences not supported for sampling"), *buildDesc.m_SkinnedMeshComponent->SkeletalMesh->GetName()); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) return false; } diff --git a/Source/PopcornFX/Private/DependencyModules/PopcornFXDependencyModuleLevelEditor.cpp b/Source/PopcornFX/Private/DependencyModules/PopcornFXDependencyModuleLevelEditor.cpp index fd55b40..7c92961 100644 --- a/Source/PopcornFX/Private/DependencyModules/PopcornFXDependencyModuleLevelEditor.cpp +++ b/Source/PopcornFX/Private/DependencyModules/PopcornFXDependencyModuleLevelEditor.cpp @@ -110,31 +110,31 @@ void FPopcornFXDependencyModuleLevelEditor::FillPopcornFXMenu(FMenuBuilder &menu menuBuilder.AddMenuEntry( LOCTEXT("DocumentationTitle", "Documentation"), LOCTEXT("DocumentationTooltip", "Opens the PopcornFX Wiki"), -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.BrowseDocumentation"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.BrowseDocumentation"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::OpenDocumentationURL, *FPopcornFXPlugin::DocumentationURL()))); menuBuilder.AddMenuEntry( LOCTEXT("WikiTitle", "Plugin Wiki"), LOCTEXT("WikiTooltip", "Opens the PopcornFX UE plugin wiki"), -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.BrowseDocumentation"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.BrowseDocumentation"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::OpenDocumentationURL, *FPopcornFXPlugin::PluginWikiURL()))); menuBuilder.AddMenuEntry( LOCTEXT("DiscordTitle", "Discord"), LOCTEXT("DiscordTooltip", "Join PopcornFX Discord server"), -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.BrowseDocumentation"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.BrowseDocumentation"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::OpenDocumentationURL, *FPopcornFXPlugin::DiscordURL()))); } menuBuilder.EndSection(); @@ -151,11 +151,11 @@ void FPopcornFXDependencyModuleLevelEditor::FillPopcornFXMenu(FMenuBuilder &menu menuBuilder.AddMenuEntry( LOCTEXT("OpenSourcePackTitle", "Open PopcornFX Editor Project"), tooltip, -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "PopcornFXLevelEditor.OpenSourcePack"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "PopcornFXLevelEditor.OpenSourcePack"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::OpenSourcePack), FCanExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::CanOpenSourcePack))); } @@ -166,51 +166,51 @@ void FPopcornFXDependencyModuleLevelEditor::FillPopcornFXMenu(FMenuBuilder &menu menuBuilder.AddMenuEntry( LOCTEXT("RuntimeSettingsTitle", "Runtime settings"), LOCTEXT("RuntimeSettingsTooltip", "Opens the project runtime settings"), -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "ProjectSettings.TabIcon"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "ProjectSettings.TabIcon"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::OpenSettings, TEXT("PopcornFXSettings")))); menuBuilder.AddMenuEntry( LOCTEXT("EditorSettingsTitle", "Editor settings"), LOCTEXT("EditorSettingsTooltip", "Opens the project editor settings"), -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "ProjectSettings.TabIcon"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "ProjectSettings.TabIcon"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::OpenSettings, TEXT("PopcornFXSettingsEditor")))); menuBuilder.AddMenuEntry( LOCTEXT("CmdStatPopcornFXTitle", "Cmd stat PopcornFX"), LOCTEXT("CmdStatPopcornFXTooltip", "Runs command \"stat PopcornFX\": Toggles PopcornFX Stats display."), -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "Log.TabIcon"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "Log.TabIcon"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::RunCommand, TEXT("stat PopcornFX")))); menuBuilder.AddMenuEntry( LOCTEXT("CmdPopcornFXProfilerHUDTitle", "Cmd ToggleProfilerHUD"), LOCTEXT("CmdPopcornFXProfilerHUDTooltip", "Runs command \"PopcornFX.ToggleProfilerHUD\": Toggles PopcornFX Profiler HUD."), -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "Log.TabIcon"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "Log.TabIcon"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::RunCommand, TEXT("PopcornFX.ToggleProfilerHUD")))); menuBuilder.AddMenuEntry( LOCTEXT("CmdPopcornFXDebugHUDTitle", "Cmd ToggleMemoryHUD"), LOCTEXT("CmdPopcornFXDebugHUDTooltip", "Runs command \"PopcornFX.ToggleMemoryHUD\": Toggles PopcornFX Memory HUD."), -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateIcon(FAppStyle::GetAppStyleSetName(), "Log.TabIcon"), #else FSlateIcon(FEditorStyle::GetStyleSetName(), "Log.TabIcon"), -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) FUIAction(FExecuteAction::CreateRaw(this, &FPopcornFXDependencyModuleLevelEditor::RunCommand, TEXT("PopcornFX.ToggleMemoryHUD")))); } diff --git a/Source/PopcornFX/Private/Editor/CustomizeDetails/PopcornFXDetailsAttributeList.cpp b/Source/PopcornFX/Private/Editor/CustomizeDetails/PopcornFXDetailsAttributeList.cpp index 9588789..84fe137 100644 --- a/Source/PopcornFX/Private/Editor/CustomizeDetails/PopcornFXDetailsAttributeList.cpp +++ b/Source/PopcornFX/Private/Editor/CustomizeDetails/PopcornFXDetailsAttributeList.cpp @@ -392,11 +392,11 @@ namespace TSharedPtr inlineSplitter; SAssignNew(inlineSplitter, SSplitter) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Style(FAppStyle::Get(), "DetailsView.Splitter") #else .Style(FEditorStyle::Get(), "DetailsView.Splitter") -#endif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .PhysicalSplitterHandleSize(1.0f) .HitDetectionSplitterHandleSize(5.0f) + SSplitter::Slot() @@ -439,11 +439,11 @@ namespace .Padding(0.0f, 2.0f) [ SNew(SSplitter) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Style(FAppStyle::Get(), "DetailsView.Splitter") #else .Style(FEditorStyle::Get(), "DetailsView.Splitter") -#endif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .PhysicalSplitterHandleSize(1.0f) .HitDetectionSplitterHandleSize(5.0f) + SSplitter::Slot() @@ -679,7 +679,7 @@ namespace if (m_Traits->VectorDimension > 3) attribValue.m_Data32f[3] = newColor.A; decl->ClampToRangeIFN(attribValue); - attrList->SetAttribute(m_Index, *reinterpret_cast(&attribValue)); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day + attrList->SetAttribute(m_Index, *reinterpret_cast(&attribValue), true); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day } attrList->PostEditChange(); } @@ -879,19 +879,19 @@ namespace .OnClicked(this, &TSelf::OnDimResetClicked, dimi) .Visibility(this, &TSelf::GetDimResetVisibility, dimi) .ToolTipText(LOCTEXT("ResetToDefaultToolTip", "Reset to Default")) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .ButtonStyle(FAppStyle::Get(), "NoBorder") #else .ButtonStyle(FEditorStyle::Get(), "NoBorder") -#endif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .Content() [ SNew(SImage) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Image(FAppStyle::GetBrush("PropertyWindow.DiffersFromDefault")) #else .Image(FEditorStyle::GetBrush("PropertyWindow.DiffersFromDefault")) -#endif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) ]; } @@ -901,19 +901,19 @@ namespace .OnClicked(this, &TSelf::OnResetClicked) .Visibility(this, &TSelf::GetResetVisibility) .ToolTipText(LOCTEXT("ResetToDefaultToolTip", "Reset to Default")) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .ButtonStyle(FAppStyle::Get(), "NoBorder") #else .ButtonStyle(FEditorStyle::Get(), "NoBorder") -#endif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .Content() [ SNew(SImage) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Image(FAppStyle::GetBrush("PropertyWindow.DiffersFromDefault")) #else .Image(FEditorStyle::GetBrush("PropertyWindow.DiffersFromDefault")) -#endif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) ]; } @@ -961,7 +961,7 @@ namespace const FScopedTransaction Transaction(LOCTEXT("AttributeCommit", "Attribute Value Commit")); attrList->Modify(); - attrList->SetAttributeDim(m_Index, dimi, value == ECheckBoxState::Checked); + attrList->SetAttributeDim(m_Index, dimi, value == ECheckBoxState::Checked, true); attrList->PostEditChange(); } @@ -986,7 +986,7 @@ namespace const FScopedTransaction Transaction(LOCTEXT("AttributeCommit", "Attribute Value Commit")); attrList->Modify(); - attrList->SetAttributeDim(m_Index, 0, *selectedItem); + attrList->SetAttributeDim(m_Index, 0, *selectedItem, true); attrList->PostEditChange(); } @@ -1002,9 +1002,9 @@ namespace //attrList->Modify(); if (!m_IsQuaternion) - attrList->SetAttributeDim<_Scalar>(m_Index, dimi, value); + attrList->SetAttributeDim<_Scalar>(m_Index, dimi, value, true); else - attrList->SetAttributeQuaternionDim(m_Index, dimi, value); + attrList->SetAttributeQuaternionDim(m_Index, dimi, value, true); } template @@ -1025,9 +1025,9 @@ namespace attrList->Modify(); if (!m_IsQuaternion) - attrList->SetAttributeDim<_Scalar>(m_Index, dimi, value); + attrList->SetAttributeDim<_Scalar>(m_Index, dimi, value, true); else - attrList->SetAttributeQuaternionDim(m_Index, dimi, value); + attrList->SetAttributeQuaternionDim(m_Index, dimi, value, true); attrList->PostEditChange(); } @@ -1044,7 +1044,7 @@ namespace const FScopedTransaction Transaction(LOCTEXT("AttributeReset", "Attribute Reset")); attrList->SetFlags(RF_Transactional); attrList->Modify(); - attrList->SetAttribute(m_Index, *reinterpret_cast(&m_Def)); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day + attrList->SetAttribute(m_Index, *reinterpret_cast(&m_Def), true); // Ugly cast, so PopcornFXAttributeList.h is a public header to satisfy UE4 nativization bugs. To refactor some day attrList->PostEditChange(); return FReply::Handled(); } @@ -1065,12 +1065,12 @@ namespace if (m_Traits->ScalarType == PopcornFX::BaseType_Bool) { const bool defaultValue = reinterpret_cast(m_Def.Get())[dimi]; - attrList->SetAttributeDim(m_Index, dimi, defaultValue); + attrList->SetAttributeDim(m_Index, dimi, defaultValue, true); } else { const s32 defaultValue = m_Def.Get()[dimi]; - attrList->SetAttributeDim(m_Index, dimi, defaultValue); + attrList->SetAttributeDim(m_Index, dimi, defaultValue, true); } attrList->PostEditChange(); return FReply::Handled(); @@ -1272,11 +1272,11 @@ namespace TSharedPtr inlineSplitter; SAssignNew(inlineSplitter, SSplitter) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Style(FAppStyle::Get(), "DetailsView.Splitter") #else .Style(FEditorStyle::Get(), "DetailsView.Splitter") -#endif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .PhysicalSplitterHandleSize(1.0f) .HitDetectionSplitterHandleSize(5.0f) + SSplitter::Slot() @@ -1353,11 +1353,11 @@ namespace .FillHeight(1.0f) [ SNew(SSplitter) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Style(FAppStyle::Get(), "DetailsView.Splitter") #else .Style(FEditorStyle::Get(), "DetailsView.Splitter") -#endif (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .PhysicalSplitterHandleSize(1.0f) .HitDetectionSplitterHandleSize(5.0f) + SSplitter::Slot() @@ -1624,11 +1624,11 @@ namespace [ SNew(STextBlock) .Text(m_CategoryName) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Font(FAppStyle::GetFontStyle("PropertyWindow.NormalFont")) #else .Font(FEditorStyle::GetFontStyle("PropertyWindow.NormalFont")) -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) ] ] ] diff --git a/Source/PopcornFX/Private/Editor/EditorHelpers.cpp b/Source/PopcornFX/Private/Editor/EditorHelpers.cpp index 7ff4ff7..23f61c2 100644 --- a/Source/PopcornFX/Private/Editor/EditorHelpers.cpp +++ b/Source/PopcornFX/Private/Editor/EditorHelpers.cpp @@ -11,11 +11,11 @@ #include "AssetToolsModule.h" #include "UObject/NameTypes.h" #include "FileHelpers.h" -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # include "AssetRegistry/AssetRegistryModule.h" #else # include "AssetRegistryModule.h" -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) #include "IAssetTools.h" #include "Factories/Factory.h" #include "Editor.h" diff --git a/Source/PopcornFX/Private/Editor/PopcornFXEffectEditor.cpp b/Source/PopcornFX/Private/Editor/PopcornFXEffectEditor.cpp index 7b8e96d..334959f 100644 --- a/Source/PopcornFX/Private/Editor/PopcornFXEffectEditor.cpp +++ b/Source/PopcornFX/Private/Editor/PopcornFXEffectEditor.cpp @@ -191,11 +191,11 @@ void FPopcornFXEffectEditor::FillEffectToolbar(FToolBarBuilder &toolbarBuilder) .ToolTipText(LOCTEXT("DelayTooltip", "Time before the emitter restarts")) .MinValue(0.0f) .MaxValue(20.0f) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Font(FAppStyle::GetFontStyle(TEXT("MenuItem.Font"))) #else .Font(FEditorStyle::GetFontStyle(TEXT("MenuItem.Font"))) -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .Value(PreviewViewport.Get(), &SPopcornFXEffectPreviewViewport::OnGetLoopDelayValue) .OnValueChanged(PreviewViewport.Get(), &SPopcornFXEffectPreviewViewport::OnLoopDelayValueChanged) ] diff --git a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationAssetDep.cpp b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationAssetDep.cpp index 7895ab0..d623145 100644 --- a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationAssetDep.cpp +++ b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationAssetDep.cpp @@ -15,11 +15,11 @@ #include "DetailWidgetRow.h" #include "PropertyCustomizationHelpers.h" #include "AssetThumbnail.h" -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # include "AssetRegistry/AssetData.h" #else # include "AssetData.h" -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) #include "Widgets/SBoxPanel.h" #include "Widgets/Input/SEditableTextBox.h" #include "Widgets/Layout/SSpacer.h" @@ -75,11 +75,11 @@ void FPopcornFXCustomizationAssetDep::CustomizeHeader( // Source\Editor\PropertyEditor\Private\UserInterface\PropertyEditor\PropertyEditorConstants.cpp static const FName PropertyFontStyle( TEXT("PropertyWindow.NormalFont") ); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateFontInfo FontStyle = FAppStyle::GetFontStyle(PropertyFontStyle); #else FSlateFontInfo FontStyle = FEditorStyle::GetFontStyle(PropertyFontStyle); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) HeaderRow.NameContent() .MinDesiredWidth(125.f * 3.f) @@ -117,19 +117,19 @@ void FPopcornFXCustomizationAssetDep::CustomizeHeader( .OnClicked(this, &FPopcornFXCustomizationAssetDep::OnResetClicked) .Visibility(this, &FPopcornFXCustomizationAssetDep::GetResetVisibility) .ToolTipText(LOCTEXT("ResetToDefaultToolTip", "Reset to Default")) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .ButtonStyle(FAppStyle::Get(), "NoBorder") #else .ButtonStyle(FEditorStyle::Get(), "NoBorder") -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .Content() [ SNew(SImage) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Image(FAppStyle::GetBrush("PropertyWindow.DiffersFromDefault")) #else .Image(FEditorStyle::GetBrush("PropertyWindow.DiffersFromDefault")) -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) ] ] ] @@ -184,11 +184,11 @@ bool FPopcornFXCustomizationAssetDep::OnFilterAssetPicker(const FAssetData& InAs UClass *assetClass = InAssetData.GetClass(); // return filterOut; return !self->IsCompatibleClass(assetClass) || -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) !InAssetData.GetSoftObjectPath().ToString().StartsWith(FPopcornFXPlugin::Get().Settings()->PackMountPoint); #else !InAssetData.ObjectPath.ToString().StartsWith(FPopcornFXPlugin::Get().Settings()->PackMountPoint); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) } FReply FPopcornFXCustomizationAssetDep::OnResetClicked() diff --git a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationRendererMaterial.cpp b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationRendererMaterial.cpp index d4f9a7f..672357e 100644 --- a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationRendererMaterial.cpp +++ b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationRendererMaterial.cpp @@ -57,11 +57,11 @@ void FPopcornFXCustomizationRendererMaterial::CustomizeHeader( ; static const FName propertyFontStyle(TEXT("PropertyWindow.NormalFont")); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) FSlateFontInfo fontStyle = FAppStyle::GetFontStyle(propertyFontStyle); #else FSlateFontInfo fontStyle = FEditorStyle::GetFontStyle(propertyFontStyle); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) uint32 numBaseObjects; //baseObjectNames->GetNumChildren(numBaseObjects); diff --git a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.cpp b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.cpp index 4ce667c..3bada8a 100644 --- a/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.cpp +++ b/Source/PopcornFX/Private/Editor/PropertyCustomization/PopcornFXCustomizationSubRendererMaterial.cpp @@ -194,19 +194,19 @@ void FPopcornFXCustomizationSubRendererMaterial::CustomizeHeader( // too slow .Visibility(this, &FPopcornFXCustomizationSubRendererMaterial::GetResetVisibility) .ToolTipText(LOCTEXT("ResetToDefaultToolTip", "Reset to Default")) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .ButtonStyle(FAppStyle::Get(), "NoBorder") #else .ButtonStyle(FEditorStyle::Get(), "NoBorder") -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) .Content() [ SNew(SImage) -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) .Image(FAppStyle::GetBrush("PropertyWindow.DiffersFromDefault")) #else .Image(FEditorStyle::GetBrush("PropertyWindow.DiffersFromDefault")) -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) ] ] ] diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.cpp b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.cpp index 97f722f..6ce8622 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.cpp +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXGPUSim_D3D12.cpp @@ -141,11 +141,11 @@ void FD3D12ResourceLocation::SetResource(FD3D12Resource* Value) } UnderlyingResource = Value; -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) ResidencyHandle = &UnderlyingResource->GetResidencyHandle(); #else ResidencyHandle = UnderlyingResource->GetResidencyHandle(); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) } //---------------------------------------------------------------------------- diff --git a/Source/PopcornFX/Private/GPUSim/PopcornFXSortComputeShader.cpp b/Source/PopcornFX/Private/GPUSim/PopcornFXSortComputeShader.cpp index 14d46be..24a4a01 100644 --- a/Source/PopcornFX/Private/GPUSim/PopcornFXSortComputeShader.cpp +++ b/Source/PopcornFX/Private/GPUSim/PopcornFXSortComputeShader.cpp @@ -259,7 +259,7 @@ void FPopcornFXSortComputeShader_Sorter::DispatchGenIndiceBatch(FRHICommandList& PK_ASSERT(params.m_Count > 0); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) SetComputePipelineState(RHICmdList, shader); #else RHICmdList.SetComputeShader(shader); @@ -391,11 +391,11 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis //---------------------------------------------------------------------------- // Up Sweep -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) SetComputePipelineState(RHICmdList, upSweepShader); #else RHICmdList.SetComputeShader(upSweepShader); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) if (PK_VERIFY(upSweep->InKeys.IsBound())) { @@ -441,11 +441,11 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis //---------------------------------------------------------------------------- // Up Sweep Offsets -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) SetComputePipelineState(RHICmdList, upSweepOffsetsShader); #else RHICmdList.SetComputeShader(upSweepOffsetsShader); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) if (PK_VERIFY(upSweepOffsets->InOutOffsets.IsBound())) { @@ -481,11 +481,11 @@ void FPopcornFXSortComputeShader_Sorter::DispatchSort(FRHICommandList& RHICmdLis //---------------------------------------------------------------------------- // Down Sweep -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) SetComputePipelineState(RHICmdList, downSweepShader); #else RHICmdList.SetComputeShader(downSweepShader); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) if (PK_VERIFY(downSweep->InOffsets.IsBound())) { diff --git a/Source/PopcornFX/Private/HUD/PopcornFXHUDProfiler.cpp b/Source/PopcornFX/Private/HUD/PopcornFXHUDProfiler.cpp index c386f0c..cd37dec 100644 --- a/Source/PopcornFX/Private/HUD/PopcornFXHUDProfiler.cpp +++ b/Source/PopcornFX/Private/HUD/PopcornFXHUDProfiler.cpp @@ -98,7 +98,7 @@ void APopcornFXHUDProfiler::DrawBar(float minX, float maxX, float yPos, float cu { const float clampedCursor = FMath::Clamp(cursor, 0.0f, 1.0f); const float sizeX = (maxX - minX) * clampedCursor; - FLinearColor color(clampedCursor, 1.f - clampedCursor, 0.f, 0.6f); + FLinearColor color(clampedCursor, 1.f - clampedCursor, 0.f, 0.8f); { FCanvasTileItem tile(FVector2D(minX, yPos), FVector2D(sizeX, thickness), color); tile.BlendMode = SE_BLEND_AlphaBlend; @@ -129,7 +129,7 @@ void APopcornFXHUDProfiler::DrawDebugHUD(UCanvas* inCanvas, APlayerController* p // Grab all medium collections from the world PopcornFX::TArray allSceneTimings; - double totalUpdateTime = 0.0; + double wallUpdateTimeCPU = 0.0; u32 totalParticleCount_CPU = 0; u32 totalParticleCount_GPU = 0; u32 totalInstanceCount = 0; @@ -141,7 +141,7 @@ void APopcornFXHUDProfiler::DrawDebugHUD(UCanvas* inCanvas, APlayerController* p if (sceneComp->ParticleScene() == null) continue; allSceneTimings.Merge(sceneComp->ParticleScene()->EffectTimings()); - totalUpdateTime += sceneComp->ParticleScene()->MediumCollectionUpdateTime(); + wallUpdateTimeCPU += sceneComp->ParticleScene()->MediumCollectionUpdateTime(); totalParticleCount_CPU += sceneComp->ParticleScene()->MediumCollectionParticleCount_CPU(); totalParticleCount_GPU += sceneComp->ParticleScene()->MediumCollectionParticleCount_GPU(); totalInstanceCount += sceneComp->ParticleScene()->MediumCollectionInstanceCount(); @@ -170,10 +170,19 @@ void APopcornFXHUDProfiler::DrawDebugHUD(UCanvas* inCanvas, APlayerController* p const u32 frameCount = settings->HUD_UpdateTimeFrameCount; const EPopcornFXEffectsProfilerSortMode::Type sortMode = settings->EffectsProfilerSortMode; + // Sum flat times: double totalTime = 0.0; + double totalTimeCPU = 0.0; + double totalTimeGPU = 0.0; for (u32 iTiming = 0; iTiming < allSceneTimings.Count(); ++iTiming) + { totalTime += allSceneTimings[iTiming].TotalTime() / frameCount; - const float timeNormalizer = totalUpdateTime / totalTime; + totalTimeCPU += allSceneTimings[iTiming].TotalTimeCPU() / frameCount; + totalTimeGPU += allSceneTimings[iTiming].TotalTimeGPU() / frameCount; // Note: not this frame's gpu time, 2-4 frames delay + } + // Always display gpu flat time, we won't extract hardware specs here. + // This normalizes effect flat time against CPU wall time (time between mediumCollection->Update() and mediumCollection->UpdateFence()) + const float timeNormalizerCPU = wallUpdateTimeCPU / totalTimeCPU; switch (sortMode) { @@ -192,31 +201,41 @@ void APopcornFXHUDProfiler::DrawDebugHUD(UCanvas* inCanvas, APlayerController* p Canvas->SetDrawColor(255, 255, 255, 255); - UFont *font = GEngine->GetSmallFont(); - FFontRenderInfo fri = Canvas->CreateFontRenderInfo(true, true); - FFontRenderInfo friNoShadow = Canvas->CreateFontRenderInfo(true, false); + const UFont *font = GEngine->GetSmallFont(); + const FFontRenderInfo fri = Canvas->CreateFontRenderInfo(true, true); + const FFontRenderInfo friNoShadow = Canvas->CreateFontRenderInfo(true, false); - FString title = TEXT("PopcornFX Effects Profiler"); - float titleWidth; - float lineHeight; + const FString title = TEXT("PopcornFX Effects Profiler"); + float titleWidth; + float lineHeight; Canvas->StrLen(font, title, titleWidth, lineHeight); float yPos = Canvas->SizeY * screenRatio; - float maxyPos = Canvas->SizeY * (1.f - screenRatio); float xPos = yPos; + const float maxyPos = Canvas->SizeY * (1.f - screenRatio); Canvas->DrawText(font, title, xPos, yPos, 1.f, 1.f, fri); yPos += lineHeight; + const bool hasGPU = totalTimeGPU > 0.0f; + const float relTimexPos = xPos + 0; - const float timexPos = relTimexPos + 60; - const float pCountCPUxPos = timexPos + 60; + const float relTimeCPUxPos = relTimexPos + 60; + const float relTimeGPUxPos = relTimeCPUxPos + 60; + const float timexPos = (hasGPU ? relTimeGPUxPos : relTimexPos) + 60; + const float timeCPUxPos = timexPos + 60; + const float timeGPUxPos = timeCPUxPos + 60; + const float pCountCPUxPos = (hasGPU ? timeGPUxPos : timexPos) + 60; const float pCountGPUxPos = pCountCPUxPos + 70; - const float iCountxPos = pCountGPUxPos + 70; + const float iCountxPos = (hasGPU ? pCountGPUxPos : pCountCPUxPos) + 70; const float effectPathxPos = iCountxPos + 60; + const float TimeLimitPerEffectSeconds = settings->TimeLimitPerEffect * 0.001f; const float CPUTimeLimitPerEffectSeconds = settings->CPUTimeLimitPerEffect * 0.001f; + const float GPUTimeLimitPerEffectSeconds = settings->GPUTimeLimitPerEffect * 0.001f; + const float TimeLimitTotalSeconds = settings->TimeLimitTotal * 0.001f; const float CPUTimeLimitTotalSeconds = settings->CPUTimeLimitTotal * 0.001f; + const float GPUTimeLimitTotalSeconds = settings->GPUTimeLimitTotal * 0.001f; const u32 CPUParticleCountLimitPerEffect = settings->CPUParticleCountLimitPerEffect; const u32 GPUParticleCountLimitPerEffect = settings->GPUParticleCountLimitPerEffect; @@ -224,48 +243,86 @@ void APopcornFXHUDProfiler::DrawDebugHUD(UCanvas* inCanvas, APlayerController* p const u32 CPUParticleCountLimitTotal = settings->CPUParticleCountLimitTotal; const u32 GPUParticleCountLimitTotal = settings->GPUParticleCountLimitTotal; + // Draw summary + Canvas->DrawText(font, FString::Printf(TEXT("Timings are averaged over %d frames"), frameCount), relTimexPos, yPos, 1.f, 1.f, fri); yPos += lineHeight; - Canvas->DrawText(font, FString::Printf(TEXT("Total:")), relTimexPos, yPos, 1.f, 1.f, fri); Canvas->DrawText(font, FString::Printf(TEXT("Total time")), timexPos, yPos, 1.f, 1.f, fri); Canvas->DrawText(font, FString::Printf(TEXT("CPU count")), pCountCPUxPos, yPos, 1.f, 1.f, fri); - Canvas->DrawText(font, FString::Printf(TEXT("GPU count")), pCountGPUxPos, yPos, 1.f, 1.f, fri); Canvas->DrawText(font, FString::Printf(TEXT("Instances")), iCountxPos, yPos, 1.f, 1.f, fri); + if (hasGPU) + { + Canvas->DrawText(font, FString::Printf(TEXT("Total CPU")), timeCPUxPos, yPos, 1.f, 1.f, fri); + Canvas->DrawText(font, FString::Printf(TEXT("Total GPU")), timeGPUxPos, yPos, 1.f, 1.f, fri); + Canvas->DrawText(font, FString::Printf(TEXT("GPU count")), pCountGPUxPos, yPos, 1.f, 1.f, fri); + } yPos += lineHeight; - const PopcornFX::Units::SValueAndNamedUnit readableTotalTime = PopcornFX::Units::AutoscaleTime(totalUpdateTime, 0.5f); - Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTotalTime.m_Value, ANSI_TO_TCHAR(readableTotalTime.m_UnitName)), timexPos, yPos, 1.f, 1.f, friNoShadow); - Canvas->DrawText(font, FString::Printf(TEXT("%d"), totalParticleCount_CPU), pCountCPUxPos, yPos, 1.f, 1.f, fri); - Canvas->DrawText(font, FString::Printf(TEXT("%d"), totalParticleCount_GPU), pCountGPUxPos, yPos, 1.f, 1.f, fri); - Canvas->DrawText(font, FString::Printf(TEXT("%d"), totalInstanceCount), iCountxPos, yPos, 1.f, 1.f, fri); - DrawBar(timexPos, pCountCPUxPos - 1, yPos, totalUpdateTime / CPUTimeLimitTotalSeconds, lineHeight); - DrawBar(pCountCPUxPos, pCountGPUxPos - 1, yPos, (float)totalParticleCount_CPU / (float)CPUParticleCountLimitTotal, lineHeight); - DrawBar(pCountGPUxPos, iCountxPos - 1, yPos, (float)totalParticleCount_GPU / (float)GPUParticleCountLimitTotal, lineHeight); + // Timings + { + const PopcornFX::Units::SValueAndNamedUnit readableTotalTime = PopcornFX::Units::AutoscaleTime(wallUpdateTimeCPU, 0.5f); + const PopcornFX::Units::SValueAndNamedUnit readableTotalTimeCPU = PopcornFX::Units::AutoscaleTime(wallUpdateTimeCPU, 0.5f); + //const PopcornFX::Units::SValueAndNamedUnit readableTotalTimeGPU = PopcornFX::Units::AutoscaleTime(totalUpdateTimeGPU, 0.5f); + DrawBar(timexPos, timeCPUxPos - 1, yPos, wallUpdateTimeCPU / TimeLimitTotalSeconds, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTotalTime.m_Value, ANSI_TO_TCHAR(readableTotalTime.m_UnitName)), timexPos, yPos, 1.f, 1.f, friNoShadow); + if (hasGPU) + { + DrawBar(timeCPUxPos, timeGPUxPos - 1, yPos, wallUpdateTimeCPU / CPUTimeLimitTotalSeconds, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTotalTimeCPU.m_Value, ANSI_TO_TCHAR(readableTotalTimeCPU.m_UnitName)), timeCPUxPos, yPos, 1.f, 1.f, friNoShadow); + //DrawBar(timeGPUxPos, pCountCPUxPos - 1, yPos, totalUpdateTimeGPU / GPUTimeLimitTotalSeconds, lineHeight); + //Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTotalTimeGPU.m_Value, ANSI_TO_TCHAR(readableTotalTimeGPU.m_UnitName)), timeGPUxPos, yPos, 1.f, 1.f, friNoShadow); + } + } + // Counts + { + DrawBar(pCountCPUxPos, pCountGPUxPos - 1, yPos, (float)totalParticleCount_CPU / (float)CPUParticleCountLimitTotal, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%d"), totalParticleCount_CPU), pCountCPUxPos, yPos, 1.f, 1.f, fri); + if (hasGPU) + { + DrawBar(pCountGPUxPos, iCountxPos - 1, yPos, (float)totalParticleCount_GPU / (float)GPUParticleCountLimitTotal, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%d"), totalParticleCount_GPU), pCountGPUxPos, yPos, 1.f, 1.f, fri); + } + + Canvas->DrawText(font, FString::Printf(TEXT("%d"), totalInstanceCount), iCountxPos, yPos, 1.f, 1.f, fri); + } yPos += lineHeight; if (totalTime > 0.0f && !allSceneTimings.Empty()) { - Canvas->DrawText(font, TEXT("%CPU"), relTimexPos, yPos, 1.f, 1.f, fri); + Canvas->DrawText(font, TEXT("%"), relTimexPos, yPos, 1.f, 1.f, fri); + if (hasGPU) + { + Canvas->DrawText(font, TEXT("%CPU"), relTimeCPUxPos, yPos, 1.f, 1.f, fri); + Canvas->DrawText(font, TEXT("%GPU"), relTimeGPUxPos, yPos, 1.f, 1.f, fri); + Canvas->DrawText(font, TEXT("Est. CPU"), timeCPUxPos, yPos, 1.f, 1.f, fri); + Canvas->DrawText(font, TEXT("Est. GPU"), timeGPUxPos, yPos, 1.f, 1.f, fri); + Canvas->DrawText(font, TEXT("GPU count"), pCountGPUxPos, yPos, 1.f, 1.f, fri); + } Canvas->DrawText(font, TEXT("Est. time"), timexPos, yPos, 1.f, 1.f, fri); Canvas->DrawText(font, TEXT("CPU count"), pCountCPUxPos, yPos, 1.f, 1.f, fri); - Canvas->DrawText(font, TEXT("GPU count"), pCountGPUxPos, yPos, 1.f, 1.f, fri); Canvas->DrawText(font, TEXT("Instances"), iCountxPos, yPos, 1.f, 1.f, fri); Canvas->DrawText(font, TEXT("Effect path"), effectPathxPos, yPos, 1.f, 1.f, fri); yPos += lineHeight; const float maxDrawyPos = maxyPos - lineHeight * 2; // 2 last total lines double displayedTotalTime = 0.0f; + double displayedTotalTimeCPU = 0.0f; + double displayedTotalTimeGPU = 0.0f; u32 displayedTotalPCount_CPU = 0; u32 displayedTotalPCount_GPU = 0; u32 displayedTotalICount = 0; for (u32 iTiming = 0; iTiming < allSceneTimings.Count(); ++iTiming) { const float effectTime = allSceneTimings[iTiming].TotalTime() / frameCount; + const float effectTimeCPU = allSceneTimings[iTiming].TotalTimeCPU() / frameCount; + const float effectTimeGPU = allSceneTimings[iTiming].TotalTimeGPU() / frameCount; const u32 effectCPUPCount = allSceneTimings[iTiming].TotalParticleCount_CPU() / frameCount; const u32 effectGPUPCount = allSceneTimings[iTiming].TotalParticleCount_GPU() / frameCount; const u32 effectInstanceCount = allSceneTimings[iTiming].TotalInstanceCount()/* / frameCount */; // Not averaged const float effectTimeRelative = (effectTime / totalTime) * 100.0f; + const float effectTimeRelativeCPU = totalTimeCPU > 0.0 ? (effectTimeCPU / totalTimeCPU) * 100.0f : 0.0f; + const float effectTimeRelativeGPU = totalTimeGPU > 0.0 ? (effectTimeGPU / totalTimeGPU) * 100.0f : 0.0f; if (effectTimeRelative < hideBelowPerc) { @@ -273,29 +330,61 @@ void APopcornFXHUDProfiler::DrawDebugHUD(UCanvas* inCanvas, APlayerController* p continue; break; // We know all following will be lower } - DrawBar(relTimexPos, timexPos - 1, yPos, effectTimeRelative / 100.0f, lineHeight); - - Canvas->DrawText(font, FString::Printf(TEXT("%.1f"), effectTimeRelative), relTimexPos, yPos, 1.f, 1.f, friNoShadow); - displayedTotalTime += effectTime; + displayedTotalTimeCPU += effectTimeCPU; + displayedTotalTimeGPU += effectTimeGPU; displayedTotalPCount_CPU += effectCPUPCount; displayedTotalPCount_GPU += effectGPUPCount; displayedTotalICount += effectInstanceCount; - const PopcornFX::Units::SValueAndNamedUnit readableTime = PopcornFX::Units::AutoscaleTime(effectTime * timeNormalizer, 0.5f); - const PopcornFX::Units::SValueAndNamedUnit readableTimeFlat = PopcornFX::Units::AutoscaleTime(effectTime, 0.5f); - - Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTime.m_Value, ANSI_TO_TCHAR(readableTime.m_UnitName)), timexPos, yPos, 1.f, 1.f, friNoShadow); - DrawBar(timexPos, pCountCPUxPos - 1, yPos, (float)(effectTime * timeNormalizer) / (float)CPUTimeLimitPerEffectSeconds, lineHeight); - Canvas->DrawText(font, FString::Printf(TEXT("%d"), effectCPUPCount), pCountCPUxPos, yPos, 1.f, 1.f, friNoShadow); - DrawBar(pCountCPUxPos, pCountGPUxPos - 1, yPos, (float)effectCPUPCount / (float)CPUParticleCountLimitPerEffect, lineHeight); + // Relative time + { + DrawBar(relTimexPos, relTimeCPUxPos - 1, yPos, effectTimeRelative / 100.0f, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f"), effectTimeRelative), relTimexPos, yPos, 1.f, 1.f, friNoShadow); + if (hasGPU) + { + DrawBar(relTimeCPUxPos, relTimeGPUxPos - 1, yPos, effectTimeRelativeCPU / 100.0f, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f"), effectTimeRelativeCPU), relTimeCPUxPos, yPos, 1.f, 1.f, friNoShadow); + DrawBar(relTimeGPUxPos, timexPos - 1, yPos, effectTimeRelativeGPU / 100.0f, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f"), effectTimeRelativeGPU), relTimeGPUxPos, yPos, 1.f, 1.f, friNoShadow); + } + } - Canvas->DrawText(font, FString::Printf(TEXT("%d"), effectGPUPCount), pCountGPUxPos, yPos, 1.f, 1.f, friNoShadow); - DrawBar(pCountGPUxPos, iCountxPos - 1, yPos, (float)effectGPUPCount / (float)GPUParticleCountLimitPerEffect, lineHeight); + // Timings + { + const float timeTotalCPU = effectTimeCPU * timeNormalizerCPU; + const float timeTotalGPU = effectTimeGPU; + const float timeTotal = timeTotalCPU + timeTotalGPU; + const PopcornFX::Units::SValueAndNamedUnit readableTime = PopcornFX::Units::AutoscaleTime(timeTotal, 0.5f); + const PopcornFX::Units::SValueAndNamedUnit readableTimeCPU = PopcornFX::Units::AutoscaleTime(timeTotalCPU, 0.5f); + const PopcornFX::Units::SValueAndNamedUnit readableTimeGPU = PopcornFX::Units::AutoscaleTime(timeTotalGPU, 0.5f); + + DrawBar(timexPos, timeCPUxPos - 1, yPos, timeTotal / TimeLimitPerEffectSeconds, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTime.m_Value, ANSI_TO_TCHAR(readableTime.m_UnitName)), timexPos, yPos, 1.f, 1.f, friNoShadow); + if (hasGPU) + { + DrawBar(timeCPUxPos, timeGPUxPos - 1, yPos, timeTotalCPU / CPUTimeLimitPerEffectSeconds, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTimeCPU.m_Value, ANSI_TO_TCHAR(readableTimeCPU.m_UnitName)), timeCPUxPos, yPos, 1.f, 1.f, friNoShadow); + DrawBar(timeGPUxPos, pCountCPUxPos - 1, yPos, timeTotalGPU / GPUTimeLimitPerEffectSeconds, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTimeGPU.m_Value, ANSI_TO_TCHAR(readableTimeGPU.m_UnitName)), timeGPUxPos, yPos, 1.f, 1.f, friNoShadow); + } + } - Canvas->DrawText(font, FString::Printf(TEXT("%d"), effectInstanceCount), iCountxPos, yPos, 1.f, 1.f, friNoShadow); + // Counts + { + DrawBar(pCountCPUxPos, pCountGPUxPos - 1, yPos, (float)effectCPUPCount / (float)CPUParticleCountLimitPerEffect, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%d"), effectCPUPCount), pCountCPUxPos, yPos, 1.f, 1.f, friNoShadow); + if (hasGPU) + { + DrawBar(pCountGPUxPos, iCountxPos - 1, yPos, (float)effectGPUPCount / (float)GPUParticleCountLimitPerEffect, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%d"), effectGPUPCount), pCountGPUxPos, yPos, 1.f, 1.f, friNoShadow); + } + + Canvas->DrawText(font, FString::Printf(TEXT("%d"), effectInstanceCount), iCountxPos, yPos, 1.f, 1.f, friNoShadow); + } - Canvas->DrawText(font, FString::Printf(TEXT("%s"), ANSI_TO_TCHAR(allSceneTimings[iTiming].m_EffectPath.Data())), effectPathxPos, yPos, 1.f, 1.f, friNoShadow); + // Effect path + Canvas->DrawText(font, FString::Printf(TEXT("%s"), ANSI_TO_TCHAR(allSceneTimings[iTiming].m_EffectPath.Data())), effectPathxPos, yPos, 1.f, 1.f, fri); yPos += lineHeight; if (yPos > maxDrawyPos) @@ -304,21 +393,54 @@ void APopcornFXHUDProfiler::DrawDebugHUD(UCanvas* inCanvas, APlayerController* p yPos += lineHeight / 2; - const float displayedEffectsPercentage = 100.0f * (displayedTotalTime / totalTime); + const float displayedEffectsPercentage = totalTime > 0.0 ? 100.0f * (displayedTotalTime / totalTime) : 0.0f; + const float displayedEffectsPercentageCPU = totalTimeCPU > 0.0 ? 100.0f * (displayedTotalTimeCPU / totalTimeCPU) : 0.0f; + const float displayedEffectsPercentageGPU = totalTimeGPU > 0.0 ? 100.0f * (displayedTotalTimeGPU / totalTimeGPU) : 0.0f; - DrawBar(relTimexPos, timexPos - 1, yPos, displayedEffectsPercentage / 100.0f, lineHeight); - Canvas->DrawText(font, FString::Printf(TEXT("%5.1f"), displayedEffectsPercentage), relTimexPos, yPos, 1.f, 1.f, friNoShadow); + // Relative time + { + DrawBar(relTimexPos, relTimeCPUxPos - 1, yPos, displayedEffectsPercentage / 100.0f, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%5.1f"), displayedEffectsPercentage), relTimexPos, yPos, 1.f, 1.f, friNoShadow); + if (hasGPU) + { + DrawBar(relTimeCPUxPos, relTimeGPUxPos - 1, yPos, displayedEffectsPercentageCPU / 100.0f, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%5.1f"), displayedEffectsPercentageCPU), relTimeCPUxPos, yPos, 1.f, 1.f, friNoShadow); + DrawBar(relTimeGPUxPos, timexPos - 1, yPos, displayedEffectsPercentageGPU / 100.0f, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%5.1f"), displayedEffectsPercentageGPU), relTimeGPUxPos, yPos, 1.f, 1.f, friNoShadow); + } + } - const PopcornFX::Units::SValueAndNamedUnit readableTotalDisplayedTime = PopcornFX::Units::AutoscaleTime(displayedTotalTime * timeNormalizer, 0.5f); - const PopcornFX::Units::SValueAndNamedUnit readableTotalDisplayedTimeFlat = PopcornFX::Units::AutoscaleTime(displayedTotalTime, 0.5f); - Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTotalDisplayedTime.m_Value, ANSI_TO_TCHAR(readableTotalDisplayedTime.m_UnitName)), timexPos, yPos, 1.f, 1.f, friNoShadow); - DrawBar(timexPos, pCountCPUxPos - 1, yPos, (float)(displayedTotalTime * timeNormalizer) / (float)CPUTimeLimitTotalSeconds, lineHeight); + // Timings + { + const float timeTotalCPU = displayedTotalTimeCPU * timeNormalizerCPU; + const float timeTotalGPU = displayedTotalTimeGPU; + const float timeTotal = timeTotalCPU + timeTotalGPU; + const PopcornFX::Units::SValueAndNamedUnit readableTotalDisplayedTime = PopcornFX::Units::AutoscaleTime(timeTotal, 0.5f); + const PopcornFX::Units::SValueAndNamedUnit readableTotalDisplayedTimeCPU = PopcornFX::Units::AutoscaleTime(timeTotalCPU, 0.5f); + const PopcornFX::Units::SValueAndNamedUnit readableTotalDisplayedTimeGPU = PopcornFX::Units::AutoscaleTime(timeTotalGPU, 0.5f); + DrawBar(timexPos, timeCPUxPos - 1, yPos, timeTotal / TimeLimitTotalSeconds, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTotalDisplayedTime.m_Value, ANSI_TO_TCHAR(readableTotalDisplayedTime.m_UnitName)), timexPos, yPos, 1.f, 1.f, friNoShadow); + if (hasGPU) + { + DrawBar(timeCPUxPos, timeGPUxPos - 1, yPos, timeTotalCPU / CPUTimeLimitTotalSeconds, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTotalDisplayedTimeCPU.m_Value, ANSI_TO_TCHAR(readableTotalDisplayedTimeCPU.m_UnitName)), timeCPUxPos, yPos, 1.f, 1.f, friNoShadow); + DrawBar(timeGPUxPos, pCountCPUxPos - 1, yPos, timeTotalGPU / GPUTimeLimitTotalSeconds, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%.1f %s"), readableTotalDisplayedTimeGPU.m_Value, ANSI_TO_TCHAR(readableTotalDisplayedTimeGPU.m_UnitName)), timeGPUxPos, yPos, 1.f, 1.f, friNoShadow); + } + } - Canvas->DrawText(font, FString::Printf(TEXT("%d"), displayedTotalPCount_CPU), pCountCPUxPos, yPos, 1.f, 1.f, friNoShadow); - DrawBar(pCountCPUxPos, pCountGPUxPos - 1, yPos, (float)displayedTotalPCount_CPU / (float)CPUParticleCountLimitTotal, lineHeight); - Canvas->DrawText(font, FString::Printf(TEXT("%d"), displayedTotalPCount_GPU), pCountGPUxPos, yPos, 1.f, 1.f, friNoShadow); - DrawBar(pCountGPUxPos, iCountxPos - 1, yPos, (float)displayedTotalPCount_GPU / (float)GPUParticleCountLimitTotal, lineHeight); - Canvas->DrawText(font, FString::Printf(TEXT("%d"), displayedTotalICount), iCountxPos, yPos, 1.f, 1.f, friNoShadow); + // Counts + { + DrawBar(pCountCPUxPos, pCountGPUxPos - 1, yPos, (float)displayedTotalPCount_CPU / (float)CPUParticleCountLimitTotal, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%d"), displayedTotalPCount_CPU), pCountCPUxPos, yPos, 1.f, 1.f, friNoShadow); + if (hasGPU) + { + DrawBar(pCountGPUxPos, iCountxPos - 1, yPos, (float)displayedTotalPCount_GPU / (float)GPUParticleCountLimitTotal, lineHeight); + Canvas->DrawText(font, FString::Printf(TEXT("%d"), displayedTotalPCount_GPU), pCountGPUxPos, yPos, 1.f, 1.f, friNoShadow); + } + + Canvas->DrawText(font, FString::Printf(TEXT("%d"), displayedTotalICount), iCountxPos, yPos, 1.f, 1.f, friNoShadow); + } Canvas->DrawText(font, TEXT("Effects timings displayed here"), effectPathxPos, yPos, 1.f, 1.f, fri); } diff --git a/Source/PopcornFX/Private/Internal/ParticleScene.cpp b/Source/PopcornFX/Private/Internal/ParticleScene.cpp index 1b61b0b..53d74ef 100644 --- a/Source/PopcornFX/Private/Internal/ParticleScene.cpp +++ b/Source/PopcornFX/Private/Internal/ParticleScene.cpp @@ -256,10 +256,7 @@ bool CParticleScene::InternalSetup(const UPopcornFXSceneComponent *sceneComp) // This is actually an error in PopcornFX.Build.cs, PK_HAS_GPU shouldn't be defined on platforms where it's not supported! // See #5574 if (updateManager != null) - { - updateManager->SetPreferredSimLocation(PopcornFX::CParticleUpdateManager_Auto::SimLocation_Auto); // Enable GPU but does not force it SetupPopcornFXRHIAPI(API); - } #endif m_ParticleMediumCollection = PK_NEW(PopcornFX::CParticleMediumCollection(this, updateManager)); @@ -287,9 +284,8 @@ bool CParticleScene::InternalSetup(const UPopcornFXSceneComponent *sceneComp) if (updateManager != null) { #if (PK_HAS_GPU != 0) - if (!GPU_InitIFN()) + GPU_InitIFN(); #endif // (PK_HAS_GPU != 0) - updateManager->SetPreferredSimLocation(PopcornFX::CParticleUpdateManager_Auto::SimLocation_CPU); // Disable GPU sim } m_CurrentPayloadView = new SPopcornFXPayloadView(); @@ -590,9 +586,8 @@ void CParticleScene::StartUpdate(float dt) #if (PK_PARTICLES_HAS_STATS != 0) if (FPopcornFXPlugin::Get().EffectsProfilerActive()) { - for (u32 iMedium = 0; iMedium < m_ParticleMediumCollection->Mediums().Count(); iMedium++) + for (const PopcornFX::PParticleMedium &medium : m_ParticleMediumCollection->_ActiveMediums_NoLock()) { - const PopcornFX::CParticleMedium *medium = m_ParticleMediumCollection->Mediums()[iMedium].Get(); const PopcornFX::CMediumStats *mediumStats = medium->Stats(); const PopcornFX::CParticleEffect *effect = medium->Descriptor()->ParentEffect(); @@ -1377,7 +1372,7 @@ class FBlockQueryCallbackChaos : public ICollisionQueryFilterCallbackBase return ECollisionQueryHitType::Block; } -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) virtual ECollisionQueryHitType PostFilter(const FCollisionFilterData &filterData, const ChaosInterface::FPTQueryHit &hit) override { return ECollisionQueryHitType::Block; } virtual ECollisionQueryHitType PreFilter(const FCollisionFilterData &filterData, const Chaos::FPerShapeData &shape, const Chaos::FGeometryParticleHandle &actor) { @@ -1391,7 +1386,7 @@ class FBlockQueryCallbackChaos : public ICollisionQueryFilterCallbackBase virtual PxQueryHitType::Enum preFilter(const PxFilterData& filterData, const PxShape* shape, const PxRigidActor* actor, PxHitFlags& queryFlags) { PK_ASSERT_NOT_REACHED(); return PxQueryHitType::eNONE; } virtual PxQueryHitType::Enum postFilter(const PxFilterData& filterData, const PxQueryHit& hit) { PK_ASSERT_NOT_REACHED(); return PxQueryHitType::eNONE; } # endif // PHYSICS_INTERFACE_PHYSX -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) }; #endif @@ -2160,7 +2155,7 @@ static void _D3D11_ExecuteImmTasksArray(CParticleScene *self) // Fake a UAV transition so UE is happy, and disables UAV overlap (undefined behavior, generates random artefacts in the D3D11 GPU sim) // This is ugly, but they removed the implementations of FD3D11DynamicRHI::RHIBeginUAVOverlap/RHIEndUAVOverlap in 4.26. FRHICommandListImmediate &RHICmdList = FRHICommandListExecutor::GetImmediateCommandList(); -#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) if (self->m_D3D11_DummyResource == null) { check(self->m_D3D11_DummyView == null); @@ -2179,7 +2174,7 @@ static void _D3D11_ExecuteImmTasksArray(CParticleScene *self) RHICmdList.Transition(FRHITransitionInfo(self->m_D3D11_DummyView, ERHIAccess::UAVGraphics, ERHIAccess::UAVCompute)); #else RHICmdList.Transition(FRHITransitionInfo((FRHIUnorderedAccessView*)0x1234, ERHIAccess::UAVGraphics, ERHIAccess::UAVCompute)); -#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) RHICmdList.ImmediateFlush(EImmediateFlushType::FlushRHIThread); for (u32 i = 0; i < m_Exec_D3D11_Tasks.Count(); ++i) @@ -2220,7 +2215,7 @@ void CParticleScene::D3D11_Destroy() // GPU_Destroy() updateManager_D3D11->BindD3D11(null, null); } } -#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) if (m_D3D11_DummyResource != null && m_D3D11_DummyView != null) { // Delete view, release resource for proper ref count tracking. @@ -2234,7 +2229,7 @@ void CParticleScene::D3D11_Destroy() // GPU_Destroy() check(m_D3D11_DummyResource == null); check(m_D3D11_DummyView == null); } -#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) m_D3D11_DeferedContext = null; m_D3D11_Device = null; @@ -2363,9 +2358,12 @@ namespace struct SFetchD3D12Context { - bool volatile m_Finished = false; - struct ID3D12Device * volatile m_Device = null; - struct ID3D12CommandQueue * volatile m_CopyCommandQueue = null; + bool volatile m_Finished = false; + struct ID3D12Device * volatile m_Device = null; +#if (PK_PARTICLES_HAS_STATS != 0) + struct ID3D12CommandQueue * volatile m_DirectCommandQueue = null; +#endif // (PK_PARTICLES_HAS_STATS != 0) + struct ID3D12CommandQueue * volatile m_CopyCommandQueue = null; void Fetch() { @@ -2377,6 +2375,14 @@ namespace #if 0 m_CopyCommandQueue = dynamicRHI->GetAdapter().GetDevice(0)->GetD3DCommandQueue(ED3D12CommandQueueType::Copy); #endif + +#if (PK_PARTICLES_HAS_STATS != 0) +# if (ENGINE_MAJOR_VERSION == 5) + m_DirectCommandQueue = GetID3D12DynamicRHI()->RHIGetCommandQueue(); +# else + m_DirectCommandQueue = dynamicRHI->RHIGetD3DCommandQueue(); // Returns the direct command queue +# endif // (ENGINE_MAJOR_VERSION == 5) +#endif // (PK_PARTICLES_HAS_STATS != 0) if (!PK_VERIFY(m_Device != null)) { m_Finished = true; @@ -2399,13 +2405,13 @@ static void _D3D12_ExecuteTasksArray(CParticleScene *self) auto &m_Exec_D3D12_Tasks = self->m_Exec_D3D12_Tasks; //auto &m_UpdateLock = self->m_UpdateLock; -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) ID3D12CommandQueue *commandQueue = GetID3D12DynamicRHI()->RHIGetCommandQueue(); #else PK_RELEASE_ASSERT(GDynamicRHI != null); FD3D12DynamicRHI *dynamicRHI = static_cast(GDynamicRHI); ID3D12CommandQueue *commandQueue = dynamicRHI->RHIGetD3DCommandQueue(); // Returns the direct command queue -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) // TODO: Investigate performance when using the compute command queue @@ -2483,8 +2489,20 @@ bool CParticleScene::D3D12_InitIFN() return false; } + // Get info from command queue + const D3D12_COMMAND_LIST_TYPE queueType = D3D12_COMMAND_LIST_TYPE_DIRECT; // We're currently submitting in the gfx queue (_D3D12_ExecuteTasksArray) + u64 queueTimestampFrequency = 0; +#if (PK_PARTICLES_HAS_STATS != 0) + fetch->m_DirectCommandQueue->GetTimestampFrequency(&queueTimestampFrequency); +#endif // (PK_PARTICLES_HAS_STATS != 0) + m_D3D12_Device = fetch->m_Device; - PopcornFX::SD3D12Context context(m_D3D12_Device, fetch->m_CopyCommandQueue, &D3D12SerializeRootSignature, PopcornFX::CParticleUpdateManager_D3D12::CbEnqueueTask(this, &CParticleScene::D3D12_EnqueueTask)); + const PopcornFX::SD3D12Context context( m_D3D12_Device, // Device used by runtime to allocate resources + fetch->m_CopyCommandQueue, // Copy command queue used by runtime by resource handlers + &D3D12SerializeRootSignature, // Required to link internal kernels + PopcornFX::CParticleUpdateManager_D3D12::CbEnqueueTask(this, &CParticleScene::D3D12_EnqueueTask), // Enqueue cb + queueType, + queueTimestampFrequency); // Queue frequency, used to collect GPU timings (disabled in retail). delete fetch; if (!PK_VERIFY(updateManager_D3D12->BindContext(context))) diff --git a/Source/PopcornFX/Private/Internal/ParticleScene.h b/Source/PopcornFX/Private/Internal/ParticleScene.h index 65eafd0..3bea5be 100644 --- a/Source/PopcornFX/Private/Internal/ParticleScene.h +++ b/Source/PopcornFX/Private/Internal/ParticleScene.h @@ -33,13 +33,13 @@ class UPopcornFXSceneComponent; class FPopcornFXSceneProxy; -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # define PK_WITH_PHYSX 0 # define PK_WITH_CHAOS 1 #else # define PK_WITH_PHYSX PHYSICS_INTERFACE_PHYSX && WITH_PHYSX # define PK_WITH_CHAOS !(PK_WITH_PHYSX) && WITH_CHAOS -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) // The plugin doesn't support both being active at the same time. #if PK_WITH_PHYSX && PK_WITH_CHAOS @@ -151,7 +151,9 @@ class CParticleScene : public PopcornFX::IParticleScene u32 m_TotalParticleCount_GPU = 0; u32 m_InstanceCount = 0; - float TotalTime() const { return m_TotalStatsReport.m_PipelineStages[PopcornFX::SEvolveStatsReport::PipelineStage_Total].m_Time; } + float TotalTime() const { return TotalTimeCPU() + TotalTimeGPU(); } + float TotalTimeCPU() const { return m_TotalStatsReport.m_PipelineStages[PopcornFX::SEvolveStatsReport::PipelineStage_Total].m_Time; } + float TotalTimeGPU() const { return m_TotalStatsReport.m_PipelineStages[PopcornFX::SEvolveStatsReport::PipelineStage_Total + PopcornFX::SEvolveStatsReport::__MaxPipelineStages].m_Time; } u32 TotalParticleCount_CPU() const { return m_TotalParticleCount_CPU; } u32 TotalParticleCount_GPU() const { return m_TotalParticleCount_GPU; } u32 TotalParticleCount() const { return m_TotalParticleCount_CPU + m_TotalParticleCount_GPU; } @@ -312,10 +314,10 @@ class CParticleScene : public PopcornFX::IParticleScene struct ID3D11Device *D3D11_Device() const { PK_ASSERT(D3D11Ready()); return m_D3D11_Device; } struct ID3D11DeviceContext *D3D11_DeferedContext() const { PK_ASSERT(D3D11Ready()); return m_D3D11_DeferedContext; } -#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) class FRHIBuffer *m_D3D11_DummyResource = null; class FRHIUnorderedAccessView *m_D3D11_DummyView = null; -#endif // (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) private: bool D3D11_InitIFN(); diff --git a/Source/PopcornFX/Private/Platforms/PopcornFXPlatform.h b/Source/PopcornFX/Private/Platforms/PopcornFXPlatform.h index 83621f2..d5f588a 100644 --- a/Source/PopcornFX/Private/Platforms/PopcornFXPlatform.h +++ b/Source/PopcornFX/Private/Platforms/PopcornFXPlatform.h @@ -30,7 +30,7 @@ FWD_PK_API_END //---------------------------------------------------------------------------- -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # define PKFX_COMMON_NewImageFromTexture 1 #else # if PLATFORM_PS4 || PLATFORM_XBOXONE @@ -38,7 +38,7 @@ FWD_PK_API_END # else # define PKFX_COMMON_NewImageFromTexture 1 # endif // PLATFORM_PS4 || PLATFORM_XBOXONE -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) //---------------------------------------------------------------------------- diff --git a/Source/PopcornFX/Private/Platforms/PopcornFXPlatformCommon.cpp b/Source/PopcornFX/Private/Platforms/PopcornFXPlatformCommon.cpp index 64e8c2d..04bed7b 100644 --- a/Source/PopcornFX/Private/Platforms/PopcornFXPlatformCommon.cpp +++ b/Source/PopcornFX/Private/Platforms/PopcornFXPlatformCommon.cpp @@ -420,12 +420,12 @@ namespace PopcornFX::CMessageStream &outMessages) { TArray compilerFlags; -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) return CompileComputeShaderForAPI(source, buildInfos, "D3D12", SP_PCD3D_SM6, "DXBC", compilerFlags, outBytecode, outMessages); #else compilerFlags.Add(CFLAG_ForceDXC); // Force SM6.0 return CompileComputeShaderForAPI(source, buildInfos, "D3D12", SP_PCD3D_SM5, "DXBC", compilerFlags, outBytecode, outMessages); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) } } diff --git a/Source/PopcornFX/Private/PopcornFXSDK.h b/Source/PopcornFX/Private/PopcornFXSDK.h index af79579..63baffd 100644 --- a/Source/PopcornFX/Private/PopcornFXSDK.h +++ b/Source/PopcornFX/Private/PopcornFXSDK.h @@ -28,6 +28,9 @@ # ifndef PLATFORM_XBOXONE # define PLATFORM_XBOXONE 0 # endif +# if (ENGINE_MINOR_VERSION < 1) +# error PopcornFX Plugin only supported in UE5 >= 5.1 +# endif #endif // (ENGINE_MAJOR_VERSION == 5) #if PLATFORM_WINDOWS diff --git a/Source/PopcornFX/Private/PopcornFXSettings.cpp b/Source/PopcornFX/Private/PopcornFXSettings.cpp index 6ee0859..03dcd1b 100644 --- a/Source/PopcornFX/Private/PopcornFXSettings.cpp +++ b/Source/PopcornFX/Private/PopcornFXSettings.cpp @@ -40,8 +40,12 @@ UPopcornFXSettings::UPopcornFXSettings(const FObjectInitializer& PCIP) , PackMountPoint("/Game/") , GlobalScale(100.0f) , EnableAsserts(true) +, TimeLimitPerEffect(2.0f) , CPUTimeLimitPerEffect(2.0f) +, GPUTimeLimitPerEffect(1.0f) +, TimeLimitTotal(3.0f) , CPUTimeLimitTotal(3.0f) +, GPUTimeLimitTotal(2.0f) , CPUParticleCountLimitPerEffect(3000) , GPUParticleCountLimitPerEffect(10000) , CPUParticleCountLimitTotal(30000) diff --git a/Source/PopcornFX/Private/PopcornFXSettingsEditor.cpp b/Source/PopcornFX/Private/PopcornFXSettingsEditor.cpp index 2720a03..59ea7a3 100644 --- a/Source/PopcornFX/Private/PopcornFXSettingsEditor.cpp +++ b/Source/PopcornFX/Private/PopcornFXSettingsEditor.cpp @@ -36,6 +36,7 @@ UPopcornFXSettingsEditor::UPopcornFXSettingsEditor(const FObjectInitializer& PCI , bBuildAllDesktopBytecodes(false) , bAutoInsertSceneActor(true) , bAlwaysRenderAttributeSamplerShapes(false) +, bRestartEmitterWhenAttributesChanged(false) #endif // WITH_EDITORONLY_DATA { static const FString kDefaultIncludes[] = { diff --git a/Source/PopcornFX/Private/PopcornFXSettingsEditor.h b/Source/PopcornFX/Private/PopcornFXSettingsEditor.h index 3658097..dab3c6b 100644 --- a/Source/PopcornFX/Private/PopcornFXSettingsEditor.h +++ b/Source/PopcornFX/Private/PopcornFXSettingsEditor.h @@ -135,6 +135,10 @@ class UPopcornFXSettingsEditor : public UObject /** Check this to always render the attribute sampler shapes debug, even when they are not selected */ UPROPERTY(Config, EditAnywhere, Category="Debug") uint32 bAlwaysRenderAttributeSamplerShapes : 1; + + /** Check this to restart effects when their attributes are modified via the details panel (useful when tweaking attributes for infinite particles) */ + UPROPERTY(Config, EditAnywhere, Category="Debug") + uint32 bRestartEmitterWhenAttributesChanged : 1; #endif // WITH_EDITORONLY_DATA #if WITH_EDITOR diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_CPU.cpp index 567c615..f0d4aa5 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_CPU.cpp @@ -711,11 +711,11 @@ void CBatchDrawer_Billboard_CPUBB::_IssueDrawCall_Billboard(const SUERenderConte meshElement.MaxVertexIndex = m_TotalVertexCount - 1; FDynamicPrimitiveUniformBuffer &dynamicPrimitiveUniformBuffer = collector->AllocateOneFrameResource(); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) dynamicPrimitiveUniformBuffer.Set(localToWorld, previousLocalToWorld, bounds, localBounds, true, hasPrecomputedVolumetricLightmap, outputVelocity); #else dynamicPrimitiveUniformBuffer.Set(localToWorld, previousLocalToWorld, bounds, localBounds, true, hasPrecomputedVolumetricLightmap, drawsVelocity, outputVelocity); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) meshElement.PrimitiveUniformBuffer = dynamicPrimitiveUniformBuffer.UniformBuffer.GetUniformBufferRHI(); PK_ASSERT(meshElement.NumPrimitives > 0); diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_GPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_GPU.cpp index dcaf109..c21b367 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_GPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Billboard_GPU.cpp @@ -963,11 +963,11 @@ bool CBatchDrawer_Billboard_GPUBB::LaunchCustomTasks(PopcornFX::SRenderContext & copyParams.m_IsCapsule = m_CapsulesDC; copyParams.m_DrawIndirectArgsOffset = iDr * POPCORNFX_INDIRECT_ARGS_ARG_COUNT; -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) SetComputePipelineState(RHICmdList, copySizeBufferCS.GetComputeShader()); #else RHICmdList.SetComputeShader(copySizeBufferCS.GetComputeShader()); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) copySizeBufferCS->Dispatch(RHICmdList, copyParams); } diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Light.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Light.cpp index 9e27666..e5b4887 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Light.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Light.cpp @@ -191,11 +191,11 @@ void CBatchDrawer_Light::_IssueDrawCall_Light(const SUERenderContext &renderCont PopcornFX::CGuid ldatai = lightDatas.PushBack(); FSimpleLightEntry &lightdata = lightDatas[ldatai]; -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) lightdata.Color = ToUE(colors[parti] * kColorMultiplier); #else lightdata.Color = FVector(ToUE(colors[parti] * kColorMultiplier)); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) lightdata.Radius = radius; // Set the exponent to 0 if we want to enable inverse squared falloff diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp index fe2369d..942f9bd 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp @@ -104,6 +104,12 @@ bool CBatchDrawer_Ribbon_CPUBB::Setup(const PopcornFX::CRendererDataBase *render m_SecondUVSet = renderer->m_RendererCache->m_Flags.m_HasAtlasBlending && renderer->m_RendererCache->m_Flags.m_HasUV; m_RibbonCorrectDeformation = renderer->m_RendererCache->m_Flags.m_HasRibbonCorrectDeformation; m_FlipUVs = renderer->m_RendererCache->m_Flags.m_RotateTexture; + + const PopcornFX::ERibbonMode mode = renderer->m_Declaration.GetPropertyValue_Enum(PopcornFX::BasicRendererProperties::SID_BillboardingMode(), PopcornFX::RibbonMode_ViewposAligned); + if (mode == PopcornFX::RibbonMode_SideAxisAlignedTube) + m_VPP = (renderer->m_Declaration.GetPropertyValue_I1(PopcornFX::BasicRendererProperties::SID_GeometryRibbon_SegmentCount(), 8) + 1) * 2; + else if (mode == PopcornFX::RibbonMode_SideAxisAlignedMultiPlane) + m_VPP = renderer->m_Declaration.GetPropertyValue_I1(PopcornFX::BasicRendererProperties::SID_GeometryRibbon_PlaneCount(), 2) * 4; return true; } @@ -698,8 +704,10 @@ void CBatchDrawer_Ribbon_CPUBB::_IssueDrawCall_Ribbon(const SUERenderContext &re vsUniforms.DynamicParameterMask = matDesc.m_DynamicParameterMask; vsUniformsbillboard.RendererType = static_cast(PopcornFX::Renderer_Ribbon); - vsUniformsbillboard.CapsulesOffset = 0; vsUniformsbillboard.TotalParticleCount = desc.m_TotalParticleCount; + vsUniformsbillboard.CapsulesOffset = 0; + vsUniformsbillboard.TubesPlanesOffset = m_VPP > 0 ? 0 : vsUniformsbillboard.TotalParticleCount; // For now, no batching of tube/multiplane ribbons with quad bb modes + vsUniformsbillboard.VPP = m_VPP; vsUniformsbillboard.InColorsOffset = m_AdditionalStreamOffsets[StreamOffset_Colors].OffsetForShaderConstant(); vsUniformsbillboard.InEmissiveColorsOffset = m_AdditionalStreamOffsets[StreamOffset_EmissiveColors].OffsetForShaderConstant(); vsUniformsbillboard.InAlphaCursorsOffset = m_AdditionalStreamOffsets[StreamOffset_AlphaCursors].OffsetForShaderConstant(); @@ -748,11 +756,11 @@ void CBatchDrawer_Ribbon_CPUBB::_IssueDrawCall_Ribbon(const SUERenderContext &re meshElement.MaxVertexIndex = m_TotalVertexCount - 1; FDynamicPrimitiveUniformBuffer &dynamicPrimitiveUniformBuffer = collector->AllocateOneFrameResource(); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) dynamicPrimitiveUniformBuffer.Set(localToWorld, previousLocalToWorld, bounds, localBounds, true, hasPrecomputedVolumetricLightmap, outputVelocity); #else dynamicPrimitiveUniformBuffer.Set(localToWorld, previousLocalToWorld, bounds, localBounds, true, hasPrecomputedVolumetricLightmap, drawsVelocity, outputVelocity); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) meshElement.PrimitiveUniformBuffer = dynamicPrimitiveUniformBuffer.UniformBuffer.GetUniformBufferRHI(); PK_ASSERT(meshElement.NumPrimitives > 0); diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.h b/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.h index 71298ea..1ef1c5a 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.h +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.h @@ -81,6 +81,8 @@ class CBatchDrawer_Ribbon_CPUBB : public PopcornFX::CRendererBatchJobs_Ribbon_CP u32 m_TotalIndexCount = 0; u32 m_RealViewCount = 0; + u8 m_VPP = 0; + ERHIFeatureLevel::Type m_FeatureLevel = ERHIFeatureLevel::Num; // UserData used to bind shader uniforms (Billboard & Ribbon) diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_SkeletalMesh_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_SkeletalMesh_CPU.cpp index c7d7d84..738b021 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_SkeletalMesh_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_SkeletalMesh_CPU.cpp @@ -11,7 +11,7 @@ #include "Rendering/SkeletalMeshLODRenderData.h" #include "Engine/SkeletalMesh.h" #include "Engine/Texture2D.h" -#if (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # include "Engine/SkinnedAssetCommon.h" #endif #include "RHIStaticStates.h" @@ -965,21 +965,21 @@ void CBatchDrawer_SkeletalMesh_CPUBB::_IssueDrawCall_Mesh(const SUERenderContext if (m_MotionBlur) { TShaderMapRef< FPopcornFXComputeMBBoneTransformsCS > computeBoneTransformsCS(GetGlobalShaderMap(m_FeatureLevel)); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) SetComputePipelineState(RHICmdList, computeBoneTransformsCS.GetComputeShader()); #else RHICmdList.SetComputeShader(computeBoneTransformsCS.GetComputeShader()); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) computeBoneTransformsCS->Dispatch(RHICmdList, params); } else { TShaderMapRef< FPopcornFXComputeBoneTransformsCS > computeBoneTransformsCS(GetGlobalShaderMap(m_FeatureLevel)); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) SetComputePipelineState(RHICmdList, computeBoneTransformsCS.GetComputeShader()); #else RHICmdList.SetComputeShader(computeBoneTransformsCS.GetComputeShader()); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) computeBoneTransformsCS->Dispatch(RHICmdList, params); } } diff --git a/Source/PopcornFX/Private/Render/BatchDrawer_Triangle_CPU.cpp b/Source/PopcornFX/Private/Render/BatchDrawer_Triangle_CPU.cpp index fbbf0d9..ffa3379 100644 --- a/Source/PopcornFX/Private/Render/BatchDrawer_Triangle_CPU.cpp +++ b/Source/PopcornFX/Private/Render/BatchDrawer_Triangle_CPU.cpp @@ -621,11 +621,11 @@ void CBatchDrawer_Triangle_CPUBB::_IssueDrawCall_Triangle(const SUERenderContext meshElement.MinVertexIndex = 0; meshElement.MaxVertexIndex = (m_TotalParticleCount * 3) - 1; FDynamicPrimitiveUniformBuffer &dynamicPrimitiveUniformBuffer = collector->AllocateOneFrameResource(); -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) dynamicPrimitiveUniformBuffer.Set(localToWorld, previousLocalToWorld, bounds, localBounds, true, hasPrecomputedVolumetricLightmap, outputVelocity); #else dynamicPrimitiveUniformBuffer.Set(localToWorld, previousLocalToWorld, bounds, localBounds, true, hasPrecomputedVolumetricLightmap, drawsVelocity, outputVelocity); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) meshElement.PrimitiveUniformBuffer = dynamicPrimitiveUniformBuffer.UniformBuffer.GetUniformBufferRHI(); PK_ASSERT(meshElement.NumPrimitives > 0); diff --git a/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.h b/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.h index e04f28d..9206e8b 100644 --- a/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.h +++ b/Source/PopcornFX/Private/Render/PopcornFXVertexFactory.h @@ -25,6 +25,8 @@ class UMaterialInterface; BEGIN_GLOBAL_SHADER_PARAMETER_STRUCT(FPopcornFXBillboardVSUniforms, POPCORNFX_API) SHADER_PARAMETER(uint32, RendererType) SHADER_PARAMETER(uint32, CapsulesOffset) + SHADER_PARAMETER(uint32, TubesPlanesOffset) + SHADER_PARAMETER(uint32, VPP) SHADER_PARAMETER(uint32, TotalParticleCount) //SHADER_PARAMETER(int, InTextureIDsOffset) SHADER_PARAMETER(int32, InColorsOffset) diff --git a/Source/PopcornFX/Private/World/PopcornFXEmitter.cpp b/Source/PopcornFX/Private/World/PopcornFXEmitter.cpp index b750c9b..290e5c4 100644 --- a/Source/PopcornFX/Private/World/PopcornFXEmitter.cpp +++ b/Source/PopcornFX/Private/World/PopcornFXEmitter.cpp @@ -127,7 +127,7 @@ bool APopcornFXEmitter::EditorSpawnSceneIFN() params.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; //params.bNoFail = true; - params.ObjectFlags = RF_Public | RF_Transactional; + params.ObjectFlags = RF_Transactional; // ! Do not force the name ! // Or UE will magicaly just return the last deleted Actor with the same name ! diff --git a/Source/PopcornFX/Private/World/PopcornFXEmitterComponent.cpp b/Source/PopcornFX/Private/World/PopcornFXEmitterComponent.cpp index 7be5b56..6a5d879 100644 --- a/Source/PopcornFX/Private/World/PopcornFXEmitterComponent.cpp +++ b/Source/PopcornFX/Private/World/PopcornFXEmitterComponent.cpp @@ -90,6 +90,14 @@ UPopcornFXEmitterComponent::UPopcornFXEmitterComponent(const FObjectInitializer& bAutoActivate = true; //SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName); +#if WITH_EDITOR + // UPopcornFXSettingsEditor::bRestartEmitterWhenAttributesChanged + PrimaryComponentTick.bCanEverTick = true; + PrimaryComponentTick.bRunOnAnyThread = false; + PrimaryComponentTick.bAllowTickOnDedicatedServer = false; + bTickInEditor = true; +#endif // WITH_EDITOR + bPlayOnLoad = true; bKillParticlesOnDestroy = false; @@ -210,6 +218,24 @@ PopcornFX::CParticleEffectInstance *UPopcornFXEmitterComponent::_GetEffectInstan //---------------------------------------------------------------------------- #if WITH_EDITOR +void UPopcornFXEmitterComponent::TickComponent(float deltaTime, enum ELevelTick tickType, FActorComponentTickFunction *thisTickFunction) +{ + Super::TickComponent(deltaTime, tickType, thisTickFunction); + + // UPopcornFXSettingsEditor::bRestartEmitterWhenAttributesChanged + // Emitters don't tick outside editor + if (PK_VERIFY(AttributeList != null)) + { + if (m_Started && + AttributeList->GetRestartEmitter()) + { + RestartEmitter(true); + } + } +} + +//---------------------------------------------------------------------------- + bool UPopcornFXEmitterComponent::CanEditChange(const FProperty* InProperty) const { if (InProperty) @@ -271,7 +297,7 @@ void UPopcornFXEmitterComponent::SpawnPreviewSceneIFN(UWorld *world) { FActorSpawnParameters params; - params.ObjectFlags = RF_Public | RF_Transactional; + params.ObjectFlags = RF_Transactional; // ! Do not force the name ! // Or UE will magicaly just return the last deleted Actor with the same name ! //params.Name = SceneName; diff --git a/Source/PopcornFX/Private/World/PopcornFXWaitForSceneActor.cpp b/Source/PopcornFX/Private/World/PopcornFXWaitForSceneActor.cpp index c6d51f3..dd6d2f2 100644 --- a/Source/PopcornFX/Private/World/PopcornFXWaitForSceneActor.cpp +++ b/Source/PopcornFX/Private/World/PopcornFXWaitForSceneActor.cpp @@ -32,7 +32,7 @@ APopcornFXWaitForScene *APopcornFXWaitForScene::GetOrCreate(UWorld *world, FName return actor; FActorSpawnParameters params; - params.ObjectFlags = RF_Public | RF_Transient; // | RF_Transactional; + params.ObjectFlags = RF_Transient; // | RF_Transactional; // ! Do not force the name ! // Or UE will magicaly just return the last deleted Actor with the same name ! diff --git a/Source/PopcornFX/Public/PopcornFXAttributeList.h b/Source/PopcornFX/Public/PopcornFXAttributeList.h index a1e7758..00bb1e0 100644 --- a/Source/PopcornFX/Public/PopcornFXAttributeList.h +++ b/Source/PopcornFX/Public/PopcornFXAttributeList.h @@ -223,6 +223,9 @@ class UPopcornFXAttributeList : public UObject float GetColumnWidth() const { return m_ColumnWidth; } void SetColumnWidth(float width) { m_ColumnWidth = width; } + // Gets & resets restart state + bool GetRestartEmitter() { const bool restartEmitter = m_RestartEmitter; m_RestartEmitter = false; return restartEmitter; } + uint32 GetCategoryCount() const { return m_Categories.Num(); } FName GetCategoryName(uint32 categoryId) const { return m_Categories[categoryId]; } bool IsCategoryExpanded(uint32 categoryId) const; @@ -246,15 +249,15 @@ class UPopcornFXAttributeList : public UObject const void *GetParticleSampler(UPopcornFXEffect *effect, uint32 samplerId) const; #endif void GetAttribute(uint32 attributeId, FPopcornFXAttributeValue &outValue) const; - void SetAttribute(uint32 attributeId, const FPopcornFXAttributeValue &value); + void SetAttribute(uint32 attributeId, const FPopcornFXAttributeValue &value, bool fromUI = false); bool SetAttributeSampler(FName samplerName, AActor *actor, FName propertyName); #if WITH_EDITOR float GetAttributeQuaternionDim(uint32 attributeId, uint32 dim); - void SetAttributeQuaternionDim(uint32 attributeId, uint32 dim, float value); + void SetAttributeQuaternionDim(uint32 attributeId, uint32 dim, float value, bool fromUI = false); - template void SetAttributeDim(uint32 attributeId, uint32 dim, _Scalar value); + template void SetAttributeDim(uint32 attributeId, uint32 dim, _Scalar value, bool fromUI = false); template _Scalar GetAttributeDim(uint32 attributeId, uint32 dim); #endif // WITH_EDITOR @@ -303,6 +306,8 @@ class UPopcornFXAttributeList : public UObject UPROPERTY(Transient) float m_ColumnWidth; + + bool m_RestartEmitter = false; // UPopcornFXSettingsEditor::bRestartEmitterWhenAttributesChanged #endif // WITH_EDITORONLY_DATA public: diff --git a/Source/PopcornFX/Public/PopcornFXEmitterComponent.h b/Source/PopcornFX/Public/PopcornFXEmitterComponent.h index f3a89fb..76e1d02 100644 --- a/Source/PopcornFX/Public/PopcornFXEmitterComponent.h +++ b/Source/PopcornFX/Public/PopcornFXEmitterComponent.h @@ -303,6 +303,7 @@ class POPCORNFX_API UPopcornFXEmitterComponent : public USceneComponent virtual void ApplyWorldOffset(const FVector &inOffset, bool worldShift) override; #if WITH_EDITOR + virtual void TickComponent(float deltaTime, enum ELevelTick tickType, FActorComponentTickFunction *thisTickFunction) override; virtual bool CanEditChange(const FProperty* InProperty) const override; virtual void PostEditChangeProperty(FPropertyChangedEvent& propertyChangedEvent) override; virtual void CheckForErrors() override; diff --git a/Source/PopcornFX/Public/PopcornFXSettings.h b/Source/PopcornFX/Public/PopcornFXSettings.h index 83eb13b..c49169e 100644 --- a/Source/PopcornFX/Public/PopcornFXSettings.h +++ b/Source/PopcornFX/Public/PopcornFXSettings.h @@ -259,14 +259,30 @@ class UPopcornFXSettings : public UObject UPROPERTY(Config, EditAnywhere, Category="PopcornFX Materials") FPopcornFXDefaultMaterialsSettings DefaultMaterials; + /** Time limit per effect in miliseconds (does not affect simulated effects yet) */ + UPROPERTY(Config, EditAnywhere, Category="PopcornFX Budget") + float TimeLimitPerEffect; + /** CPU time limit per effect in miliseconds (does not affect simulated effects yet) */ UPROPERTY(Config, EditAnywhere, Category="PopcornFX Budget") float CPUTimeLimitPerEffect; + /** GPU time limit per effect in miliseconds (does not affect simulated effects yet) */ + UPROPERTY(Config, EditAnywhere, Category="PopcornFX Budget") + float GPUTimeLimitPerEffect; + + /** Time limit in miliseconds (does not affect simulated effects yet) */ + UPROPERTY(Config, EditAnywhere, Category="PopcornFX Budget") + float TimeLimitTotal; + /** CPU time limit in miliseconds (does not affect simulated effects yet) */ UPROPERTY(Config, EditAnywhere, Category="PopcornFX Budget") float CPUTimeLimitTotal; + /** GPU time limit in miliseconds (does not affect simulated effects yet) */ + UPROPERTY(Config, EditAnywhere, Category="PopcornFX Budget") + float GPUTimeLimitTotal; + /** CPU particle count limit per effect (does not affect simulated effects yet) */ UPROPERTY(Config, EditAnywhere, Category="PopcornFX Budget") uint32 CPUParticleCountLimitPerEffect; diff --git a/Source/PopcornFX/Public/PopcornFXVersionGenerated.h b/Source/PopcornFX/Public/PopcornFXVersionGenerated.h index 7cceb04..8fd4625 100644 --- a/Source/PopcornFX/Public/PopcornFXVersionGenerated.h +++ b/Source/PopcornFX/Public/PopcornFXVersionGenerated.h @@ -6,6 +6,6 @@ #pragma once #define POPCORNFX_PLUGIN_VERSION_MAJOR 2 -#define POPCORNFX_PLUGIN_VERSION_MINOR 15 -#define POPCORNFX_PLUGIN_VERSION_PATCH 14 +#define POPCORNFX_PLUGIN_VERSION_MINOR 18 +#define POPCORNFX_PLUGIN_VERSION_PATCH 1 #define POPCORNFX_PLUGIN_VERSION_TAG "" diff --git a/Source/PopcornFXEditor/Private/Nodes/PopcornFXNode_DynamicField.cpp b/Source/PopcornFXEditor/Private/Nodes/PopcornFXNode_DynamicField.cpp index f778329..8aea05f 100644 --- a/Source/PopcornFXEditor/Private/Nodes/PopcornFXNode_DynamicField.cpp +++ b/Source/PopcornFXEditor/Private/Nodes/PopcornFXNode_DynamicField.cpp @@ -135,13 +135,13 @@ namespace PopcornFXPinDataType // Removes leading "EPopcornFXPinFieldType::" if nessecary for Pin value FString GetPinValueName(EPopcornFXPinDataType::Type value) { -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) static const TCHAR kEnumName[] = TEXT("/Script/PopcornFX.EPopcornFXPinDataType"); UEnum *pinTypeEnum = FindObject(null, kEnumName, true); #else static const TCHAR kEnumName[] = TEXT("EPopcornFXPinDataType"); UEnum *pinTypeEnum = FindObject(ANY_PACKAGE, kEnumName, true); -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) check(pinTypeEnum); FString name = pinTypeEnum->GetNameByValue(value).ToString(); static const TCHAR kEnumNameDoubleColon[] = TEXT("EPopcornFXPinDataType::"); diff --git a/Source/PopcornFXEditor/Private/PopcornFXEmitterFactory.cpp b/Source/PopcornFXEditor/Private/PopcornFXEmitterFactory.cpp index b72cec6..79c4e34 100644 --- a/Source/PopcornFXEditor/Private/PopcornFXEmitterFactory.cpp +++ b/Source/PopcornFXEditor/Private/PopcornFXEmitterFactory.cpp @@ -6,11 +6,11 @@ #include "PopcornFXEmitterFactory.h" #include "Runtime/Launch/Resources/Version.h" -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # include "AssetRegistry/AssetData.h" #else # include "AssetData.h" -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) #include "Assets/PopcornFXEffect.h" #include "PopcornFXEmitter.h" diff --git a/Source/PopcornFXEditor/Private/PopcornFXFileFactory.cpp b/Source/PopcornFXEditor/Private/PopcornFXFileFactory.cpp index 5988a48..cdee633 100644 --- a/Source/PopcornFXEditor/Private/PopcornFXFileFactory.cpp +++ b/Source/PopcornFXEditor/Private/PopcornFXFileFactory.cpp @@ -16,11 +16,11 @@ #include "ObjectTools.h" #include "PackageTools.h" #include "AssetToolsModule.h" -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # include "AssetRegistry/AssetRegistryModule.h" #else # include "AssetRegistryModule.h" -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) #include "EditorFramework/AssetImportData.h" #include "Editor.h" diff --git a/Source/PopcornFXEditor/Private/PopcornFXFileReimportFactory.cpp b/Source/PopcornFXEditor/Private/PopcornFXFileReimportFactory.cpp index 1778dc5..2f98e8e 100644 --- a/Source/PopcornFXEditor/Private/PopcornFXFileReimportFactory.cpp +++ b/Source/PopcornFXEditor/Private/PopcornFXFileReimportFactory.cpp @@ -10,11 +10,11 @@ #include "Runtime/Launch/Resources/Version.h" #include "EditorReimportHandler.h" -#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#if (ENGINE_MAJOR_VERSION == 5) # include "AssetRegistry/AssetRegistryModule.h" #else # include "AssetRegistryModule.h" -#endif // (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1) +#endif // (ENGINE_MAJOR_VERSION == 5) #include "EditorFramework/AssetImportData.h" #include "UObject/UnrealType.h"