Skip to content

Commit

Permalink
UnityPlugin: Release 2.18.4
Browse files Browse the repository at this point in the history
  • Loading branch information
PopcornFX Bot committed Jan 12, 2024
1 parent db4f00a commit 4726212
Show file tree
Hide file tree
Showing 44 changed files with 157 additions and 51 deletions.
9 changes: 9 additions & 0 deletions Native/ManagedToNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,15 @@ extern "C"
}
}

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

MANAGED_TO_POPCORN_CONVENTION bool CanSkipUpdate()
{
NEED_PK_RUNTIME_STARTED(return true);
return CRuntimeManager::Instance().CanSkipUpdate();
}


#if defined(PK_COMPILER_CLANG) || defined(PK_COMPILER_GCC)
# pragma GCC visibility pop
#endif
Expand Down
2 changes: 2 additions & 0 deletions Native/NativeToManaged.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ extern "C"
CFloat4 *m_TextureAtlas;

int m_UID;
int m_DrawOrder;

SMeshRendererDesc()
: m_MeshAsset(null)
Expand All @@ -185,6 +186,7 @@ extern "C"
, m_TextureAtlasCount(0)
, m_TextureAtlas(null)
, m_UID(-1)
, m_DrawOrder(0)
{
}

Expand Down
4 changes: 2 additions & 2 deletions Native/PKUnity_Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ bool CPKFXScene::ShouldUpdatePopcorn()
}
else
{
PK_ASSERT(m_ParticleMeshMediumCollection != null);
PK_ASSERT(m_GameThreadMediumCollection != null);
PK_ASSERT(m_ParticleMediumCollection != null);

if (m_ParticleMediumCollection->CanSkipUpdate() &&
m_ParticleMeshMediumCollection->CanSkipUpdate())
m_GameThreadMediumCollection->CanSkipUpdate())
return false;
}

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.18.3`
* **Version:** `v2.18.4`
* **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.18.3`
* **Version:** `v2.18.4`
* **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.18.3`
* **Version:** `v2.18.4`
* **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.18.3",
"version": "2.18.4",
"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.18.3"
"com.persistant-studios.popcornfx": "2.18.4"
}
}
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.18.3`
* **Version:** `v2.18.4`
* **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.18.3`
* **Version:** `v2.18.4`
* **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.urp/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "com.persistant-studios.popcornfx.urp",
"description": "URP Materials for PopcornFX.",
"version": "2.18.3",
"version": "2.18.4",
"unity": "2020.2",
"unityRelease": "",
"displayName": "PopcornFX URP",
"dependencies": {
"com.unity.render-pipelines.core": "10.2.2",
"com.unity.render-pipelines.universal": "10.2.2",
"com.persistant-studios.popcornfx": "2.18.3"
"com.persistant-studios.popcornfx": "2.18.4"
}
}
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.18.3`
* **Version:** `v2.18.4`
* **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
18 changes: 16 additions & 2 deletions com.persistant-studios.popcornfx/Editor/Scripts/PKFxAssetEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,20 @@ public override void OnInspectorGUI()
serializedObject.ApplyModifiedProperties();
}

bool reimport = false;

if (rdrsListSize > 0)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Renderers : ");
using (new EditorGUI.DisabledScope(Application.isPlaying))
{
if (GUILayout.Button("Reimport Materials"))
reimport = true;
}
EditorGUILayout.EndHorizontal();
}

GUIStyle alernatingColors = new GUIStyle();
Color backgroundColor = EditorGUIUtility.isProSkin ? new Color32(56, 56, 56, 255) : new Color32(194, 194, 194, 255);

