Skip to content

Commit

Permalink
UnityPlugin: Release 2.19.6
Browse files Browse the repository at this point in the history
  • Loading branch information
PopcornFX Bot committed Jul 25, 2024
1 parent 0f3027c commit 40929b7
Show file tree
Hide file tree
Showing 63 changed files with 3,516 additions and 1,867 deletions.
25 changes: 24 additions & 1 deletion Native/EditorOnly/AssetBaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,20 @@ CEffectBaker::~CEffectBaker()
{
}


bool CEffectBaker::IsPathOnIgnorePath(const CString &path) const
{
for (const CString &Ignoredpath : m_IgnoredPaths)
{
if (path.StartsWith(Ignoredpath))
return true;
}
return false;
}

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

void CEffectBaker::FileAdded(const CString &path)
void CEffectBaker::FileAdded(const CString &path)
{
if (path.EndsWith(".pkfx") == true)
{
Expand All @@ -368,6 +379,9 @@ void CEffectBaker::FileAdded(const CString &path)
return;
CString cleanPath = path.Extract(m_PKPackPath.SlashAppended().Length(), path.Length());
CFilePath::Purify(cleanPath);

if (IsPathOnIgnorePath(cleanPath))
return;
effect.m_EffectPath = cleanPath;
effect.m_Type = EAssetChangesType::Add;
effect.m_Try = 0;
Expand All @@ -390,6 +404,8 @@ void CEffectBaker::FileRemoved(const CString &path)
return;
CString cleanPath = path.Extract(m_PKPackPath.SlashAppended().Length(), path.Length());
CFilePath::Purify(cleanPath);
if (IsPathOnIgnorePath(cleanPath))
return;
effect.m_EffectPath = cleanPath;
effect.m_Type = EAssetChangesType::Remove;

Expand All @@ -411,6 +427,8 @@ void CEffectBaker::FileChanged(const CString &path)
return;
CString cleanPath = path.Extract(m_PKPackPath.SlashAppended().Length(), path.Length());
CFilePath::Purify(cleanPath);
if (IsPathOnIgnorePath(cleanPath))
return;

CEffectBaker::FileChangedRelativePath(cleanPath);
}
Expand Down Expand Up @@ -448,6 +466,8 @@ void CEffectBaker::FileRenamed(const CString &oldPath, const CString &newPath)
CString cleanOldPath = oldPath.Extract(m_PKPackPath.SlashAppended().Length(), oldPath.Length());
CFilePath::Purify(cleanPath);

if (IsPathOnIgnorePath(cleanPath))
return;
effect.m_EffectPath = cleanPath;
effect.m_EffectPathOld = cleanOldPath;
effect.m_Type = EAssetChangesType::Rename;
Expand Down Expand Up @@ -502,8 +522,11 @@ void CEffectBaker::Initialize(const char *pKPackPath, const char *targetPlatfo
m_ProjectSettings->ApplyGlobalSettings();

PProjectSettingsGeneral general = m_ProjectSettings->General();
PProjectSettingsAssets asset = m_ProjectSettings->Assets();
const CString relRoot = general->RootDir();
const CString ignoredPath = asset->IgnoredPaths();

ignoredPath.Split(';', m_IgnoredPaths);
m_PKPackPath = relRoot.Compare(".") ? CString(pKPackPath) : CString(pKPackPath) + "/" + relRoot;
m_PKSourcePack = m_BakeContext.m_BakeFSController->MountPack(m_PKPackPath);

Expand Down
2 changes: 2 additions & 0 deletions Native/EditorOnly/AssetBaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class CEffectBaker : public CRefCountedObject
CEffectBaker();
~CEffectBaker();

bool IsPathOnIgnorePath(const CString &path) const;
void FileAdded(const CString &path);
void FileRemoved(const CString &path);
void FileChanged(const CString &path);
Expand Down Expand Up @@ -136,6 +137,7 @@ class CEffectBaker : public CRefCountedObject
private:
const int m_MaxBakeRetry = 5;

TArray<CString> m_IgnoredPaths;
TArray<SAssetChange> m_ToProcess;
TArray<SAssetChange> m_ToBake;
CString m_PKPackPath;
Expand Down
49 changes: 31 additions & 18 deletions Native/EditorOnly/BrowseEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ static CString PatchPathForAnimTrack(const CString &path)
return patchedPath;
}

static CString PatchPathForMeshSampler(const CString &path)
{
CString patchedPath;

if (path.EndsWith(".fbx", CaseInsensitive))
{
patchedPath = path.Extract(0, path.Length() - 4);
patchedPath += ".pkmm";
}
else
patchedPath = path;
return patchedPath;
}

struct SUnityDependencyAppendHelper
{
TArray<SResourceDependency> *m_OutListUnique;
Expand Down Expand Up @@ -315,6 +329,8 @@ bool CEffectBrowser::LoadAndBrowseEffect(void *pkfxContentPtr, int contentByteSi

bool CEffectBrowser::BrowseEffect(const PParticleEffect &particleEffect, PBaseObjectFile &file, bool browseAttributes, bool &requiresGameThreadCollect)
{
if (!PK_VERIFY(particleEffect != null))
return false;

TArray<SResourceDependency> dependencies;
SUnityDependencyAppendHelper dependenciesAppend(dependencies);
Expand All @@ -335,25 +351,21 @@ bool CEffectBrowser::BrowseEffect(const PParticleEffect &particleEffect, PBaseOb
if (!BrowseRenderers(particleEffect.Get(), file.Get(), requiresGameThreadCollect))
return false;

if (!BrowseExportedEvents(particleEffect.Get()))
return false;

if (browseAttributes)
{
if (PK_VERIFY(particleEffect != null))
{
const CParticleAttributeList *allAttribList = particleEffect->AttributeFlatList();
if (!BrowseExportedEvents(particleEffect.Get()))
return false;

if (allAttribList != null)
{
CParticleAttributeList::_TypeOfAttributeList attributeList = allAttribList->AttributeList();
CParticleAttributeList::_TypeOfSamplerList samplerList = allAttribList->SamplerList();
const TMemoryView<const u32> attributeRemapIDs = allAttribList->UniqueAttributeIDs();
const CParticleAttributeList *allAttribList = particleEffect->AttributeFlatList();
if (allAttribList != null)
{
CParticleAttributeList::_TypeOfAttributeList attributeList = allAttribList->AttributeList();
CParticleAttributeList::_TypeOfSamplerList samplerList = allAttribList->SamplerList();
const TMemoryView<const u32> attributeRemapIDs = allAttribList->UniqueAttributeIDs();

if (!BrowseAttributes(attributeList, attributeRemapIDs) ||
!BrowseSamplers(samplerList))
return false;
}
if (!BrowseAttributes(attributeList, attributeRemapIDs) ||
!BrowseSamplers(samplerList))
return false;
}
}
return true;
Expand Down Expand Up @@ -402,6 +414,7 @@ bool CEffectBrowser::BrowseObjectForDependencies(TArray<SResourceDependency> &de
if (dependency.m_Type == SResourceDependency::Type_Mesh) // && (dependency.m_Usage & SResourceDependency::UsageFlags_Mesh_Sample))
{
dependencyMask |= IsMeshSampler;
path = PatchPathForMeshSampler(path);
}
else if (dependency.m_Type == SResourceDependency::Type_Image &&
((dependency.m_Usage & SResourceDependency::UsageFlags_Image_Values) ||
Expand All @@ -411,7 +424,7 @@ bool CEffectBrowser::BrowseObjectForDependencies(TArray<SResourceDependency> &de
}
else if (dependency.m_Type == SResourceDependency::Type_AnimTrack)
{
path = PatchPathForAnimTrack(path); // GOOD
path = PatchPathForAnimTrack(path);
}
::OnEffectDependencyFound(path.Data(), dependencyMask);
}
Expand Down Expand Up @@ -596,7 +609,7 @@ bool CEffectBrowser::BrowseAttributes(const CParticleAttributeList::_TypeOfAttri
u32 declId = remapIds[i]; // We register the attributes in the order they are in the attribute container
const CParticleAttributeDeclaration *attrib = attributeList[declId].Get();

if (attrib != null)
if (attrib != null && !attrib->IsPrivate())
{
SFxAttributeDesc attribDesc;

Expand Down Expand Up @@ -665,7 +678,7 @@ bool CEffectBrowser::BrowseSamplers(const CParticleAttributeList::_TypeOfSampler
{
const CParticleAttributeSamplerDeclaration *sampler = samplerList[i].Get();

if (sampler != null)
if (sampler != null && !sampler->IsPrivate())
{
CResourceDescriptor *samplerData = sampler->AttribSamplerDefaultValue();
SFxSamplerDesc samplerDesc;
Expand Down
9 changes: 7 additions & 2 deletions Native/ImplemGraphicsAPI/RenderAPI_Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ SFlagsToUseSemantic flagsToUseSemantic[__Semantic_Count] =
{ 0U, ShaderVariationFlags::Has_CorrectDeformation }, // Semantic_UvScaleAndOffset
{ ShaderVariationFlags::Has_CorrectDeformation, ShaderVariationFlags::Has_DiffuseMap | ShaderVariationFlags::Has_DistortionMap }, // Semantic_Uv0
{ 0U, ShaderVariationFlags::Has_AnimBlend }, // Semantic_Uv1
{ 0U, ShaderVariationFlags::Has_AnimBlend }, // Semantic_AtlasId
{ 0U, ShaderVariationFlags::Has_AnimBlend | ShaderVariationFlags::Has_TransformUVs }, // Semantic_AtlasId
{ 0U, ShaderVariationFlags::Has_AlphaRemap }, // Semantic_AlphaCursor
{ 0U, ShaderVariationFlags::Has_Emissive }, // Semantic_EmissiveColor
{ 0U, ShaderVariationFlags::Has_TransformUVs }, // Semantic_TransformUvsRotate
Expand Down Expand Up @@ -311,7 +311,12 @@ u32 FillOffsetTableAndGetVertexBufferStride(u32 offsetTable[__Semantic_Count], u
(shaderVariationFlags & ShaderVariationFlags::Has_AnimBlend) == 0)
{
offsetTable[Semantic_TransformUVsRotate] = vertexOffset;
vertexOffset += semanticSize[Semantic_TransformUVsRotate] + sizeof(float);// Padding;
vertexOffset += semanticSize[Semantic_TransformUVsRotate];
if ((shaderVariationFlags & ShaderVariationFlags::Has_Atlas) != 0)
{
offsetTable[Semantic_AtlasId] = vertexOffset;
vertexOffset += semanticSize[Semantic_AtlasId];
}
}
offsetTable[Semantic_TransformUVsScaleAndOffset] = vertexOffset;
vertexOffset += semanticSize[Semantic_TransformUVsScaleAndOffset];
Expand Down
22 changes: 19 additions & 3 deletions Native/RenderingIntegration/UnityBillboardingBatchPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,13 +1200,14 @@ bool CUnityBillboardingBatchPolicy::_RenderThread_AllocBillboardingBuffers(const

m_ParticleBuffers.m_TexCoords0.ResizeIFN(Drawers::GenInput_UV0, genInputs.m_GeneratedInputs, m_ParticleBuffers.m_GeneratedInputs, m_VertexCount);
m_ParticleBuffers.m_TexCoords1.ResizeIFN(Drawers::GenInput_UV1, genInputs.m_GeneratedInputs, m_ParticleBuffers.m_GeneratedInputs, m_VertexCount);
m_ParticleBuffers.m_AtlasId.ResizeIFN(Drawers::GenInput_AtlasId, genInputs.m_GeneratedInputs, m_ParticleBuffers.m_GeneratedInputs, m_VertexCount);
m_ParticleBuffers.m_UVRemap.ResizeIFN(Drawers::GenInput_UVRemap, genInputs.m_GeneratedInputs, m_ParticleBuffers.m_GeneratedInputs, m_VertexCount);

if (_FindAdditionalInput(BasicRendererProperties::SID_Diffuse_Color(), BaseType_Float4, genInputs))
m_ParticleBuffers.m_Colors.ResizeIFN(m_VertexCount);
m_ParticleBuffers.m_Colors.ResizeIFN(m_VertexCount);
if (_FindAdditionalInput(BasicRendererProperties::SID_Atlas_TextureID(), BaseType_Float, genInputs))
m_ParticleBuffers.m_AtlasId.ResizeIFN(m_VertexCount);
if (_FindAdditionalInput(BasicRendererProperties::SID_Emissive_EmissiveColor(), BaseType_Float3, genInputs))
m_ParticleBuffers.m_EmissiveColors.ResizeIFN(m_VertexCount);
m_ParticleBuffers.m_EmissiveColors.ResizeIFN(m_VertexCount);
if (_FindAdditionalInput(BasicRendererProperties::SID_AlphaRemap_Cursor(), BaseType_Float, genInputs))
m_ParticleBuffers.m_AlphaCursor.ResizeIFN(m_VertexCount);

Expand Down Expand Up @@ -1308,6 +1309,17 @@ bool CUnityBillboardingBatchPolicy::_RenderThread_SetupBuffersBillboards(const S
field.m_Storage.m_RawDataPtr = (u8*)m_ParticleBuffers.m_Colors.m_Ptr;
field.m_Storage.m_Stride = sizeof(CFloat4);
}
else if (addInput.m_Name == BasicRendererProperties::SID_Atlas_TextureID() && addInput.m_Type == BaseType_Float)
{
if (!PK_VERIFY(m_ParticleBuffers.m_AdditionalFieldsBuffers.PushBack().Valid()))
return false;
Drawers::SCopyFieldDesc &field = m_ParticleBuffers.m_AdditionalFieldsBuffers.Last();
field.m_AdditionalInputIndex = i;

field.m_Storage.m_Count = m_VertexCount;
field.m_Storage.m_RawDataPtr = (u8 *)m_ParticleBuffers.m_AtlasId.m_Ptr;
field.m_Storage.m_Stride = sizeof(float);
}
else if (addInput.m_Name == BasicRendererProperties::SID_Emissive_EmissiveColor() && addInput.m_Type == BaseType_Float3)
{
if (!PK_VERIFY(m_ParticleBuffers.m_AdditionalFieldsBuffers.PushBack().Valid()))
Expand Down Expand Up @@ -2054,6 +2066,10 @@ void CUnityBillboardingBatchPolicy::CBillboard_Exec_SOA_OAS::_CopyData(u32 verte
(m_ShaderVariationFlags & ShaderVariationFlags::Has_AnimBlend) == 0)
{
FillTransformUVsRotate(&(m_ParticleBuffers.m_TransformUVsRotate[vertexID]), bfPtr, *m_SemanticOffsets);
if ((m_ShaderVariationFlags & ShaderVariationFlags::Has_Atlas) != 0)
{
FillAtlasId(&(m_ParticleBuffers.m_AtlasId[vertexID]), bfPtr, *m_SemanticOffsets);
}
}
FillTransformUVsScaleAndOffset(&(((CFloat2*)m_ParticleBuffers.m_TransformUVsScale)[vertexID]), &(((CFloat2*)m_ParticleBuffers.m_TransformUVsOffset)[vertexID]), bfPtr, *m_SemanticOffsets);
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Unity PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.19.5`
* **Version:** `v2.19.6`
* **Unity:** `2019.4` to `2022.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`.
[Contact-us](https://www.popcornfx.com/contact-popcornfx/) to request access to the plugin for consoles.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unity PopcornFX Plugin
Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.19.5`
* **Version:** `v2.19.6`
* **Unity:** `2019.4` to `2021.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`. [Contact-us](http://www.popcornfx.com/contact-us/) for more information.

Expand Down
2 changes: 1 addition & 1 deletion com.persistant-studios.popcornfx.hdrp/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Unity PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.19.5`
* **Version:** `v2.19.6`
* **Unity:** `2019.4` to `2022.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`.
[Contact-us](https://www.popcornfx.com/contact-popcornfx/) to request access to the plugin for consoles.
Expand Down
4 changes: 2 additions & 2 deletions com.persistant-studios.popcornfx.hdrp/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "com.persistant-studios.popcornfx.hdrp",
"description": "HDRP Materials for PopcornFX.",
"version": "2.19.5",
"version": "2.19.6",
"unity": "2020.2",
"unityRelease": "",
"displayName": "PopcornFX HDRP",
"dependencies": {
"com.unity.render-pipelines.core": "10.2.2",
"com.unity.render-pipelines.high-definition": "10.2.2",
"com.persistant-studios.popcornfx": "2.19.5"
"com.persistant-studios.popcornfx": "2.19.6"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unity PopcornFX Plugin
Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.19.5`
* **Version:** `v2.19.6`
* **Unity:** `2017.4` to `2021.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`. [Contact-us](http://www.popcornfx.com/contact-us/) for more information.

Expand Down
2 changes: 1 addition & 1 deletion com.persistant-studios.popcornfx.urp/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Unity PopcornFX Plugin

Integrates the **PopcornFX Runtime SDK** into **Unity** as a Plugin.
* **Version:** `v2.19.5`
* **Version:** `v2.19.6`
* **Unity:** `2019.4` to `2022.x`
* **Platforms:** `Windows`, `Linux`, `MacOS`, `iOS`, `Android`, `PS4`, `XboxOne`, `Switch`.
[Contact-us](https://www.popcornfx.com/contact-popcornfx/) to request access to the plugin for consoles.
Expand Down
Loading

0 comments on commit 40929b7

Please sign in to comment.