Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed May 29, 2018
2 parents db8839f + ee7c799 commit ef89675
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 55 deletions.
5 changes: 1 addition & 4 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
user=mob-sakai
project=UIEffect
issues-wo-labels=false
pr-wo-labels=false
exclude_labels=duplicate,question,invalid,wontfix,Duplicate,Question,Invalid,Wontfix,Meta: Exclude From Changelog,unreleased
unreleased=false
exclude_labels=duplicate,question,invalid,wontfix,Duplicate,Question,Invalid,Wontfix,Meta: Exclude From Changelog
15 changes: 5 additions & 10 deletions Assets/UIEffect/UI-EffectCapture.shader
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ Shader "UI/Hidden/UI-EffectCapture"
fixed4 colorFactor : COLOR1;
#endif

#if defined (UI_TONE) || defined (UI_BLUR)
half4 effectFactor : TEXCOORD2;
#endif
};

sampler2D _MainTex;
Expand All @@ -51,16 +49,9 @@ Shader "UI/Hidden/UI-EffectCapture"
{
v2f OUT;
OUT.vertex = UnityObjectToClipPos(v.vertex);

#if UNITY_UV_STARTS_AT_TOP
OUT.texcoord = half2(v.texcoord.x, 1 - v.texcoord.y);
#else
OUT.texcoord = v.texcoord;
#endif

#if defined (UI_TONE) || defined (UI_BLUR)
OUT.texcoord = v.texcoord;
OUT.effectFactor = _EffectFactor;
#endif

#if UI_TONE_HUE
OUT.effectFactor.y = sin(OUT.effectFactor.x*3.14159265359*2);
Expand All @@ -73,6 +64,10 @@ Shader "UI/Hidden/UI-EffectCapture"
OUT.colorFactor = _ColorFactor;
#endif

#if UNITY_UV_STARTS_AT_TOP
OUT.texcoord.y = lerp(OUT.texcoord.y, 1 - OUT.texcoord.y, OUT.effectFactor.w);
#endif

return OUT;
}

Expand Down
22 changes: 2 additions & 20 deletions Assets/UIEffect/UIEffectCapturedImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,6 @@ protected override void OnPopulateMesh(VertexHelper vh)
// When not displaying, clear vertex.
if (texture == null || effectColor.a < 1 / 255f || canvasRenderer.GetAlpha() < 1 / 255f)
vh.Clear();
#if UNITY_STANDALONE_WIN
else if(_capturedIterations % 2 == 0)
{
Debug.Log(iterations);
base.OnPopulateMesh(vh);
int count = vh.currentVertCount;
UIVertex vt = UIVertex.simpleVert;
Vector2 one = Vector2.one;
for (int i = 0; i < count; i++)
{
vh.PopulateUIVertex(ref vt, i);
vt.uv0 = new Vector2(vt.uv0.x, 1-vt.uv0.y);
vh.SetUIVertex(vt, i);
}
}
#endif
else
base.OnPopulateMesh(vh);
}
Expand Down Expand Up @@ -257,15 +241,14 @@ public void Capture()
_buffer.Blit(BuiltinRenderTextureType.CurrentActive, s_CopyId);

// Set properties.
_buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 0));
_buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 1));
_buffer.SetGlobalVector("_ColorFactor", new Vector4(effectColor.r, effectColor.g, effectColor.b, effectColor.a));

// Blit without effect.
if (!mat)
{
_buffer.Blit(s_CopyId, rtId);
_buffer.ReleaseTemporaryRT(s_CopyId);
_capturedIterations = 1;
}
// Blit with effect.
else
Expand All @@ -278,6 +261,7 @@ public void Capture()
// Iterate the operation.
if(1 < m_Iterations)
{
_buffer.SetGlobalVector("_EffectFactor", new Vector4(toneLevel, 0, blur, 0));
_buffer.GetTemporaryRT(s_EffectId2, w, h, 0, m_FilterMode);
for (int i = 1; i < m_Iterations; i++)
{
Expand All @@ -292,7 +276,6 @@ public void Capture()
{
_buffer.ReleaseTemporaryRT(s_EffectId2);
}
_capturedIterations = m_Iterations;
}
}

Expand Down Expand Up @@ -329,7 +312,6 @@ public void Release()
RenderTexture _rt;
RenderTexture _rtToRelease;
CommandBuffer _buffer;
int _capturedIterations = 1;

