-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f5839c
commit f8d516f
Showing
51 changed files
with
2,144 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.IO; | ||
using System.Text.RegularExpressions; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace MToon | ||
{ | ||
public class EditorUtils | ||
{ | ||
private static string BasePath { get { return Path.Combine(Application.dataPath, "VRM/MToon"); } } | ||
|
||
private static string ShaderFilePath { get { return Path.Combine(BasePath, "MToon/Resources/Shaders/MToon.shader"); } } | ||
private static string ReadMeFilePath { get { return Path.Combine(BasePath, "README.md"); } } | ||
private static string VersionFilePath { get { return Path.Combine(BasePath, "MToon/Scripts/UtilsVersion.cs"); } } | ||
|
||
|
||
//[MenuItem("VRM/MToon Version Up")] | ||
private static void VerUp(string version) | ||
{ | ||
UpdateShaderFile(version); | ||
UpdateReadMeFile(version); | ||
UpdateVersionFile(version); | ||
} | ||
|
||
private static void UpdateShaderFile(string version) | ||
{ | ||
var file = File.ReadAllText(ShaderFilePath); | ||
file = Regex.Replace( | ||
file, | ||
"(_MToonVersion \\(\"_MToonVersion\", Float\\) = )(\\d+)", | ||
"${1}" + version | ||
); | ||
File.WriteAllText(ShaderFilePath, file); | ||
} | ||
|
||
private static void UpdateReadMeFile(string version) | ||
{ | ||
version = "v" + version.Substring(0, version.Length - 1) + "." + version[version.Length - 1]; | ||
|
||
var file = File.ReadAllText(ReadMeFilePath); | ||
file = Regex.Replace( | ||
file, | ||
"v(\\d+)\\.(\\d+)", | ||
version | ||
); | ||
File.WriteAllText(ReadMeFilePath, file); | ||
} | ||
|
||
private static void UpdateVersionFile(string version) | ||
{ | ||
var file = File.ReadAllText(VersionFilePath); | ||
file = Regex.Replace( | ||
file, | ||
"(public const int VersionNumber = )(\\d+)(;)", | ||
"${1}" + version + "${3}" | ||
); | ||
File.WriteAllText(VersionFilePath, file); | ||
|
||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "MToon.Editor", | ||
"references": [ | ||
"MToon" | ||
], | ||
"optionalUnityReferences": [], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.