Skip to content

Commit

Permalink
PopcornFX Plugin v2.15.11
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoPKFX committed Jul 13, 2023
1 parent 78d8c5d commit a821b31
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 58 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.10_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.11_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.10_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.11_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": 21510,
"VersionName": "2.15.10",
"Version": 21511,
"VersionName": "2.15.11",
"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.10`
* **Version:** `v2.15.11`
* **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
2 changes: 2 additions & 0 deletions Source/PopcornFX/Private/Assets/PopcornFXMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,8 @@ void UPopcornFXMesh::WriteMesh()
if (m_ResourceMesh != null)
{
PopcornFX::SMeshWriteSettings writeSettings;
writeSettings.m_Tangents = PopcornFX::SVStreamCode::Type_F32;

const PopcornFX::CString pkPath = PkPath(); // char* -> CString

bool success = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void FPopcornFXDependencyModuleLevelEditor::FillPopcornFXMenu(FMenuBuilder &menu

menuBuilder.AddMenuEntry(
LOCTEXT("WikiTitle", "Plugin Wiki"),
LOCTEXT("WikiTooltip", "Opens the PopcornFX UE4 plugin wiki"),
LOCTEXT("WikiTooltip", "Opens the PopcornFX UE plugin wiki"),
#if (ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1)
FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.BrowseDocumentation"),
#else
Expand Down
12 changes: 11 additions & 1 deletion Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ CBatchDrawer_Ribbon_CPUBB::~CBatchDrawer_Ribbon_CPUBB()
PK_ASSERT(!m_Tangents.Valid());
PK_ASSERT(!m_Texcoords.Valid());
PK_ASSERT(!m_AtlasIDs.Valid());
PK_ASSERT(!m_UVRemaps.Valid());
PK_ASSERT(!m_UVFactors.Valid());

PK_ASSERT(!m_SimData.Valid());

Expand All @@ -86,6 +88,7 @@ CBatchDrawer_Ribbon_CPUBB::~CBatchDrawer_Ribbon_CPUBB()
PK_ASSERT(!m_ViewDependents[iView].m_Positions.Valid());
PK_ASSERT(!m_ViewDependents[iView].m_Normals.Valid());
PK_ASSERT(!m_ViewDependents[iView].m_Tangents.Valid());
PK_ASSERT(!m_ViewDependents[iView].m_UVFactors.Valid());
}
}

Expand All @@ -99,6 +102,7 @@ bool CBatchDrawer_Ribbon_CPUBB::Setup(const PopcornFX::CRendererDataBase *render
m_NeedsBTN = renderer->m_RendererCache->m_Flags.m_HasNormal;
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;
return true;
}

Expand Down Expand Up @@ -396,6 +400,8 @@ void CBatchDrawer_Ribbon_CPUBB::_ClearBuffers()
m_Tangents.UnmapAndClear();
m_Texcoords.UnmapAndClear();
m_AtlasIDs.UnmapAndClear();
m_UVRemaps.UnmapAndClear();
m_UVFactors.UnmapAndClear();

m_SimData.UnmapAndClear();

Expand Down Expand Up @@ -578,6 +584,7 @@ bool CBatchDrawer_Ribbon_CPUBB::MapBuffers(PopcornFX::SRenderContext &ctx, const
dstView.m_Exec_PNT.m_UVFactors4 = uvFactors;
}
}
m_BBJobs_Ribbon.m_Exec_Texcoords.m_ForUVFactor = hasUVFactors;
return true;
}

