Skip to content

Commit

Permalink
PopcornFX Plugin v2.15.9
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoPKFX committed Jun 2, 2023
1 parent cdf7f27 commit 9794416
Show file tree
Hide file tree
Showing 12 changed files with 503 additions and 393 deletions.
2 changes: 1 addition & 1 deletion Download_SDK_Desktop.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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.8_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.15.9_Win64_Linux64_Mac64.7z "%~dp0\_PopcornFX_Runtime_SDK_Desktop.7z"
bitsadmin /setpriority third_party_download_desktop "FOREGROUND"
bitsadmin /resume third_party_download_desktop

Expand Down
2 changes: 1 addition & 1 deletion Download_SDK_Mobile.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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.8_iOS_Android.7z "%~dp0\_PopcornFX_Runtime_SDK_Mobile.7z"
bitsadmin /addfile third_party_download_mobile https://downloads.popcornfx.com/Plugins/UE4/UnrealEngine_PopcornFXPlugin_2.15.9_iOS_Android.7z "%~dp0\_PopcornFX_Runtime_SDK_Mobile.7z"
bitsadmin /setpriority third_party_download_mobile "FOREGROUND"
bitsadmin /resume third_party_download_mobile

Expand Down
4 changes: 2 additions & 2 deletions PopcornFX.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 21508,
"VersionName": "2.15.8",
"Version": 21509,
"VersionName": "2.15.9",
"FriendlyName": "PopcornFX",
"Description": "PopcornFX Realtime Particle Solution integration into Unreal Engine",
"Category": "PopcornFX",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Unreal Engine PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **Unreal Engine 4** and **Unreal Engine 5** as a Plugin.
* **Version:** `v2.15.8`
* **Version:** `v2.15.9`
* **Unreal Engine:** `4.27`, `5.0`, `5.1` and `5.2`
* **Supported platforms:** `Windows`, `MacOS`, `Linux`, `iOS`, `Android`, `PS4`, `PS5`, `XboxOne`, `Xbox Series`, `Switch`

Expand Down
45 changes: 22 additions & 23 deletions Source/PopcornFX/Private/Attributes/PopcornFXAttributeList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ using PopcornFX::PCShapeDescriptor;

uint32 ToPkShapeType(EPopcornFXAttribSamplerShapeType::Type ueShapeType)
{
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Box == (u32)CShapeDescriptor::ShapeBox);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Sphere == (u32)CShapeDescriptor::ShapeSphere);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Box == (u32)CShapeDescriptor::ShapeBox);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Sphere == (u32)CShapeDescriptor::ShapeSphere);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Ellipsoid == (u32)CShapeDescriptor::ShapeEllipsoid);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Cylinder == (u32)CShapeDescriptor::ShapeCylinder);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Capsule == (u32)CShapeDescriptor::ShapeCapsule);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Cone == (u32)CShapeDescriptor::ShapeCone);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Mesh == (u32)CShapeDescriptor::ShapeMesh);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Cylinder == (u32)CShapeDescriptor::ShapeCylinder);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Capsule == (u32)CShapeDescriptor::ShapeCapsule);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Cone == (u32)CShapeDescriptor::ShapeCone);
PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Mesh == (u32)CShapeDescriptor::ShapeMesh);
//PK_STATIC_ASSERT(EPopcornFXAttribSamplerShapeType::Collection == (u32)CShapeDescriptor::ShapeMeshCollection);
return static_cast<CShapeDescriptor::EShapeType>(ueShapeType);
}
Expand Down Expand Up @@ -281,6 +281,7 @@ UPopcornFXAttributeList::UPopcornFXAttributeList(const FObjectInitializer& PCIP)
#if WITH_EDITORONLY_DATA
, m_ColumnWidth(0.65f)
#endif // WITH_EDITORONLY_DATA
, m_Owner(null)
{
SetFlags(RF_Transactional);
}
Expand All @@ -292,7 +293,7 @@ bool UPopcornFXAttributeList::CheckDataIntegrity() const
bool ok = true;