Expand Down Expand Up @@ -225,9 +239,9 @@ public override void OnInspectorGUI()
else
{
SerializedProperty matProp = mats.GetArrayElementAtIndex(index.m_Idx);
if (matProp.objectReferenceValue == null)
if (reimport || matProp.objectReferenceValue == null)
{
Material mat = PKFxSettings.MaterialFactory.EditorResolveMaterial(renderers[i], asset, false);
Material mat = PKFxSettings.MaterialFactory.EditorResolveMaterial(renderers[i], asset, reimport, true, false);
matProp.objectReferenceValue = mat;
serializedObject.ApplyModifiedProperties();
}
Expand Down
52 changes: 51 additions & 1 deletion com.persistant-studios.popcornfx/Editor/Scripts/PKFxMenus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ public static void CreatePKFxFXMaterialsIFN(bool reimport = false)
foreach (SBatchDesc batch in asset.m_RendererDescs)
{
PKFxEffectAsset.MaterialUIDToIndex index = asset.m_MaterialIndexes.Find(item => item.m_UID == batch.m_UID);
asset.m_Materials[index.m_Idx] = factory.EditorResolveMaterial(batch, asset);
asset.m_Materials[index.m_Idx] = factory.EditorResolveMaterial(batch, asset, reimport, true);
}
}
AssetDatabase.SaveAssets();
Expand All @@ -538,7 +538,57 @@ static void _CreatePKFxFXMaterialsIFN(MenuCommand menuCommand)
static public void UpdateQualityLevelSettings()
{
PKFxManager.SetQualityLevelSettings();
}

[MenuItem("Assets/PopcornFX/Delete unused PKFxFX Materials")]
static void _DeleteUnusedPKFxFXMaterials(MenuCommand menuCommand)
{
string pkfxMaterialsFolder = "Assets/" + PKFxSettings.UnityPackFxPath + "/UnityMaterials/";
string[] pkfxMaterialAssets = AssetDatabase.FindAssets("t:material", new string[] { pkfxMaterialsFolder });
Dictionary<string, bool> isUsedPkfxMaterials = new Dictionary<string, bool>();

foreach (string matGUID in pkfxMaterialAssets)
{
string matName = AssetDatabase.GUIDToAssetPath(matGUID);
matName = matName.Remove(0, pkfxMaterialsFolder.Length - 1); // Remove pkfxMaterialsFolder
matName = matName.Remove(matName.Length - 4); // Remove ".mat"
isUsedPkfxMaterials.Add(matName, false);
}

string[] pkfxEffectAssets = AssetDatabase.FindAssets("t:PKFxEffectAsset");
PKFxMaterialFactory factory = PKFxSettings.MaterialFactory;
foreach (string assetGUID in pkfxEffectAssets)
{
PKFxEffectAsset asset = (PKFxEffectAsset)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(assetGUID), typeof(PKFxEffectAsset));

foreach (SBatchDesc batch in asset.m_RendererDescs)
{
string matName = factory.EditorResolveMaterialName(batch);
if (isUsedPkfxMaterials.ContainsKey(matName))
isUsedPkfxMaterials[matName] = true;
}
}

int deleteCount = 0;

foreach (var isUsedMat in isUsedPkfxMaterials)
{
if (!isUsedMat.Value)
{
string materialPath = pkfxMaterialsFolder + isUsedMat.Key + ".mat";
AssetDatabase.DeleteAsset(materialPath);
deleteCount++;
}
}
Debug.Log("[PopcornFX] " + deleteCount + " unused PKFx material deleted.");
}

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

[MenuItem("Assets/PopcornFX/Reimport PKFxFX Materials")]
static void _ReimportKFxFXMaterials(MenuCommand menuCommand)
{
CreatePKFxFXMaterialsIFN(true);
}

//----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion com.persistant-studios.popcornfx/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.18.3`
* **Version:** `v2.18.4`
* **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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion com.persistant-studios.popcornfx/Runtime/Plugins/OSX.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion com.persistant-studios.popcornfx/Runtime/Plugins/iOS.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion com.persistant-studios.popcornfx/Runtime/Plugins/x86.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ internal partial class PKFxManagerImpl : object
//----------------------------------------------------------------------------

private const string m_UnityVersion = "Unity 2019.4 and up";
public const string m_PluginVersion = "2.18.3 for " + m_UnityVersion;
public const string m_PluginVersion = "2.18.4 for " + m_UnityVersion;
public static string m_CurrentVersionString = "";
public static bool m_IsStarted = false;
public static string m_DistortionLayer = "PopcornFX_Disto";
Expand Down
Loading

0 comments on commit 4726212

Please sign in to comment.