Compare commits

..

24 Commits

Author SHA1 Message Date
semantic-release-bot d6c363cc47 chore(release): 5.15.1 [skip ci]
## [5.15.1](https://github.com/mob-sakai/UIEffect/compare/5.15.0...5.15.1) (2026-11-26)

### Bug Fixes

* improve round corner inspector ([d9fa364](https://github.com/mob-sakai/UIEffect/commit/d9fa3641e36b84c976b6282ca5013c4d5248df41))
2026-11-26 16:51:27 +00:00
mob-sakai d9fa3641e3 fix: improve round corner inspector 2026-11-27 01:15:13 +09:00
semantic-release-bot 126748eee6 chore(release): 5.15.0 [skip ci]
# [5.15.0](https://github.com/mob-sakai/UIEffect/compare/5.14.1...5.15.0) (2026-11-26)

### Features

* add `Round Corner` feature ([417e92c](https://github.com/mob-sakai/UIEffect/commit/417e92cebadfcbd0063d32aa8fc32716d94dbc2f)), closes [#403](https://github.com/mob-sakai/UIEffect/issues/403)
2026-11-26 09:04:17 +00:00
mob-sakai 417e92ceba feat: add Round Corner feature
close #403
2026-11-26 17:35:31 +09:00
semantic-release-bot 154fbef0fa chore(release): 5.14.1 [skip ci]
## [5.14.1](https://github.com/mob-sakai/UIEffect/compare/5.14.0...5.14.1) (2026-11-26)

### Bug Fixes

* queue TextMeshPro parent for submesh rebuild ([240ac6b](https://github.com/mob-sakai/UIEffect/commit/240ac6b206229dfcdba7a3f38341ae9b198aff6f)), closes [#416](https://github.com/mob-sakai/UIEffect/issues/416)
2026-11-26 01:34:04 +00:00
mob-sakai 240ac6b206 fix: queue TextMeshPro parent for submesh rebuild
close #416
2026-11-26 10:32:14 +09:00
mob-sakai ff9055471a docs: update readme [skip ci] 2026-11-25 23:10:44 +09:00
semantic-release-bot 86c74e77c4 chore(release): 5.14.0 [skip ci]
# [5.14.0](https://github.com/mob-sakai/UIEffect/compare/5.13.0...5.14.0) (2026-11-25)

### Bug Fixes

* output colors for gradients are incorrect when `enableColorCorrection=true` ([587ff28](https://github.com/mob-sakai/UIEffect/commit/587ff28e91d229baa5c56d0ac58030b44ddf7271))
* paste color is incorrect when `enableColorCorrection=true` ([7be2bf4](https://github.com/mob-sakai/UIEffect/commit/7be2bf463dc91feb41d4585841ddc489f0302433))
* picked color is incorrect when `enableColorCorrection=true` ([8d906a7](https://github.com/mob-sakai/UIEffect/commit/8d906a78365147833c8d9ba58224c7819a957d4d))

### Features

* improve CSS gradient paste handling ([50c0e47](https://github.com/mob-sakai/UIEffect/commit/50c0e475ca9c77fe4584f8be8478e243fb193c6f)), closes [#415](https://github.com/mob-sakai/UIEffect/issues/415)
2026-11-25 14:07:38 +00:00
mob-sakai 1332f805ff docs: update readme 2026-11-25 22:50:41 +09:00
mob-sakai 50c0e475ca feat: improve CSS gradient paste handling
close #415
2026-11-25 22:50:41 +09:00
mob-sakai 7be2bf463d fix: paste color is incorrect when enableColorCorrection=true 2026-11-25 22:26:37 +09:00
mob-sakai 8d906a7836 fix: picked color is incorrect when enableColorCorrection=true 2026-11-25 22:26:37 +09:00
mob-sakai 587ff28e91 fix: output colors for gradients are incorrect when enableColorCorrection=true 2026-11-25 22:26:37 +09:00
semantic-release-bot 8ba8ada3f2 chore(release): 5.13.0 [skip ci]
# [5.13.0](https://github.com/mob-sakai/UIEffect/compare/5.12.1...5.13.0) (2026-11-25)

### Features

* add gradient reverse button ([78f7c2f](https://github.com/mob-sakai/UIEffect/commit/78f7c2f789fb4af0ad2eb7accfb111eb9adccd4e))
* add paste color/gradient button (from css code) ([fd1e9bc](https://github.com/mob-sakai/UIEffect/commit/fd1e9bcaf2fc4a620c7902243df1115306c43c70)), closes [#389](https://github.com/mob-sakai/UIEffect/issues/389)
2026-11-25 09:23:15 +00:00
mob-sakai d877a9f4c1 docs: update readme 2026-11-25 18:22:21 +09:00
mob-sakai fd1e9bcaf2 feat: add paste color/gradient button (from css code)
close #389
2026-11-24 21:26:50 +09:00
mob-sakai 78f7c2f789 feat: add gradient reverse button 2026-11-24 21:10:41 +09:00
mob-sakai 8b00091539 chore: change icon path 2026-11-24 21:10:41 +09:00
semantic-release-bot 95500b6c73 chore(release): 5.12.1 [skip ci]
## [5.12.1](https://github.com/mob-sakai/UIEffect/compare/5.12.0...5.12.1) (2026-11-24)

### Bug Fixes

* Added an option to Project Settings to disable color correction and revert to the color output used in version 5.11.8 or earlier ([aa0bf72](https://github.com/mob-sakai/UIEffect/commit/aa0bf72bd429eb2aa173f316e5863bb9bee2eb4e)), closes [#414](https://github.com/mob-sakai/UIEffect/issues/414)
2026-11-24 06:00:36 +00:00
mob-sakai ab952812d6 chore: update internal code 2026-11-24 14:51:10 +09:00
mob-sakai aa0bf72bd4 fix: Added an option to Project Settings to disable color correction and revert to the color output used in version 5.11.8 or earlier
close #414
2026-11-24 14:50:59 +09:00
semantic-release-bot 76f1478523 chore(release): 5.12.0 [skip ci]
# [5.12.0](https://github.com/mob-sakai/UIEffect/compare/5.11.10...5.12.0) (2026-11-17)

### Features

* "Additional Resource" can be installed as a package instead of importing as a sample ([afbfcdd](https://github.com/mob-sakai/UIEffect/commit/afbfcdd40c5775390643d9c649e2bc1f223148f8))
2026-11-17 23:14:06 +00:00
mob-sakai afbfcdd40c feat: "Additional Resource" can be installed as a package instead of importing as a sample
This allows you to use the necessary features without adding samples to the `Assets` directory in your project.
2026-11-17 16:51:59 +09:00
semantic-release-bot c34c2ec0c2 chore(release): 5.11.10 [skip ci]
## [5.11.10](https://github.com/mob-sakai/UIEffect/compare/5.11.9...5.11.10) (2026-11-17)

### Bug Fixes

* added "Show Readme" to the auto-import menu ([27629cd](https://github.com/mob-sakai/UIEffect/commit/27629cdd7c9dd64c053a92fcd69119efffe4a127))
* fix font path in demo ([3ca1214](https://github.com/mob-sakai/UIEffect/commit/3ca121423382668eee335fbb8bf8308b7f04159b))
* fix potential NPE in code ([6e8aaf3](https://github.com/mob-sakai/UIEffect/commit/6e8aaf36f00e4a42f7b9d6f79e065d4022b567c2))
* fix potential NPE in code ([d41d1ad](https://github.com/mob-sakai/UIEffect/commit/d41d1ad21f3b4ce38bb1fae870cf8621ed61a1e8))
* fix project setting inspector ([d359086](https://github.com/mob-sakai/UIEffect/commit/d359086ed4baaf2bc0bfb64742492e3ea6d6d4b6))
2026-11-17 02:22:15 +00:00
76 changed files with 15900 additions and 5840 deletions
+104 -13
View File
@@ -38,6 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311918, g: 0.3807396, b: 0.35872662, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
@@ -192,7 +193,6 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 2
@@ -226,7 +226,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 986199155} m_Father: {fileID: 986199155}
m_RootOrder: 3 m_RootOrder: 3
@@ -249,6 +248,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Target: {fileID: 1567169363} m_Target: {fileID: 1567169363}
m_Preset: {fileID: 0}
m_UseTargetTransform: 1 m_UseTargetTransform: 1
m_SamplingScale: 1 m_SamplingScale: 1
m_AllowToModifyMeshShape: 1 m_AllowToModifyMeshShape: 1
@@ -321,7 +321,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical m_VerticalAxis: Vertical
m_SubmitButton: Submit m_SubmitButton: Submit
@@ -354,7 +353,6 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1 m_RootOrder: 1
@@ -395,7 +393,6 @@ Canvas:
m_OverrideSorting: 0 m_OverrideSorting: 0
m_OverridePixelPerfect: 0 m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0 m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 27 m_AdditionalShaderChannelsFlag: 27
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingOrder: 0 m_SortingOrder: 0
@@ -450,7 +447,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1120943171} - {fileID: 1120943171}
- {fileID: 1242517204} - {fileID: 1242517204}
@@ -493,7 +489,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 2, z: 2} m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1
m_Children: [] m_Children: []
m_Father: {fileID: 986199155} m_Father: {fileID: 986199155}
m_RootOrder: 0 m_RootOrder: 0
@@ -517,7 +512,6 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_ToneFilter: 1 m_ToneFilter: 1
m_ToneIntensity: 0.5 m_ToneIntensity: 0.5
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
m_ColorFilter: 6 m_ColorFilter: 6
m_ColorIntensity: 0.5 m_ColorIntensity: 0.5
m_Color: {r: 0.5377358, g: 0, b: 0.09190052, a: 1} m_Color: {r: 0.5377358, g: 0, b: 0.09190052, a: 1}
@@ -545,6 +539,35 @@ MonoBehaviour:
m_TransitionColorGlow: 0 m_TransitionColorGlow: 0
m_TransitionPatternReverse: 0 m_TransitionPatternReverse: 0
m_TransitionAutoPlaySpeed: 0 m_TransitionAutoPlaySpeed: 0
m_TransitionGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
m_TargetMode: 0 m_TargetMode: 0
m_TargetColor: {r: 0.15686275, g: 0.72156864, b: 0.8509804, a: 1} m_TargetColor: {r: 0.15686275, g: 0.72156864, b: 0.8509804, a: 1}
m_TargetRange: 0.033 m_TargetRange: 0.033
@@ -600,6 +623,8 @@ MonoBehaviour:
m_GradationOffset: 0 m_GradationOffset: 0
m_GradationScale: 0.15 m_GradationScale: 0.15
m_GradationRotation: 135 m_GradationRotation: 135
m_GradationWrapMode: 0
m_GradationReverse: 0
m_AllowToModifyMeshShape: 1 m_AllowToModifyMeshShape: 1
m_EdgeMode: 2 m_EdgeMode: 2
m_EdgeWidth: 0.05 m_EdgeWidth: 0.05
@@ -615,10 +640,13 @@ MonoBehaviour:
m_DetailThreshold: m_DetailThreshold:
m_Min: 0 m_Min: 0
m_Max: 1 m_Max: 1
m_DetailColor: {r: 1, g: 1, b: 1, a: 1}
m_DetailTex: {fileID: 0} m_DetailTex: {fileID: 0}
m_DetailTexScale: {x: 1, y: 1} m_DetailTexScale: {x: 1, y: 1}
m_DetailTexOffset: {x: 0, y: 0} m_DetailTexOffset: {x: 0, y: 0}
m_DetailTexSpeed: {x: 0, y: 0} m_DetailTexSpeed: {x: 0, y: 0}
m_RoundCornerMode: 0
m_RoundCornerRadius: {x: 20, y: 20, z: 20, w: 20}
m_CustomRoot: {fileID: 0} m_CustomRoot: {fileID: 0}
m_Flip: 0 m_Flip: 0
--- !u!114 &1120943173 --- !u!114 &1120943173
@@ -689,7 +717,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 2125393230} - {fileID: 2125393230}
m_Father: {fileID: 986199155} m_Father: {fileID: 986199155}
@@ -790,7 +817,6 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_ToneFilter: 1 m_ToneFilter: 1
m_ToneIntensity: 0.875 m_ToneIntensity: 0.875
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
m_ColorFilter: 1 m_ColorFilter: 1
m_ColorIntensity: 0.7 m_ColorIntensity: 0.7
m_Color: {r: 1, g: 0.08701122, b: 0, a: 1} m_Color: {r: 1, g: 0.08701122, b: 0, a: 1}
@@ -818,6 +844,35 @@ MonoBehaviour:
m_TransitionColorGlow: 1 m_TransitionColorGlow: 1
m_TransitionPatternReverse: 0 m_TransitionPatternReverse: 0
m_TransitionAutoPlaySpeed: 0 m_TransitionAutoPlaySpeed: 0
m_TransitionGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
m_TargetMode: 1 m_TargetMode: 1
m_TargetColor: {r: 0.22352943, g: 0.87843144, b: 0.9450981, a: 1} m_TargetColor: {r: 0.22352943, g: 0.87843144, b: 0.9450981, a: 1}
m_TargetRange: 0.118 m_TargetRange: 0.118
@@ -873,6 +928,8 @@ MonoBehaviour:
m_GradationOffset: 0 m_GradationOffset: 0
m_GradationScale: 1 m_GradationScale: 1
m_GradationRotation: 60 m_GradationRotation: 60
m_GradationWrapMode: 0
m_GradationReverse: 0
m_AllowToModifyMeshShape: 1 m_AllowToModifyMeshShape: 1
m_EdgeMode: 2 m_EdgeMode: 2
m_EdgeWidth: 0.5 m_EdgeWidth: 0.5
@@ -888,10 +945,13 @@ MonoBehaviour:
m_DetailThreshold: m_DetailThreshold:
m_Min: 0.25 m_Min: 0.25
m_Max: 0.5 m_Max: 0.5
m_DetailColor: {r: 1, g: 1, b: 1, a: 1}
m_DetailTex: {fileID: 2800000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3} m_DetailTex: {fileID: 2800000, guid: dee1cb6c2ee294c6087ea9d89d368417, type: 3}
m_DetailTexScale: {x: 1, y: 1} m_DetailTexScale: {x: 1, y: 1}
m_DetailTexOffset: {x: 0, y: 0} m_DetailTexOffset: {x: 0, y: 0}
m_DetailTexSpeed: {x: 0, y: 0} m_DetailTexSpeed: {x: 0, y: 0}
m_RoundCornerMode: 1
m_RoundCornerRadius: {x: 20, y: 20, z: 20, w: 20}
m_CustomRoot: {fileID: 2125393230} m_CustomRoot: {fileID: 2125393230}
m_Flip: 1 m_Flip: 1
--- !u!114 &1242517207 --- !u!114 &1242517207
@@ -962,7 +1022,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 986199155} m_Father: {fileID: 986199155}
m_RootOrder: 2 m_RootOrder: 2
@@ -986,7 +1045,6 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_ToneFilter: 1 m_ToneFilter: 1
m_ToneIntensity: 1 m_ToneIntensity: 1
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
m_ColorFilter: 0 m_ColorFilter: 0
m_ColorIntensity: 1 m_ColorIntensity: 1
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
@@ -1014,6 +1072,35 @@ MonoBehaviour:
m_TransitionColorGlow: 0 m_TransitionColorGlow: 0
m_TransitionPatternReverse: 0 m_TransitionPatternReverse: 0
m_TransitionAutoPlaySpeed: 0 m_TransitionAutoPlaySpeed: 0
m_TransitionGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
m_TargetMode: 0 m_TargetMode: 0
m_TargetColor: {r: 1, g: 1, b: 1, a: 1} m_TargetColor: {r: 1, g: 1, b: 1, a: 1}
m_TargetRange: 0.1 m_TargetRange: 0.1
@@ -1069,6 +1156,8 @@ MonoBehaviour:
m_GradationOffset: 0 m_GradationOffset: 0
m_GradationScale: 1 m_GradationScale: 1
m_GradationRotation: 0 m_GradationRotation: 0
m_GradationWrapMode: 0
m_GradationReverse: 0
m_AllowToModifyMeshShape: 1 m_AllowToModifyMeshShape: 1
m_EdgeMode: 0 m_EdgeMode: 0
m_EdgeWidth: 0.5 m_EdgeWidth: 0.5
@@ -1084,10 +1173,13 @@ MonoBehaviour:
m_DetailThreshold: m_DetailThreshold:
m_Min: 0 m_Min: 0
m_Max: 1 m_Max: 1
m_DetailColor: {r: 1, g: 1, b: 1, a: 1}
m_DetailTex: {fileID: 0} m_DetailTex: {fileID: 0}
m_DetailTexScale: {x: 1, y: 1} m_DetailTexScale: {x: 1, y: 1}
m_DetailTexOffset: {x: 0, y: 0} m_DetailTexOffset: {x: 0, y: 0}
m_DetailTexSpeed: {x: 0, y: 0} m_DetailTexSpeed: {x: 0, y: 0}
m_RoundCornerMode: 0
m_RoundCornerRadius: {x: 20, y: 20, z: 20, w: 20}
m_CustomRoot: {fileID: 0} m_CustomRoot: {fileID: 0}
m_Flip: 0 m_Flip: 0
--- !u!114 &1567169364 --- !u!114 &1567169364
@@ -1230,7 +1322,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1242517204} m_Father: {fileID: 1242517204}
m_RootOrder: 0 m_RootOrder: 0
File diff suppressed because it is too large Load Diff
+68
View File
@@ -1,3 +1,71 @@
## [5.15.1](https://github.com/mob-sakai/UIEffect/compare/5.15.0...5.15.1) (2026-11-26)
### Bug Fixes
* improve round corner inspector ([d9fa364](https://github.com/mob-sakai/UIEffect/commit/d9fa3641e36b84c976b6282ca5013c4d5248df41))
# [5.15.0](https://github.com/mob-sakai/UIEffect/compare/5.14.1...5.15.0) (2026-11-26)
### Features
* add `Round Corner` feature ([417e92c](https://github.com/mob-sakai/UIEffect/commit/417e92cebadfcbd0063d32aa8fc32716d94dbc2f)), closes [#403](https://github.com/mob-sakai/UIEffect/issues/403)
## [5.14.1](https://github.com/mob-sakai/UIEffect/compare/5.14.0...5.14.1) (2026-11-26)
### Bug Fixes
* queue TextMeshPro parent for submesh rebuild ([240ac6b](https://github.com/mob-sakai/UIEffect/commit/240ac6b206229dfcdba7a3f38341ae9b198aff6f)), closes [#416](https://github.com/mob-sakai/UIEffect/issues/416)
# [5.14.0](https://github.com/mob-sakai/UIEffect/compare/5.13.0...5.14.0) (2026-11-25)
### Bug Fixes
* output colors for gradients are incorrect when `enableColorCorrection=true` ([587ff28](https://github.com/mob-sakai/UIEffect/commit/587ff28e91d229baa5c56d0ac58030b44ddf7271))
* paste color is incorrect when `enableColorCorrection=true` ([7be2bf4](https://github.com/mob-sakai/UIEffect/commit/7be2bf463dc91feb41d4585841ddc489f0302433))
* picked color is incorrect when `enableColorCorrection=true` ([8d906a7](https://github.com/mob-sakai/UIEffect/commit/8d906a78365147833c8d9ba58224c7819a957d4d))
### Features
* improve CSS gradient paste handling ([50c0e47](https://github.com/mob-sakai/UIEffect/commit/50c0e475ca9c77fe4584f8be8478e243fb193c6f)), closes [#415](https://github.com/mob-sakai/UIEffect/issues/415)
# [5.13.0](https://github.com/mob-sakai/UIEffect/compare/5.12.1...5.13.0) (2026-11-25)
### Features
* add gradient reverse button ([78f7c2f](https://github.com/mob-sakai/UIEffect/commit/78f7c2f789fb4af0ad2eb7accfb111eb9adccd4e))
* add paste color/gradient button (from css code) ([fd1e9bc](https://github.com/mob-sakai/UIEffect/commit/fd1e9bcaf2fc4a620c7902243df1115306c43c70)), closes [#389](https://github.com/mob-sakai/UIEffect/issues/389)
## [5.12.1](https://github.com/mob-sakai/UIEffect/compare/5.12.0...5.12.1) (2026-11-24)
### Bug Fixes
* Added an option to Project Settings to disable color correction and revert to the color output used in version 5.11.8 or earlier ([aa0bf72](https://github.com/mob-sakai/UIEffect/commit/aa0bf72bd429eb2aa173f316e5863bb9bee2eb4e)), closes [#414](https://github.com/mob-sakai/UIEffect/issues/414)
# [5.12.0](https://github.com/mob-sakai/UIEffect/compare/5.11.10...5.12.0) (2026-11-17)
### Features
* "Additional Resource" can be installed as a package instead of importing as a sample ([afbfcdd](https://github.com/mob-sakai/UIEffect/commit/afbfcdd40c5775390643d9c649e2bc1f223148f8))
## [5.11.10](https://github.com/mob-sakai/UIEffect/compare/5.11.9...5.11.10) (2026-11-17)
### Bug Fixes
* added "Show Readme" to the auto-import menu ([27629cd](https://github.com/mob-sakai/UIEffect/commit/27629cdd7c9dd64c053a92fcd69119efffe4a127))
* fix font path in demo ([3ca1214](https://github.com/mob-sakai/UIEffect/commit/3ca121423382668eee335fbb8bf8308b7f04159b))
* fix potential NPE in code ([6e8aaf3](https://github.com/mob-sakai/UIEffect/commit/6e8aaf36f00e4a42f7b9d6f79e065d4022b567c2))
* fix potential NPE in code ([d41d1ad](https://github.com/mob-sakai/UIEffect/commit/d41d1ad21f3b4ce38bb1fae870cf8621ed61a1e8))
* fix project setting inspector ([d359086](https://github.com/mob-sakai/UIEffect/commit/d359086ed4baaf2bc0bfb64742492e3ea6d6d4b6))
## [5.11.9](https://github.com/mob-sakai/UIEffect/compare/5.11.8...5.11.9) (2026-11-14) ## [5.11.9](https://github.com/mob-sakai/UIEffect/compare/5.11.8...5.11.9) (2026-11-14)
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 195d371d8be894451a95368b19109420
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

@@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 8c562a51524754926a36370d17d4b181
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

@@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 253286b92599345a0b7261e3ae1eac75
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -20,11 +20,10 @@ TextureImporter:
externalNormalMap: 0 externalNormalMap: 0
heightScale: 0.25 heightScale: 0.25
normalMapFilter: 0 normalMapFilter: 0
isReadable: 1 isReadable: 0
streamingMipmaps: 0 streamingMipmaps: 0
streamingMipmapsPriority: 0 streamingMipmapsPriority: 0
vTOnly: 0 vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0 grayScaleToAlpha: 0
generateCubemap: 6 generateCubemap: 6
cubemapConvolution: 0 cubemapConvolution: 0
@@ -91,9 +90,9 @@ TextureImporter:
forceMaximumCompressionQuality_BC6H_BC7: 0 forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3 - serializedVersion: 3
buildTarget: Standalone buildTarget: Standalone
maxTextureSize: 64 maxTextureSize: 2048
resizeAlgorithm: 0 resizeAlgorithm: 0
textureFormat: 12 textureFormat: -1
textureCompression: 1 textureCompression: 1
compressionQuality: 50 compressionQuality: 50
crunchedCompression: 0 crunchedCompression: 0
@@ -150,7 +149,6 @@ TextureImporter:
edges: [] edges: []
weights: [] weights: []
secondaryTextures: [] secondaryTextures: []
nameFileIdTable: {}
spritePackingTag: spritePackingTag:
pSDRemoveMatte: 0 pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0 pSDShowRemoveMatteOption: 0
Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

@@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: b776aab5f71a54c63afd46d6987707e7
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

@@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: c58c458b53265474ea456ff2861bd6fd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
+152
View File
@@ -0,0 +1,152 @@
using System;
using System.Globalization;
using UnityEditor;
using UnityEngine;
namespace Coffee.UIEffects.Editors
{
internal static class PasteColorUtil
{
internal const string SupportedFormats =
"hex values (#RGB, #RRGGBB, #RGBA, #RRGGBBAA), Unity-supported color names, transparent, rgb(), and rgba()";
internal static void PasteFromClipboard(SerializedProperty color)
{
var clipboard = GUIUtility.systemCopyBuffer;
if (!TryParseColor(clipboard, out var value))
{
EditorUtility.DisplayDialog("Paste Color",
$"Supported formats are {SupportedFormats}, or CSS background/background-color declarations containing one of these values.",
"OK");
return;
}
color.colorValue = ApplyPasteColorCorrection(value);
}
internal static bool TryParseColor(string text, out Color color)
{
if (string.IsNullOrWhiteSpace(text))
{
color = default;
return false;
}
if (TryExtractCssColorValue(text, out var cssColor))
{
text = cssColor;
}
text = text.Trim();
if (text.Equals("transparent", StringComparison.OrdinalIgnoreCase))
{
color = Color.clear;
return true;
}
if (ColorUtility.TryParseHtmlString(text, out color))
{
return true;
}
var openIndex = text.IndexOf('(');
if (openIndex < 0 || text[text.Length - 1] != ')')
{
return false;
}
var function = text.Substring(0, openIndex).Trim();
var isRgba = function.Equals("rgba", StringComparison.OrdinalIgnoreCase);
if (!isRgba && !function.Equals("rgb", StringComparison.OrdinalIgnoreCase))
{
return false;
}
var components = text.Substring(openIndex + 1, text.Length - openIndex - 2)
.Split(new[] { ' ', '\t', '\r', '\n', ',', '/' }, StringSplitOptions.RemoveEmptyEntries);
if (components.Length != 3 && components.Length != 4)
{
return false;
}
if ((isRgba && components.Length != 4)
|| !TryParseRgbComponent(components[0], out var red)
|| !TryParseRgbComponent(components[1], out var green)
|| !TryParseRgbComponent(components[2], out var blue))
{
return false;
}
var alpha = 1f;
if (components.Length == 4 && !TryParseAlphaComponent(components[3], out alpha))
{
return false;
}
color = new Color(red, green, blue, alpha);
return true;
}
private static Color ApplyPasteColorCorrection(Color color)
{
return UIEffectProjectSettings.enableColorCorrection ? color.linear : color;
}
private static bool TryExtractCssColorValue(string text, out string value)
{
foreach (var declaration in text.Split(';'))
{
var separatorIndex = declaration.IndexOf(':');
if (separatorIndex < 0)
{
continue;
}
var property = declaration.Substring(0, separatorIndex).Trim();
var commentEndIndex = property.LastIndexOf("*/", StringComparison.Ordinal);
if (commentEndIndex >= 0)
{
property = property.Substring(commentEndIndex + 2).Trim();
}
if (property.Equals("background", StringComparison.OrdinalIgnoreCase)
|| property.Equals("background-color", StringComparison.OrdinalIgnoreCase))
{
value = declaration.Substring(separatorIndex + 1).Trim();
return true;
}
}
value = null;
return false;
}
private static bool TryParseRgbComponent(string text, out float value)
{
var isPercentage = text.EndsWith("%", StringComparison.Ordinal);
if (!float.TryParse(isPercentage ? text.Substring(0, text.Length - 1) : text,
NumberStyles.Float, CultureInfo.InvariantCulture, out value)
|| float.IsNaN(value) || float.IsInfinity(value))
{
return false;
}
value = Mathf.Clamp01(isPercentage ? value / 100f : value / 255f);
return true;
}
private static bool TryParseAlphaComponent(string text, out float value)
{
var isPercentage = text.EndsWith("%", StringComparison.Ordinal);
if (!float.TryParse(isPercentage ? text.Substring(0, text.Length - 1) : text,
NumberStyles.Float, CultureInfo.InvariantCulture, out value)
|| float.IsNaN(value) || float.IsInfinity(value))
{
return false;
}
value = Mathf.Clamp01(isPercentage ? value / 100f : value);
return true;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e2fe72e593aed4b90a864e52a745a813
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+387
View File
@@ -0,0 +1,387 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using UnityEditor;
using UnityEngine;
namespace Coffee.UIEffects.Editors
{
internal static class PasteGradientUtil
{
private struct GradientStop
{
public Color color;
public float? position;
}
internal static void PasteFromClipboard(SerializedProperty property,
Action<SerializedProperty, Gradient> setGradient,
SerializedProperty gradationMode,
SerializedProperty gradationRotation,
SerializedProperty gradationOffset,
SerializedProperty gradationScale,
SerializedProperty gradationWrapMode,
SerializedProperty gradationReverse)
{
var clipboard = GUIUtility.systemCopyBuffer;
if (!TryParseCssGradient(clipboard, out var value, out var mode, out var rotation))
{
EditorUtility.DisplayDialog("Paste Gradient",
"The clipboard does not contain a supported CSS linear-gradient(...) or radial-gradient(...) value.",
"OK");
return;
}
value.mode = GradientMode.Blend;
setGradient(property, value);
gradationMode.intValue = (int)mode;
gradationWrapMode.intValue = (int)(mode == GradationMode.RadialGradient
? TextureWrapMode.Clamp
: TextureWrapMode.Repeat);
if (rotation.HasValue)
{
gradationRotation.floatValue = rotation.Value;
}
gradationOffset.floatValue = 0;
gradationScale.floatValue = 1;
gradationReverse.boolValue = false;
}
private static bool TryParseCssGradient(string text, out Gradient gradient, out GradationMode mode,
out float? rotation)
{
gradient = null;
mode = GradationMode.None;
rotation = null;
if (string.IsNullOrWhiteSpace(text))
{
return false;
}
text = text.Trim();
var linearIndex = text.IndexOf("linear-gradient(", StringComparison.OrdinalIgnoreCase);
var radialIndex = text.IndexOf("radial-gradient(", StringComparison.OrdinalIgnoreCase);
var functionIndex = linearIndex < 0
? radialIndex
: radialIndex < 0
? linearIndex
: Math.Min(linearIndex, radialIndex);
if (functionIndex < 0)
{
return false;
}
text = text.Substring(functionIndex);
var openIndex = text.IndexOf('(');
if (openIndex < 0)
{
return false;
}
var functionName = text.Substring(0, openIndex).Trim();
var isRadial = functionName.Equals("radial-gradient", StringComparison.OrdinalIgnoreCase);
if (!isRadial && !functionName.Equals("linear-gradient", StringComparison.OrdinalIgnoreCase))
{
return false;
}
mode = isRadial ? GradationMode.RadialGradient : GradationMode.AngleGradient;
var depth = 0;
var closeIndex = -1;
for (var i = openIndex; i < text.Length; i++)
{
if (text[i] == '(')
{
depth++;
}
else if (text[i] == ')')
{
depth--;
if (depth < 0)
{
return false;
}
if (depth == 0)
{
closeIndex = i;
break;
}
}
}
if (closeIndex < 0)
{
return false;
}
var arguments = new List<string>();
if (!TrySplitGradientArguments(text.Substring(openIndex + 1, closeIndex - openIndex - 1), arguments)
|| arguments.Count < 2)
{
return false;
}
var firstStopIndex = 0;
if (!TryParseGradientStop(arguments[0], out _)
&& (isRadial || IsGradientDirection(arguments[0])))
{
firstStopIndex = 1;
if (!isRadial && TryParseLinearGradientAngle(arguments[0], out var cssAngle))
{
rotation = Mathf.Repeat(cssAngle - 90, 360);
}
}
var stops = new List<GradientStop>();
for (var i = firstStopIndex; i < arguments.Count; i++)
{
if (!TryParseGradientStop(arguments[i], out var stop))
{
return false;
}
stops.Add(stop);
}
if (stops.Count < 2)
{
return false;
}
if (!stops[0].position.HasValue)
{
stops[0] = SetStopPosition(stops[0], 0);
}
var lastStopIndex = stops.Count - 1;
if (!stops[lastStopIndex].position.HasValue)
{
stops[lastStopIndex] = SetStopPosition(stops[lastStopIndex], 1);
}
var previousPositionIndex = 0;
for (var i = 1; i < stops.Count; i++)
{
if (!stops[i].position.HasValue)
{
continue;
}
var previousPosition = stops[previousPositionIndex].position.Value;
var currentPosition = stops[i].position.Value;
var interval = i - previousPositionIndex;
for (var j = 1; j < interval; j++)
{
var position = Mathf.Lerp(previousPosition, currentPosition, (float)j / interval);
stops[previousPositionIndex + j] =
SetStopPosition(stops[previousPositionIndex + j], position);
}
previousPositionIndex = i;
}
var colorKeys = new GradientColorKey[stops.Count];
var alphaKeys = new GradientAlphaKey[stops.Count];
var previousTime = 0f;
for (var i = 0; i < stops.Count; i++)
{
var stop = stops[i];
var time = Mathf.Clamp01(stop.position.Value);
time = Mathf.Max(previousTime, time);
colorKeys[i] = new GradientColorKey(new Color(stop.color.r, stop.color.g, stop.color.b), time);
alphaKeys[i] = new GradientAlphaKey(stop.color.a, time);
previousTime = time;
}
gradient = new Gradient();
gradient.SetKeys(colorKeys, alphaKeys);
return true;
}
private static bool TrySplitGradientArguments(string text, List<string> arguments)
{
var depth = 0;
var argumentStart = 0;
for (var i = 0; i < text.Length; i++)
{
if (text[i] == '(')
{
depth++;
}
else if (text[i] == ')')
{
depth--;
if (depth < 0)
{
return false;
}
}
else if (text[i] == ',' && depth == 0)
{
arguments.Add(text.Substring(argumentStart, i - argumentStart).Trim());
argumentStart = i + 1;
}
}
if (depth != 0)
{
return false;
}
arguments.Add(text.Substring(argumentStart).Trim());
return true;
}
private static bool TryParseGradientStop(string text, out GradientStop stop)
{
stop = default;
text = text.Trim();
var colorLength = text.Length;
var openIndex = text.IndexOf('(');
if (openIndex > 0
&& (text.Substring(0, openIndex).Trim().Equals("rgb", StringComparison.OrdinalIgnoreCase)
|| text.Substring(0, openIndex).Trim().Equals("rgba", StringComparison.OrdinalIgnoreCase)))
{
var closeIndex = text.IndexOf(')', openIndex + 1);
if (closeIndex < 0)
{
return false;
}
colorLength = closeIndex + 1;
}
else
{
var whitespaceIndex = text.IndexOfAny(new[] { ' ', '\t', '\r', '\n' });
if (whitespaceIndex >= 0)
{
colorLength = whitespaceIndex;
}
}
var colorText = text.Substring(0, colorLength).Trim();
var positionText = text.Substring(colorLength).Trim();
if (!PasteColorUtil.TryParseColor(colorText, out var color))
{
return false;
}
float? position = null;
if (positionText.Length > 0)
{
if (!positionText.EndsWith("%", StringComparison.Ordinal)
|| !float.TryParse(positionText.Substring(0, positionText.Length - 1),
NumberStyles.Float, CultureInfo.InvariantCulture, out var percentage)
|| float.IsNaN(percentage) || float.IsInfinity(percentage))
{
return false;
}
position = percentage / 100f;
}
stop.color = color;
stop.position = position;
return true;
}
private static bool IsGradientDirection(string text)
{
text = text.Trim();
if (text.StartsWith("to ", StringComparison.OrdinalIgnoreCase))
{
return true;
}
foreach (var suffix in new[] { "deg", "grad", "rad", "turn" })
{
if (text.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)
&& float.TryParse(text.Substring(0, text.Length - suffix.Length),
NumberStyles.Float, CultureInfo.InvariantCulture, out var direction)
&& !float.IsNaN(direction) && !float.IsInfinity(direction))
{
return true;
}
}
return false;
}
private static bool TryParseLinearGradientAngle(string text, out float degrees)
{
text = text.Trim();
switch (text.ToLowerInvariant())
{
case "to top":
degrees = 0;
return true;
case "to top right":
case "to right top":
degrees = 45;
return true;
case "to right":
degrees = 90;
return true;
case "to bottom right":
case "to right bottom":
degrees = 135;
return true;
case "to bottom":
degrees = 180;
return true;
case "to bottom left":
case "to left bottom":
degrees = 225;
return true;
case "to left":
degrees = 270;
return true;
case "to top left":
case "to left top":
degrees = 315;
return true;
}
var suffixes = new[] { "deg", "grad", "rad", "turn" };
foreach (var suffix in suffixes)
{
if (!text.EndsWith(suffix, StringComparison.OrdinalIgnoreCase)
|| !float.TryParse(text.Substring(0, text.Length - suffix.Length),
NumberStyles.Float, CultureInfo.InvariantCulture, out var value)
|| float.IsNaN(value) || float.IsInfinity(value))
{
continue;
}
switch (suffix)
{
case "grad":
degrees = value * 0.9f;
return true;
case "rad":
degrees = value * Mathf.Rad2Deg;
return true;
case "turn":
degrees = value * 360;
return true;
default:
degrees = value;
return true;
}
}
degrees = 0;
return false;
}
private static GradientStop SetStopPosition(GradientStop stop, float position)
{
stop.position = position;
return stop;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 271608aaaedb44ac39b1357557a71342
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

@@ -16,6 +16,7 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _runtimePresets; private SerializedProperty _runtimePresets;
private SerializedProperty _runtimePresetsV2; private SerializedProperty _runtimePresetsV2;
private SerializedProperty _useHDRColorPicker; private SerializedProperty _useHDRColorPicker;
private SerializedProperty _enableColorCorrection;
private ShaderVariantRegistryEditor _shaderVariantRegistryEditor; private ShaderVariantRegistryEditor _shaderVariantRegistryEditor;
private UIEffect[] _legacyPresets; private UIEffect[] _legacyPresets;
private bool _expandRuntimePresets; private bool _expandRuntimePresets;
@@ -25,6 +26,7 @@ namespace Coffee.UIEffects.Editors
{ {
base.OnEnable(); base.OnEnable();
_legacyPresets = UIEffectProjectSettings.LoadEditorPresets(); _legacyPresets = UIEffectProjectSettings.LoadEditorPresets();
_enableColorCorrection = serializedObject.FindProperty("m_EnableColorCorrection");
_useHDRColorPicker = serializedObject.FindProperty("m_UseHDRColorPicker"); _useHDRColorPicker = serializedObject.FindProperty("m_UseHDRColorPicker");
_runtimePresets = serializedObject.FindProperty("m_RuntimePresets"); _runtimePresets = serializedObject.FindProperty("m_RuntimePresets");
_runtimePresetsV2 = serializedObject.FindProperty("m_RuntimePresetsV2"); _runtimePresetsV2 = serializedObject.FindProperty("m_RuntimePresetsV2");
@@ -69,6 +71,17 @@ namespace Coffee.UIEffects.Editors
// Legacy Presets // Legacy Presets
DrawLegacyPresets(); DrawLegacyPresets();
// Settings
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(_enableColorCorrection);
if (EditorGUI.EndChangeCheck())
{
foreach (var g in Misc.FindObjectsOfType<UIEffect>())
{
g.SetMaterialContextAllDirty();
}
}
// Editor // Editor
// Use HDR color pickers. // Use HDR color pickers.
EditorGUILayout.PropertyField(_useHDRColorPicker); EditorGUILayout.PropertyField(_useHDRColorPicker);
+148 -6
View File
@@ -1,7 +1,8 @@
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using System; using System;
using System.Reflection; using System.Reflection;
using Coffee.UIEffectInternal;
namespace Coffee.UIEffects.Editors namespace Coffee.UIEffects.Editors
{ {
@@ -18,6 +19,12 @@ namespace Coffee.UIEffects.Editors
(Action<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Action<SerializedProperty, Gradient>), (Action<SerializedProperty, Gradient>)Delegate.CreateDelegate(typeof(Action<SerializedProperty, Gradient>),
s_PiGradient.SetMethod); s_PiGradient.SetMethod);
private static GUIContent s_PasteColorContent;
private static GUIContent s_PasteGradientContent;
private static GUIContent s_RoundCornerIconContent;
private static readonly GUIContent s_RotationLabel = new GUIContent("* Rotation");
private static readonly GUIContent s_KeepAspectRatioLabel = new GUIContent("* Keep Aspect Ratio");
private SerializedProperty _toneFilter; private SerializedProperty _toneFilter;
private SerializedProperty _toneIntensity; private SerializedProperty _toneIntensity;
@@ -103,12 +110,32 @@ namespace Coffee.UIEffects.Editors
private SerializedProperty _detailTexOffset; private SerializedProperty _detailTexOffset;
private SerializedProperty _detailTexSpeed; private SerializedProperty _detailTexSpeed;
private SerializedProperty _roundCornerMode;
private SerializedProperty _roundCornerRadius;
private SerializedProperty _roundCornerRadiusTL;
private SerializedProperty _roundCornerRadiusTR;
private SerializedProperty _roundCornerRadiusBR;
private SerializedProperty _roundCornerRadiusBL;
private bool _roundCornerRadiiLinked;
private SerializedProperty _flip; private SerializedProperty _flip;
private static GUIContent s_RotationLabel = new GUIContent("* Rotation");
private static GUIContent s_KeepAspectRatioLabel = new GUIContent("* Keep Aspect Ratio");
protected virtual void OnEnable() protected virtual void OnEnable()
{ {
const string iconDir = "Packages/com.coffee.ui-effect/Editor/Icons";
if (s_PasteColorContent == null)
{
s_PasteColorContent = Misc.GetIconContent($"{iconDir}/PasteIcon.png",
$"Paste {PasteColorUtil.SupportedFormats} or CSS background/background-color declarations.");
s_PasteGradientContent = Misc.GetIconContent($"{iconDir}/PasteIcon.png",
"Paste CSS linear-gradient(...) or radial-gradient(...).");
}
if (s_RoundCornerIconContent == null)
{
s_RoundCornerIconContent = Misc.GetIconContent($"{iconDir}/RoundCornerIcon.png");
}
_toneFilter = serializedObject.FindProperty("m_ToneFilter"); _toneFilter = serializedObject.FindProperty("m_ToneFilter");
_toneIntensity = serializedObject.FindProperty("m_ToneIntensity"); _toneIntensity = serializedObject.FindProperty("m_ToneIntensity");
@@ -197,6 +224,23 @@ namespace Coffee.UIEffects.Editors
_detailTexOffset = serializedObject.FindProperty("m_DetailTexOffset"); _detailTexOffset = serializedObject.FindProperty("m_DetailTexOffset");
_detailTexSpeed = serializedObject.FindProperty("m_DetailTexSpeed"); _detailTexSpeed = serializedObject.FindProperty("m_DetailTexSpeed");
_roundCornerMode = serializedObject.FindProperty("m_RoundCornerMode");
_roundCornerRadius = serializedObject.FindProperty("m_RoundCornerRadius");
_roundCornerRadiusTL = _roundCornerRadius.FindPropertyRelative("x");
_roundCornerRadiusTR = _roundCornerRadius.FindPropertyRelative("y");
_roundCornerRadiusBR = _roundCornerRadius.FindPropertyRelative("z");
_roundCornerRadiusBL = _roundCornerRadius.FindPropertyRelative("w");
_roundCornerRadiiLinked = !_roundCornerRadiusTL.hasMultipleDifferentValues
&& !_roundCornerRadiusTR.hasMultipleDifferentValues
&& !_roundCornerRadiusBR.hasMultipleDifferentValues
&& !_roundCornerRadiusBL.hasMultipleDifferentValues
&& Mathf.Approximately(_roundCornerRadiusTL.floatValue,
_roundCornerRadiusTR.floatValue)
&& Mathf.Approximately(_roundCornerRadiusTL.floatValue,
_roundCornerRadiusBR.floatValue)
&& Mathf.Approximately(_roundCornerRadiusTL.floatValue,
_roundCornerRadiusBL.floatValue);
_flip = serializedObject.FindProperty("m_Flip"); _flip = serializedObject.FindProperty("m_Flip");
} }
@@ -363,7 +407,18 @@ namespace Coffee.UIEffects.Editors
// Gradient // Gradient
DrawSeparator(); DrawSeparator();
if (DrawHeaderPopup(_gradationMode)) EditorGUILayout.BeginHorizontal();
var isGradationEnabled = DrawHeaderPopup(_gradationMode);
if (GUILayout.Button(s_PasteGradientContent, "IconButton"))
{
PasteGradientUtil.PasteFromClipboard(_gradationGradient, s_SetGradient,
_gradationMode, _gradationRotation, _gradationOffset, _gradationScale, _gradationWrapMode,
_gradationReverse);
}
EditorGUILayout.EndHorizontal();
if (isGradationEnabled)
{ {
EditorGUI.indentLevel++; EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_gradationColorFilter); EditorGUILayout.PropertyField(_gradationColorFilter);
@@ -465,6 +520,15 @@ namespace Coffee.UIEffects.Editors
EditorGUI.indentLevel--; EditorGUI.indentLevel--;
} }
// Round Corner
DrawSeparator();
if (DrawHeaderPopup(_roundCornerMode))
{
EditorGUI.indentLevel++;
DrawRoundCornerRadii();
EditorGUI.indentLevel--;
}
// Flip // Flip
DrawSeparator(); DrawSeparator();
DrawHeaderPopup(_flip); DrawHeaderPopup(_flip);
@@ -490,6 +554,75 @@ namespace Coffee.UIEffects.Editors
EditorGUI.indentLevel = indentLevel; EditorGUI.indentLevel = indentLevel;
} }
private void DrawRoundCornerRadii()
{
var radii = _roundCornerRadius;
var lineH = EditorGUIUtility.singleLineHeight;
var r = EditorGUILayout.GetControlRect(false, lineH * 2 + 2);
var labelW = EditorGUIUtility.labelWidth;
var controlX = r.x + labelW;
var controlW = r.width - labelW;
var fieldW = (controlW - 48) / 2;
var leftIconX = controlX;
var leftFieldX = leftIconX + 4;
var linkX = leftFieldX + fieldW + 10;
var rightFieldX = linkX + 14;
var rightIconX = rightFieldX + fieldW + 2;
var bottomY = r.y + lineH + 2;
var prefixPos = new Rect(r.x, r.y, r.width, lineH);
// Label
{
var label = EditorGUIUtility.TrTempContent("Corner Radii");
label = EditorGUI.BeginProperty(prefixPos, label, _roundCornerRadius);
EditorGUI.PrefixLabel(prefixPos, label);
}
// Link toggle
{
var linkRect = new Rect(linkX, r.y + (r.height - 22) * 0.5f, 22, 22);
var linkContent = EditorGUIUtility.IconContent(_roundCornerRadiiLinked ? "Linked" : "Unlinked");
EditorGUI.BeginChangeCheck();
_roundCornerRadiiLinked = GUI.Toggle(linkRect, _roundCornerRadiiLinked, linkContent, "IconButton");
if (EditorGUI.EndChangeCheck())
{
var v = Mathf.Max(0, _roundCornerRadiusTL.floatValue);
radii.vector4Value = new Vector4(v, v, v, v);
}
}
// Draw fields
var linked = _roundCornerRadiiLinked;
Misc.DrawIconContent(new Rect(leftIconX, r.y, 18, 18), s_RoundCornerIconContent, 0);
DrawRadiusField(new Rect(leftFieldX, r.y, fieldW, lineH), _roundCornerRadiusTL, radii, linked);
Misc.DrawIconContent(new Rect(rightIconX, r.y, 18, 18), s_RoundCornerIconContent, 90);
DrawRadiusField(new Rect(rightFieldX, r.y, fieldW, lineH), _roundCornerRadiusTR, radii, linked);
Misc.DrawIconContent(new Rect(rightIconX, bottomY, 18, 18), s_RoundCornerIconContent, 180);
DrawRadiusField(new Rect(leftFieldX, bottomY, fieldW, lineH), _roundCornerRadiusBL, radii, linked);
Misc.DrawIconContent(new Rect(leftIconX, bottomY, 18, 18), s_RoundCornerIconContent, 270);
DrawRadiusField(new Rect(rightFieldX, bottomY, fieldW, lineH), _roundCornerRadiusBR, radii, linked);
EditorGUI.EndProperty();
return;
static void DrawRadiusField(Rect rect, SerializedProperty radius, SerializedProperty radii, bool linked)
{
EditorGUI.BeginChangeCheck();
EditorGUI.PropertyField(rect, radius, GUIContent.none);
if (!EditorGUI.EndChangeCheck()) return;
var v = Mathf.Max(0, radius.floatValue);
radius.floatValue = v;
if (linked)
{
radii.vector4Value = new Vector4(v, v, v, v);
}
}
}
private static void DrawColorPickerField(Rect rect, SerializedProperty color, bool showAlpha) private static void DrawColorPickerField(Rect rect, SerializedProperty color, bool showAlpha)
{ {
var label = EditorGUIUtility.TrTempContent(color.displayName); var label = EditorGUIUtility.TrTempContent(color.displayName);
@@ -502,11 +635,20 @@ namespace Coffee.UIEffects.Editors
var hdr = UIEffectProjectSettings.useHdrColorPicker; var hdr = UIEffectProjectSettings.useHdrColorPicker;
EditorGUI.showMixedValue = color.hasMultipleDifferentValues; EditorGUI.showMixedValue = color.hasMultipleDifferentValues;
const float pasteWidth = 20f;
var colorRect = new Rect(rect.x, rect.y, rect.width - pasteWidth - 2, rect.height);
var pasteRect = new Rect(colorRect.xMax + 2, rect.y, pasteWidth, rect.height);
EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck();
var colorValue = EditorGUI.ColorField(rect, label, color.colorValue, true, showAlpha, hdr); var colorValue = EditorGUI.ColorField(colorRect, label, color.colorValue, true, showAlpha, hdr);
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
color.colorValue = colorValue; color.colorValue = UIEffectProjectSettings.enableColorCorrection ? colorValue : colorValue.gamma;
}
if (GUI.Button(pasteRect, s_PasteColorContent, "IconButton"))
{
PasteColorUtil.PasteFromClipboard(color);
} }
} }
+26 -3
View File
@@ -38,6 +38,7 @@ Apply professional-grade filters like grayscale, blur, and dissolve directly fro
- [Install via UPM (Manually)](#install-via-upm-manually) - [Install via UPM (Manually)](#install-via-upm-manually)
- [Install as Embedded Package](#install-as-embedded-package) - [Install as Embedded Package](#install-as-embedded-package)
- [Import Additional Resources](#import-additional-resources) - [Import Additional Resources](#import-additional-resources)
- [Install Additional Resources as Packages](#install-additional-resources-as-packages)
- [🔄 Upgrading from v4 to v5](#-upgrading-from-v4-to-v5) - [🔄 Upgrading from v4 to v5](#-upgrading-from-v4-to-v5)
- [🚀 Usage](#-usage) - [🚀 Usage](#-usage)
- [Getting Started](#getting-started) - [Getting Started](#getting-started)
@@ -52,6 +53,7 @@ Apply professional-grade filters like grayscale, blur, and dissolve directly fro
- [Gradation Mode](#gradation-mode) - [Gradation Mode](#gradation-mode)
- [Edge Mode](#edge-mode) - [Edge Mode](#edge-mode)
- [Detail Filter](#detail-filter) - [Detail Filter](#detail-filter)
- [Round Corner](#round-corner)
- [Flip](#flip) - [Flip](#flip)
- [Others](#others) - [Others](#others)
- [Component: UIEffectTweener](#component-uieffecttweener) - [Component: UIEffectTweener](#component-uieffecttweener)
@@ -67,6 +69,7 @@ Apply professional-grade filters like grayscale, blur, and dissolve directly fro
- [Settings](#settings) - [Settings](#settings)
- [Editor](#editor) - [Editor](#editor)
- [Shader](#shader) - [Shader](#shader)
- [Advanced](#advanced)
- [:warning: Limitations](#warning-limitations) - [:warning: Limitations](#warning-limitations)
- [🤝 Contributing](#-contributing) - [🤝 Contributing](#-contributing)
- [Issues](#issues) - [Issues](#issues)
@@ -297,13 +300,17 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
#### Color Filter #### Color Filter
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-inspector-color.png) ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1795598277160.png)
- **Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast` - **Color Filter**: `None`, `Multiply`, `Additive`, `Subtractive`, `Replace`, `Multiply Luminance`, `Multiply Additive`, `Hsv Modifier`, `Contrast`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-color.png) ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-color.png)
- **Color Intensity**: 0.0 (no effect) - 1.0 (full effect). - **Color Intensity**: 0.0 (no effect) - 1.0 (full effect).
- **Color Glow**: Set the color to glow. - **Color Glow**: Set the color to glow.
> [!TIP]
> The paste button beside a color field accepts hex values (`#RGB`, `#RRGGBB`, `#RGBA`, `#RRGGBBAA`), Unity-supported color names, `transparent`, `rgb()`, and `rgba()`. It also accepts CSS `background` or `background-color` declarations containing one of these values.
> This is useful when copying and pasting color codes from CSS, USS, Figma, Photoshop, etc.
<br> <br>
#### Sampling Filter #### Sampling Filter
@@ -389,7 +396,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
#### Gradation Mode #### Gradation Mode
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744305109784.png) ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1795615744853.png)
- **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `RadialGradient`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient` - **Gradation Mode**: `None`, `Horizontal`, `HorizontalGradient`, `Vertical`, `VerticalGradient`, `Radial`, `RadialGradient`, `Diagonal`, `DiagonalToRightBottom`, `DiagonalToLeftBottom`, `Angle`, `AngleGradient`
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749461050342.png) ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1749461050342.png)
@@ -407,6 +414,10 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
- **Keep Aspect Ratio**: - **Keep Aspect Ratio**:
- ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`. - ⚠️ NOTE: `Keep Aspect Ratio` is shared with `Transition Filter` and `Gradation Mode` and `Detail Filter`.
> [!TIP]
> The paste button beside the Gradation Mode selector accepts CSS `linear-gradient(...)` and `radial-gradient(...)` values, including gradients in CSS `background` declarations. It imports the color stops and positions, selects `AngleGradient` or `RadialGradient`, and resets the gradation offset and scale. Explicit linear-gradient directions and angles (`deg`, `grad`, `rad`, or `turn`) are applied to the rotation. CSS radial-gradient shape, size, and position are not imported.
> This is useful when copying and pasting color codes from CSS, USS, Figma, Photoshop, etc.
<br> <br>
#### Edge Mode #### Edge Mode
@@ -442,6 +453,18 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
<br> <br>
#### Round Corner
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1795709212318.png)
- **Mode**: `Off` or `On`. The default is `Off`.
- **Corner Radii**: Set each corner radius independently.
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1795681588650.png)
- Radius values use `transitionRoot` local units. They are normalized against its shorter dimension and clamped to half that dimension; `0` keeps a corner square.
- The mask applies to the main UI surface; Shadow and Mirror outputs are left unchanged to avoid shadow-edge artifacts.
<br>
#### Flip #### Flip
![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744762521061.png) ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1744762521061.png)
@@ -466,7 +489,7 @@ The `UIEffect` component applies visual effects to UI elements, allowing various
- **Custom Root**: Use the custom transform for some effects. - **Custom Root**: Use the custom transform for some effects.
> [!TIP] > [!TIP]
> `Transition Filter`, `Gradation Filter`, and `Detail Filter` usually refer to their own `RectTransform` when applying effects. > `Transition Filter`, `Gradation Filter`, `Detail Filter`, and `Round Corner` use their effect root for local-coordinate calculations.
> For example, if the mesh shape exceeds the `RectTransform` boundaries, the effect may not be applied correctly. > For example, if the mesh shape exceeds the `RectTransform` boundaries, the effect may not be applied correctly.
> By specifying `Custom Root`, you can refer to the specified transform. > By specifying `Custom Root`, you can refer to the specified transform.
> ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-custom-root.gif) > ![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/uieffect5.7.0-sample-custom-root.gif)
+6
View File
@@ -90,6 +90,12 @@ namespace Coffee.UIEffects
Mirror Mirror
} }
public enum RoundCornerMode
{
Off = 0,
On = 1
}
public enum EdgeMode public enum EdgeMode
{ {
None = 0, None = 0,
@@ -19,7 +19,11 @@ namespace Coffee.UIEffectInternal
#endif #endif
private static void Clear() private static void Clear()
{ {
s_Caches.Clear(); lock (s_Caches)
{
s_Caches.Clear();
}
UIExtraCallbacks.onLateAfterCanvasRebuild -= ClearAllCache; UIExtraCallbacks.onLateAfterCanvasRebuild -= ClearAllCache;
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache; UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
} }
@@ -74,21 +78,27 @@ namespace Coffee.UIEffectInternal
private static void ClearAllCache() private static void ClearAllCache()
{ {
foreach (var cache in s_Caches.Values) lock (s_Caches)
{ {
cache.Clear(); foreach (var cache in s_Caches.Values)
{
cache.Clear();
}
} }
} }
private static FrameCacheContainer<T> GetFrameCache<T>() private static FrameCacheContainer<T> GetFrameCache<T>()
{ {
var t = typeof(T); lock (s_Caches)
if (s_Caches.TryGetValue(t, out var frameCache)) return frameCache as FrameCacheContainer<T>; {
var t = typeof(T);
if (s_Caches.TryGetValue(t, out var frameCache)) return frameCache as FrameCacheContainer<T>;
frameCache = new FrameCacheContainer<T>(); frameCache = new FrameCacheContainer<T>();
s_Caches.Add(t, frameCache); s_Caches.Add(t, frameCache);
return (FrameCacheContainer<T>)frameCache; return (FrameCacheContainer<T>)frameCache;
}
} }
private interface IFrameCache private interface IFrameCache
@@ -102,17 +112,26 @@ namespace Coffee.UIEffectInternal
public void Clear() public void Clear()
{ {
_caches.Clear(); lock (_caches)
{
_caches.Clear();
}
} }
public bool TryGet((int, int) key, out T result) public bool TryGet((int, int) key, out T result)
{ {
return _caches.TryGetValue(key, out result); lock (_caches)
{
return _caches.TryGetValue(key, out result);
}
} }
public void Set((int, int) key, T result) public void Set((int, int) key, T result)
{ {
_caches[key] = result; lock (_caches)
{
_caches[key] = result;
}
} }
} }
} }
@@ -13,6 +13,7 @@ using UnityEditor.SceneManagement;
#else #else
using UnityEditor.Experimental.SceneManagement; using UnityEditor.Experimental.SceneManagement;
#endif #endif
#endif #endif
namespace Coffee.UIEffectInternal namespace Coffee.UIEffectInternal
@@ -86,6 +87,36 @@ namespace Coffee.UIEffectInternal
} }
#endif #endif
} }
#if UNITY_EDITOR
public static GUIContent GetIconContent(string iconPath, string tooltip = null)
{
if (string.IsNullOrEmpty(iconPath))
{
return new GUIContent(tooltip);
}
if (EditorGUIUtility.isProSkin)
{
var darkIconPath = $"{Path.GetDirectoryName(iconPath)}/d_{Path.GetFileName(iconPath)}";
if (File.Exists(darkIconPath))
{
iconPath = darkIconPath;
}
}
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(iconPath);
return new GUIContent(icon, tooltip);
}
public static void DrawIconContent(Rect rect, GUIContent content, float angle = 0f)
{
var matrix = GUI.matrix;
GUIUtility.RotateAroundPivot(angle, rect.center);
GUI.Label(rect, content);
GUI.matrix = matrix;
}
#endif
} }
#if !UNITY_2021_2_OR_NEWER #if !UNITY_2021_2_OR_NEWER
+93 -1
View File
@@ -7,7 +7,7 @@ using UnityEngine.Rendering;
namespace Coffee.UIEffects namespace Coffee.UIEffects
{ {
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")] [Icon("Packages/com.coffee.ui-effect/Editor/Icons/UIEffectIconIcon.png")]
[ExecuteAlways] [ExecuteAlways]
[DisallowMultipleComponent] [DisallowMultipleComponent]
public class UIEffect : UIEffectBase public class UIEffect : UIEffectBase
@@ -266,6 +266,12 @@ namespace Coffee.UIEffects
[SerializeField] [SerializeField]
protected Vector2 m_DetailTexSpeed = new Vector2(0, 0); protected Vector2 m_DetailTexSpeed = new Vector2(0, 0);
[SerializeField]
protected RoundCornerMode m_RoundCornerMode = RoundCornerMode.Off;
[SerializeField]
protected Vector4 m_RoundCornerRadius = new Vector4(20, 20, 20, 20);
[SerializeField] [SerializeField]
protected RectTransform m_CustomRoot = null; protected RectTransform m_CustomRoot = null;
@@ -1423,6 +1429,71 @@ namespace Coffee.UIEffects
} }
} }
public Vector4 roundCornerRadius
{
get => m_RoundCornerRadius;
set
{
value = new Vector4(
Mathf.Max(0, value.x),
Mathf.Max(0, value.y),
Mathf.Max(0, value.z),
Mathf.Max(0, value.w));
if (m_RoundCornerRadius.x == value.x
&& m_RoundCornerRadius.y == value.y
&& m_RoundCornerRadius.z == value.z
&& m_RoundCornerRadius.w == value.w)
{
return;
}
context.m_RoundCornerRadius = m_RoundCornerRadius = value;
SetMaterialDirty();
}
}
public RoundCornerMode roundCornerMode
{
get => m_RoundCornerMode;
set
{
if (m_RoundCornerMode == value) return;
context.m_RoundCornerMode = m_RoundCornerMode = value;
SetMaterialDirty();
}
}
public float roundCornerRadiusTopLeft
{
get => m_RoundCornerRadius.x;
set => SetRoundCornerRadius(0, value);
}
public float roundCornerRadiusTopRight
{
get => m_RoundCornerRadius.y;
set => SetRoundCornerRadius(1, value);
}
public float roundCornerRadiusBottomRight
{
get => m_RoundCornerRadius.z;
set => SetRoundCornerRadius(2, value);
}
public float roundCornerRadiusBottomLeft
{
get => m_RoundCornerRadius.w;
set => SetRoundCornerRadius(3, value);
}
private void SetRoundCornerRadius(int index, float value)
{
var radius = m_RoundCornerRadius;
radius[index] = value;
roundCornerRadius = radius;
}
public bool allowToModifyMeshShape public bool allowToModifyMeshShape
{ {
get => m_AllowToModifyMeshShape; get => m_AllowToModifyMeshShape;
@@ -1837,6 +1908,12 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed; dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
} }
if (!append || src.m_RoundCornerMode != RoundCornerMode.Off)
{
dst.m_RoundCornerMode = src.m_RoundCornerMode;
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
}
if (!append || src.m_Flip != 0) if (!append || src.m_Flip != 0)
{ {
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip; dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
@@ -1969,6 +2046,12 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed; dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
} }
if (!append || src.m_RoundCornerMode != RoundCornerMode.Off)
{
dst.m_RoundCornerMode = src.m_RoundCornerMode;
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
}
if (!append || src.m_Flip != 0) if (!append || src.m_Flip != 0)
{ {
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip; dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
@@ -2111,6 +2194,12 @@ namespace Coffee.UIEffects
dst.m_DetailTexSpeed = src.m_DetailTexSpeed; dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
} }
if (!append || src.m_RoundCornerMode != RoundCornerMode.Off)
{
dst.m_RoundCornerMode = src.m_RoundCornerMode;
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
}
if (!append || src.m_Flip != 0) if (!append || src.m_Flip != 0)
{ {
dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip; dst.m_Flip = append ? dst.m_Flip | src.m_Flip : src.m_Flip;
@@ -2204,6 +2293,9 @@ namespace Coffee.UIEffects
dst.m_DetailTexOffset = src.m_DetailTexOffset; dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed; dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_RoundCornerMode = src.m_RoundCornerMode;
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
dst.m_Flip = src.m_Flip; dst.m_Flip = src.m_Flip;
} }
} }
+7
View File
@@ -288,6 +288,13 @@ namespace Coffee.UIEffects
_isContextDirty = true; _isContextDirty = true;
} }
public void SetMaterialContextAllDirty()
{
_isContextDirty = true;
context.SetGradationDirty();
context.SetTransitionGradationDirty();
}
internal void ReleaseMaterial() internal void ReleaseMaterial()
{ {
MaterialRepository.Release(ref _material); MaterialRepository.Release(ref _material);
+70 -5
View File
@@ -57,6 +57,8 @@ namespace Coffee.UIEffects
private static readonly int s_DetailTex = Shader.PropertyToID("_DetailTex"); private static readonly int s_DetailTex = Shader.PropertyToID("_DetailTex");
private static readonly int s_DetailTex_ST = Shader.PropertyToID("_DetailTex_ST"); private static readonly int s_DetailTex_ST = Shader.PropertyToID("_DetailTex_ST");
private static readonly int s_DetailTex_Speed = Shader.PropertyToID("_DetailTex_Speed"); private static readonly int s_DetailTex_Speed = Shader.PropertyToID("_DetailTex_Speed");
private static readonly int s_RoundCornerRadius = Shader.PropertyToID("_RoundCornerRadius");
private static readonly int s_RoundCornerRectSize = Shader.PropertyToID("_RoundCornerRectSize");
private static readonly int s_GradationIntensity = Shader.PropertyToID("_GradationIntensity"); private static readonly int s_GradationIntensity = Shader.PropertyToID("_GradationIntensity");
private static readonly int s_GradationColorFilter = Shader.PropertyToID("_GradationColorFilter"); private static readonly int s_GradationColorFilter = Shader.PropertyToID("_GradationColorFilter");
private static readonly int s_GradationColor1 = Shader.PropertyToID("_GradationColor1"); private static readonly int s_GradationColor1 = Shader.PropertyToID("_GradationColor1");
@@ -67,8 +69,13 @@ namespace Coffee.UIEffects
private static readonly int s_GradationTex_ST = Shader.PropertyToID("_GradationTex_ST"); private static readonly int s_GradationTex_ST = Shader.PropertyToID("_GradationTex_ST");
private static readonly int s_GradationRadial = Shader.PropertyToID("_GradationRadial"); private static readonly int s_GradationRadial = Shader.PropertyToID("_GradationRadial");
private static readonly int s_RootViewMatrix = Shader.PropertyToID("_RootViewMatrix"); private static readonly int s_RootViewMatrix = Shader.PropertyToID("_RootViewMatrix");
private static readonly int s_RoundCornerViewMatrix = Shader.PropertyToID("_RoundCornerViewMatrix");
private static readonly int s_GradViewMatrix = Shader.PropertyToID("_GradViewMatrix"); private static readonly int s_GradViewMatrix = Shader.PropertyToID("_GradViewMatrix");
private static readonly int s_MirrorRootViewMatrix = Shader.PropertyToID("_MirrorRootViewMatrix"); private static readonly int s_MirrorRootViewMatrix = Shader.PropertyToID("_MirrorRootViewMatrix");
private static readonly int s_MirrorRoundCornerViewMatrix =
Shader.PropertyToID("_MirrorRoundCornerViewMatrix");
private static readonly int s_MirrorGradViewMatrix = Shader.PropertyToID("_MirrorGradViewMatrix"); private static readonly int s_MirrorGradViewMatrix = Shader.PropertyToID("_MirrorGradViewMatrix");
private static readonly int s_CanvasToWorldMatrix = Shader.PropertyToID("_CanvasToWorldMatrix"); private static readonly int s_CanvasToWorldMatrix = Shader.PropertyToID("_CanvasToWorldMatrix");
@@ -147,6 +154,12 @@ namespace Coffee.UIEffects
"GRADATION_COLOR4" "GRADATION_COLOR4"
}; };
private static readonly string[] s_RoundCornerKeywords =
{
"",
"ROUND_CORNER_ON"
};
private static readonly Vector2[][] s_ShadowVectors = new[] private static readonly Vector2[][] s_ShadowVectors = new[]
{ {
Array.Empty<Vector2>(), // None Array.Empty<Vector2>(), // None
@@ -243,8 +256,17 @@ namespace Coffee.UIEffects
public Vector2 m_DetailTexOffset; public Vector2 m_DetailTexOffset;
public Vector2 m_DetailTexSpeed; public Vector2 m_DetailTexSpeed;
public RoundCornerMode m_RoundCornerMode;
public Vector4 m_RoundCornerRadius;
public Flip m_Flip; public Flip m_Flip;
private bool hasRoundCorner => m_RoundCornerMode == RoundCornerMode.On
&& (0 < m_RoundCornerRadius.x
|| 0 < m_RoundCornerRadius.y
|| 0 < m_RoundCornerRadius.z
|| 0 < m_RoundCornerRadius.w);
public bool willModifyMaterial => m_ToneFilter != ToneFilter.None public bool willModifyMaterial => m_ToneFilter != ToneFilter.None
|| m_ColorFilter != ColorFilter.None || m_ColorFilter != ColorFilter.None
|| m_SamplingFilter != SamplingFilter.None || m_SamplingFilter != SamplingFilter.None
@@ -254,14 +276,16 @@ namespace Coffee.UIEffects
|| m_ShadowMode != ShadowMode.None || m_ShadowMode != ShadowMode.None
|| m_EdgeMode != EdgeMode.None || m_EdgeMode != EdgeMode.None
|| m_DetailFilter != DetailFilter.None || m_DetailFilter != DetailFilter.None
|| m_GradationMode != GradationMode.None; || m_GradationMode != GradationMode.None
|| hasRoundCorner;
public bool willModifyVertex => willModifyMaterial; public bool willModifyVertex => willModifyMaterial;
public bool useViewMatrix => m_TransitionFilter != TransitionFilter.None public bool useViewMatrix => m_TransitionFilter != TransitionFilter.None
|| m_GradationMode != GradationMode.None || m_GradationMode != GradationMode.None
|| m_DetailFilter != DetailFilter.None || m_DetailFilter != DetailFilter.None
|| m_EdgeMode == EdgeMode.Shiny; || m_EdgeMode == EdgeMode.Shiny
|| hasRoundCorner;
private Texture2D _gradationRampTex; private Texture2D _gradationRampTex;
private Texture2D _transitionRampTex; private Texture2D _transitionRampTex;
@@ -299,7 +323,7 @@ namespace Coffee.UIEffects
{ {
var x = m_GradationReverse ? w - 1 - i : i; var x = m_GradationReverse ? w - 1 - i : i;
var t = (float)i / (w - 1); var t = (float)i / (w - 1);
s_Colors[x] = ApplyColorSpace(m_GradationGradient.Evaluate(t)); s_Colors[x] = ApplyColorSpaceForGradient(m_GradationGradient.Evaluate(t));
} }
_gradationRampTex.wrapMode = m_GradationWrapMode; _gradationRampTex.wrapMode = m_GradationWrapMode;
@@ -325,7 +349,7 @@ namespace Coffee.UIEffects
for (var i = 0; i < w; i++) for (var i = 0; i < w; i++)
{ {
var t = (float)i / (w - 1); var t = (float)i / (w - 1);
s_Colors[i] = ApplyColorSpace(m_TransitionGradient.Evaluate(t)); s_Colors[i] = ApplyColorSpaceForGradient(m_TransitionGradient.Evaluate(t));
} }
s_Colors[w - 1].a = 0; s_Colors[w - 1].a = 0;
@@ -434,6 +458,9 @@ namespace Coffee.UIEffects
dst.m_DetailTexOffset = src.m_DetailTexOffset; dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed; dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_RoundCornerMode = src.m_RoundCornerMode;
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
dst.m_Flip = src.m_Flip; dst.m_Flip = src.m_Flip;
} }
@@ -539,6 +566,8 @@ namespace Coffee.UIEffects
new Vector4(m_DetailTexScale.x, m_DetailTexScale.y, new Vector4(m_DetailTexScale.x, m_DetailTexScale.y,
m_DetailTexOffset.x, m_DetailTexOffset.y)); m_DetailTexOffset.x, m_DetailTexOffset.y));
material.SetVector(s_DetailTex_Speed, m_DetailTexSpeed); material.SetVector(s_DetailTex_Speed, m_DetailTexSpeed);
material.SetVector(s_RoundCornerRadius, Vector4.zero);
material.SetVector(s_RoundCornerRectSize, Vector2.one);
SetKeyword(material, s_ToneKeywords, (int)m_ToneFilter); SetKeyword(material, s_ToneKeywords, (int)m_ToneFilter);
SetKeyword(material, s_ColorKeywords, m_ColorFilter != 0 || m_ShadowMode != 0 ? 1 : 0); SetKeyword(material, s_ColorKeywords, m_ColorFilter != 0 || m_ShadowMode != 0 ? 1 : 0);
@@ -547,6 +576,7 @@ namespace Coffee.UIEffects
SetKeyword(material, s_EdgeKeywords, (int)m_EdgeMode); SetKeyword(material, s_EdgeKeywords, (int)m_EdgeMode);
SetKeyword(material, s_DetailKeywords, (int)m_DetailFilter); SetKeyword(material, s_DetailKeywords, (int)m_DetailFilter);
SetKeyword(material, s_TargetKeywords, (int)m_TargetMode); SetKeyword(material, s_TargetKeywords, (int)m_TargetMode);
SetKeyword(material, s_RoundCornerKeywords, (int)m_RoundCornerMode);
switch (m_GradationMode) switch (m_GradationMode)
{ {
@@ -608,6 +638,26 @@ namespace Coffee.UIEffects
var offset = (transitionRoot.pivot - (Vector2)pivot) * size; var offset = (transitionRoot.pivot - (Vector2)pivot) * size;
var w2LMat = Matrix4x4.Translate(offset) * transitionRoot.worldToLocalMatrix; var w2LMat = Matrix4x4.Translate(offset) * transitionRoot.worldToLocalMatrix;
var roundCornerNormalization = Mathf.Min(size.x, size.y);
var roundCornerRectSize = Vector2.one;
var roundCornerRadius = Vector4.zero;
if (m_RoundCornerMode == RoundCornerMode.On && 0 < roundCornerNormalization)
{
roundCornerRectSize = size / roundCornerNormalization;
roundCornerRadius = new Vector4(
Mathf.Clamp(m_RoundCornerRadius.x / roundCornerNormalization, 0, 0.5f),
Mathf.Clamp(m_RoundCornerRadius.y / roundCornerNormalization, 0, 0.5f),
Mathf.Clamp(m_RoundCornerRadius.z / roundCornerNormalization, 0, 0.5f),
Mathf.Clamp(m_RoundCornerRadius.w / roundCornerNormalization, 0, 0.5f));
}
material.SetVector(s_RoundCornerRadius, roundCornerRadius);
material.SetVector(s_RoundCornerRectSize, roundCornerRectSize);
var roundCornerScale = new Vector3(1f / size.x, 1f / size.y, 1f);
material.SetMatrix(s_RoundCornerViewMatrix,
Matrix4x4.TRS(pivot, Quaternion.identity, roundCornerScale) * w2LMat);
var rootRotation = Quaternion.Euler(0, 0, m_TransitionRotation); var rootRotation = Quaternion.Euler(0, 0, m_TransitionRotation);
var rootScale = 1f / GetMultiplier(m_TransitionRotation); var rootScale = 1f / GetMultiplier(m_TransitionRotation);
material.SetMatrix(s_RootViewMatrix, Matrix4x4.TRS(pivot, rootRotation, scale * rootScale) * w2LMat); material.SetMatrix(s_RootViewMatrix, Matrix4x4.TRS(pivot, rootRotation, scale * rootScale) * w2LMat);
@@ -624,6 +674,8 @@ namespace Coffee.UIEffects
var mirrorScale = new Vector3(1, mirrorInv, 1); var mirrorScale = new Vector3(1, mirrorInv, 1);
var udScale = new Vector3(scale.x, -scale.y, scale.z); var udScale = new Vector3(scale.x, -scale.y, scale.z);
var mirrorTranslation = Matrix4x4.TRS(mirrorOffset, Quaternion.identity, mirrorScale) * w2LMat; var mirrorTranslation = Matrix4x4.TRS(mirrorOffset, Quaternion.identity, mirrorScale) * w2LMat;
material.SetMatrix(s_MirrorRoundCornerViewMatrix,
Matrix4x4.TRS(pivot, Quaternion.identity, roundCornerScale) * mirrorTranslation);
material.SetMatrix( material.SetMatrix(
s_MirrorRootViewMatrix, s_MirrorRootViewMatrix,
Matrix4x4.TRS(pivot, rootRotation, udScale * rootScale) * mirrorTranslation Matrix4x4.TRS(pivot, rootRotation, udScale * rootScale) * mirrorTranslation
@@ -852,7 +904,20 @@ namespace Coffee.UIEffects
private static Color ApplyColorSpace(Color color) private static Color ApplyColorSpace(Color color)
{ {
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color : color.gamma; // v5.11.9 or later, color correction is applied to the color filter and gradation colors.
if (UIEffectProjectSettings.enableColorCorrection)
{
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color : color.gamma;
}
else
{
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
}
}
private static Color ApplyColorSpaceForGradient(Color color)
{
return QualitySettings.activeColorSpace == ColorSpace.Linear ? color.linear : color;
} }
} }
} }
+6
View File
@@ -117,6 +117,9 @@ namespace Coffee.UIEffects
public Vector2 m_DetailTexOffset = new Vector2(0, 0); public Vector2 m_DetailTexOffset = new Vector2(0, 0);
public Vector2 m_DetailTexSpeed = new Vector2(0, 0); public Vector2 m_DetailTexSpeed = new Vector2(0, 0);
public RoundCornerMode m_RoundCornerMode = RoundCornerMode.Off;
public Vector4 m_RoundCornerRadius = new Vector4(20, 20, 20, 20);
public Flip m_Flip = 0; public Flip m_Flip = 0;
public void UpdateContext(UIEffectContext dst) public void UpdateContext(UIEffectContext dst)
@@ -206,6 +209,9 @@ namespace Coffee.UIEffects
dst.m_DetailTexOffset = src.m_DetailTexOffset; dst.m_DetailTexOffset = src.m_DetailTexOffset;
dst.m_DetailTexSpeed = src.m_DetailTexSpeed; dst.m_DetailTexSpeed = src.m_DetailTexSpeed;
dst.m_RoundCornerMode = src.m_RoundCornerMode;
dst.m_RoundCornerRadius = src.m_RoundCornerRadius;
dst.m_Flip = src.m_Flip; dst.m_Flip = src.m_Flip;
} }
} }
@@ -21,6 +21,12 @@ namespace Coffee.UIEffects
[SerializeField] [SerializeField]
internal List<UIEffectPreset> m_RuntimePresetsV2 = new List<UIEffectPreset>(); internal List<UIEffectPreset> m_RuntimePresetsV2 = new List<UIEffectPreset>();
[Header("Settings")]
[Tooltip("Whether to enable the color correction feature added in v5.11.9.\n" +
"If disabled, the color picker will not display the correct colors, but compatibility with previous versions can be maintained.")]
[HideInInspector]
[SerializeField] private bool m_EnableColorCorrection = true;
[Header("Editor")] [Header("Editor")]
[Tooltip("Use HDR color pickers on color fields.")] [Tooltip("Use HDR color pickers on color fields.")]
[HideInInspector] [HideInInspector]
@@ -38,6 +44,16 @@ namespace Coffee.UIEffects
public static ShaderVariantCollection shaderVariantCollection => shaderRegistry.shaderVariantCollection; public static ShaderVariantCollection shaderVariantCollection => shaderRegistry.shaderVariantCollection;
/// <summary>
/// Whether to enable the color correction feature added in v5.11.9.
/// If disabled, the color picker will not display the correct colors, but compatibility with previous
/// versions can be maintained.
/// </summary>
public static bool enableColorCorrection => instance.m_EnableColorCorrection;
/// <summary>
/// Whether to use HDR color pickers on color fields.
/// </summary>
public static bool useHdrColorPicker public static bool useHdrColorPicker
{ {
get => instance.m_UseHDRColorPicker; get => instance.m_UseHDRColorPicker;
@@ -103,10 +119,10 @@ namespace Coffee.UIEffects
{ {
#if !LEGACY_TMP_ENABLE #if !LEGACY_TMP_ENABLE
const string tmpSupport = "TextMeshPro Support (Unity 6)"; const string tmpSupport = "TextMeshPro Support (Unity 6)";
const string version = "v5.11.0 (Unity 6)"; const string version = "v5.15.0 (Unity 6)";
#else #else
const string tmpSupport = "TextMeshPro Support"; const string tmpSupport = "TextMeshPro Support";
const string version = "v5.11.0"; const string version = "v5.15.0";
#endif #endif
ShaderSampleImporter.RegisterReadmeUrl("https://github.com/mob-sakai/UIEffect#import-additional-resources"); ShaderSampleImporter.RegisterReadmeUrl("https://github.com/mob-sakai/UIEffect#import-additional-resources");
ShaderSampleImporter.RegisterShaderSamples(new[] ShaderSampleImporter.RegisterShaderSamples(new[]
@@ -122,8 +138,8 @@ namespace Coffee.UIEffects
("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version), ("Hidden/TextMeshPro/Mobile/Distance Field (UIEffect)", tmpSupport, version),
// ShaderGraph Support // ShaderGraph Support
("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.11.0"), ("Shader Graphs/UISample (UIEffect)", "ShaderGraph Support (Unity 6 BuiltIn)", "v5.15.0"),
("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.11.0") ("Shader Graphs/UISampleURP (UIEffect)", "ShaderGraph Support (Unity 6 URP)", "v5.15.0")
}); });
ShaderSampleImporter.RegisterShaderAliases(new[] ShaderSampleImporter.RegisterShaderAliases(new[]
{ {
+1 -1
View File
@@ -4,7 +4,7 @@ using UnityEngine;
namespace Coffee.UIEffects namespace Coffee.UIEffects
{ {
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")] [Icon("Packages/com.coffee.ui-effect/Editor/Icons/UIEffectIconIcon.png")]
public class UIEffectReplica : UIEffectBase, ISerializationCallbackReceiver public class UIEffectReplica : UIEffectBase, ISerializationCallbackReceiver
{ {
[SerializeField] private UIEffect m_Target; [SerializeField] private UIEffect m_Target;
+1 -1
View File
@@ -5,7 +5,7 @@ using UnityEngine.Events;
namespace Coffee.UIEffects namespace Coffee.UIEffects
{ {
[Icon("Packages/com.coffee.ui-effect/Editor/UIEffectIconIcon.png")] [Icon("Packages/com.coffee.ui-effect/Editor/Icons/UIEffectIconIcon.png")]
[ExecuteAlways] [ExecuteAlways]
[RequireComponent(typeof(UIEffectBase))] [RequireComponent(typeof(UIEffectBase))]
public class UIEffectTweener : MonoBehaviour public class UIEffectTweener : MonoBehaviour
@@ -54,6 +54,13 @@ namespace Coffee.UIEffects
public override void SetVerticesDirty(Graphic graphic, bool enabled) public override void SetVerticesDirty(Graphic graphic, bool enabled)
{ {
// TMP submeshes are updated only when the parent is rebuilt, so queue the parent even if the replica is disabled. (#416)
if (graphic is TMP_SubMeshUI subMeshUI)
{
graphic = subMeshUI.textComponent as TextMeshProUGUI;
enabled = true;
}
if (graphic is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled) if (graphic is TextMeshProUGUI textMeshProUGUI && textMeshProUGUI.isActiveAndEnabled)
{ {
if (enabled) if (enabled)
@@ -48,6 +48,7 @@ namespace UnityEditor.Rendering.BuiltIn.ShaderGraph
.AddKeywordForUIEffect("DETAIL", "s_DetailKeywords") // add detail keywords .AddKeywordForUIEffect("DETAIL", "s_DetailKeywords") // add detail keywords
.AddKeywordForUIEffect("TARGET", "s_TargetKeywords") // add target keywords .AddKeywordForUIEffect("TARGET", "s_TargetKeywords") // add target keywords
.AddKeywordForUIEffect("GRADATION", "s_GradationKeywords") // add gradation keywords .AddKeywordForUIEffect("GRADATION", "s_GradationKeywords") // add gradation keywords
.AddKeywordForUIEffect("ROUND_CORNER", "s_RoundCornerKeywords") // add round corner keywords
.AddKeywordForUIEffect("UIEFFECT_EDITOR", KeywordScope.Global) // add UIEffect editor keywords .AddKeywordForUIEffect("UIEFFECT_EDITOR", KeywordScope.Global) // add UIEffect editor keywords
.AddKeywordForUIEffect("SOFTMASK_EDITOR", KeywordScope.Global) // add softmask editor keywords .AddKeywordForUIEffect("SOFTMASK_EDITOR", KeywordScope.Global) // add softmask editor keywords
.AddKeywordForUIEffect("SOFTMASKABLE"); // add softmaskable keywords .AddKeywordForUIEffect("SOFTMASKABLE"); // add softmaskable keywords
@@ -4,7 +4,7 @@ ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
@@ -2,7 +2,7 @@
"name": "com.coffee.ui-effect.shadergraph-builtin", "name": "com.coffee.ui-effect.shadergraph-builtin",
"displayName": "UI Effect - ShaderGraph Support (Unity 6 BuiltIn)", "displayName": "UI Effect - ShaderGraph Support (Unity 6 BuiltIn)",
"description": "An extension for UI Effect that adds ShaderGraph support (Unity 6 BuiltIn).", "description": "An extension for UI Effect that adds ShaderGraph support (Unity 6 BuiltIn).",
"version": "5.11.9", "version": "5.15.1",
"unity": "2020.3", "unity": "2020.3",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
@@ -15,7 +15,7 @@
"url": "https://github.com/mob-sakai" "url": "https://github.com/mob-sakai"
}, },
"dependencies": { "dependencies": {
"com.coffee.ui-effect": "5.11.9" "com.coffee.ui-effect": "5.15.1"
}, },
"keywords": [ "keywords": [
"ui", "ui",
@@ -4,7 +4,7 @@ ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
@@ -2,7 +2,7 @@
"name": "com.coffee.ui-effect.shadergraph-urp", "name": "com.coffee.ui-effect.shadergraph-urp",
"displayName": "UI Effect - ShaderGraph Support (Unity 6 URP)", "displayName": "UI Effect - ShaderGraph Support (Unity 6 URP)",
"description": "An extension for UI Effect that adds ShaderGraph support (Unity 6 URP).", "description": "An extension for UI Effect that adds ShaderGraph support (Unity 6 URP).",
"version": "5.11.9", "version": "5.15.1",
"unity": "2020.3", "unity": "2020.3",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
@@ -15,8 +15,8 @@
"url": "https://github.com/mob-sakai" "url": "https://github.com/mob-sakai"
}, },
"dependencies": { "dependencies": {
"com.coffee.ui-effect": "5.11.9", "com.coffee.ui-effect": "5.15.1",
"com.coffee.ui-effect-shadergraph-builtin": "5.11.9" "com.coffee.ui-effect-shadergraph-builtin": "5.15.1"
}, },
"keywords": [ "keywords": [
"ui", "ui",
@@ -66,6 +66,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -65,6 +65,7 @@ SubShader{
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -135,6 +135,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -135,6 +135,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -97,6 +97,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -100,6 +100,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -97,6 +97,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -135,6 +135,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 userData: v5.15.0
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -2,7 +2,7 @@
"name": "com.coffee.ui-effect.textmeshpro-legacy", "name": "com.coffee.ui-effect.textmeshpro-legacy",
"displayName": "UI Effect - TextMeshPro Support", "displayName": "UI Effect - TextMeshPro Support",
"description": "An extension for UI Effect that adds TextMeshPro support.", "description": "An extension for UI Effect that adds TextMeshPro support.",
"version": "5.11.9", "version": "5.15.1",
"unity": "2020.3", "unity": "2020.3",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
@@ -15,7 +15,7 @@
"url": "https://github.com/mob-sakai" "url": "https://github.com/mob-sakai"
}, },
"dependencies": { "dependencies": {
"com.coffee.ui-effect": "5.11.9" "com.coffee.ui-effect": "5.15.1"
}, },
"keywords": [ "keywords": [
"ui", "ui",
@@ -66,6 +66,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 (Unity 6) userData: v5.15.0 (Unity 6)
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -65,6 +65,7 @@ SubShader{
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 (Unity 6) userData: v5.15.0 (Unity 6)
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -135,6 +135,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 (Unity 6) userData: v5.15.0 (Unity 6)
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -136,6 +136,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 (Unity 6) userData: v5.15.0 (Unity 6)
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -97,6 +97,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 (Unity 6) userData: v5.15.0 (Unity 6)
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -100,6 +100,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 (Unity 6) userData: v5.15.0 (Unity 6)
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -98,6 +98,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 (Unity 6) userData: v5.15.0 (Unity 6)
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -135,6 +135,7 @@ SubShader {
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
@@ -4,6 +4,6 @@ ShaderImporter:
externalObjects: {} externalObjects: {}
defaultTextures: [] defaultTextures: []
nonModifiableTextures: [] nonModifiableTextures: []
userData: v5.11.0 (Unity 6) userData: v5.15.0 (Unity 6)
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
@@ -2,7 +2,7 @@
"name": "com.coffee.ui-effect.textmeshpro", "name": "com.coffee.ui-effect.textmeshpro",
"displayName": "UI Effect - TextMeshPro Support (Unity 6)", "displayName": "UI Effect - TextMeshPro Support (Unity 6)",
"description": "An extension for UI Effect that adds TextMeshPro support (Unity 6).", "description": "An extension for UI Effect that adds TextMeshPro support (Unity 6).",
"version": "5.11.9", "version": "5.15.1",
"unity": "2020.3", "unity": "2020.3",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
@@ -15,7 +15,7 @@
"url": "https://github.com/mob-sakai" "url": "https://github.com/mob-sakai"
}, },
"dependencies": { "dependencies": {
"com.coffee.ui-effect": "5.11.9" "com.coffee.ui-effect": "5.15.1"
}, },
"keywords": [ "keywords": [
"ui", "ui",
@@ -2,7 +2,7 @@
"name": "com.coffee.ui-effect.v4-compatible-components", "name": "com.coffee.ui-effect.v4-compatible-components",
"displayName": "UI Effect - v4 Compatible Components", "displayName": "UI Effect - v4 Compatible Components",
"description": "An extension for UI Effect that adds v4 compatible components.", "description": "An extension for UI Effect that adds v4 compatible components.",
"version": "5.11.9", "version": "5.15.1",
"unity": "2020.3", "unity": "2020.3",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
@@ -15,7 +15,7 @@
"url": "https://github.com/mob-sakai" "url": "https://github.com/mob-sakai"
}, },
"dependencies": { "dependencies": {
"com.coffee.ui-effect": "5.11.9", "com.coffee.ui-effect": "5.15.1",
"com.unity.modules.animation": "1.0.0" "com.unity.modules.animation": "1.0.0"
}, },
"keywords": [ "keywords": [
+79 -18
View File
@@ -54,6 +54,8 @@ uniform const half4 _DetailColor;
uniform const sampler2D _DetailTex; uniform const sampler2D _DetailTex;
uniform const float4 _DetailTex_ST; uniform const float4 _DetailTex_ST;
uniform const float2 _DetailTex_Speed; uniform const float2 _DetailTex_Speed;
uniform const float4 _RoundCornerRadius;
uniform const float2 _RoundCornerRectSize;
uniform const float _GradationIntensity; uniform const float _GradationIntensity;
uniform const int _GradationColorFilter; uniform const int _GradationColorFilter;
uniform const half4 _GradationColor1; uniform const half4 _GradationColor1;
@@ -64,8 +66,10 @@ uniform const sampler2D _GradationTex;
uniform const float4 _GradationTex_ST; uniform const float4 _GradationTex_ST;
uniform const int _GradationRadial; uniform const int _GradationRadial;
uniform const matrix _RootViewMatrix; uniform const matrix _RootViewMatrix;
uniform const matrix _RoundCornerViewMatrix;
uniform const matrix _GradViewMatrix; uniform const matrix _GradViewMatrix;
uniform const matrix _MirrorRootViewMatrix; uniform const matrix _MirrorRootViewMatrix;
uniform const matrix _MirrorRoundCornerViewMatrix;
uniform const matrix _MirrorGradViewMatrix; uniform const matrix _MirrorGradViewMatrix;
uniform const matrix _CanvasToWorldMatrix; uniform const matrix _CanvasToWorldMatrix;
@@ -95,8 +99,9 @@ struct uieffect_v2f
#define EDGE_NONE (!EDGE_PLAIN && !EDGE_SHINY) #define EDGE_NONE (!EDGE_PLAIN && !EDGE_SHINY)
#define DETAIL_NONE (!DETAIL_MASKING && !DETAIL_MULTIPLY && !DETAIL_ADDITIVE && !DETAIL_SUBTRACTIVE && !DETAIL_REPLACE && !DETAIL_MULTIPLY_ADDITIVE) #define DETAIL_NONE (!DETAIL_MASKING && !DETAIL_MULTIPLY && !DETAIL_ADDITIVE && !DETAIL_SUBTRACTIVE && !DETAIL_REPLACE && !DETAIL_MULTIPLY_ADDITIVE)
#define GRADATION_NONE (!GRADATION_GRADIENT && !GRADATION_RADIAL && !GRADATION_COLOR2 && !GRADATION_COLOR4) #define GRADATION_NONE (!GRADATION_GRADIENT && !GRADATION_RADIAL && !GRADATION_COLOR2 && !GRADATION_COLOR4)
#define ROUND_CORNER_OFF (!ROUND_CORNER_ON)
#if TONE_NONE && !COLOR_FILTER && SAMPLING_NONE && TRANSITION_NONE && TARGET_NONE && EDGE_NONE && DETAIL_NONE && GRADATION_NONE #if TONE_NONE && !COLOR_FILTER && SAMPLING_NONE && TRANSITION_NONE && TARGET_NONE && EDGE_NONE && DETAIL_NONE && GRADATION_NONE && ROUND_CORNER_OFF
#define NO_UIEFFECT #define NO_UIEFFECT
#endif #endif
@@ -559,20 +564,45 @@ float is_edge_shiny(const float2 uvLocal)
#endif #endif
} }
half4 uieffect_internal(UIEFFECT_FRAG_STRUCT IN, float2 uv, float4 uvMask, const float2 uvLocal, const float2 uvGrad, const float isShadow) float round_corner_mask(const float2 uvLocal)
{ {
const half alpha = transition_alpha(uvLocal); #if ROUND_CORNER_ON
const float radius = uvLocal.y > 0.5
? (uvLocal.x < 0.5 ? _RoundCornerRadius.x : _RoundCornerRadius.y)
: (uvLocal.x < 0.5 ? _RoundCornerRadius.w : _RoundCornerRadius.z);
if (radius <= 0)
{
return 1;
}
const float2 halfSize = _RoundCornerRectSize * 0.5;
const float clampedRadius = min(radius, min(halfSize.x, halfSize.y));
const float2 localPosition = (uvLocal - 0.5) * _RoundCornerRectSize;
const float2 corner = abs(localPosition) - (halfSize - clampedRadius);
const float signedDistance = length(max(corner, 0)) + min(max(corner.x, corner.y), 0) - clampedRadius;
const float antialias = max(fwidth(signedDistance), 1e-5);
return 1 - smoothstep(-antialias, antialias, signedDistance);
#else
return 1;
#endif
}
half4 uieffect_internal(UIEFFECT_FRAG_STRUCT IN, float2 uv, float4 uvMask, const float2 uvLocal,
const float2 uvEffect, const float2 uvGrad, const float isShadow, const bool applyRoundCornerMask)
{
const half alpha = transition_alpha(uvEffect);
const float edgeFactor = edge(uv, uvMask, _EdgeWidth); const float edgeFactor = edge(uv, uvMask, _EdgeWidth);
uv += move_transition_filter(uvMask, alpha); uv += move_transition_filter(uvMask, alpha);
half4 color = apply_sampling_filter(IN, uv, uvMask, isShadow); half4 color = apply_sampling_filter(IN, uv, uvMask, isShadow);
color = apply_gradation_filter(color, uvGrad); color = apply_gradation_filter(color, uvGrad);
color = apply_tone_filter(color); color = apply_tone_filter(color);
color = apply_transition_filter(color, alpha, uvLocal, edgeFactor); color = apply_transition_filter(color, alpha, uvEffect, edgeFactor);
color = apply_detail_filter(color, uvLocal); color = apply_detail_filter(color, uvEffect);
half4 result;
if (0 < isShadow) if (0 < isShadow)
{ {
return apply_color_filter(_ShadowColorFilter, color, _ShadowColor, 1, _ShadowColorGlow); result = apply_color_filter(_ShadowColorFilter, color, _ShadowColor, 1, _ShadowColorGlow);
} }
else else
{ {
@@ -580,21 +610,27 @@ half4 uieffect_internal(UIEFFECT_FRAG_STRUCT IN, float2 uv, float4 uvMask, const
{ {
color = apply_color_filter(_ColorFilter, color, _ColorValue, _ColorIntensity, _ColorGlow); color = apply_color_filter(_ColorFilter, color, _ColorValue, _ColorIntensity, _ColorGlow);
const half4 edgeColor = apply_color_filter(_EdgeColorFilter, color, _EdgeColor, 1, _EdgeColorGlow); const half4 edgeColor = apply_color_filter(_EdgeColorFilter, color, _EdgeColor, 1, _EdgeColorGlow);
const float isEdgeShiny = is_edge_shiny(uvLocal); const float isEdgeShiny = is_edge_shiny(uvEffect);
return lerp(color, edgeColor, edgeFactor * isEdgeShiny); result = lerp(color, edgeColor, edgeFactor * isEdgeShiny);
} }
#else #else
{ {
return apply_color_filter(_ColorFilter, color, _ColorValue, _ColorIntensity, _ColorGlow); result = apply_color_filter(_ColorFilter, color, _ColorValue, _ColorIntensity, _ColorGlow);
} }
#endif #endif
} }
return applyRoundCornerMask ? result * round_corner_mask(uvLocal) : result;
} }
half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRAG_STRUCT IN) half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRAG_STRUCT IN)
{ {
#ifdef NO_UIEFFECT #ifdef NO_UIEFFECT
return origin; if (max(max(_RoundCornerRadius.x, _RoundCornerRadius.y),
max(_RoundCornerRadius.z, _RoundCornerRadius.w)) <= 0)
{
return origin;
}
#endif #endif
#ifndef CANVAS_SHADERGRAPH #ifndef CANVAS_SHADERGRAPH
@@ -605,14 +641,35 @@ half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRA
wpos = mul(_CanvasToWorldMatrix, wpos); wpos = mul(_CanvasToWorldMatrix, wpos);
#endif #endif
const half rate = get_target_rate(origin.rgb); const half rate = get_target_rate(origin.rgb);
float2 uvLocal = saturate(mul(_RootViewMatrix, wpos)).xy; float2 uvEffect = saturate(mul(_RootViewMatrix, wpos)).xy;
#if !ROUND_CORNER_OFF
float2 uvLocal = saturate(mul(_RoundCornerViewMatrix, wpos)).xy;
#else
float2 uvLocal = float2(0, 0);
#endif
#if !GRADATION_NONE
float2 uvGrad = mul(_GradViewMatrix, wpos).xy; float2 uvGrad = mul(_GradViewMatrix, wpos).xy;
#else
float2 uvGrad = float2(0, 0);
#endif
const bool isShadowMesh = uvMask.x < -1;
// Mirror // Mirror
if (uvMask.x < -3) if (uvMask.x < -3)
{ {
uvLocal = saturate(mul(_MirrorRootViewMatrix, wpos)).xy; uvEffect = saturate(mul(_MirrorRootViewMatrix, wpos)).xy;
#if !ROUND_CORNER_OFF
uvLocal = saturate(mul(_MirrorRoundCornerViewMatrix, wpos)).xy;
#endif
#if !GRADATION_NONE
uvGrad = saturate(mul(_MirrorGradViewMatrix, wpos)).xy; uvGrad = saturate(mul(_MirrorGradViewMatrix, wpos)).xy;
#endif
uvMask.x += 4; uvMask.x += 4;
} }
@@ -629,10 +686,11 @@ half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRA
#elif SAMPLING_RGB_SHIFT #elif SAMPLING_RGB_SHIFT
{ {
const half2 offset = half2(_SamplingIntensity * texel_size().x * 20, 0); const half2 offset = half2(_SamplingIntensity * texel_size().x * 20, 0);
const half2 r = uieffect_internal(IN, uv + offset, uvMask, uvLocal, uvGrad, isShadow).ra; const half2 r = uieffect_internal(IN, uv + offset, uvMask, uvLocal, uvEffect, uvGrad, isShadow, false).ra;
const half2 g = uieffect_internal(IN, uv, uvMask, uvLocal, uvGrad, isShadow).ga; const half2 g = uieffect_internal(IN, uv, uvMask, uvLocal, uvEffect, uvGrad, isShadow, false).ga;
const half2 b = uieffect_internal(IN, uv - offset, uvMask, uvLocal, uvGrad, isShadow).ba; const half2 b = uieffect_internal(IN, uv - offset, uvMask, uvLocal, uvEffect, uvGrad, isShadow, false).ba;
return half4(r.x * r.y, g.x * g.y, b.x * b.y, (r.y + g.y + b.y) / 3); const half4 color = half4(r.x * r.y, g.x * g.y, b.x * b.y, (r.y + g.y + b.y) / 3);
return isShadowMesh ? color : color * round_corner_mask(uvLocal);
} }
// Sampling.EdgeLuminance/EdgeAlpha // Sampling.EdgeLuminance/EdgeAlpha
#elif SAMPLING_EDGE_LUMINANCE || SAMPLING_EDGE_ALPHA #elif SAMPLING_EDGE_LUMINANCE || SAMPLING_EDGE_ALPHA
@@ -655,11 +713,14 @@ half4 uieffect(half4 origin, float2 uv, float4 uvMask, float4 wpos, UIEFFECT_FRA
half sobel_v = v00 * -1.0 + v10 * -2.0 + v20 * -1.0 + v02 * 1.0 + v12 * 2.0 + v22 * 1.0; half sobel_v = v00 * -1.0 + v10 * -2.0 + v20 * -1.0 + v02 * 1.0 + v12 * 2.0 + v22 * 1.0;
const half sobel = sqrt(sobel_h * sobel_h + sobel_v * sobel_v) * _SamplingIntensity; const half sobel = sqrt(sobel_h * sobel_h + sobel_v * sobel_v) * _SamplingIntensity;
return lerp(half4(0, 0, 0, 0), uieffect_internal(IN, uv, uvMask, uvLocal, uvGrad, isShadow), inv_lerp(0.5, 1, sobel)); return lerp(half4(0, 0, 0, 0),
uieffect_internal(IN, uv, uvMask, uvLocal, uvEffect, uvGrad, isShadow, !isShadowMesh),
inv_lerp(0.5, 1, sobel));
} }
#endif #endif
return lerp(origin, uieffect_internal(IN, uv, uvMask, uvLocal, uvGrad, isShadow), rate); return lerp(origin, uieffect_internal(IN, uv, uvMask, uvLocal, uvEffect, uvGrad, isShadow, !isShadowMesh),
rate);
} }
+1
View File
@@ -69,6 +69,7 @@ Shader "Hidden/UI/Default (UIEffect)"
#pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE #pragma shader_feature_local_fragment _ DETAIL_MASKING DETAIL_MULTIPLY DETAIL_ADDITIVE DETAIL_SUBTRACTIVE DETAIL_REPLACE DETAIL_MULTIPLY_ADDITIVE
#pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE #pragma shader_feature_local_fragment _ TARGET_HUE TARGET_LUMINANCE
#pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4 #pragma shader_feature_local_fragment _ GRADATION_GRADIENT GRADATION_COLOR2 GRADATION_COLOR4
#pragma shader_feature_local_fragment _ ROUND_CORNER_ON
#pragma shader_feature_fragment _ UIEFFECT_EDITOR #pragma shader_feature_fragment _ UIEFFECT_EDITOR
// ==== UIEFFECT END ==== // ==== UIEFFECT END ====
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "com.coffee.ui-effect", "name": "com.coffee.ui-effect",
"displayName": "UI Effect", "displayName": "UI Effect",
"description": "UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code.\nCombine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!", "description": "UIEffect is an open-source package that allows you to intuitively apply rich UI effects directly from the Inspector or via code.\nCombine various filters, such as grayscale, blur, and dissolve, to decorate your UI with a unique visual style!",
"version": "5.11.9", "version": "5.15.1",
"unity": "2020.3", "unity": "2020.3",
"license": "MIT", "license": "MIT",
"repository": { "repository": {