Expand Down Expand Up @@ -649,6 +656,7 @@ void CBatchDrawer_Ribbon_CPUBB::_IssueDrawCall_Ribbon(const SUERenderContext &re
const bool fullViewIndependent = viewDep == null;
const bool viewIndependentIndices = (fullViewIndependent && m_Indices.Valid()) || (!fullViewIndependent && !viewDep->m_Indices.Valid());
const bool viewIndependentPNT = (fullViewIndependent && m_Positions.Valid()) || (!fullViewIndependent && !viewDep->m_Positions.Valid());
const bool viewIndependentUVFactors = (fullViewIndependent && m_UVFactors.Valid()) || (!fullViewIndependent && !viewDep->m_UVFactors.Valid());

// This should never happen
if (!viewIndependentIndices && (viewDep == null || !viewDep->m_Indices.Valid()))
Expand Down Expand Up @@ -678,6 +686,8 @@ void CBatchDrawer_Ribbon_CPUBB::_IssueDrawCall_Ribbon(const SUERenderContext &re
vertexFactory->m_Normals.Setup(viewIndependentPNT ? m_Normals : viewDep->m_Normals);
vertexFactory->m_Tangents.Setup(viewIndependentPNT ? m_Tangents : viewDep->m_Tangents);

vertexFactory->m_UVFactors.Setup(viewIndependentUVFactors ? m_UVFactors : viewDep->m_UVFactors);
vertexFactory->m_UVScalesAndOffsets.Setup(m_UVRemaps);

FPopcornFXUniforms vsUniforms;
FPopcornFXBillboardVSUniforms vsUniformsbillboard;
Expand All @@ -696,7 +706,7 @@ void CBatchDrawer_Ribbon_CPUBB::_IssueDrawCall_Ribbon(const SUERenderContext &re
vsUniformsbillboard.InDynamicParameter3sOffset = m_AdditionalStreamOffsets[StreamOffset_DynParam3s].OffsetForShaderConstant();

commonUniformsBillboard.HasSecondUVSet = m_SecondUVSet;
commonUniformsBillboard.FlipUVs = false;
commonUniformsBillboard.FlipUVs = m_FlipUVs;
commonUniformsBillboard.NeedsBTN = m_NeedsBTN;
commonUniformsBillboard.CorrectRibbonDeformation = m_RibbonCorrectDeformation;

Expand Down
1 change: 1 addition & 0 deletions Source/PopcornFX/Private/Render/BatchDrawer_Ribbon_CPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class CBatchDrawer_Ribbon_CPUBB : public PopcornFX::CRendererBatchJobs_Ribbon_CP
bool m_SecondUVSet = false;
bool m_NeedsBTN = false;
bool m_RibbonCorrectDeformation = false;
bool m_FlipUVs = false;

// View independent buffers
CPooledIndexBuffer m_Indices;
Expand Down
32 changes: 8 additions & 24 deletions Source/PopcornFX/Private/Render/MaterialDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,31 +212,21 @@ void CRendererCache::UpdateThread_BuildBillboardingFlags(const PopcornFX::PRende

if (renderer->m_RendererType == PopcornFX::Renderer_Billboard)
{
const PopcornFX::SRendererFeaturePropertyValue *flipUVs = renderer->m_Declaration.FindProperty(PopcornFX::BasicRendererProperties::SID_FlipUVs());

if (flipUVs != null && flipUVs->ValueB())
if (renderer->m_Declaration.IsFeatureEnabled(PopcornFX::BasicRendererProperties::SID_FlipUVs()))
{
m_Flags.m_FlipU = true;
m_Flags.m_FlipU = false;
m_Flags.m_FlipV = true;
}
}
else if (renderer->m_RendererType == PopcornFX::Renderer_Ribbon)
{
const PopcornFX::SRendererFeaturePropertyValue *textureUVs = renderer->m_Declaration.FindProperty(PopcornFX::BasicRendererProperties::SID_TextureUVs());

if (textureUVs != null && textureUVs->ValueB())
if (renderer->m_Declaration.IsFeatureEnabled(PopcornFX::BasicRendererProperties::SID_TextureUVs()))
{
const PopcornFX::SRendererFeaturePropertyValue *flipU = renderer->m_Declaration.FindProperty(PopcornFX::BasicRendererProperties::SID_TextureUVs_FlipU());
const PopcornFX::SRendererFeaturePropertyValue *flipV = renderer->m_Declaration.FindProperty(PopcornFX::BasicRendererProperties::SID_TextureUVs_FlipV());
const PopcornFX::SRendererFeaturePropertyValue *rotateTexture = renderer->m_Declaration.FindProperty(PopcornFX::BasicRendererProperties::SID_TextureUVs_RotateTexture());

m_Flags.m_FlipU = flipU != null ? flipU->ValueB() : false;
m_Flags.m_FlipV = flipV != null ? flipV->ValueB() : false;
m_Flags.m_RotateTexture = rotateTexture != null ? rotateTexture->ValueB() : false;
m_Flags.m_FlipU = renderer->m_Declaration.GetPropertyValue_B(PopcornFX::BasicRendererProperties::SID_TextureUVs_FlipU(), false);
m_Flags.m_FlipV = renderer->m_Declaration.GetPropertyValue_B(PopcornFX::BasicRendererProperties::SID_TextureUVs_FlipV(), false);
m_Flags.m_RotateTexture = renderer->m_Declaration.GetPropertyValue_B(PopcornFX::BasicRendererProperties::SID_TextureUVs_RotateTexture(), false);
}

const PopcornFX::SRendererFeaturePropertyValue *correctDeformation = renderer->m_Declaration.FindProperty(PopcornFX::BasicRendererProperties::SID_CorrectDeformation());
m_Flags.m_HasRibbonCorrectDeformation = correctDeformation != null ? correctDeformation->ValueB() : false;
m_Flags.m_HasRibbonCorrectDeformation = renderer->m_Declaration.IsFeatureEnabled(PopcornFX::BasicRendererProperties::SID_CorrectDeformation());
}
else if (renderer->m_RendererType == PopcornFX::Renderer_Mesh)
{
Expand Down Expand Up @@ -412,13 +402,7 @@ bool CMaterialDesc_GameThread::GameThread_Setup()
return false;
}
else
{
const PopcornFX::SRendererFeaturePropertyValue *lightsTranslucent = m_Renderer->m_Declaration.FindProperty(PopcornFX::BasicRendererProperties::SID_LightTranslucent());
m_LightsTranslucent = lightsTranslucent != null ? lightsTranslucent->ValueB() : false;

const PopcornFX::SRendererFeaturePropertyValue *castShadows = m_Renderer->m_Declaration.FindProperty(PopcornFX::BasicRendererProperties::SID_LegacyLit_CastShadows());
m_CastShadows = castShadows != null ? castShadows->ValueB() : false;
}
m_LightsTranslucent = m_Renderer->m_Declaration.IsFeatureEnabled(PopcornFX::BasicRendererProperties::SID_LightTranslucent());
}
else
{
Expand Down
55 changes: 29 additions & 26 deletions Source/PopcornFX/Private/World/PopcornFXEmitterComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ UPopcornFXEmitterComponent::UPopcornFXEmitterComponent(const FObjectInitializer&

AttributeList = CreateDefaultSubobject<UPopcornFXAttributeList>("AttributeList");

//UE_LOG(LogPopcornFXEmitterComponent, Log, TEXT("EMITTERCOMP ctor attrlist %p"), AttributeList);

AttributeList->SetFlags(RF_Transactional);
AttributeList->CheckEmitter(this);

Expand All @@ -141,16 +139,6 @@ UPopcornFXEmitterComponent::~UPopcornFXEmitterComponent()
UE_LOG(LogPopcornFXEmitterComponent, Log, TEXT("UPopcornFXEmitterComponent::dtor '%p'"), this);
#endif // HEAVY_DEBUG

#if 0
#if defined(PK_DEBUG)
if (m_CurrentScene != null)
m_CurrentScene->RegisterDestroyedEmitter(this);
#endif // defined(PK_DEBUG)
#endif // 0

// Last-minute terminate call. we need to unregister from the owner scene.
TerminateEmitter();

check(m_EffectInstancePtr == null);
check(m_Started == false);
check(!SelfSceneIsRegistered());
Expand Down Expand Up @@ -198,8 +186,6 @@ bool UPopcornFXEmitterComponent::ResolveScene(bool warnIFN)
SpawnPreviewSceneIFN(world);
#endif // WITH_EDITOR
}
//if (!found)
// UE_LOG(LogPopcornFXEmitterComponent, Warning, TEXT("Emitter '%s': scene '%s' not found"), *GetFullName(), *(SceneName.ToString()));
}

m_CurrentScene = Scene != null ? Scene->ParticleScene() : null;
Expand Down Expand Up @@ -272,11 +258,8 @@ void UPopcornFXEmitterComponent::PostEditChangeProperty(FPropertyChangedEvent& p
}
}

if (AttributeList != null)
{
PK_VERIFY(AttributeList->Prepare(Effect)); // make sure everything is up to date, always
if (IsValid(AttributeList))
AttributeList->CheckEmitter(this);
}
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -505,7 +488,11 @@ bool UPopcornFXEmitterComponent::SetEffect(UPopcornFXEffect *effect, bool startE

bool UPopcornFXEmitterComponent::StartEmitter()
{
if (m_Destroyed || IsPendingKill() || m_DiedThisFrame)
#if (ENGINE_MAJOR_VERSION == 5)
if (m_Destroyed || m_DiedThisFrame || !IsValid(this))
#else
if (m_Destroyed || m_DiedThisFrame || IsPendingKill())
#endif // (ENGINE_MAJOR_VERSION == 5)
{
UE_LOG(LogPopcornFXEmitterComponent, Warning, TEXT("Could not StartEmitter '%s' of effect '%s': emitter was destroyed"), *GetFullName(), *Effect->GetPathName());
return false;
Expand Down Expand Up @@ -620,10 +607,11 @@ bool UPopcornFXEmitterComponent::StartEmitter()
UPopcornFXAttributeList *attributeList = GetAttributeList();
PK_ASSERT(attributeList != null);

if (attributeList != null)
if (IsValid(attributeList))
{
attributeList->RefreshAttributes(this);
if (attributeList != null)
attributeList->RefreshAttributeSamplers(this, true);
}

AActor *owner = GetOwner();
bool isVisible = IsVisible();
Expand Down Expand Up @@ -700,7 +688,11 @@ void UPopcornFXEmitterComponent::OnComponentDestroyed(bool bDestroyingHierarchy)

void UPopcornFXEmitterComponent::RestartEmitter(bool killParticles)
{
if (m_Destroyed || IsPendingKill() || m_DiedThisFrame)
#if (ENGINE_MAJOR_VERSION == 5)
if (m_Destroyed || m_DiedThisFrame || !IsValid(this))
#else
if (m_Destroyed || m_DiedThisFrame || IsPendingKill())
#endif // (ENGINE_MAJOR_VERSION == 5)
{
UE_LOG(LogPopcornFXEmitterComponent, Warning, TEXT("Could not RestartEmitter '%s' of effect '%s': emitter was destroyed"), *GetFullName(), *Effect->GetPathName());
return;
Expand Down Expand Up @@ -764,7 +756,11 @@ void UPopcornFXEmitterComponent::StopEmitter(bool killParticles)

bool UPopcornFXEmitterComponent::ToggleEmitter(bool startEmitter, bool killParticles)
{
if (m_Destroyed || IsPendingKill() || m_DiedThisFrame)
#if (ENGINE_MAJOR_VERSION == 5)
if (m_Destroyed || m_DiedThisFrame || !IsValid(this))
#else
if (m_Destroyed || m_DiedThisFrame || IsPendingKill())
#endif // (ENGINE_MAJOR_VERSION == 5)
{
UE_LOG(LogPopcornFXEmitterComponent, Warning, TEXT("Could not ToggleEmitter '%s' of effect '%s': emitter was destroyed"), *GetFullName(), *Effect->GetPathName());
return false;
Expand Down Expand Up @@ -842,6 +838,12 @@ void UPopcornFXEmitterComponent::TerminateEmitter(bool killParticles)

CheckForDead(); // can call OnEmissionStops

// Force unregister
if (SelfSceneIsRegistered())
SelfSceneUnregister();
if (SelfSceneIsPreInitRegistered())
SelfPreInitSceneUnregister();

PK_ASSERT(!SelfSceneIsRegistered());
PK_ASSERT(!SelfSceneIsPreInitRegistered());
PK_ASSERT(m_EffectInstancePtr == null);
Expand Down Expand Up @@ -1321,7 +1323,7 @@ void UPopcornFXEmitterComponent::OnRegister()
// Sometimes UE reflection breaks connection with the underlying AttributeList member, not sure why.
// Returning here instead of crashing below, and UE properly re-registers the component later on..
// Ugly but does the trick (there is probably wrong done plugin side that causes this issue)
if (AttributeList == null)
if (!IsValid(AttributeList))
return;

// Avoids Prepare call on the attribute list before the PostEditChangeProperty is called
Expand Down Expand Up @@ -1593,10 +1595,11 @@ void UPopcornFXEmitterComponent::CheckForDead()
{
m_DiedThisFrame = false;

// Instance died: unregister from the scene
if (SelfSceneIsRegistered())
{
SelfSceneUnregister();
}
if (SelfSceneIsPreInitRegistered())
SelfPreInitSceneUnregister();

// if effect dies, need to unregister all events listeners
UnregisterAllEventsListeners();
Expand Down
2 changes: 1 addition & 1 deletion Source/PopcornFX/Public/PopcornFXVersionGenerated.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

#define POPCORNFX_PLUGIN_VERSION_MAJOR 2
#define POPCORNFX_PLUGIN_VERSION_MINOR 15
#define POPCORNFX_PLUGIN_VERSION_PATCH 10
#define POPCORNFX_PLUGIN_VERSION_PATCH 11
#define POPCORNFX_PLUGIN_VERSION_TAG ""

0 comments on commit a821b31

Please sign in to comment.