ok &= PK_VERIFY(m_AttributesRawData.Num() == m_Attributes.Num() * kAttributeSize);
if (m_Owner != null && m_Owner->IsEmitterStarted())
if (m_Owner.IsValid() && m_Owner->IsEmitterStarted())
{
PopcornFX::CParticleEffectInstance *effectInstance = m_Owner->_GetEffectInstance();

Expand Down Expand Up @@ -942,7 +943,7 @@ void UPopcornFXAttributeList::RestoreAttributesFromCachedRawData(const TArray<ui
PopcornFX::Mem::Copy(m_AttributesRawData.GetData(), rawData.GetData(), coveredBytes);

if (m_Owner != null)
_RefreshAttributes(m_Owner);
_RefreshAttributes(m_Owner.Get());
}

//----------------------------------------------------------------------------
Expand All @@ -969,7 +970,7 @@ void UPopcornFXAttributeList::ResetToDefaultValues(UPopcornFXEffect *effect)
m_AttributesRawData = defRawData;

if (m_Owner != null)
_RefreshAttributes(m_Owner);
_RefreshAttributes(m_Owner.Get());

for (int32 i = 0; i < m_Samplers.Num(); ++i)
m_Samplers[i].ResetValue();
Expand Down Expand Up @@ -1080,7 +1081,7 @@ void UPopcornFXAttributeList::BeginDestroy()
void UPopcornFXAttributeList::PostEditUndo()
{
if (m_Owner != null)
_RefreshAttributes(m_Owner);
_RefreshAttributes(m_Owner.Get());
Super::PostEditUndo();
}

Expand All @@ -1093,7 +1094,7 @@ void UPopcornFXAttributeList::Scene_PreUpdate(UPopcornFXEmitterComponent *emitte
PK_NAMEDSCOPEDPROFILE_C("UPopcornFXAttributeList::Scene_PreUpdate", POPCORNFX_UE_PROFILER_COLOR);

PK_ASSERT(emitter != null);
PK_ASSERT(m_Owner == null || emitter == m_Owner);
PK_ASSERT(!m_Owner.IsValid() || emitter == m_Owner);
m_Owner = emitter;

for (int32 sampleri = 0; sampleri < m_Samplers.Num(); ++sampleri)
Expand Down Expand Up @@ -1130,7 +1131,7 @@ void UPopcornFXAttributeList::AttributeSamplers_IndirectSelectedThisTick(UPopcor
bool UPopcornFXAttributeList::SetAttributeSampler(FName samplerName, AActor *actor, FName propertyName)
{
// The actual UPopcornFXAttributeSampler will be resolved later
if (m_Owner != null && m_Owner->IsEmitterStarted())
if (m_Owner.IsValid() && m_Owner->IsEmitterStarted())
{
UE_LOG(LogPopcornFXAttributeList, Warning, TEXT("SetAttributeSampler cannot be called on started emitters."));
return false;
Expand Down Expand Up @@ -1161,7 +1162,7 @@ void UPopcornFXAttributeList::GetAttribute(uint32 attributeId, FPopcornFXAttribu
PopcornFX::SAttributesContainer_SAttrib &_outAttribute = *reinterpret_cast<PopcornFX::SAttributesContainer_SAttrib*>(&outAttribute);

const PopcornFX::EBaseTypeID typeID = (PopcornFX::EBaseTypeID)m_Attributes[attributeId].AttributeBaseTypeID();
if (m_Owner != null && m_Owner->IsEmitterStarted())
if (m_Owner.IsValid() && m_Owner->IsEmitterStarted())
{
PopcornFX::CParticleEffectInstance *effectInstance = m_Owner->_GetEffectInstance();

Expand All @@ -1188,7 +1189,7 @@ void UPopcornFXAttributeList::SetAttribute(uint32 attributeId, const FPopcornFXA
const PopcornFX::SAttributesContainer_SAttrib &_value = *reinterpret_cast<const PopcornFX::SAttributesContainer_SAttrib*>(&value);

const PopcornFX::EBaseTypeID typeID = (PopcornFX::EBaseTypeID)m_Attributes[attributeId].AttributeBaseTypeID();
if (m_Owner != null && m_Owner->IsEmitterStarted())
if (m_Owner.IsValid() && m_Owner->IsEmitterStarted())
{
PopcornFX::CParticleEffectInstance *effectInstance = m_Owner->_GetEffectInstance();

Expand Down Expand Up @@ -1330,11 +1331,11 @@ void UPopcornFXAttributeList::_RefreshAttributes(const UPopcornFXEmitterComponen
DBG_HERE();

PK_ASSERT(emitter != null);
PK_ASSERT(m_Owner == null || emitter == m_Owner);
PK_ASSERT(!m_Owner.IsValid() || emitter == m_Owner);
m_Owner = emitter;

// If the emitter is running, set its attributes from serialized attributes
if (!PK_VERIFY(m_Owner != null))
if (!PK_VERIFY(m_Owner.IsValid()))
return;
PK_ASSERT(CheckDataIntegrity());

Expand Down Expand Up @@ -1368,7 +1369,7 @@ void UPopcornFXAttributeList::_RefreshAttributeSamplers(UPopcornFXEmitterCompone
PK_NAMEDSCOPEDPROFILE_C("UPopcornFXAttributeList::_RefreshAttributeSamplers", POPCORNFX_UE_PROFILER_COLOR);

PK_ASSERT(emitter != null);
PK_ASSERT(m_Owner == null || emitter == m_Owner);
PK_ASSERT(!m_Owner.IsValid() || emitter == m_Owner);
m_Owner = emitter;

if (!PK_VERIFY(emitter != null))
Expand All @@ -1383,7 +1384,7 @@ void UPopcornFXAttributeList::_RefreshAttributeSamplers(UPopcornFXEmitterCompone
if (m_Samplers.Num() == 0)
return;

if (m_Owner == null || !m_Owner->IsEmitterStarted())
if (!m_Owner.IsValid() || !m_Owner->IsEmitterStarted())
return;
PopcornFX::CParticleEffectInstance *effectInstance = m_Owner->_GetEffectInstance();
if (!PK_VERIFY(effectInstance != null))
Expand Down Expand Up @@ -1438,12 +1439,10 @@ void UPopcornFXAttributeList::_RefreshAttributeSamplers(UPopcornFXEmitterCompone

//----------------------------------------------------------------------------

void UPopcornFXAttributeList::CheckEmitter(const class UPopcornFXEmitterComponent *emitter)
void UPopcornFXAttributeList::CheckEmitter(const UPopcornFXEmitterComponent *emitter)
{
PK_ASSERT(emitter != null);
#if 0 // We can't trust this when UE is doing its garbage collect
PK_ASSERT(m_Owner == null || m_Owner == emitter);
#endif
check(emitter != null);
//check(!m_Owner.IsValid() || m_Owner == emitter);
m_Owner = emitter;
}

Expand Down
13 changes: 6 additions & 7 deletions Source/PopcornFX/Private/Render/MaterialDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ bool CRendererCache::GameThread_ResolveRenderer(PopcornFX::PCRendererDataBase re

if (m_GameThreadDesc.HasMaterial())
{
UPopcornFXRendererMaterial *rendererMat = ResolveCachedMaterial(renderer.Get(), particleDesc);
m_GameThreadDesc.m_RendererMaterial = rendererMat;
return rendererMat != null;
m_GameThreadDesc.m_RendererMaterial = ResolveCachedMaterial(renderer.Get(), particleDesc);
return m_GameThreadDesc.m_RendererMaterial.IsValid();
}
return true; // Light, sound
}
Expand All @@ -123,8 +122,8 @@ void CRendererCache::BuildCacheInfos_SkeletalMesh()
{
PK_ASSERT(m_GameThreadDesc.m_SkeletalMesh != null);
PK_ASSERT(m_GameThreadDesc.m_RendererMaterial != null);
const FSkeletalMeshRenderData *renderData = m_GameThreadDesc.m_SkeletalMesh->GetResourceForRendering();
FPopcornFXSubRendererMaterial *rendererSubMat = m_GameThreadDesc.m_RendererMaterial->GetSubMaterial(0);
const FSkeletalMeshRenderData *renderData = m_GameThreadDesc.m_SkeletalMesh->GetResourceForRendering();
const FPopcornFXSubRendererMaterial *rendererSubMat = m_GameThreadDesc.m_RendererMaterial->GetSubMaterial(0);
PK_ASSERT(rendererSubMat != null);

if (renderData != null)
Expand Down Expand Up @@ -152,8 +151,8 @@ void CRendererCache::BuildCacheInfos_StaticMesh()
{
PK_ASSERT(m_GameThreadDesc.m_StaticMesh != null);
PK_ASSERT(m_GameThreadDesc.m_RendererMaterial != null);
const FStaticMeshRenderData *renderData = m_GameThreadDesc.m_StaticMesh->GetRenderData();
FPopcornFXSubRendererMaterial *rendererSubMat = m_GameThreadDesc.m_RendererMaterial->GetSubMaterial(0);
const FStaticMeshRenderData *renderData = m_GameThreadDesc.m_StaticMesh->GetRenderData();
const FPopcornFXSubRendererMaterial *rendererSubMat = m_GameThreadDesc.m_RendererMaterial->GetSubMaterial(0);
PK_ASSERT(rendererSubMat != null);

if (renderData != null)
Expand Down
7 changes: 4 additions & 3 deletions Source/PopcornFX/Private/Render/MaterialDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ class CMaterialDesc_GameThread
virtual void Clear();

public:
UPopcornFXRendererMaterial *m_RendererMaterial = null;
PopcornFX::ERendererClass m_RendererClass;
PopcornFX::PCRendererDataBase m_Renderer = null;
// Note: should be refactored, render thread should have no need to maintain a weak pointer to the uasset.
TWeakObjectPtr<UPopcornFXRendererMaterial> m_RendererMaterial;
PopcornFX::ERendererClass m_RendererClass;
PopcornFX::PCRendererDataBase m_Renderer = null;

CSoundDescriptorPoolCollection *m_SoundPoolCollection = null;

Expand Down
4 changes: 2 additions & 2 deletions Source/PopcornFX/Private/Render/PopcornFXVertexFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ void FPopcornFXVertexFactory::_SetupStream( u32 attributeIndex,
{
if (!buffer.Valid())
{
FVertexStreamComponent NullColorComponent(&GNullColorVertexBuffer, 0, 0, VET_Color);
decl.Add(AccessStreamComponent(NullColorComponent, attributeIndex));
FVertexStreamComponent nullComponent(&GNullVertexBuffer, 0, 0, type);
decl.Add(AccessStreamComponent(nullComponent, attributeIndex));
return;
}

Expand Down
Loading

0 comments on commit 9794416

Please sign in to comment.