release v0.9.0
commit
862842e891
|
@ -0,0 +1,12 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: # [mob-sakai]
|
||||
patreon: mob_sakai
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with a single custom sponsorship URL
|
|
@ -1,5 +1,18 @@
|
|||
# Changelog
|
||||
|
||||
## [v0.9.0](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.9.0) (2019-08-27)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.8.1...v0.9.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Improved work in prefab view [\#55](https://github.com/mob-sakai/SoftMaskForUGUI/pull/55) ([ManeFunction](https://github.com/ManeFunction))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Prefab Mode in Play Mode is not supported [\#60](https://github.com/mob-sakai/SoftMaskForUGUI/issues/60)
|
||||
- Missing .meta file [\#59](https://github.com/mob-sakai/SoftMaskForUGUI/issues/59)
|
||||
|
||||
## [v0.8.1](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.8.1) (2019-05-07)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.8.0...v0.8.1)
|
||||
|
|
|
@ -7,7 +7,7 @@ Soft masking for uGUI elements in Unity.
|
|||
|
||||
[](https://github.com/mob-sakai/SoftMaskForUGUI/releases)
|
||||
[](https://github.com/mob-sakai/SoftMaskForUGUI/releases)
|
||||

|
||||

|
||||
[](https://github.com/mob-sakai/SoftMaskForUGUI/blob/upm/LICENSE.txt)
|
||||
[](http://makeapullrequest.com)
|
||||
[](https://twitter.com/intent/follow?screen_name=mob_sakai)
|
||||
|
@ -16,7 +16,9 @@ Soft masking for uGUI elements in Unity.
|
|||
|
||||
### What's new? [See changelog ](https://github.com/mob-sakai/SoftMaskForUGUI/blob/develop/CHANGELOG.md)
|
||||
### Do you want to receive notifications for new releases? [Watch this repo ](https://github.com/mob-sakai/SoftMaskForUGUI/subscription)
|
||||
### Support me on Patreon! [](https://www.patreon.com/join/2343451?)
|
||||
### Support me on Patreon!
|
||||
[](https://www.patreon.com/join/2343451?)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -82,7 +84,7 @@ By using SoftMask instead of default Mask, rounded edges of UI elements can be e
|
|||
<br><br><br><br>
|
||||
## Install
|
||||
|
||||
#### Using UnityPackageManager (for Unity 2018.3+)
|
||||
#### Using UnityPackageManager (for Unity 2018.3 or later)
|
||||
|
||||
Find the manifest.json file in the Packages folder of your project and edit it to look like this:
|
||||
```js
|
||||
|
@ -96,7 +98,7 @@ Find the manifest.json file in the Packages folder of your project and edit it t
|
|||
To update the package, change `#{version}` to the target version.
|
||||
Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension).
|
||||
|
||||
#### Using .unitypackage file (for Unity 2017.1+)
|
||||
#### Using .unitypackage file (for Unity 2017.1 or later)
|
||||
|
||||
Download `*.unitypackage` from [Releases](https://github.com/mob-sakai/SoftMaskForUGUI/releases) and import the package into your Unity project.
|
||||
Select `Assets > Import Package > Custom Package` from the menu.
|
||||
|
@ -132,7 +134,7 @@ Or, add SoftMaskable components from the inspector of SoftMask component.
|
|||
|
||||
##### Requirement
|
||||
|
||||
* Unity 2017+ *(including Unity 2018.x)*
|
||||
* Unity 2017 or later *(including Unity 2018.x)*
|
||||
* No other SDK are required
|
||||
|
||||
|
||||
|
@ -144,14 +146,17 @@ Or, add SoftMaskable components from the inspector of SoftMask component.
|
|||
|
||||
You can support soft masks in your custom shaders, by adding just 3 lines!
|
||||
|
||||
1. Add `#pragma` and `#include`. `SOFTMASK_EDITOR` is a keyword for editor, not included in the build.
|
||||
1. Add `#pragma` and `#include`. `SOFTMASK_EDITOR` is a keyword for editor only, not included in the build.
|
||||
If you installed using packageManager, include `Packages/com.coffee.softmask-for-ugui/SoftMask.cginc` instead of.
|
||||
```
|
||||
#include "Assets/Coffee/UIExtensions/SoftMaskForUGUI/SoftMask.cginc"
|
||||
#pragma shader_feature __ SOFTMASK_EDITOR
|
||||
```
|
||||
2. Apply a soft mask in the fragment shader. `IN.vertex` is clip position.
|
||||
2. Apply a soft mask in the fragment shader.
|
||||
- `IN.vertex` is clip position
|
||||
- `IN.worldPosition` is world position
|
||||
```
|
||||
color.a *= SoftMask(IN.vertex);
|
||||
color.a *= SoftMask(IN.vertex, IN.worldPosition);
|
||||
```
|
||||
|
||||
As an example of implementation, please see [UI-Default-SoftMask.shader](https://raw.githubusercontent.com/mob-sakai/SoftMaskForUGUI/upm/Shaders/Resources/UI-Default-SoftMask.shader).
|
||||
|
@ -313,7 +318,8 @@ UnityEditor.EditorApplication.update += ()
|
|||
|
||||
[mob-sakai](https://github.com/mob-sakai)
|
||||
[](https://twitter.com/intent/follow?screen_name=mob_sakai)
|
||||
[](https://www.patreon.com/join/2343451?)
|
||||
[](https://www.patreon.com/join/2343451?)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
@ -34,7 +33,7 @@ namespace Coffee.UIExtensions.Editors
|
|||
if (0 < fixTargets.Count)
|
||||
{
|
||||
GUILayout.BeginHorizontal ();
|
||||
EditorGUILayout.HelpBox ("There are child Graphicss that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning);
|
||||
EditorGUILayout.HelpBox ("There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning);
|
||||
GUILayout.BeginVertical ();
|
||||
if (GUILayout.Button ("Fix"))
|
||||
{
|
||||
|
@ -42,6 +41,8 @@ namespace Coffee.UIExtensions.Editors
|
|||
{
|
||||
p.gameObject.AddComponent<SoftMaskable> ();
|
||||
}
|
||||
|
||||
Utils.MarkPrefabDirty ();
|
||||
}
|
||||
if (GUILayout.Button ("Ping"))
|
||||
{
|
||||
|
@ -60,8 +61,8 @@ namespace Coffee.UIExtensions.Editors
|
|||
if (s_Preview)
|
||||
{
|
||||
var tex = current.softMaskBuffer;
|
||||
var wtdth = tex.width * 64 / tex.height;
|
||||
EditorGUI.DrawPreviewTexture (GUILayoutUtility.GetRect (wtdth, 64), tex, null, ScaleMode.ScaleToFit);
|
||||
var width = tex.width * 64 / tex.height;
|
||||
EditorGUI.DrawPreviewTexture (GUILayoutUtility.GetRect (width, 64), tex, null, ScaleMode.ScaleToFit);
|
||||
Repaint ();
|
||||
}
|
||||
GUILayout.FlexibleSpace ();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEditor;
|
||||
|
@ -71,7 +71,7 @@ namespace Coffee.UIExtensions.Editors
|
|||
List<MaterialEditor> _materialEditors = new List<MaterialEditor> ();
|
||||
SerializedProperty _spMaskInteraction;
|
||||
|
||||
private void OnEnable ()
|
||||
void OnEnable ()
|
||||
{
|
||||
_spMaskInteraction = serializedObject.FindProperty("m_MaskInteraction");
|
||||
_custom = (maskInteraction == MaskInteraction.Custom);
|
||||
|
@ -98,8 +98,8 @@ namespace Coffee.UIExtensions.Editors
|
|||
|
||||
s_MaskWarning = new GUIContent(EditorGUIUtility.FindTexture("console.warnicon.sml"), "This component is not SoftMask. Use SoftMask instead of Mask.");
|
||||
}
|
||||
|
||||
private void OnDisable ()
|
||||
|
||||
void OnDisable ()
|
||||
{
|
||||
ClearMaterialEditors ();
|
||||
}
|
||||
|
@ -201,15 +201,14 @@ namespace Coffee.UIExtensions.Editors
|
|||
|
||||
|
||||
|
||||
|
||||
// var current = target as SoftMaskable;
|
||||
var current = target as SoftMaskable;
|
||||
|
||||
current.GetComponentsInChildren<Graphic> (true, s_Graphics);
|
||||
var fixTargets = s_Graphics.Where (x => x.gameObject != current.gameObject && !x.GetComponent<SoftMaskable> () && (!x.GetComponent<Mask> () || x.GetComponent<Mask> ().showMaskGraphic)).ToList ();
|
||||
if (0 < fixTargets.Count)
|
||||
{
|
||||
GUILayout.BeginHorizontal ();
|
||||
EditorGUILayout.HelpBox ("There are child Graphicss that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning);
|
||||
EditorGUILayout.HelpBox ("There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning);
|
||||
GUILayout.BeginVertical ();
|
||||
if (GUILayout.Button ("Fix"))
|
||||
{
|
||||
|
@ -236,6 +235,34 @@ namespace Coffee.UIExtensions.Editors
|
|||
ShowMaterialEditors (fontSharedMaterials, 1, fontSharedMaterials.Length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!DetectMask (current.transform.parent))
|
||||
{
|
||||
GUILayout.BeginHorizontal ();
|
||||
EditorGUILayout.HelpBox ("This is unnecessary SoftMaskable.\nCan't find any SoftMask components above.", MessageType.Warning);
|
||||
if (GUILayout.Button ("Remove", GUILayout.Height (40)))
|
||||
{
|
||||
DestroyImmediate (current);
|
||||
|
||||
Utils.MarkPrefabDirty ();
|
||||
}
|
||||
GUILayout.EndHorizontal ();
|
||||
}
|
||||
}
|
||||
|
||||
static bool DetectMask (Transform transform)
|
||||
{
|
||||
if (transform == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (transform.GetComponent<SoftMask> () != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return DetectMask (transform.parent);
|
||||
}
|
||||
|
||||
void ClearMaterialEditors ()
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#if UNITY_2018_3_OR_NEWER
|
||||
using UnityEditor.Experimental.SceneManagement;
|
||||
#endif
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
|
||||
namespace Coffee.UIExtensions.Editors
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static void MarkPrefabDirty ()
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage ();
|
||||
if (prefabStage != null)
|
||||
{
|
||||
EditorSceneManager.MarkSceneDirty (prefabStage.scene);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8829eb4004797463480fafa9a1112833
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -12,7 +12,11 @@ namespace Coffee.UIExtensions
|
|||
/// Soft maskable.
|
||||
/// Add this component to Graphic under SoftMask for smooth masking.
|
||||
/// </summary>
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
[ExecuteAlways]
|
||||
#else
|
||||
[ExecuteInEditMode]
|
||||
# endif
|
||||
public class SoftMaskable : MonoBehaviour, IMaterialModifier, ICanvasRaycastFilter, ISerializationCallbackReceiver
|
||||
{
|
||||
//################################
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "com.coffee.softmask-for-ugui",
|
||||
"displayName": "Soft Mask For uGUI",
|
||||
"description": "SoftMask is a smooth masking component for uGUI elements in Unity.\nBy using SoftMask instead of default Mask, rounded edges of UI elements can be expressed beautifully.",
|
||||
"version": "0.8.1",
|
||||
"version": "0.9.0",
|
||||
"unity": "2017.1",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,5 +1,18 @@
|
|||
# Changelog
|
||||
|
||||
## [v0.9.0](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.9.0) (2019-08-27)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.8.1...v0.9.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Improved work in prefab view [\#55](https://github.com/mob-sakai/SoftMaskForUGUI/pull/55) ([ManeFunction](https://github.com/ManeFunction))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Prefab Mode in Play Mode is not supported [\#60](https://github.com/mob-sakai/SoftMaskForUGUI/issues/60)
|
||||
- Missing .meta file [\#59](https://github.com/mob-sakai/SoftMaskForUGUI/issues/59)
|
||||
|
||||
## [v0.8.1](https://github.com/mob-sakai/SoftMaskForUGUI/tree/v0.8.1) (2019-05-07)
|
||||
|
||||
[Full Changelog](https://github.com/mob-sakai/SoftMaskForUGUI/compare/v0.8.0...v0.8.1)
|
||||
|
|
24
README.md
24
README.md
|
@ -7,7 +7,7 @@ Soft masking for uGUI elements in Unity.
|
|||
|
||||
[](https://github.com/mob-sakai/SoftMaskForUGUI/releases)
|
||||
[](https://github.com/mob-sakai/SoftMaskForUGUI/releases)
|
||||

|
||||

|
||||
[](https://github.com/mob-sakai/SoftMaskForUGUI/blob/upm/LICENSE.txt)
|
||||
[](http://makeapullrequest.com)
|
||||
[](https://twitter.com/intent/follow?screen_name=mob_sakai)
|
||||
|
@ -16,7 +16,9 @@ Soft masking for uGUI elements in Unity.
|
|||
|
||||
### What's new? [See changelog ](https://github.com/mob-sakai/SoftMaskForUGUI/blob/develop/CHANGELOG.md)
|
||||
### Do you want to receive notifications for new releases? [Watch this repo ](https://github.com/mob-sakai/SoftMaskForUGUI/subscription)
|
||||
### Support me on Patreon! [](https://www.patreon.com/join/2343451?)
|
||||
### Support me on Patreon!
|
||||
[](https://www.patreon.com/join/2343451?)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -82,7 +84,7 @@ By using SoftMask instead of default Mask, rounded edges of UI elements can be e
|
|||
<br><br><br><br>
|
||||
## Install
|
||||
|
||||
#### Using UnityPackageManager (for Unity 2018.3+)
|
||||
#### Using UnityPackageManager (for Unity 2018.3 or later)
|
||||
|
||||
Find the manifest.json file in the Packages folder of your project and edit it to look like this:
|
||||
```js
|
||||
|
@ -96,7 +98,7 @@ Find the manifest.json file in the Packages folder of your project and edit it t
|
|||
To update the package, change `#{version}` to the target version.
|
||||
Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension).
|
||||
|
||||
#### Using .unitypackage file (for Unity 2017.1+)
|
||||
#### Using .unitypackage file (for Unity 2017.1 or later)
|
||||
|
||||
Download `*.unitypackage` from [Releases](https://github.com/mob-sakai/SoftMaskForUGUI/releases) and import the package into your Unity project.
|
||||
Select `Assets > Import Package > Custom Package` from the menu.
|
||||
|
@ -132,7 +134,7 @@ Or, add SoftMaskable components from the inspector of SoftMask component.
|
|||
|
||||
##### Requirement
|
||||
|
||||
* Unity 2017+ *(including Unity 2018.x)*
|
||||
* Unity 2017 or later *(including Unity 2018.x)*
|
||||
* No other SDK are required
|
||||
|
||||
|
||||
|
@ -144,14 +146,17 @@ Or, add SoftMaskable components from the inspector of SoftMask component.
|
|||
|
||||
You can support soft masks in your custom shaders, by adding just 3 lines!
|
||||
|
||||
1. Add `#pragma` and `#include`. `SOFTMASK_EDITOR` is a keyword for editor, not included in the build.
|
||||
1. Add `#pragma` and `#include`. `SOFTMASK_EDITOR` is a keyword for editor only, not included in the build.
|
||||
If you installed using packageManager, include `Packages/com.coffee.softmask-for-ugui/SoftMask.cginc` instead of.
|
||||
```
|
||||
#include "Assets/Coffee/UIExtensions/SoftMaskForUGUI/SoftMask.cginc"
|
||||
#pragma shader_feature __ SOFTMASK_EDITOR
|
||||
```
|
||||
2. Apply a soft mask in the fragment shader. `IN.vertex` is clip position.
|
||||
2. Apply a soft mask in the fragment shader.
|
||||
- `IN.vertex` is clip position
|
||||
- `IN.worldPosition` is world position
|
||||
```
|
||||
color.a *= SoftMask(IN.vertex);
|
||||
color.a *= SoftMask(IN.vertex, IN.worldPosition);
|
||||
```
|
||||
|
||||
As an example of implementation, please see [UI-Default-SoftMask.shader](https://raw.githubusercontent.com/mob-sakai/SoftMaskForUGUI/upm/Shaders/Resources/UI-Default-SoftMask.shader).
|
||||
|
@ -313,7 +318,8 @@ UnityEditor.EditorApplication.update += ()
|
|||
|
||||
[mob-sakai](https://github.com/mob-sakai)
|
||||
[](https://twitter.com/intent/follow?screen_name=mob_sakai)
|
||||
[](https://www.patreon.com/join/2343451?)
|
||||
[](https://www.patreon.com/join/2343451?)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "com.coffee.softmask-for-ugui",
|
||||
"displayName": "Soft Mask For uGUI",
|
||||
"description": "SoftMask is a smooth masking component for uGUI elements in Unity.\nBy using SoftMask instead of default Mask, rounded edges of UI elements can be expressed beautifully.",
|
||||
"version": "0.8.1",
|
||||
"version": "0.9.0",
|
||||
"unity": "2017.1",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue