Compare commits

...

12 Commits

Author SHA1 Message Date
semantic-release-bot
6394eee4de chore(release): 3.3.14 [skip ci]
## [3.3.14](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.13...3.3.14) (2023-08-15)

### Bug Fixes

* error on InitializeIfNeeded ([1f1fb2a](1f1fb2a62a)), closes [#264](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/264)
2023-08-15 02:04:46 +00:00
mob-sakai
1f1fb2a62a fix: error on InitializeIfNeeded
close #264
2023-08-15 11:02:19 +09:00
semantic-release-bot
640cee9e34 chore(release): 3.3.13 [skip ci]
## [3.3.13](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.12...3.3.13) (2023-05-18)

### Bug Fixes

* memory leak when using AnimatableProperty ([3849a9f](3849a9f697))
2023-05-18 12:38:06 +00:00
mob-sakai
9dedbfb48f build: update release workflow 2023-05-18 21:37:23 +09:00
mob-sakai
3849a9f697 fix: memory leak when using AnimatableProperty 2023-05-18 21:29:36 +09:00
semantic-release-bot
69bde2cf3d chore(release): 3.3.12 [skip ci]
## [3.3.12](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.11...3.3.12) (2022-06-10)

### Bug Fixes

* always display materials in inspector ([a10042d](a10042d989))
* UNITY_UI_ALPHACLIP in UIAdditive shader is not working ([e817e8d](e817e8d3c7))
2022-06-10 11:32:11 +00:00
mob-sakai
a10042d989 fix: always display materials in inspector 2022-06-10 19:55:49 +09:00
mob-sakai
dd2d185e4a style: tab to space 2022-06-10 17:06:34 +09:00
mob-sakai
e817e8d3c7 fix: UNITY_UI_ALPHACLIP in UIAdditive shader is not working 2022-06-10 17:06:34 +09:00
semantic-release-bot
aaac2b71a3 chore(release): 3.3.11 [skip ci]
## [3.3.11](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.10...3.3.11) (2022-06-10)

### Bug Fixes

* sorting by layer does not work properly ([ccc09e6](ccc09e6aca))
* when using linear color space, the particle colors are not output correctly ([11c3a7b](11c3a7b374)), closes [#203](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/203)
2022-06-10 07:21:00 +00:00
mob-sakai
11c3a7b374 fix: when using linear color space, the particle colors are not output correctly
To fix, set 'Apply Active Color Space' in renderer module to false.

close #203
2022-06-10 16:12:15 +09:00
micromang
ccc09e6aca fix: sorting by layer does not work properly 2022-06-10 16:10:13 +09:00
7 changed files with 177 additions and 106 deletions

View File

@@ -5,7 +5,7 @@ on:
branches: branches:
- preview - preview
- main - main
- v*.x - "*.x"
tags-ignore: tags-ignore:
- "**" - "**"
@@ -13,9 +13,9 @@ jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: cycjimmy/semantic-release-action@v2 - uses: cycjimmy/semantic-release-action@v3
with: with:
extra_plugins: | extra_plugins: |
@semantic-release/changelog @semantic-release/changelog

View File

@@ -1,3 +1,33 @@
## [3.3.14](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.13...3.3.14) (2023-08-15)
### Bug Fixes
* error on InitializeIfNeeded ([1f1fb2a](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/1f1fb2a62a9d2ca6562e1b1e70d528aaf52bfc82)), closes [#264](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/264)
## [3.3.13](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.12...3.3.13) (2023-05-18)
### Bug Fixes
* memory leak when using AnimatableProperty ([3849a9f](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/3849a9f6977bc6d2474001c8154a8e201f7e8b7b))
## [3.3.12](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.11...3.3.12) (2022-06-10)
### Bug Fixes
* always display materials in inspector ([a10042d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/a10042d989dea18ff010bdbe970aa434e2bdf117))
* UNITY_UI_ALPHACLIP in UIAdditive shader is not working ([e817e8d](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/e817e8d3c75188f3243243855b135bd840699199))
## [3.3.11](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.10...3.3.11) (2022-06-10)
### Bug Fixes
* sorting by layer does not work properly ([ccc09e6](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/ccc09e6aca2fa3d7bc887e6c733e66706e40ae0f))
* when using linear color space, the particle colors are not output correctly ([11c3a7b](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/11c3a7b37415d78e1b8ba3988a6e043c9f1861e0)), closes [#203](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/203)
## [3.3.10](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.9...3.3.10) (2022-02-17) ## [3.3.10](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/3.3.9...3.3.10) (2022-02-17)

View File

@@ -30,8 +30,7 @@ namespace Coffee.UIExtensions
private SerializedProperty _spShrinkByMaterial; private SerializedProperty _spShrinkByMaterial;
private ReorderableList _ro; private ReorderableList _ro;
private bool _xyzMode; static private bool _xyzMode;
private bool _showMaterials;
private static readonly List<string> s_MaskablePropertyNames = new List<string> private static readonly List<string> s_MaskablePropertyNames = new List<string>
{ {
@@ -58,14 +57,11 @@ namespace Coffee.UIExtensions
_spIgnoreCanvasScaler = serializedObject.FindProperty("m_IgnoreCanvasScaler"); _spIgnoreCanvasScaler = serializedObject.FindProperty("m_IgnoreCanvasScaler");
_spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties"); _spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties");
_spShrinkByMaterial = serializedObject.FindProperty("m_ShrinkByMaterial"); _spShrinkByMaterial = serializedObject.FindProperty("m_ShrinkByMaterial");
_showMaterials = EditorPrefs.GetBool("Coffee.UIExtensions.UIParticleEditor._showMaterials", true);
var sp = serializedObject.FindProperty("m_Particles"); var sp = serializedObject.FindProperty("m_Particles");
_ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true); _ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true);
_ro.elementHeight = EditorGUIUtility.singleLineHeight * 3 + 4; _ro.elementHeight = EditorGUIUtility.singleLineHeight * 3 + 4;
_ro.elementHeightCallback = _ => _showMaterials _ro.elementHeightCallback = _ => 3 * (EditorGUIUtility.singleLineHeight + 2);
? 3 * (EditorGUIUtility.singleLineHeight + 2)
: EditorGUIUtility.singleLineHeight + 2;
_ro.drawElementCallback = (rect, index, active, focused) => _ro.drawElementCallback = (rect, index, active, focused) =>
{ {
EditorGUI.BeginDisabledGroup(sp.hasMultipleDifferentValues); EditorGUI.BeginDisabledGroup(sp.hasMultipleDifferentValues);
@@ -73,8 +69,6 @@ namespace Coffee.UIExtensions
rect.height = EditorGUIUtility.singleLineHeight; rect.height = EditorGUIUtility.singleLineHeight;
var p = sp.GetArrayElementAtIndex(index); var p = sp.GetArrayElementAtIndex(index);
EditorGUI.ObjectField(rect, p, GUIContent.none); EditorGUI.ObjectField(rect, p, GUIContent.none);
if (!_showMaterials) return;
rect.x += 15; rect.x += 15;
rect.width -= 15; rect.width -= 15;
var ps = p.objectReferenceValue as ParticleSystem; var ps = p.objectReferenceValue as ParticleSystem;
@@ -98,9 +92,6 @@ namespace Coffee.UIExtensions
#endif #endif
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);
var content = EditorGUIUtility.IconContent(_showMaterials ? "VisibilityOn" : "VisibilityOff");
_showMaterials = GUI.Toggle(new Rect(rect.width - 55, rect.y, 24, 20), _showMaterials, content, EditorStyles.label);
if (GUI.Button(new Rect(rect.width - 35, rect.y, 60, rect.height), s_ContentRefresh, EditorStyles.miniButton)) if (GUI.Button(new Rect(rect.width - 35, rect.y, 60, rect.height), s_ContentRefresh, EditorStyles.miniButton))
{ {
foreach (UIParticle t in targets) foreach (UIParticle t in targets)
@@ -202,6 +193,24 @@ namespace Coffee.UIExtensions
DestroyUIParticle(current); DestroyUIParticle(current);
return; return;
} }
// #203: When using linear color space, the particle colors are not output correctly.
// To fix, set 'Apply Active Color Space' in renderer module to false.
var allPsRenderers = targets.OfType<UIParticle>()
.SelectMany(x => x.particles)
.Where(x => x)
.Select(x => x.GetComponent<ParticleSystemRenderer>())
.ToArray();
if (0 < allPsRenderers.Length)
{
var so = new SerializedObject(allPsRenderers);
var sp = so.FindProperty("m_ApplyActiveColorSpace");//.boolValue = false;
if (FixButton(sp.boolValue || sp.hasMultipleDifferentValues, "When using linear color space, the particle colors are not output correctly.\nTo fix, set 'Apply Active Color Space' in renderer module to false."))
{
sp.boolValue = false;
so.ApplyModifiedProperties();
}
}
} }
void DestroyUIParticle(UIParticle p, bool ignoreCurrent = false) void DestroyUIParticle(UIParticle p, bool ignoreCurrent = false)

View File

@@ -313,6 +313,20 @@ namespace Coffee.UIExtensions
ClearPreviousMaterials(); ClearPreviousMaterials();
} }
private void ClearMaterials()
{
// Clear mask materials.
s_PrevMaskMaterials.AddRange(_maskMaterials);
_maskMaterials.Clear();
// Clear modified materials.
s_PrevModifiedMaterials.AddRange(_modifiedMaterials);
_modifiedMaterials.Clear();
canvasRenderer.Clear();
ClearPreviousMaterials();
}
private void ClearPreviousMaterials() private void ClearPreviousMaterials()
{ {
foreach (var m in s_PrevMaskMaterials) foreach (var m in s_PrevMaskMaterials)
@@ -447,6 +461,7 @@ namespace Coffee.UIExtensions
_bakedMesh = null; _bakedMesh = null;
base.OnDisable(); base.OnDisable();
ClearMaterials();
} }
/// <summary> /// <summary>
@@ -465,6 +480,7 @@ namespace Coffee.UIExtensions
private void InitializeIfNeeded() private void InitializeIfNeeded()
{ {
if (!this) return;
if (enabled && m_IsTrail) if (enabled && m_IsTrail)
{ {
UnityEngine.Debug.LogWarningFormat(this, "[UIParticle] The UIParticle component should be removed: {0}\nReason: UIParticle for trails is no longer needed.", name); UnityEngine.Debug.LogWarningFormat(this, "[UIParticle] The UIParticle component should be removed: {0}\nReason: UIParticle for trails is no longer needed.", name);

View File

@@ -230,7 +230,7 @@ namespace Coffee.UIParticleExtensions
// Sorting layer: ascending // Sorting layer: ascending
if (aRenderer.sortingLayerID != bRenderer.sortingLayerID) if (aRenderer.sortingLayerID != bRenderer.sortingLayerID)
return aRenderer.sortingLayerID - bRenderer.sortingLayerID; return SortingLayer.GetLayerValueFromID(aRenderer.sortingLayerID) - SortingLayer.GetLayerValueFromID(bRenderer.sortingLayerID);
// Sorting order: ascending // Sorting order: ascending
if (aRenderer.sortingOrder != bRenderer.sortingOrder) if (aRenderer.sortingOrder != bRenderer.sortingOrder)

View File

@@ -1,101 +1,117 @@
Shader "UI/Additive" Shader "UI/Additive"
{ {
Properties Properties
{ {
_MainTex ("Sprite Texture", 2D) = "white" {} _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1) _Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15 _StencilComp ("Stencil Comparison", Float) = 8
_ClipRect ("Clip Rect", Vector) = (-32767, -32767, 32767, 32767) _Stencil ("Stencil ID", Float) = 0
} _StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
SubShader _ColorMask ("Color Mask", Float) = 15
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
Lighting Off }
ZWrite Off
ZTest [unity_GUIZTestMode]
Fog { Mode Off }
Blend One One
ColorMask [_ColorMask] SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Pass Stencil
{ {
CGPROGRAM Ref [_Stencil]
#pragma vertex vert Comp [_StencilComp]
#pragma fragment frag Pass [_StencilOp]
#include "UnityCG.cginc" ReadMask [_StencilReadMask]
#include "UnityUI.cginc" WriteMask [_StencilWriteMask]
}
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f Cull Off
{ Lighting Off
float4 vertex : SV_POSITION; ZWrite Off
fixed4 color : COLOR; ZTest [unity_GUIZTestMode]
half2 texcoord : TEXCOORD0; Fog { Mode Off }
float4 worldPosition : TEXCOORD1; Blend One One
};
fixed4 _Color;
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _ClipRect;
v2f vert(appdata_t IN) ColorMask [_ColorMask]
{
v2f OUT;
OUT.worldPosition = IN.vertex;
OUT.vertex = UnityObjectToClipPos(IN.vertex);
OUT.texcoord = TRANSFORM_TEX(IN.texcoord, _MainTex);
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
#endif
OUT.color = IN.color * _Color;
return OUT;
}
fixed4 frag(v2f IN) : SV_Target Pass
{ {
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color; Name "Default"
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); CGPROGRAM
color.rgb *= color.a; #pragma vertex vert
#ifdef UNITY_UI_ALPHACLIP #pragma fragment frag
clip (color.a - 0.01); #pragma target 2.0
#endif
return color; #include "UnityCG.cginc"
} #include "UnityUI.cginc"
ENDCG
} #pragma multi_compile __ UNITY_UI_CLIP_RECT
} #pragma multi_compile __ UNITY_UI_ALPHACLIP
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
fixed4 _Color;
sampler2D _MainTex;
float4 _MainTex_ST;
fixed4 _TextureSampleAdd;
float4 _ClipRect;
v2f vert(appdata_t v)
{
v2f OUT;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
OUT.worldPosition = v.vertex;
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
OUT.color = v.color * _Color;
return OUT;
}
fixed4 frag(v2f IN) : SV_Target
{
half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
#ifdef UNITY_UI_CLIP_RECT
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
color.rgb *= color.a;
return color;
}
ENDCG
}
}
} }

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.3.10", "version": "3.3.14",
"unity": "2018.2", "unity": "2018.2",
"license": "MIT", "license": "MIT",
"repository": { "repository": {