Compare commits

...

12 Commits
3.0.1 ... 3.2.0

Author SHA1 Message Date
semantic-release-bot
6884c62687 chore(release): 3.2.0 [skip ci]
# [3.2.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.1.1...3.2.0) (2020-11-15)

### Features

* compatibility with other IMaterialModifier ([08273cb](08273cb0c3)), closes [#115](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/115)
2020-11-15 18:08:38 +00:00
mob-sakai
fc4bd708fd refactor: refactor 2020-11-16 03:07:35 +09:00
mob-sakai
08273cb0c3 feat: compatibility with other IMaterialModifier
Close #115
2020-11-16 03:07:24 +09:00
semantic-release-bot
06d8fae58f chore(release): 3.1.1 [skip ci]
## [3.1.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.1.0...3.1.1) (2020-11-09)

### Bug Fixes

* error on build in Unity 2019.3.11-15 ([68669c7](68669c7396)), closes [#114](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/114)
* null Reference when creating New Scene after Prefab was open in PrefabMode ([22bcecd](22bcecd0ab)), closes [#111](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/111)
2020-11-09 16:52:34 +00:00
mob-sakai
22bcecd0ab fix: null Reference when creating New Scene after Prefab was open in PrefabMode
Close #111
2020-11-10 01:51:24 +09:00
mob-sakai
68669c7396 fix: error on build in Unity 2019.3.11-15
Close #114
2020-11-10 01:44:24 +09:00
mob-sakai
1b1ca56461 docs: update readme 2020-10-29 02:13:45 +09:00
semantic-release-bot
b322db3ca9 chore(release): 3.1.0 [skip ci]
# [3.1.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.0.1...3.1.0) (2020-10-28)

### Bug Fixes

* compile error in 2018.2 ([82f81ef](82f81efd7e))

### Features

* maskable option to ignore masking ([af5f7e9](af5f7e90b0)), closes [#109](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/109)
2020-10-28 17:05:39 +00:00
mob-sakai
44beab0de8 test: update test workflow 2020-10-29 01:57:17 +09:00
mob-sakai
82f81efd7e fix: compile error in 2018.2 2020-10-29 01:57:17 +09:00
mob-sakai
af5f7e90b0 feat: maskable option to ignore masking
Close #109
2020-10-28 22:19:15 +09:00
mob-sakai
3d8f11ba82 docs: add warning for the obsolete tags and branches 2020-10-28 13:13:11 +09:00
8 changed files with 101 additions and 74 deletions

View File

@@ -1,5 +1,3 @@
# Secrets
# ULF_REPO: Git repository url contains ulf files. https://mob-sakai:{{token}}@github.com/mob-sakai/ulfs.git
name: unity-test name: unity-test
on: on:
@@ -14,29 +12,20 @@ on:
- synchronize - synchronize
jobs: jobs:
release-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
npm i --no-save https://gist.github.com/mob-sakai/c90044338361af97a7e8c8a78425bdb3
npx semantic-release -e @mob-sakai/semantic-release-upm --dry-run --branches develop
env:
GITHUB_TOKEN: ${{ github.token }}
unity-test: unity-test:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
unity: unity:
[ [
"2018.3.14f1",
"2018.4.25f1", "2018.4.25f1",
"2019.4.10f1", "2019.1.14f1",
"2019.2.11f1",
"2019.3.15f1",
"2019.4.8f1",
"2020.1.5f1", "2020.1.5f1",
] ]
env:
RUN_UNITY: "xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath ."
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
@@ -48,41 +37,13 @@ jobs:
- name: Activate Unity Editor - name: Activate Unity Editor
id: activation id: activation
run: | run: |
# Clone ulfs. apt-get update > /dev/null
apt-get update apt-get install software-properties-common -y > /dev/null
apt-get install software-properties-common -y apt-add-repository ppa:git-core/ppa -y > /dev/null
apt-add-repository ppa:git-core/ppa -y apt-get update > /dev/null
apt-get update apt-get install git -y > /dev/null
apt-get install git -y git clone https://gist.github.com/135c940b45ec4e385861c8711777db7f.git .ulfs
git clone --depth 1 ${ULF_REPO} .ulfs chmod 755 .ulfs/activate.sh && .ulfs/activate.sh ${{ matrix.unity }}
# Activate with ulf.
ULF_FILE=.ulfs/Unity_v${UNITY_VERSION}.ulf
echo $ULF_FILE
if [ -e ${ULF_FILE} ]; then
/opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -manualLicenseFile ${ULF_FILE} \
| grep -E 'LICENSE SYSTEM.*\w{32} != \w{32}' && FAILED=true
else
echo "::error:: ulf file '${ULF_FILE}' is not found."
FAILED=true
fi
# Activation failed.
if [ $FAILED ]; then
echo "::error:: the unity activation may have failed. manual activation is required.%0A \
1. download the artifact's .alf file.%0A \
2. Go to https://license.unity3d.com/manual to activate manually.%0A \
3. Generate a .ulf file from the .alf file and download it.%0A \
4. Rename .ulf to 'Unity_v${UNITY_VERSION}.ulf'.%0A \
5. Add file to ulfs repository.%0A \
5. Re-run the jobs."
/opt/Unity/Editor/Unity -quit -batchmode -nographics -logFile -createManualActivationFile
exit 1
fi
env:
ULF_REPO: ${{ secrets.ULF_REPO }}
UNITY_VERSION: ${{ matrix.unity }}
# (On failed activation) Upload unity activation file # (On failed activation) Upload unity activation file
- name: Upload unity activation file - name: Upload unity activation file
@@ -92,40 +53,46 @@ jobs:
name: Unity_v${{ matrix.unity }}.alf name: Unity_v${{ matrix.unity }}.alf
path: ./*.alf path: ./*.alf
# Setup testspace
- uses: testspace-com/setup-testspace@v1
with:
domain: ${{ github.repository_owner }}
# Checkout sandbox project # Checkout sandbox project
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
ref: "sandbox" ref: "sandbox"
submodules: "true" submodules: "true"
fetch-depth: "1"
# Update package submodule # Update package submodule
- name: "Update package submodule" - name: "Update package submodule"
working-directory: Packages/dev working-directory: Packages/dev
run: git checkout ${{ github.head_ref }} run: git checkout ${{ github.head_ref }}
# Install codecoverage package
- name: "Install codecoverage package"
if: always() && steps.activation.conclusion == 'success'
run: |
[ -n "`echo ${{ matrix.unity }} | grep -e '\(2017.\|2018.\|2019.1.\|2019.2.\)'`" ] && exit 0
npm i -g openupm-cli
openupm add com.unity.testtools.codecoverage
# Run playmode tests # Run playmode tests
- name: "Run playmode tests" - name: "Run playmode tests"
if: always() && steps.activation.conclusion == 'success' if: always() && steps.activation.conclusion == 'success'
run: | run: |
# Install codecoverage xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
if [ -z "`echo ${{ matrix.unity }} | grep 2018.`" ]; then /opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . \
npm i -g openupm-cli -runTests -testPlatform playmode -enableCodeCoverage
openupm add com.unity.testtools.codecoverage
fi
$RUN_UNITY -runTests -testPlatform playmode -enableCodeCoverage || exit 0
# Run editmode tests # Run editmode tests
- name: "Run editmode tests" - name: "Run editmode tests"
if: always() && steps.activation.conclusion == 'success' if: always() && steps.activation.conclusion == 'success'
run: | run: |
$RUN_UNITY -runTests -testPlatform editmode -enableCodeCoverage || exit 0 xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . \
-runTests -testPlatform editmode -enableCodeCoverage
# Setup testspace
- uses: testspace-com/setup-testspace@v1
if: always() && steps.activation.conclusion == 'success'
with:
domain: ${{ github.repository_owner }}
# Push test results # Push test results
- name: Push test results - name: Push test results

View File

@@ -1,3 +1,30 @@
# [3.2.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.1.1...3.2.0) (2020-11-15)
### Features
* compatibility with other IMaterialModifier ([08273cb](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/08273cb0c340ccb4f35120dc804c37d758da9ce1)), closes [#115](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/115)
## [3.1.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.1.0...3.1.1) (2020-11-09)
### Bug Fixes
* error on build in Unity 2019.3.11-15 ([68669c7](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/68669c739676f2354db4913a0e2296ab1715ee1f)), closes [#114](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/114)
* null Reference when creating New Scene after Prefab was open in PrefabMode ([22bcecd](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/22bcecd0abd6ad651fcf066e5c9efe9a43fd217a)), closes [#111](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/111)
# [3.1.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.0.1...3.1.0) (2020-10-28)
### Bug Fixes
* compile error in 2018.2 ([82f81ef](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/82f81efd7e4ea06465e24f44f96d9726a1a60cc8))
### Features
* maskable option to ignore masking ([af5f7e9](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/af5f7e90b0570d5c7fcf045fd6b81036a060e493)), closes [#109](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/109)
## [3.0.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.0.0...3.0.1) (2020-10-28) ## [3.0.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.0.0...3.0.1) (2020-10-28)

View File

@@ -1,6 +1,8 @@
Particle Effect For UGUI (UI Particle) Particle Effect For UGUI (UI Particle)
=== ===
**:warning: NOTE: Do not use [the obsolete tags and branches](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/108) to reference the package. They will be removed in near future. :warning:**
This plugin provide a component to render particle effect for uGUI in Unity 2018.2 or later. This plugin provide a component to render particle effect for uGUI in Unity 2018.2 or later.
The particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas. The particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.
@@ -58,7 +60,7 @@ Compares this "Baking mesh" approach with the conventional approach:
## Demo ## Demo
* [WebGL Demo](http://mob-sakai.github.io/ParticleEffectForUGUI) * [WebGL Demo](https://mob-sakai.github.io/Demos/ParticleEffectForUGUI)
* [WebGL Demo (Cartoon FX & War FX)](https://mob-sakai.github.io/Demos/ParticleEffectForUGUI_CFX) * [WebGL Demo (Cartoon FX & War FX)](https://mob-sakai.github.io/Demos/ParticleEffectForUGUI_CFX)
* [Cartoon FX Free][CFX] & [War FX][WFX] (by [Jean Moreno (JMO)][JMO]) with UIParticle * [Cartoon FX Free][CFX] & [War FX][WFX] (by [Jean Moreno (JMO)][JMO]) with UIParticle

View File

@@ -25,6 +25,7 @@ namespace Coffee.UIExtensions
private static readonly List<UIParticle> s_TempParents = new List<UIParticle>(); private static readonly List<UIParticle> s_TempParents = new List<UIParticle>();
private static readonly List<UIParticle> s_TempChildren = new List<UIParticle>(); private static readonly List<UIParticle> s_TempChildren = new List<UIParticle>();
private SerializedProperty _spMaskable;
private SerializedProperty _spScale; private SerializedProperty _spScale;
private SerializedProperty _spIgnoreCanvasScaler; private SerializedProperty _spIgnoreCanvasScaler;
private SerializedProperty _spAnimatableProperties; private SerializedProperty _spAnimatableProperties;
@@ -52,6 +53,7 @@ namespace Coffee.UIExtensions
protected override void OnEnable() protected override void OnEnable()
{ {
base.OnEnable(); base.OnEnable();
_spMaskable = serializedObject.FindProperty("m_Maskable");
_spScale = serializedObject.FindProperty("m_Scale3D"); _spScale = serializedObject.FindProperty("m_Scale3D");
_spIgnoreCanvasScaler = serializedObject.FindProperty("m_IgnoreCanvasScaler"); _spIgnoreCanvasScaler = serializedObject.FindProperty("m_IgnoreCanvasScaler");
_spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties"); _spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties");
@@ -87,11 +89,11 @@ namespace Coffee.UIExtensions
{ {
EditorGUI.LabelField(new Rect(rect.x, rect.y, 150, rect.height), s_ContentRenderingOrder); EditorGUI.LabelField(new Rect(rect.x, rect.y, 150, rect.height), s_ContentRenderingOrder);
#if UNITY_2019_3_OR_NEWER #if UNITY_2019_3_OR_NEWER
rect = new Rect(rect.width - 55, rect.y, 80, rect.height); rect = new Rect(rect.width - 55, rect.y, 80, rect.height);
#else #else
rect = new Rect(rect.width - 55, rect.y - 1, 80, rect.height); rect = new Rect(rect.width - 55, rect.y - 1, 80, rect.height);
#endif #endif
if (GUI.Button(rect, s_ContentRefresh, EditorStyles.miniButton)) if (GUI.Button(rect, s_ContentRefresh, EditorStyles.miniButton))
{ {
@@ -127,6 +129,9 @@ namespace Coffee.UIExtensions
serializedObject.Update(); serializedObject.Update();
// Maskable
EditorGUILayout.PropertyField(_spMaskable);
// IgnoreCanvasScaler // IgnoreCanvasScaler
using (var ccs = new EditorGUI.ChangeCheckScope()) using (var ccs = new EditorGUI.ChangeCheckScope())
{ {

View File

@@ -1,3 +1,6 @@
#if UNITY_2019_3_11 || UNITY_2019_3_12 || UNITY_2019_3_13 || UNITY_2019_3_14 || UNITY_2019_3_15 || UNITY_2019_4_OR_NEWER
#define SERIALIZE_FIELD_MASKABLE
#endif
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Coffee.UIParticleExtensions; using Coffee.UIParticleExtensions;
@@ -38,6 +41,10 @@ namespace Coffee.UIExtensions
[Tooltip("Particles")] [SerializeField] [Tooltip("Particles")] [SerializeField]
private List<ParticleSystem> m_Particles = new List<ParticleSystem>(); private List<ParticleSystem> m_Particles = new List<ParticleSystem>();
#if !SERIALIZE_FIELD_MASKABLE
[SerializeField] private bool m_Maskable = true;
#endif
private bool _shouldBeRemoved; private bool _shouldBeRemoved;
private DrivenRectTransformTracker _tracker; private DrivenRectTransformTracker _tracker;
private Mesh _bakedMesh; private Mesh _bakedMesh;
@@ -49,6 +56,7 @@ namespace Coffee.UIExtensions
private static MaterialPropertyBlock s_Mpb; private static MaterialPropertyBlock s_Mpb;
private static readonly List<Material> s_PrevMaskMaterials = new List<Material>(); private static readonly List<Material> s_PrevMaskMaterials = new List<Material>();
private static readonly List<Material> s_PrevModifiedMaterials = new List<Material>(); private static readonly List<Material> s_PrevModifiedMaterials = new List<Material>();
private static readonly List<Component> s_Components = new List<Component>();
/// <summary> /// <summary>
@@ -116,6 +124,11 @@ namespace Coffee.UIExtensions
get { return _modifiedMaterials; } get { return _modifiedMaterials; }
} }
public override Material materialForRendering
{
get { return canvasRenderer.GetMaterial(0); }
}
public List<bool> activeMeshIndices public List<bool> activeMeshIndices
{ {
get { return _activeMeshIndices; } get { return _activeMeshIndices; }
@@ -242,6 +255,7 @@ namespace Coffee.UIExtensions
} }
// //
GetComponents(typeof(IMaterialModifier), s_Components);
var materialCount = Mathf.Max(8, count); var materialCount = Mathf.Max(8, count);
canvasRenderer.materialCount = materialCount; canvasRenderer.materialCount = materialCount;
var j = 0; var j = 0;
@@ -260,6 +274,8 @@ namespace Coffee.UIExtensions
if (activeMeshIndices[index] && 0 < s_TempMaterials.Count) if (activeMeshIndices[index] && 0 < s_TempMaterials.Count)
{ {
var mat = GetModifiedMaterial(s_TempMaterials[0], ps.GetTextureForSprite()); var mat = GetModifiedMaterial(s_TempMaterials[0], ps.GetTextureForSprite());
for (var k = 1; k < s_Components.Count; k++)
mat = (s_Components[k] as IMaterialModifier).GetModifiedMaterial(mat);
canvasRenderer.SetMaterial(mat, j); canvasRenderer.SetMaterial(mat, j);
UpdateMaterialProperties(r, j); UpdateMaterialProperties(r, j);
j++; j++;
@@ -271,6 +287,8 @@ namespace Coffee.UIExtensions
if (activeMeshIndices[index] && 1 < s_TempMaterials.Count) if (activeMeshIndices[index] && 1 < s_TempMaterials.Count)
{ {
var mat = GetModifiedMaterial(s_TempMaterials[1], null); var mat = GetModifiedMaterial(s_TempMaterials[1], null);
for (var k = 1; k < s_Components.Count; k++)
mat = (s_Components[k] as IMaterialModifier).GetModifiedMaterial(mat);
canvasRenderer.SetMaterial(mat, j++); canvasRenderer.SetMaterial(mat, j++);
} }
} }
@@ -350,6 +368,9 @@ namespace Coffee.UIExtensions
/// </summary> /// </summary>
protected override void OnEnable() protected override void OnEnable()
{ {
#if !SERIALIZE_FIELD_MASKABLE
maskable = m_Maskable;
#endif
_cachedPosition = transform.localPosition; _cachedPosition = transform.localPosition;
activeMeshIndices.Clear(); activeMeshIndices.Clear();
@@ -440,6 +461,9 @@ namespace Coffee.UIExtensions
SetVerticesDirty(); SetVerticesDirty();
m_ShouldRecalculateStencil = true; m_ShouldRecalculateStencil = true;
RecalculateClipping(); RecalculateClipping();
#if !SERIALIZE_FIELD_MASKABLE
maskable = m_Maskable;
#endif
} }
void ISerializationCallbackReceiver.OnBeforeSerialize() void ISerializationCallbackReceiver.OnBeforeSerialize()

View File

@@ -59,7 +59,7 @@ namespace Coffee.UIExtensions
private static void Refresh(UIParticle particle) private static void Refresh(UIParticle particle)
{ {
if (!particle || !particle.canvas || !particle.canvasRenderer) return; if (!particle || !particle.bakedMesh || !particle.canvas || !particle.canvasRenderer) return;
Profiler.BeginSample("[UIParticle] Modify scale"); Profiler.BeginSample("[UIParticle] Modify scale");
ModifyScale(particle); ModifyScale(particle);
@@ -211,9 +211,11 @@ namespace Coffee.UIExtensions
Profiler.EndSample(); Profiler.EndSample();
} }
#if UNITY_2018_3_OR_NEWER
// #102: Do not bake particle system to mesh when the alpha is zero. // #102: Do not bake particle system to mesh when the alpha is zero.
if (Mathf.Approximately(particle.canvasRenderer.GetInheritedAlpha(), 0)) if (Mathf.Approximately(particle.canvasRenderer.GetInheritedAlpha(), 0))
continue; continue;
#endif
// Bake main particles. // Bake main particles.
var r = currentPs.GetComponent<ParticleSystemRenderer>(); var r = currentPs.GetComponent<ParticleSystemRenderer>();

View File

@@ -210,10 +210,10 @@ namespace Coffee.UIParticleExtensions
// Z position & sortingFudge: descending // Z position & sortingFudge: descending
var aTransform = a.transform; var aTransform = a.transform;
var bTransform = b.transform; var bTransform = b.transform;
var aPos = tr.InverseTransformPoint(aTransform.position).z+ aRenderer.sortingFudge; var aPos = tr.InverseTransformPoint(aTransform.position).z + aRenderer.sortingFudge;
var bPos = tr.InverseTransformPoint(bTransform.position).z+ bRenderer.sortingFudge; var bPos = tr.InverseTransformPoint(bTransform.position).z + bRenderer.sortingFudge;
if (!Mathf.Approximately(aPos, bPos)) if (!Mathf.Approximately(aPos, bPos))
return (int)Mathf.Sign(bPos - aPos); return (int) Mathf.Sign(bPos - aPos);
// Material instance ID: match // Material instance ID: match
if (aMat.GetInstanceID() == bMat.GetInstanceID()) if (aMat.GetInstanceID() == bMat.GetInstanceID())

View File

@@ -2,7 +2,7 @@
"name": "com.coffee.ui-particle", "name": "com.coffee.ui-particle",
"displayName": "UI Particle", "displayName": "UI Particle",
"description": "This plugin provide a component to render particle effect for uGUI.\nThe particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.", "description": "This plugin provide a component to render particle effect for uGUI.\nThe particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.",
"version": "3.0.1", "version": "3.2.0",
"unity": "2018.2", "unity": "2018.2",
"license": "MIT", "license": "MIT",
"repository": { "repository": {