static int s_CopyId;
static int s_EffectId1;
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v2.4.1](https://github.com/mob-sakai/UIEffect/tree/v2.4.1) (2018-05-29)

[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.4.0...v2.4.1)

**Fixed bugs:**

- UIEffectCapturedImage: The result image is flipped vertically [\#69](https://github.com/mob-sakai/UIEffect/issues/69)

## [v2.4.0](https://github.com/mob-sakai/UIEffect/tree/v2.4.0) (2018-05-21)

[Full Changelog](https://github.com/mob-sakai/UIEffect/compare/v2.3.2...v2.4.0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "UIEffect",
"version": "2.4.0",
"version": "2.4.1",
"repository": {
"type": "git",
"url": "git+https://github.com/mob-sakai/UIEffect.git"
Expand Down
55 changes: 35 additions & 20 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,52 @@


# input release version
echo -e "\n>> Start Github Release:"
PACKAGE_NAME=`node -pe 'require("./package.json").name'`
echo Github Release: $PACKAGE_NAME
read -p "[? release version (for example: 1.0.0): " RELEASE_VERSION
[ -z "$RELEASE_VERSION" ] && exit
echo -e ">> Package name: ${PACKAGE_NAME}"
CURRENT_VERSION=`grep -o -e "\"version\".*$" package.json | sed -e "s/\"version\": \"\(.*\)\".*$/\1/"`
read -p "[? release version (for current: ${CURRENT_VERSION}): " RELEASE_VERSION
[ -z "${RELEASE_VERSION}" ] && exit


# update version in package.json
echo -e "\n>> Update version... package.json"
git checkout -B release develop
sed -i -e "s/\"version\": \(.*\)/\"version\": \"${RELEASE_VERSION}\",/g" package.json


# generate change log
TAG=v$RELEASE_VERSION
git tag $TAG
git push --tags
github_changelog_generator
git tag -d $TAG
git push --delete origin $TAG
# check unity editor
UNITY_VER=`sed -e "s/m_EditorVersion: \(.*\)/\1/g" ProjectSettings/ProjectVersion.txt`
UNITY_EDITOR="/Applications/Unity/Hub/Editor/${UNITY_VER}/Unity.app/Contents/MacOS/Unity"
echo -e "\n>> Check unity editor... ${UNITY_VER} (${UNITY_EDITOR})"
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`"
echo -e ">> OK"

# generate change log
CHANGELOG_GENERATOR_ARG=`grep -o -e ".*git\"$" package.json | sed -e "s/^.*\/\([^\/]*\)\/\([^\/]*\).git.*$/--user \1 --project \2/"`
CHANGELOG_GENERATOR_ARG="--future-release v${RELEASE_VERSION} ${CHANGELOG_GENERATOR_ARG}"
echo -e "\n>> Generate change log... ${CHANGELOG_GENERATOR_ARG}"
# TAG=v$RELEASE_VERSION
# git tag $TAG
# git push --tags
github_changelog_generator ${CHANGELOG_GENERATOR_ARG}
# git tag -d $TAG
# git push --delete origin $TAG

git diff -- CHANGELOG.md
read -p "[? continue? (y/N):" yn
read -p "[? is the change log correct? (y/N):" yn
case "$yn" in [yY]*) ;; *) exit ;; esac


# export unitypackage
UNITY_EDITOR=`node -pe 'require("./package.json").unity'`
PACKAGE_SRC=`node -pe 'require("./package.json").src'`
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`" -exportpackage "$PACKAGE_SRC" "$PACKAGE_NAME.unitypackage"


# commit files
# commit release files
echo -e "\n>> Commit release files..."
git add CHANGELOG.md -f
git add package.json -f
git commit -m "update change log"


# merge and push
echo -e "\n>> Merge and push..."
git checkout master
git merge --no-ff release -m "release $TAG"
git branch -D release
Expand All @@ -60,8 +68,15 @@ git merge --ff master
git push origin develop


# export unitypackage
PACKAGE_SRC=`node -pe 'require("./package.json").src'`
echo -e "\n>> Export unitypackage... ${PACKAGE_SRC}"
"$UNITY_EDITOR" -quit -batchmode -projectPath "`pwd`" -exportpackage "$PACKAGE_SRC" "$PACKAGE_NAME.unitypackage"
echo -e ">> OK"


# upload unitypackage and release on Github
gh-release --draft --assets "$PACKAGE_NAME.unitypackage"
gh-release --assets "$PACKAGE_NAME.unitypackage"


echo "\n\n$PACKAGE_NAME v$RELEASE_VERSION has been successfully released!\n"
echo -e "\n\n>> $PACKAGE_NAME v$RELEASE_VERSION has been successfully released!\n"

0 comments on commit ef89675

Please sign in to comment.