[
  {
    "path": ".github/workflows/main.yml",
    "content": "name: Create UPM branches and run NPM publish\n\non:\n  push:\n    tags:\n      - v*\n\njobs:\n  update:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n        with:\n          fetch-depth: 0\n\n      - name: Get tag name\n        id: tag\n        run: echo ::set-output name=name::${GITHUB_REF#refs/tags/v}\n\n      - name: Create UPM Branch\n        uses: hecomi/create-upm-branch-action@main\n        with:\n          git-tag: ${{ steps.tag.outputs.name }}\n          pkg-root-dir-path: Assets/uShaderTemplate\n          main-branch: master\n          samples-dir: Examples\n\n      - name: Setup node\n        uses: actions/setup-node@v2\n        with:\n          registry-url: 'https://registry.npmjs.org'\n\n      - name: NPM publish\n        run: npm publish --access public\n        env:\n          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}\n"
  },
  {
    "path": ".gitignore",
    "content": "# This .gitignore file should be placed at the root of your Unity project directory\n#\n# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore\n#\n/[Ll]ibrary/\n/[Tt]emp/\n/[Oo]bj/\n/[Bb]uild/\n/[Bb]uilds/\n/[Ll]ogs/\n/[Uu]ser[Ss]ettings/\n\n# MemoryCaptures can get excessive in size.\n# They also could contain extremely sensitive data\n/[Mm]emoryCaptures/\n\n# Asset meta data should only be ignored when the corresponding asset is also ignored\n!/[Aa]ssets/**/*.meta\n\n# Uncomment this line if you wish to ignore the asset store tools plugin\n# /[Aa]ssets/AssetStoreTools*\n\n# Autogenerated Jetbrains Rider plugin\n/[Aa]ssets/Plugins/Editor/JetBrains*\n\n# Visual Studio cache directory\n.vs/\n.vsconfig\n\n# Gradle cache directory\n.gradle/\n\n# Autogenerated VS/MD/Consulo solution and project files\nExportedObj/\n.consulo/\n*.csproj\n*.unityproj\n*.sln\n*.suo\n*.tmp\n*.user\n*.userprefs\n*.pidb\n*.booproj\n*.svd\n*.pdb\n*.mdb\n*.opendb\n*.VC.db\n\n# Unity3D generated meta files\n*.pidb.meta\n*.pdb.meta\n*.mdb.meta\n\n# Unity3D generated file on crash reports\nsysinfo.txt\n\n# Builds\n*.apk\n*.aab\n*.unitypackage\n\n# Crashlytics generated file\ncrashlytics-build.properties\n\n# Packed Addressables\n/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*\n\n# Temporary auto-generated Android Assets\n/[Aa]ssets/[Ss]treamingAssets/aa.meta\n/[Aa]ssets/[Ss]treamingAssets/aa/*\n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants/Custom Constants.asset.meta",
    "content": "fileFormatVersion: 2\nguid: cfee3bf03df3b40c3b654c2cfd4db724\ntimeCreated: 1495353467\nlicenseType: Pro\nNativeFormatImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants/Default Constants.asset.meta",
    "content": "fileFormatVersion: 2\nguid: 9c8b2f5a7a56c4e21bee7ca4ccfc6640\ntimeCreated: 1495353467\nlicenseType: Pro\nNativeFormatImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants.meta",
    "content": "fileFormatVersion: 2\nguid: 0808cee05a22541f1b7c328a1c052f38\nfolderAsset: yes\ntimeCreated: 1514605650\nlicenseType: Pro\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/LICENSE_OFL.txt",
    "content": "This Font Software is licensed under the SIL Open Font License,\nVersion 1.1.\n\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 26 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font\ncreation efforts of academic and linguistic communities, and to\nprovide a free and open framework in which fonts may be shared and\nimproved in partnership with others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded,\nredistributed and/or sold with any software provided that any reserved\nnames are not used by derivative works. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply to\nany document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software\ncomponents as distributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to,\ndeleting, or substituting -- in part or in whole -- any of the\ncomponents of the Original Version, by changing formats or by porting\nthe Font Software to a new environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed,\nmodify, redistribute, and sell modified and unmodified copies of the\nFont Software, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components, in\nOriginal or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the\ncorresponding Copyright Holder. This restriction only applies to the\nprimary font name as presented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created using\nthe Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/LICENSE_OFL.txt.meta",
    "content": "fileFormatVersion: 2\nguid: e7f1e444a1fa94406a60546cb778466b\ntimeCreated: 1475660344\nlicenseType: Pro\nTextScriptImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/NotoMono-Regular.ttf.meta",
    "content": "fileFormatVersion: 2\nguid: 278ecf23a382e4292b4a907449fd15f0\ntimeCreated: 1475660344\nlicenseType: Pro\nTrueTypeFontImporter:\n  externalObjects: {}\n  serializedVersion: 4\n  fontSize: 16\n  forceTextureCase: -2\n  characterSpacing: 0\n  characterPadding: 1\n  includeFontData: 1\n  fontName: Noto Mono\n  fontNames:\n  - Noto Mono\n  fallbackFontReferences:\n  - {fileID: 12800000, guid: 9c8d17aeaa1c7bf47805458f830d46cb, type: 3}\n  customCharacters: \n  fontRenderingMode: 0\n  ascentCalculationMode: 1\n  useLegacyBoundsCalculation: 0\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts.meta",
    "content": "fileFormatVersion: 2\nguid: 30a3ca36b7ccf4deb8e21cfe35ca7fd8\nfolderAsset: yes\ntimeCreated: 1475660340\nlicenseType: Pro\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate.meta",
    "content": "fileFormatVersion: 2\nguid: 9cf019badb8c146e08ad33e26ab9e3a0\nfolderAsset: yes\ntimeCreated: 1495345278\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources.meta",
    "content": "fileFormatVersion: 2\nguid: 22a5a44deb3d648c6abf24801723eca0\nfolderAsset: yes\ntimeCreated: 1495345065\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/CodeEditor.cs",
    "content": "﻿using UnityEngine;\nusing UnityEditor;\n\nnamespace uShaderTemplate\n{\n\npublic class CodeEditor\n{\n    public string controlName { get; set; }\n    public Color backgroundColor { get; set; }\n    public Color textColor { get; set; }\n    public Color cursorColor { get; set; }\n\n    string cachedCode { get; set; }\n    string cachedHighlightedCode { get; set; }\n    public System.Func<string, string> highlighter { get; set; }\n\n    public bool isFocused \n    {\n        get { return GUI.GetNameOfFocusedControl() == controlName; }\n    }\n\n    public CodeEditor(string controlName)\n    {\n        this.controlName = controlName;\n        backgroundColor = Color.black;\n        textColor = Color.white;\n        highlighter = code => code;\n    }\n\n    public string Draw(string code, GUIStyle style, params GUILayoutOption[] options)\n    {\n        var preBackgroundColor = GUI.backgroundColor;\n        var preColor = GUI.color;\n        var preCursorColor = GUI.skin.settings.cursorColor;\n        var preCursorFlashSpeed = GUI.skin.settings.cursorFlashSpeed;\n\n        var backStyle = new GUIStyle(style);\n        backStyle.normal.textColor = Color.clear;\n        backStyle.hover.textColor = Color.clear;\n        backStyle.active.textColor = Color.clear;\n        backStyle.focused.textColor = Color.clear;\n\n        GUI.backgroundColor = backgroundColor;\n        GUI.color = textColor;\n        GUI.skin.settings.cursorColor = cursorColor;\n        GUI.SetNextControlName(controlName);\n\n        // IMPORTANT: \n        // Sadly, we cannot use TextEditor with (EditorGUILayout|EditorGUI).TextArea()... X(\n        // And GUILayout.TextArea() cannot handle TAB key... ;_;\n        // GUI.TextArea needs a lot of tasks to implement basic functions... T_T\n        var editedCode = EditorGUILayout.TextArea(code, backStyle, GUILayout.ExpandHeight(true));\n\n        // So, this does not work...\n        // var editor = GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl) as TextEditor;\n        // CheckEvents(editor);\n\n        if (editedCode != code) {\n            code = editedCode;\n        }\n\n        if (string.IsNullOrEmpty(cachedHighlightedCode) || (cachedCode != code)) {\n            cachedCode = code;\n            cachedHighlightedCode = highlighter(code);\n        }\n\n        GUI.backgroundColor = Color.clear;\n        GUI.color = textColor;\n        GUI.skin.settings.cursorColor = Color.clear;\n\n        var foreStyle = new GUIStyle(style);\n        foreStyle.richText = true;\n        foreStyle.normal.textColor = textColor;\n        foreStyle.hover.textColor = textColor;\n        foreStyle.active.textColor = textColor;\n        foreStyle.focused.textColor = textColor;\n\n        EditorGUI.TextArea(GUILayoutUtility.GetLastRect(), cachedHighlightedCode, foreStyle);\n\n        GUI.backgroundColor = preBackgroundColor;\n        GUI.color = preColor;\n        GUI.skin.settings.cursorColor = preCursorColor;\n\n        return code;\n    }\n\n    void CheckEvents(TextEditor editor)\n    {\n        // ...\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/CodeEditor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 62d234cb567694d2789ade8d5cab6a89\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ColorScheme.cs",
    "content": "﻿namespace uShaderTemplate\n{\n\nnamespace ColorScheme\n{\n    // http://ethanschoonover.com/solarized\n    public static class Solarized\n    {\n        public const string base03  = \"#002b36\";\n        public const string base02  = \"#073642\";\n        public const string base01  = \"#586e75\";\n        public const string base00  = \"#657b83\";\n        public const string base0   = \"#839496\";\n        public const string base1   = \"#93a1a1\";\n        public const string base2   = \"#eee8d5\";\n        public const string base3   = \"#fdf6e3\";\n        public const string yellow  = \"#b58900\";\n        public const string orange  = \"#cb4b16\";\n        public const string red     = \"#dc322f\";\n        public const string magenta = \"#d33682\";\n        public const string violet  = \"#6c71c4\";\n        public const string blue    = \"#268bd2\";\n        public const string cyan    = \"#2aa198\";\n        public const string green   = \"#859900\";\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ColorScheme.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 9cb8608d376b04cab8df8562d02cca44\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Common.cs",
    "content": "﻿using uShaderTemplate.ColorScheme;\n\nnamespace uShaderTemplate\n{\n\nnamespace Common\n{\n\npublic static class Color\n{ \n    public const string background = Solarized.base03;\n    public const string color = \"#ffffff\";\n    public const string cursorColor = \"#ffffff\";\n    public const string type = Solarized.yellow;\n    public const string keyword = Solarized.green;\n    public const string symbol = Solarized.base1;\n    public const string digit = Solarized.violet;\n    public const string str = Solarized.violet;\n    public const string comment = Solarized.base01;\n    public const string cgprogram = Solarized.blue;\n    public const string unity = Solarized.magenta;\n    public const string user1 = Solarized.orange;\n    public const string user2 = Solarized.cyan;\n}\n\npublic static class Editor\n{\n    public const string font = \"uShaderTemplate/Font/NotoMono-regular\";\n    public const int fontSize = 12;\n    public const bool wordWrap = false;\n    public const int height = 200;\n}\n\npublic static class Setting\n{\n    public const int menuOrder = 1000;\n    public const string menuPlace = \"Shader/uShaderTemplate/\";\n    public const string defaultConstants = \"uShaderTemplate/Constants/Default Constants\";\n    public const string templateDirectoryPath = \"ShaderTemplates\";\n    public const string templateFileExtension = \".txt\";\n}\n\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Common.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 4a29e724630f4487cb646107886e433f\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Constants.cs",
    "content": "﻿using UnityEngine;\n\nnamespace uShaderTemplate\n{\n\n[System.Serializable]\npublic struct Constant\n{\n    public string name;\n    public string value;\n}\n\n[CreateAssetMenu(\n    menuName = Common.Setting.menuPlace + \"Constants\", \n    order = Common.Setting.menuOrder + 1)]\npublic class Constants : ScriptableObject\n{\n    public Constant[] values;\n    public virtual void OnBeforeConvert() {}\n    public virtual void OnAfterConvert() {}\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Constants.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 0b69f41837370415ab1f75789505044f\ntimeCreated: 1495353387\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/FileWatcher.cs",
    "content": "﻿using System.IO;\nusing UnityEngine.Events;\n\nnamespace uShaderTemplate\n{\n\npublic class FileWatcher\n{\n    FileSystemWatcher watcher_;\n    bool hasChanged_ = false;\n    FileSystemEventHandler onChangedHandler_;\n    RenamedEventHandler onRenamedHandler_;\n\n    public UnityEvent onChanged = new UnityEvent();\n\n    public void Start(string path)\n    {\n        watcher_ = new System.IO.FileSystemWatcher();\n        watcher_.Path = Path.GetDirectoryName(path);\n        watcher_.NotifyFilter = \n            NotifyFilters.LastAccess | \n            NotifyFilters.LastWrite |\n            NotifyFilters.FileName | \n            NotifyFilters.DirectoryName;\n        watcher_.Filter = Path.GetFileName(path);\n\n        onChangedHandler_ = new FileSystemEventHandler(OnChanged);\n        onRenamedHandler_ = new RenamedEventHandler(OnRenamed);\n        watcher_.Changed += onChangedHandler_;\n        watcher_.Created += onChangedHandler_;\n        watcher_.Deleted += onChangedHandler_;\n        watcher_.Renamed += onRenamedHandler_;\n\n        watcher_.EnableRaisingEvents = true;\n    }\n\n    public void Stop()\n    {\n        if (watcher_ != null) {\n            watcher_.EnableRaisingEvents = false;\n            watcher_.Changed -= onChangedHandler_;\n            watcher_.Created -= onChangedHandler_;\n            watcher_.Deleted -= onChangedHandler_;\n            watcher_.Renamed -= onRenamedHandler_;\n        }\n    }\n\n    public void Update()\n    {\n        if (hasChanged_) {\n            hasChanged_ = false;\n            onChanged.Invoke();\n        }\n    }\n\n    void OnChanged(object source, FileSystemEventArgs e)\n    {\n        hasChanged_ = true;\n    }\n\n    void OnRenamed(object source, RenamedEventArgs e)\n    {\n        hasChanged_ = true;\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/FileWatcher.cs.meta",
    "content": "fileFormatVersion: 2\nguid: fc635ea546c084c8291db4721c1d416a\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Generator.cs",
    "content": "﻿using UnityEngine;\nusing System.Collections.Generic;\n\nnamespace uShaderTemplate\n{\n\n[System.Serializable]\npublic struct ShaderVariables\n{\n    public string key;\n    public string value;\n}\n\n[System.Serializable]\npublic struct ShaderCondition\n{\n    public string key;\n    public bool value;\n}\n\n[System.Serializable]\npublic struct ShaderBlock\n{\n    public string key;\n    public string value;\n    public bool folded;\n}\n\n[CreateAssetMenu(\n    menuName = Common.Setting.menuPlace + \"Generator\", \n    order = Common.Setting.menuOrder)]\npublic class Generator : ScriptableObject\n{\n    public string shaderName = \"\";\n    public Shader shaderReference = null;\n    public string shaderTemplate = \"\";\n\n    public List<ShaderVariables> variables = new List<ShaderVariables>();\n    public List<ShaderCondition> conditions = new List<ShaderCondition>();\n    public List<ShaderBlock> blocks = new List<ShaderBlock>();\n    public Constants constants;\n\n    public bool basicFolded = true;\n    public bool conditionsFolded = false;\n    public bool variablesFolded = false;\n    public bool materialsFolded = false;\n    public bool constantsFolded = false;\n\n    public virtual void OnBeforeConvert() {}\n    public virtual void OnAfterConvert() {}\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Generator.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 3acd6fe57257048db802c1c4c2b75248\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/GeneratorEditor.cs",
    "content": "﻿using UnityEngine;\nusing UnityEditor;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace uShaderTemplate\n{\n\n[CustomEditor(typeof(Generator))]\npublic class GeneratorEditor : Editor\n{\n    SerializedProperty name_;\n    SerializedProperty shader_;\n\n    SerializedProperty basicFolded_;\n    SerializedProperty materialsFolded_;\n\n    SerializedProperty conditions_;\n    SerializedProperty conditionsFolded_;\n\n    SerializedProperty variables_;\n    SerializedProperty variablesFolded_;\n\n    SerializedProperty constants_;\n    SerializedProperty constantsFolded_;\n\n    SerializedProperty blocks_;\n    Dictionary<string, ShaderCodeEditor> editors_ = new Dictionary<string, ShaderCodeEditor>();\n\n    ShaderTemplateSelector template_;\n    ShaderTemplateParser templateParser_;\n\n    FileWatcher watcher_ = new FileWatcher();\n\n    string errorMessage_;\n\n    Dictionary<string, Func<string, string>> toConstFuncs_;\n    bool constVarsFolded_ = false;\n\n    bool hasShaderReference\n    {\n        get { return shader_.objectReferenceValue != null; }\n    }\n\n    void OnEnable()\n    {\n        name_ = serializedObject.FindProperty(\"shaderName\");\n        shader_ = serializedObject.FindProperty(\"shaderReference\");\n        variables_ = serializedObject.FindProperty(\"variables\");\n        variablesFolded_ = serializedObject.FindProperty(\"variablesFolded\");\n        conditions_ = serializedObject.FindProperty(\"conditions\");\n        conditionsFolded_ = serializedObject.FindProperty(\"conditionsFolded\");\n        blocks_ = serializedObject.FindProperty(\"blocks\");\n        basicFolded_ = serializedObject.FindProperty(\"basicFolded\");\n        materialsFolded_ = serializedObject.FindProperty(\"materialsFolded\");\n        constants_ = serializedObject.FindProperty(\"constants\");\n        constantsFolded_ = serializedObject.FindProperty(\"constantsFolded\");\n\n        template_ = new ShaderTemplateSelector(serializedObject.FindProperty(\"shaderTemplate\"));\n        template_.onChange.AddListener(OnTemplateChanged);\n\n        watcher_.onChanged.AddListener(CheckShaderUpdate);\n        if (hasShaderReference) {\n            watcher_.Start(GetShaderPath());\n        }\n\n        CheckShaderUpdate();\n    }\n\n    void OnDisable()\n    {\n        if (template_ != null) {\n            template_.onChange.RemoveListener(OnTemplateChanged);\n        }\n        if (watcher_ != null) {\n            watcher_.Stop();\n            watcher_.onChanged.RemoveListener(CheckShaderUpdate);\n        }\n    }\n\n    public override void OnInspectorGUI()\n    {\n        serializedObject.Update();\n        watcher_.Update();\n\n        HandleKeyEvents();\n\n        if (templateParser_ == null) {\n            OnTemplateChanged();\n        }\n\n        DrawBasics();\n        DrawConditions();\n        DrawVariables();\n        DrawBlocks();\n        DrawConstants();\n        DrawMaterialReferences();\n\n        EditorGUILayout.Separator();\n\n        DrawButtons();\n        DrawMessages();\n\n        EditorGUILayout.Separator();\n\n        serializedObject.ApplyModifiedProperties();\n    }\n\n    SerializedProperty FindProperty(SerializedProperty array, string key, string keyName = \"key\")\n    {\n        for (int i = 0; i < array.arraySize; ++i) {\n            var prop = array.GetArrayElementAtIndex(i);\n            var keyProp = prop.FindPropertyRelative(keyName);\n            if (keyProp.stringValue == key) {\n                return prop;\n            }\n        }\n        return null;\n    }\n\n    SerializedProperty AddProperty(SerializedProperty array, string key)\n    {\n        var prop = FindProperty(array, key);\n        if (prop != null) return prop;\n\n        var index = array.arraySize;\n        array.InsertArrayElementAtIndex(index);\n        return array.GetArrayElementAtIndex(index);\n    }\n\n    void DrawBasics()\n    {\n        basicFolded_.boolValue = Utils.Foldout(\"Basic\", basicFolded_.boolValue);\n        if (basicFolded_.boolValue) {\n            ++EditorGUI.indentLevel;\n            EditorGUILayout.PropertyField(name_);\n            EditorGUILayout.PropertyField(shader_);\n            template_.Draw();\n            --EditorGUI.indentLevel;\n        }\n    }\n\n    void DrawConditions()\n    {\n        if (templateParser_.conditions.Count == 0) {\n            return;\n        }\n\n        conditionsFolded_.boolValue = Utils.Foldout(\"Conditions\", conditionsFolded_.boolValue);\n        if (!conditionsFolded_.boolValue) return;\n\n        ++EditorGUI.indentLevel;\n\n        foreach (var kv in templateParser_.conditions) {\n            var prop = FindProperty(conditions_, kv.Key);\n            var value = prop.FindPropertyRelative(\"value\");\n            var name = Utils.ToSpacedCamel(kv.Key);\n\n            var isSelected = EditorGUILayout.Toggle(name, value.boolValue);\n            if (value.boolValue != isSelected) {\n                value.boolValue = isSelected;\n            }\n        }\n\n        --EditorGUI.indentLevel;\n    }\n\n    void DrawBlocks()\n    {\n        foreach (var kv in templateParser_.blocks) {\n            var prop = FindProperty(blocks_, kv.Key);\n            var value = prop.FindPropertyRelative(\"value\");\n            var folded = prop.FindPropertyRelative(\"folded\");\n\n            var name = Utils.ToSpacedCamel(kv.Key);\n            ShaderCodeEditor editor = null;\n\n            if (editors_.ContainsKey(name)) {\n                editor = editors_[name];\n            } else {\n                editor = new ShaderCodeEditor(name, value, folded);\n                editors_.Add(name, editor);\n            }\n\n            editor.Draw();\n        }\n    }\n\n    void DrawVariables()\n    {\n        if (templateParser_.variables.Count == 0) {\n            return;\n        }\n\n        variablesFolded_.boolValue = Utils.Foldout(\"Variables\", variablesFolded_.boolValue);\n        if (!variablesFolded_.boolValue) return;\n\n        ++EditorGUI.indentLevel;\n\n        var constVars = new Dictionary<string, string>();\n\n        foreach (var kv in templateParser_.variables) {\n            var prop = FindProperty(variables_, kv.Key);\n            if (prop == null) continue;\n            var value = prop.FindPropertyRelative(\"value\");\n\n            var name = Utils.ToSpacedCamel(kv.Key);\n            var constValue = ToConstVariable(kv.Key);\n            string changedValue;\n\n            if (constValue != null) {\n                changedValue = constValue;\n                constVars.Add(name, constValue);\n            } else {\n                if (kv.Value.Count <= 1) {\n                    changedValue = EditorGUILayout.TextField(name, value.stringValue);\n                } else {\n                    var index = kv.Value.IndexOf(value.stringValue);\n                    if (index == -1) index = 0;\n                    index = EditorGUILayout.Popup(name, index, kv.Value.ToArray());\n                    changedValue = kv.Value[index];\n                }\n            }\n\n            if (value.stringValue != changedValue) {\n                value.stringValue = changedValue;\n            }\n        }\n\n        if (constVars.Count > 0) {\n            constVarsFolded_ = EditorGUILayout.Foldout(constVarsFolded_, \"Constants\");\n            if (constVarsFolded_) {\n                ++EditorGUI.indentLevel;\n                foreach (var kv in constVars) {\n                    Utils.ReadOnlyTextField(kv.Key, kv.Value);\n                }\n                --EditorGUI.indentLevel;\n            }\n        }\n\n        --EditorGUI.indentLevel;\n    }\n\n    void DrawConstants()\n    {\n        constantsFolded_.boolValue = Utils.Foldout(\"Constants\", constantsFolded_.boolValue);\n        if (!constantsFolded_.boolValue) return;\n\n        ++EditorGUI.indentLevel;\n        EditorGUILayout.BeginHorizontal(); \n        {\n            EditorGUILayout.PropertyField(constants_);\n            if (templateParser_ != null && templateParser_.constants) {\n                var style = new GUIStyle(EditorStyles.miniButtonLeft);\n                style.fixedWidth = 64;\n                if (GUILayout.Button(\"Use Default\", style)) {\n                    constants_.objectReferenceValue = templateParser_.constants;\n                }\n            }\n        } \n        EditorGUILayout.EndHorizontal();\n        --EditorGUI.indentLevel;\n    }\n\n    void DrawMaterialReferences()\n    {\n        materialsFolded_.boolValue = Utils.Foldout(\"Material References\", materialsFolded_.boolValue);\n        if (!materialsFolded_.boolValue) return;\n\n        ++EditorGUI.indentLevel;\n        var materials = Utils.FindMaterialsUsingShader(shader_.objectReferenceValue as Shader);\n        if (materials.Count > 0) {\n            foreach (var material in materials) {\n                EditorGUILayout.ObjectField(material, typeof(Material), false);\n            }\n        } else {\n            EditorGUILayout.LabelField(\"No material using this shader.\");\n        }\n        --EditorGUI.indentLevel;\n    }\n\n    void DrawButtons()\n    {\n        EditorGUILayout.BeginHorizontal();\n        {\n            var buttonFontSize = GUI.skin.label.fontSize;\n            var buttonPadding = new RectOffset(12, 12, 6, 6);\n\n            GUILayout.FlexibleSpace();\n            var style = new GUIStyle(EditorStyles.miniButtonLeft);\n            style.fontSize = buttonFontSize;\n            style.padding = buttonPadding;\n            if (GUILayout.Button(\"Export (Ctrl+R)\", style)) {\n                ExportShaderWithErrorCheck();\n            }\n\n            style = new GUIStyle(EditorStyles.miniButtonMid);\n            style.fontSize = buttonFontSize;\n            style.padding = buttonPadding;\n            if (GUILayout.Button(\"Create Material\", style)) {\n                CreateMaterial();\n            }\n\n            style = new GUIStyle(EditorStyles.miniButtonMid);\n            style.fontSize = buttonFontSize;\n            style.padding = buttonPadding;\n            if (GUILayout.Button(\"Reset to Default\", style)) {\n                ResetToDefault();\n            }\n\n            style = new GUIStyle(EditorStyles.miniButtonMid);\n            style.fontSize = buttonFontSize;\n            style.padding = buttonPadding;\n            if (GUILayout.Button(\"Update Template\", style)) {\n                OnTemplateChanged();\n            }\n\n            style = new GUIStyle(EditorStyles.miniButtonRight);\n            style.fontSize = buttonFontSize;\n            style.padding = buttonPadding;\n            if (GUILayout.Button(\"Reconvert All\", style)) {\n                ReconvertAll();\n            }\n        }\n        EditorGUILayout.EndHorizontal();\n    }\n\n    void DrawMessages()\n    {\n        if (!string.IsNullOrEmpty(errorMessage_)) {\n            EditorGUILayout.HelpBox(errorMessage_, MessageType.Error, true);\n        }\n    }\n\n    string ToConstVariable(string name)\n    {\n        if (name == \"Name\") {\n            return name_.stringValue;\n        } else if (constants_ != null) {\n            var constants = (Constants)constants_.objectReferenceValue;\n            foreach (var kv in constants.values) {\n                if (kv.name == name) return kv.value;\n            }\n        }\n        return null;\n    }\n\n    void OnTemplateChanged()\n    {\n        templateParser_ = new ShaderTemplateParser(template_.text);\n\n        constants_.objectReferenceValue = \n            templateParser_.constants ??\n            Resources.Load<Constants>(Common.Setting.defaultConstants);\n\n        foreach (var kv in templateParser_.conditions) {\n            if (FindProperty(conditions_, kv.Key) != null) continue;\n            var prop = AddProperty(conditions_, kv.Key);\n            prop.FindPropertyRelative(\"key\").stringValue = kv.Key;\n            prop.FindPropertyRelative(\"value\").boolValue = kv.Value;\n        }\n\n        foreach (var kv in templateParser_.blocks) {\n            if (FindProperty(blocks_, kv.Key) != null) continue;\n            var prop = AddProperty(blocks_, kv.Key);\n            prop.FindPropertyRelative(\"key\").stringValue = kv.Key;\n            prop.FindPropertyRelative(\"value\").stringValue = kv.Value;\n            prop.FindPropertyRelative(\"folded\").boolValue = false;\n        }\n\n        foreach (var kv in templateParser_.variables) {\n            if (FindProperty(variables_, kv.Key) != null) continue;\n            var prop = AddProperty(variables_, kv.Key);\n            var hasDefaultValue = (kv.Value.Count >= 1);\n            prop.FindPropertyRelative(\"key\").stringValue = kv.Key;\n            prop.FindPropertyRelative(\"value\").stringValue = hasDefaultValue ? kv.Value[0] : \"\";\n        }\n    }\n\n    string GetShaderName()\n    {\n        var name = name_.stringValue;\n        if (string.IsNullOrEmpty(name)) {\n            throw new System.Exception(string.Format(\"Shader name of \\\"{0}\\\" is empty.\", target.name));\n        }\n        return name_.stringValue;\n    }\n\n    string GetOutputDirPath()\n    {\n        if (hasShaderReference) {\n            return Path.GetDirectoryName(AssetDatabase.GetAssetPath(shader_.objectReferenceValue));\n        }\n        return Path.GetDirectoryName(AssetDatabase.GetAssetPath(target));\n    }\n\n    string GetShaderPath()\n    {\n        return string.Format(\"{0}/{1}.shader\", GetOutputDirPath(), GetShaderName());\n    }\n\n    void ReImport()\n    {\n        var outputPath = GetShaderPath();\n        AssetDatabase.ImportAsset(outputPath);\n        shader_.objectReferenceValue = AssetDatabase.LoadAssetAtPath<Shader>(outputPath);\n    }\n\n    void ExportShader()\n    {\n        var info = new ShaderTemplateConvertInfo();\n\n        foreach (var kv in templateParser_.conditions) {\n            var prop = FindProperty(conditions_, kv.Key);\n            var value = prop.FindPropertyRelative(\"value\");\n            info.conditions.Add(kv.Key, value.boolValue);\n        }\n\n        foreach (var kv in templateParser_.blocks) {\n            var prop = FindProperty(blocks_, kv.Key);\n            var value = prop.FindPropertyRelative(\"value\");\n            info.blocks.Add(kv.Key, value.stringValue);\n        }\n\n        foreach (var kv in templateParser_.variables) {\n            var prop = FindProperty(variables_, kv.Key);\n            var value = prop.FindPropertyRelative(\"value\");\n            var constValue = ToConstVariable(kv.Key);\n            if (constValue != null) {\n                value.stringValue = constValue;\n            }\n            info.variables.Add(kv.Key, value.stringValue);\n        }\n\n        var code = templateParser_.Convert(info);\n\n        // rename if generator has a shader reference.\n        if (hasShaderReference) {\n            var shaderFilePath = AssetDatabase.GetAssetPath(shader_.objectReferenceValue);\n            var shaderFileName = Path.GetFileNameWithoutExtension(shaderFilePath);\n            var newFilePath = GetShaderPath();\n\n            if (GetShaderName() != shaderFileName) {\n                if (File.Exists(newFilePath)) {\n                    throw new System.Exception(\n                        string.Format(\"attempted to rename {0} to {1}, but target file existed.\",\n                            shaderFilePath, newFilePath));\n                }\n                AssetDatabase.RenameAsset(shaderFilePath, GetShaderName());\n            }\n        }\n\n        using (var writer = new StreamWriter(GetShaderPath())) {\n            writer.Write(code);\n        }\n\n        ReImport();\n\n        if (hasShaderReference) {\n            watcher_.Start(GetShaderPath());\n        }\n    }\n\n    void ExportShaderWithErrorCheck()\n    {\n        ClearError();\n\n        var generator = target as Generator;\n        generator.OnBeforeConvert();\n\n        try {\n            ExportShader();\n        } catch (Exception e) {\n            AddError(e.Message);\n        }\n\n        generator.OnAfterConvert();\n    }\n\n    void ResetToDefault()\n    {\n        blocks_.ClearArray();\n        conditions_.ClearArray();\n        variables_.ClearArray();\n        OnTemplateChanged();\n    }\n\n    public void Reconvert()\n    {\n        CheckShaderUpdate();\n        OnTemplateChanged();\n        ExportShaderWithErrorCheck();\n    }\n\n    void ReconvertAll()\n    {\n        Debug.LogFormat(\"<color=blue>Reconvert started.\\n------------------------------</color>\"); \n        var generators = Utils.FindAllAssets<Generator>();\n        foreach (var generator in generators) {\n            try {\n                if (target == generator) {\n                    Debug.LogFormat(\"<color=green>{0}</color>\", GetShaderPath());\n                    Reconvert();\n                } else {\n                    var editor = Editor.CreateEditor(generator) as GeneratorEditor;\n                    Debug.LogFormat(\"<color=green>{0}</color>\", editor.GetShaderPath());\n                    editor.Reconvert();\n                }\n            } catch (System.Exception e) {\n                Debug.LogFormat(\"<color=red>Error: \" + e.Message + \"</color>\"); \n            }\n        }\n        Debug.LogFormat(\"<color=blue>------------------------------\\nReconvert finished.</color>\"); \n    }\n\n    void CheckShaderUpdate()\n    {\n        if (!hasShaderReference) return;\n\n        ClearError();\n        try {\n            var shaderPath = GetShaderPath();\n            using (var reader = new StreamReader(shaderPath)) {\n                var code = reader.ReadToEnd();\n                var parser = new ShaderTemplateParser(code);\n                foreach (var kv in parser.blocks) {\n                    var prop = FindProperty(blocks_, kv.Key);\n                    if (prop != null) {\n                        var value = prop.FindPropertyRelative(\"value\");\n                        value.stringValue = kv.Value;\n                    }\n                }\n            }\n        } catch (System.Exception e) {\n            AddError(e.Message);\n        }\n    }\n\n    void CreateMaterial()\n    {\n        var material = new Material(shader_.objectReferenceValue as Shader);\n        var path = string.Format(\"{0}/{1}.mat\", GetOutputDirPath(), GetShaderName());\n        ProjectWindowUtil.CreateAsset(material, path);\n    }\n\n    void HandleKeyEvents()\n    {\n        var e = Event.current;\n        var isKeyPressing = e.type == EventType.KeyUp;\n        if (isKeyPressing && e.control && e.keyCode == KeyCode.R) {\n            ExportShaderWithErrorCheck();\n        }\n    }\n\n    void ClearError()\n    {\n        errorMessage_ = \"\";\n    }\n\n    void AddError(string error)\n    {\n        if (!string.IsNullOrEmpty(errorMessage_)) {\n            errorMessage_ += \"\\n\";\n        }\n        errorMessage_ += error;\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/GeneratorEditor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: f0e7677688d9d41f385006d35eb6ce88\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/MaterialEditor.cs",
    "content": "﻿using UnityEngine;\nusing UnityEditor;\n\nnamespace uShaderTemplate\n{\n\npublic class MaterialEditor : ShaderGUI\n{\n    bool folded_ = true;\n    Editor cachedEditor_;\n\n    override public void OnGUI(\n        UnityEditor.MaterialEditor materialEditor, \n        MaterialProperty[] properties)\n\t{\n        if (!cachedEditor_) {\n            var material = materialEditor.target as Material;\n            var shader = material.shader;\n            var generators = Utils.FindAllAssets<Generator>();\n            Generator targetGenerator = null;\n            foreach (var generator in generators) {\n                if (generator.shaderReference == shader) {\n                    targetGenerator = generator;\n                    break;\n                }\n            }\n            if (targetGenerator) {\n                cachedEditor_ = Editor.CreateEditor(targetGenerator);\n            }\n        }\n\n        if (cachedEditor_) {\n            cachedEditor_.OnInspectorGUI();\n            EditorGUILayout.Separator();\n        }\n\n        folded_ = Utils.Foldout(\"Material Properties\", folded_);\n        if (folded_) {\n            ++EditorGUI.indentLevel;\n            base.OnGUI(materialEditor, properties);\n            --EditorGUI.indentLevel;\n        }\n\t}\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/MaterialEditor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: b2fe1cb944fe14609899b7870ce5e639\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderCodeEditor.cs",
    "content": "﻿using UnityEngine;\nusing UnityEditor;\n\nnamespace uShaderTemplate\n{\n\npublic class ShaderCodeEditor\n{\n    public string name { get; private set; }\n    public SerializedProperty value { get; private set; }\n    public SerializedProperty folded { get; private set; }\n\n    CodeEditor editor_;\n    Vector2 scrollPos_;\n    Font font_;\n\n    public string code\n    {\n        get { return value != null ? value.stringValue : \"\"; }\n        private set { this.value.stringValue = value; }\n    }\n\n    public ShaderCodeEditor(string name, SerializedProperty value, SerializedProperty folded)\n    {\n        this.name = name;\n        this.value = value;\n        this.folded = folded;\n\n        font_ = Resources.Load<Font>(Common.Editor.font);\n\n        Color color, bgColor, cursorColor;\n        ColorUtility.TryParseHtmlString(Common.Color.background, out bgColor);\n        ColorUtility.TryParseHtmlString(Common.Color.color, out color);\n        ColorUtility.TryParseHtmlString(Common.Color.cursorColor, out cursorColor);\n\n        editor_ = new CodeEditor(name);\n        editor_.backgroundColor = bgColor;\n        editor_.textColor = color;\n        editor_.cursorColor = cursorColor;\n        editor_.highlighter = ShaderHighlighter.Highlight;\n    }\n\n    public void Draw()\n    {\n        var preFolded = folded.boolValue;\n        folded.boolValue = Utils.Foldout(name, folded.boolValue);\n\n        if (!folded.boolValue) {\n            if (preFolded) {\n                GUI.FocusControl(\"\");\n            }\n            return;\n        }\n\n        if (!preFolded) {\n            GUI.FocusControl(name);\n        }\n\n        var height = GUILayout.Height(Common.Editor.height);\n        scrollPos_ = EditorGUILayout.BeginScrollView(scrollPos_, height);\n        {\n            var style = new GUIStyle(GUI.skin.textArea);\n            style.padding = new RectOffset(6, 6, 6, 6);\n            style.font = font_;\n            style.fontSize = Common.Editor.fontSize;\n            style.wordWrap = Common.Editor.wordWrap;\n\n            var editedCode = editor_.Draw(code, style, GUILayout.ExpandHeight(true));\n            if (editedCode != code) {\n                code = editedCode;\n            }\n        }\n        EditorGUILayout.EndScrollView();\n\n        EditorGUILayout.Space();\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderCodeEditor.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 79cc0d829733b429c9476e482f714b82\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderHighlighter.cs",
    "content": "﻿using System.Text.RegularExpressions;\nusing System.Collections.Generic;\n\nnamespace uShaderTemplate\n{\n\npublic static class ShaderHighlighter\n{\n    static Regex regex;\n    static MatchEvaluator evaluator;\n    static Dictionary<string, string> colorTable = new Dictionary<string, string> {\n        { \"symbol\",      Common.Color.symbol },\n        { \"digit\",       Common.Color.digit },\n        { \"str\",         Common.Color.str },\n        { \"comment\",     Common.Color.comment },\n        { \"type\",        Common.Color.type },\n        { \"keyword\",     Common.Color.keyword },\n        { \"cgprogram\",   Common.Color.cgprogram },\n        { \"user1\",       Common.Color.user1 },\n        { \"user2\",       Common.Color.user2 },\n        { \"unity\",       Common.Color.unity },\n    };\n\n    static string ToColoredCode(string code, string color)\n    {\n        return \"<color=\" + color + \">\" + code + \"</color>\";\n    }\n\n    [UnityEditor.InitializeOnLoadMethod]\n    static void Init()\n    {\n        var forwardSeparator = \"(?<![0-9a-zA-Z_])\";\n        var backwardSeparator = \"(?![0-9a-zA-Z_])\";\n        var pattern1 = \"(?<{0}>({1}))\";\n        var pattern2 = string.Format(\"(?<{0}>{2}({1}){3})\", \"{0}\", \"{1}\", forwardSeparator, backwardSeparator);\n\n        var patterns = new string[] { \n            string.Format(pattern1, \"comment\", string.Join(\"|\", ShaderSyntax.comment)),\n            string.Format(pattern2, \"type\", string.Join(\"|\", ShaderSyntax.type)),\n            string.Format(pattern2, \"keyword\", string.Join(\"|\", ShaderSyntax.keyword)),\n            string.Format(pattern2, \"user1\", string.Join(\"|\", ShaderSyntax.user1)),\n            string.Format(pattern2, \"user2\", string.Join(\"|\", ShaderSyntax.user2)),\n            string.Format(pattern2, \"cgprogram\", string.Join(\"|\", ShaderSyntax.cgprogram)),\n            string.Format(pattern2, \"unity\", string.Join(\"|\", ShaderSyntax.unity)),\n            string.Format(pattern1, \"str\", string.Join(\"|\", ShaderSyntax.str)),\n            string.Format(pattern1, \"digit\", string.Join(\"|\", ShaderSyntax.digit)),\n            string.Format(pattern1, \"symbol\", string.Join(\"|\", ShaderSyntax.symbol)),\n        };\n        var combinedPattern = \"(\" + string.Join(\"|\", patterns) + \")\";\n\n        regex = new Regex(combinedPattern, RegexOptions.Compiled);\n\n        evaluator = new MatchEvaluator(match => { \n            foreach (var pair in colorTable) {\n                if (match.Groups[pair.Key].Success) {\n                    return ToColoredCode(match.Value, pair.Value);\n                }\n            }\n            return match.Value;\n        });\n    }\n\n    public static string Highlight(string code)\n    {\n        return regex.Replace(code, evaluator);\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderHighlighter.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 5ac75baca8c8f4d35b934f94decfb6b6\ntimeCreated: 1495351861\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderSyntax.cs",
    "content": "﻿using System.Text.RegularExpressions;\nusing System.Collections.Generic;\n\nnamespace uShaderTemplate\n{\n\npublic static class ShaderSyntax\n{\n    public static readonly string[] type = new string[] {\n        \"void\",\n        \"fixed\",\n        \"fixed[1-4]\",\n        \"fixed[1-4]x[1-4]\",\n        \"half\",\n        \"half[1-4]\",\n        \"half[1-4]x[1-4]\",\n        \"float\",\n        \"float[1-4]\",\n        \"float[1-4]x[1-4]\",\n    };\n\n    public static readonly string[] keyword = new string[] {\n        \"#include\",\n        \"#define\",\n        \"return\",\n        \"out\",\n        \"inout\",\n        \"inline\",\n    };\n\n    public static readonly string[] symbol = new string[] {\n        @\"[{}()=;,+\\-*/<>|]+\",\n    };\n\n    public static readonly string[] digit = new string[] {\n        @\"(?<![a-zz_Z_])[+-]?[0-9]+\\.?[0-9]?(([eE][+-]?)?[0-9]+)?\"\n    };\n\n    public static readonly string[] str = new string[] {\n        \"(\\\"[^\\\"\\\\n]*?\\\")\"\n    };\n\n    public static readonly string[] comment = new string[] {\n        @\"/\\*[\\s\\S]*?\\*/|//.*\"\n    };\n\n    public static readonly string[] cgprogram = new string[] {\n        \"abs\",\n        \"acos\",\n        \"all\",\n        \"any\",\n        \"asin\",\n        \"atan\",\n        \"atan2\",\n        \"bitCount\",\n        \"bitfieldExtract\",\n        \"bitfieldInsert\",\n        \"bitfieldReverse\",\n        \"ceil\",\n        \"clamp\",\n        \"clip\",\n        \"cos\",\n        \"cosh\",\n        \"cross\",\n        \"ddx\",\n        \"ddy\",\n        \"degrees\",\n        \"determinant\",\n        \"distance\",\n        \"dot\",\n        \"exp\",\n        \"exp2\",\n        \"faceforward\",\n        \"findLSB\",\n        \"findMSB\",\n        \"floatToIntBits\",\n        \"floatToRawIntBits\",\n        \"floor\",\n        \"fmod\",\n        \"frac\",\n        \"frexp\",\n        \"fwidth\",\n        \"intBitsToFloat\",\n        \"inverse\",\n        \"isfinite\",\n        \"isinf\",\n        \"isnan\",\n        \"ldexp\",\n        \"length\",\n        \"lerp\",\n        \"lit\",\n        \"log\",\n        \"log10\",\n        \"log2\",\n        \"max\",\n        \"min\",\n        \"modf\",\n        \"mul\",\n        \"normalize\",\n        \"pack\",\n        \"pow\",\n        \"radians\",\n        \"reflect\",\n        \"refract\",\n        \"round\",\n        \"rsqrt\",\n        \"saturate\",\n        \"sign\",\n        \"sin\",\n        \"sincos\",\n        \"sinh\",\n        \"smoothstep\",\n        \"sqrt\",\n        \"step\",\n        \"tan\",\n        \"tanh\",\n        \"tex1D\",\n        \"tex2D\",\n        \"tex3D\",\n        \"transpose\",\n        \"trunc\",\n        \"unpack\",\n    };\n\n    public static readonly string[] unity = new string[] {\n        \"UNITY_MATRIX_MVP\",\n        \"UNITY_MATRIX_MV\",\n        \"UNITY_MATRIX_V\",\n        \"UNITY_MATRIX_P\",\n        \"UNITY_MATRIX_VP\",\n        \"UNITY_MATRIX_T_MV\",\n        \"UNITY_MATRIX_IT_MV\",\n        \"unity_ObjectToWorld\",\n        \"unity_WorldToObject\",\n        \"_WorldSpaceCameraPos\",\n        \"_ProjectionParams\",\n        \"_ScreenParams\",\n        \"_ZBufferParams\",\n        \"unity_OrthoParams\",\n        \"unity_CameraProjection\",\n        \"unity_CameraInvProjection\",\n        \"unity_CameraWorldClipPlanes\",\n        \"_Time\",\n        \"_SinTime\",\n        \"_CosTime\",\n        \"unity_DeltaTime\",\n        \"_LightColor0\",\n        \"_WorldSpaceLightPos0\",\n        \"_LightMatrix0\",\n        \"unity_4LightPosX0\",\n        \"unity_4LightAtten0\",\n        \"unity_LightColor\",\n        \"_LightColor\",\n        \"_LightMatrix0\",\n        \"unity_LightColor\",\n        \"unity_LightPosition\",\n        \"unity_LightAtten\",\n        \"unity_SpotDirection\",\n        \"unity_AmbientSky\",\n        \"unity_AmbientEquator\",\n        \"unity_AmbientGround\",\n        \"UNITY_LIGHTMODEL_AMBIENT\",\n        \"unity_FogColor\",\n        \"unity_FogParams\",\n        \"unity_LODFade\",\n    };\n\n    public static readonly string[] user1 = new string[] {\n        \"DistanceFunction\",\n        \"PostEffect\",\n    };\n\n    public static readonly string[] user2 = new string[] {\n        \"Rand\",\n        \"Mod\",\n        \"SmoothMin\",\n        \"Repeat\",\n        \"Rotate\",\n        \"TwistX\",\n        \"TwistY\",\n        \"TwistZ\",\n        \"ToLocal\",\n        \"ToWorld\",\n        \"GetDepth\",\n        \"Sphere\",\n        \"RoundBox\",\n        \"Box\",\n        \"Torus\",\n        \"Plane\",\n        \"Cylinder\",\n        \"HexagonalPrismX\",\n        \"HexagonalPrismY\",\n        \"HexagonalPrismZ\",\n        \"PI\",\n        \"_Scale\",\n    };\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderSyntax.cs.meta",
    "content": "fileFormatVersion: 2\nguid: fe815b6c248854d5aa4ddbff23ab32c6\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateParser.cs",
    "content": "﻿using System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\nnamespace uShaderTemplate\n{\n\npublic class ShaderTemplateConvertInfo\n{\n    public Dictionary<string, bool> conditions = new Dictionary<string, bool>();\n    public Dictionary<string, string> blocks = new Dictionary<string, string>();\n    public Dictionary<string, string> variables = new Dictionary<string, string>();\n}\n\npublic class ShaderTemplateParser\n{\n    static readonly string conditionPattern = \n        @\"@if\\s*(?<Cond>[^:\\s\\n]+)(?:\\s*:\\s*)?(?<Init>[^\\s\\n]+)?\\s*\\n\" + \n        @\"(?<TrueValue>[^@]*?)\" + \n        @\"((\\s*@else\\s*)\\n\" +\n        @\"(?<FalseValue>[^@]*?))?\" + \n        @\"\\n\\s*@endif\";\n    static readonly string blockPattern = \n        @\"@block\\s*(?<Block>[^\\s\\n]+)\\s*\\n\" +\n        @\"(?<Value>[\\s\\S]*?)\" +\n        @\"\\n\\s*(:?//\\s*)*?@endblock\";\n    static readonly string variablePattern = \n        @\"<(?<Name>[^=\\s\\n]+)(?:\\s*=\\s*(?<Value>[^\\s\\n|>]+)(\\s*\\|\\s*(?<Value>[^\\s\\n|>]+))*)?\\s*>\";\n    static readonly string constantsPattern =\n        @\"@constants\\s*(?<Path>[^\\n]+)\";\n\n    public string code { get; set; }\n\n    public Dictionary<string, bool> conditions { get; private set; }\n    public Dictionary<string, string> blocks { get; private set; }\n    public Dictionary<string, List<string>> variables { get; private set; }\n    public Constants constants { get; private set; }\n\n    public ShaderTemplateParser(string code)\n    {\n        this.code = code;\n        conditions = new Dictionary<string, bool>();\n        blocks = new Dictionary<string, string>();\n        variables = new Dictionary<string, List<string>>();\n        Parse();\n    }\n\n    void Parse()\n    {\n        ParseConstants();\n        ParseConditions();\n        ParseBlocks();\n        ParseVariables();\n    }\n\n    public string Convert(ShaderTemplateConvertInfo info)\n    {\n        if (constants != null) {\n            constants.OnBeforeConvert();\n        }\n\n        var code = this.code;\n        code = WriteConstants(code);\n        code = WriteConditions(code, info);\n        code = WriteBlocks(code, info);\n        code = WriteVariables(code, info);\n        code = code.Replace(\"\\r\\n\", \"\\n\");\n        var regex = new Regex(@\"\\n\\n\\n+\");\n        code = regex.Replace(code, \"\\n\\n\");\n\n        if (constants != null) {\n            constants.OnAfterConvert();\n        }\n\n        return code;\n    }\n\n    void ParseConstants()\n    {\n        var regex = new Regex(constantsPattern);\n        var matches = regex.Matches(code);\n        if (matches.Count > 0) {\n            var path = matches[0].Groups[\"Path\"].Value;\n            constants = UnityEngine.Resources.Load<Constants>(path);\n        }\n    }\n\n    string WriteConstants(string code)\n    {\n        var regex = new Regex(constantsPattern);\n        var evaluator = new MatchEvaluator(match => \"\");\n        return regex.Replace(code, evaluator);\n    }\n\n    void ParseConditions()\n    {\n        conditions.Clear();\n\n        var regex = new Regex(conditionPattern);\n        var matches = regex.Matches(code);\n        foreach (Match match in matches) {\n            var cond = match.Groups[\"Cond\"].Value;\n            if (conditions.ContainsKey(cond)) continue;\n            bool init = false;\n            if (match.Groups[\"Init\"].Success) {\n                init = bool.Parse(match.Groups[\"Init\"].Value);\n            }\n            conditions.Add(cond, init);\n        }\n    }\n\n    string WriteConditions(string code, ShaderTemplateConvertInfo info)\n    {\n        var regex = new Regex(conditionPattern);\n        var evaluator = new MatchEvaluator(match => {\n            var cond = match.Groups[\"Cond\"].Value;\n            var trueValue = match.Groups[\"TrueValue\"].Value;\n            var falseValue = match.Groups[\"FalseValue\"].Value;\n            if (!info.conditions.ContainsKey(cond)) {\n                throw new System.Exception(string.Format(\"The key \\\"{0}\\\" is not found in the given conditions.\", cond));\n            }\n            return (info.conditions[cond]) ? trueValue : falseValue;\n        });\n\n        var preCode = code;\n        code = regex.Replace(code, evaluator);\n        while (code != preCode) {\n            preCode = code;\n            code = regex.Replace(code, evaluator);\n        }\n\n        return code;\n    }\n\n    void ParseBlocks()\n    {\n        blocks.Clear();\n\n        var regex = new Regex(blockPattern);\n        var matches = regex.Matches(code);\n        foreach (Match match in matches) {\n            var block = match.Groups[\"Block\"].Value;\n            var value = match.Groups[\"Value\"].Value;\n            blocks.Add(block, value);\n        }\n    }\n\n    string WriteBlocks(string code, ShaderTemplateConvertInfo info)\n    {\n        var regex = new Regex(blockPattern);\n        var evaluator = new MatchEvaluator(match => {\n            var block = match.Groups[\"Block\"].Value;\n            var value = info.blocks[block];\n            if (!info.blocks.ContainsKey(block)) {\n                throw new System.Exception(string.Format(\"The key \\\"{0}\\\" is not found in the given blocks.\", block));\n            }\n            return string.Format(\"// @block {0}\\n{1}\\n// @endblock\", block, value);\n        });\n        return regex.Replace(code, evaluator);\n    }\n\n    void ParseVariables()\n    {\n        variables.Clear();\n\n        var regex = new Regex(variablePattern);\n        var matches = regex.Matches(code);\n        foreach (Match match in matches) {\n            var variable = match.Groups[\"Name\"].Value;\n            if (!variables.ContainsKey(variable)) {\n                var values = new List<string>();\n                foreach (Capture capture in match.Groups[\"Value\"].Captures) {\n                    values.Add(capture.Value);\n                }\n                variables.Add(variable, values);\n            }\n        }\n    }\n\n    string WriteVariables(string code, ShaderTemplateConvertInfo info)\n    {\n        var regex = new Regex(variablePattern);\n        var evaluator = new MatchEvaluator(match => {\n            var variable = match.Groups[\"Name\"].Value;\n            if (!info.variables.ContainsKey(variable)) {\n                throw new System.Exception(string.Format(\"The key \\\"{0}\\\" is not found in the given variables.\", variable));\n            }\n            return info.variables[variable];\n        });\n        return regex.Replace(code, evaluator);\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateParser.cs.meta",
    "content": "fileFormatVersion: 2\nguid: bcb46db3577114bb4aadb54b6309e9e1\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateSelector.cs",
    "content": "﻿using UnityEngine;\nusing UnityEngine.Events;\nusing UnityEditor;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace uShaderTemplate\n{\n\npublic class ShaderTemplateSelector\n{\n    public SerializedProperty prop { get; private set; }\n\n    public class OnChangeEventHandler : UnityEvent {}\n    public OnChangeEventHandler onChange = new OnChangeEventHandler();\n\n    struct TemplateInfo\n    {\n        public string name;\n        public string path;\n    }\n    List<TemplateInfo> list_ = new List<TemplateInfo>();\n\n    public string selected\n    {\n        get { return prop.stringValue; }\n    }\n\n    public string text\n    {\n        get {\n            if (string.IsNullOrEmpty(prop.stringValue)) {\n                prop.stringValue = list_[0].name;\n            }\n            var dir = Common.Setting.templateDirectoryPath;\n            var asset = Resources.Load<TextAsset>(dir + \"/\" + prop.stringValue);\n            return asset ? asset.text : \"\";\n        }\n    }\n\n    public ShaderTemplateSelector(SerializedProperty prop)\n    {\n        this.prop = prop;\n\n        var paths = Utils.GetShaderTemplatePathList();\n        foreach (var path in paths) {\n            if (Path.GetExtension(path) == Common.Setting.templateFileExtension) {\n                var index = path.IndexOf(Common.Setting.templateDirectoryPath);\n                var name = path\n                    .Substring(index + Common.Setting.templateDirectoryPath.Length + 1)\n                    .Replace(Common.Setting.templateFileExtension, \"\");\n                var info = new TemplateInfo() {\n                    name = name,\n                    path = path,\n                };\n                list_.Add(info);\n            }\n        }\n    }\n\n    public void Draw()\n    {\n        var currentIndex = list_.Select(x => x.name).ToList().IndexOf(prop.stringValue);\n        if (currentIndex == -1) currentIndex = 0;\n\n        EditorGUILayout.BeginHorizontal(); {\n            var selectedIndex = EditorGUILayout.Popup(\n                \"Shader Template\", \n                currentIndex, \n                list_.Select(x => x.name).ToArray());\n            var selected = list_[selectedIndex];\n\n            var openButtonStyle = EditorStyles.miniButton;\n            openButtonStyle.fixedWidth = 36;\n            if (GUILayout.Button(\"Edit\", openButtonStyle)) {\n                var asset = AssetDatabase.LoadAssetAtPath(selected.path, typeof(Object));\n                AssetDatabase.OpenAsset(asset);\n            }\n\n            var pre = prop.stringValue;\n            var cur = selected.name;\n            if (pre != cur) {\n                prop.stringValue = cur;\n                onChange.Invoke();\n            }\n        } EditorGUILayout.EndHorizontal();\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateSelector.cs.meta",
    "content": "fileFormatVersion: 2\nguid: a8acd5a733ea24db89ac81f30cb3f9d4\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Utils.cs",
    "content": "﻿using UnityEngine;\nusing UnityEngine.Assertions;\nusing UnityEditor;\nusing System.IO;\nusing System.Collections.Generic;\n\nnamespace uShaderTemplate\n{\n\npublic static class Utils\n{\n    public static HashSet<string> GetShaderTemplatePathList()\n    {\n        var files = Resources.LoadAll<TextAsset>(Common.Setting.templateDirectoryPath);\n        var list = new HashSet<string>();\n        foreach (var file in files) {\n            var path = AssetDatabase.GetAssetPath(file);\n            list.Add(path);\n        }\n        return list;\n    }\n\n    public static bool Foldout(string title, bool display)\n    {\n        var style = new GUIStyle(\"ShurikenModuleTitle\");\n        style.font = new GUIStyle(EditorStyles.label).font;\n        style.border = new RectOffset(15, 7, 4, 4);\n        style.fixedHeight = 22;\n        style.contentOffset = new Vector2(20f, -2f);\n\n        var rect = GUILayoutUtility.GetRect(16f, 22f, style);\n        GUI.Box(rect, title, style);\n\n        var e = Event.current;\n\n        var toggleRect = new Rect(rect.x + 4f, rect.y + 2f, 13f, 13f);\n        if (e.type == EventType.Repaint) {\n            EditorStyles.foldout.Draw(toggleRect, false, false, display, false);\n        }\n        \n        if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) {\n            display = !display;\n            e.Use();\n        }\n\n        return display;\n    }\n\n    public static string ToSpacedCamel(string str)\n    {\n        return System.Text.RegularExpressions.Regex.Replace(str, @\"([A-Z][^A-Z]+)\", @\"$1 \");\n    }\n\n    public static void ReadOnlyTextField(string label, string text)\n    {\n        EditorGUILayout.BeginHorizontal();\n        {\n            EditorGUILayout.LabelField(label, GUILayout.Width(EditorGUIUtility.labelWidth - 4));\n            EditorGUILayout.SelectableLabel(text, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));\n        }\n        EditorGUILayout.EndHorizontal();\n    }\n\n    public static List<T> FindAllAssets<T>(string query) where T : Object\n    {\n        var list = new List<T>();\n        var guids = AssetDatabase.FindAssets(query);\n        foreach (var guid in guids) {\n            var path = AssetDatabase.GUIDToAssetPath(guid);\n            var obj = AssetDatabase.LoadAssetAtPath<T>(path);\n            if (obj) list.Add(obj);\n        }\n        return list;\n    }\n\n    public static List<T> FindAllAssets<T>() where T : Object\n    {\n        return FindAllAssets<T>(\"t:\" + typeof(T));\n    }\n\n    public static List<Material> FindMaterialsUsingShader(Shader shader)\n    {\n        var materials = new List<Material>();\n        var allMaterials = FindAllAssets<Material>(\"t:Material\");\n        foreach (var material in allMaterials) {\n            if (material.shader == shader) {\n                materials.Add(material);\n            }\n        }\n        return materials;\n    }\n}\n\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Utils.cs.meta",
    "content": "fileFormatVersion: 2\nguid: 925b388b01b594c7698c988bb6d6ae93\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  serializedVersion: 2\n  defaultReferences: []\n  executionOrder: 0\n  icon: {instanceID: 0}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts.meta",
    "content": "fileFormatVersion: 2\nguid: aa9023223e4924f0b9c0b34c0d3080a1\nfolderAsset: yes\ntimeCreated: 1495350799\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/uShaderTemplate.Editor.asmdef",
    "content": "{\n    \"name\": \"uShaderTemplate.Editor\",\n    \"rootNamespace\": \"\",\n    \"references\": [],\n    \"includePlatforms\": [\n        \"Editor\"\n    ],\n    \"excludePlatforms\": [],\n    \"allowUnsafeCode\": false,\n    \"overrideReferences\": false,\n    \"precompiledReferences\": [],\n    \"autoReferenced\": true,\n    \"defineConstraints\": [],\n    \"versionDefines\": [],\n    \"noEngineReferences\": false\n}"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/uShaderTemplate.Editor.asmdef.meta",
    "content": "fileFormatVersion: 2\nguid: a0c568dd17c433c488d48cb56a032e0b\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 1dc0de322bc9d4c928c2515ca6c0b497\nfolderAsset: yes\ntimeCreated: 1495345051\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Generators/Surface.asset.meta",
    "content": "fileFormatVersion: 2\nguid: 88c90c500f31b4686bae88f3a389e73f\ntimeCreated: 1495458303\nlicenseType: Pro\nNativeFormatImporter:\n  mainObjectFileID: 11400000\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Generators/VertFrag.asset.meta",
    "content": "fileFormatVersion: 2\nguid: a0068c12e7d1a4937b32899156d170d1\ntimeCreated: 1495382657\nlicenseType: Pro\nNativeFormatImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Generators.meta",
    "content": "fileFormatVersion: 2\nguid: d17285a28a5464c8cb0d2066d7d2560e\nfolderAsset: yes\ntimeCreated: 1495350945\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/Surface.txt",
    "content": "Shader \"Custom/<Name>\"\n{\n\n@constants uShaderTemplate/Constants/Custom Constants\n\nProperties\n{\n    _Color(\"Color\", Color) = (1,1,1,1)\n    _MainTex(\"Albedo (RGB)\", 2D) = \"white\" {}\n    _NormalTex(\"Normalmap\", 2D) = \"bump\" {}\n@if UseTesselation : false\n    _DispTex(\"Disp Texture\", 2D) = \"gray\" {}\n    _Displacement(\"Displacement\", Range(0, 1.0)) = 0.3\n    _Tess(\"Tess Factor\", Range(1, 32.0)) = 3\n@endif\n    _Glossiness(\"Smoothness\", Range(0,1)) = 0.5\n    _Metallic(\"Metallic\", Range(0,1)) = 0.0\n}\n\nSubShader\n{\n\nTags { \"RenderType\"=\"Opaque\" }\nLOD <LOD=200>\n\nCGPROGRAM\n\n@if UseTesselation\n#pragma surface surf <LightModel=Standard|StandardSpecular|Lambert|BlinnPhong> addshadow fullforwardshadows vertex:disp tessellate:tessFixed nolightmap <Option>\n@else\n#pragma surface surf <LightModel=Standard|StandardSpecular|Lambert|BlinnPhong> fullforwardshadows <Option>\n@endif\n\n@if UseTesselation\n#pragma target 5.0\n@else\n#pragma target 3.0\n@endif\n\nstruct Input\n{\n    float2 uv_MainTex;\n};\n\nsampler2D _MainTex;\nsampler2D _NormalTex;\nhalf _Glossiness;\nhalf _Metallic;\nfixed4 _Color;\n\n@if UseTesselation\nstruct appdata\n{\n    float4 vertex   : POSITION;\n    float4 tangent  : TANGENT;\n    float3 normal   : NORMAL;\n    float2 texcoord : TEXCOORD0;\n};\n\nfloat _Tess;\nfloat _Displacement;\nsampler2D _DispTex;\n\nfloat4 tessFixed()\n{\n    return _Tess;\n}\n\nvoid disp(inout appdata v)\n{\n    float d = tex2Dlod(_DispTex, float4(v.texcoord.xy,0,0)).r * _Displacement;\n    v.vertex.xyz += v.normal * d;\n}\n@endif\n\nvoid surf(Input IN, inout <SurfaceFunctionInput=SurfaceOutputStandard|SurfaceOutputStandardSpecular|SurfaceOutput> o)\n{\n@block SurfaceFunction\nfixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;\no.Albedo = c.rgb;\no.Metallic = _Metallic;\no.Smoothness = _Glossiness;\no.Alpha = c.a;\no.Normal = UnpackNormal(tex2D(_NormalTex, IN.uv_MainTex));\n@endblock\n}\n\nENDCG\n\n}\n\nFallBack \"Diffuse\"\n\nCustomEditor \"uShaderTemplate.MaterialEditor\"\n\n}\n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/Surface.txt.meta",
    "content": "fileFormatVersion: 2\nguid: 43bf8662976fb470b986a9f654977189\ntimeCreated: 1495457698\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/VertFrag.txt",
    "content": "Shader \"Custom/<Name>\"\n{\n\nProperties\n{\n@block Properties\n_MainTex(\"Texture\", 2D) = \"white\" {}\n@endblock\n}\n\nSubShader\n{\n\nTags { \"Queue\"=\"<Queue=Geometry|Transparent>\" \"RenderType\"=\"<RenderType=Opaque|Transparent>\" }\nLOD <LOD=100>\n\nCGINCLUDE\n\n#include \"UnityCG.cginc\"\n\nstruct v2f\n{\n    float2 uv : TEXCOORD0;\n@if UseFog : true\n    UNITY_FOG_COORDS(1)\n@endif\n    float4 vertex : SV_POSITION;\n};\n\n@block VertexShader\nsampler2D _MainTex;\nfloat4 _MainTex_ST;\n\nv2f vert(appdata_full v)\n{\n    v2f o;\n    o.vertex = UnityObjectToClipPos(v.vertex);\n    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);\n    UNITY_TRANSFER_FOG(o,o.vertex);\n    return o;\n}\n@endblock\n\n@block FragmentShader\nfixed4 frag(v2f i) : SV_Target\n{\n    fixed4 col = tex2D(_MainTex, i.uv);\n    UNITY_APPLY_FOG(i.fogCoord, col);\n    return col;\n}\n@endblock\n\nENDCG\n\nPass\n{\n    CGPROGRAM\n    #pragma vertex vert\n    #pragma fragment frag\n@if UseFog : true\n    #pragma multi_compile_fog\n@endif\n    ENDCG\n}\n\n}\n\nCustomEditor \"uShaderTemplate.MaterialEditor\"\n\n}\n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/VertFrag.txt.meta",
    "content": "fileFormatVersion: 2\nguid: 606d21f85fa4348baa28d511ebe46d5d\ntimeCreated: 1495382484\nlicenseType: Pro\nTextScriptImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples.meta",
    "content": "fileFormatVersion: 2\nguid: b54e9e82905204f31afb0390f6bed8a7\nfolderAsset: yes\ntimeCreated: 1514533371\nlicenseType: Pro\nDefaultImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates.meta",
    "content": "fileFormatVersion: 2\nguid: cd4d10a21be924728ae1d8b6a53576bd\nfolderAsset: yes\ntimeCreated: 1495348314\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources.meta",
    "content": "fileFormatVersion: 2\nguid: dc5bf9f6e92bd4787a0ea1d3a7ce5629\nfolderAsset: yes\ntimeCreated: 1495348310\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor.meta",
    "content": "fileFormatVersion: 2\nguid: 09890211325254c11a0addaf79b580cf\nfolderAsset: yes\ntimeCreated: 1495348306\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Materials/Surface.mat.meta",
    "content": "fileFormatVersion: 2\nguid: aa9bfc87f3c6443fe8bc35cecfd72a61\ntimeCreated: 1495458388\nlicenseType: Pro\nNativeFormatImporter:\n  mainObjectFileID: 2100000\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Materials/VertFrag.mat.meta",
    "content": "fileFormatVersion: 2\nguid: 90705d78cb60a418395eea6f6df87e87\ntimeCreated: 1495382706\nlicenseType: Pro\nNativeFormatImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Materials.meta",
    "content": "fileFormatVersion: 2\nguid: e212224d38dfe42c8b1ddc1d65561bf7\nfolderAsset: yes\ntimeCreated: 1495382701\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders/Surface.shader",
    "content": "Shader \"Custom/Surface\"\n{\n\nProperties\n{\n    _Color(\"Color\", Color) = (1,1,1,1)\n    _MainTex(\"Albedo (RGB)\", 2D) = \"white\" {}\n    _NormalTex(\"Normalmap\", 2D) = \"bump\" {}\n    _DispTex(\"Disp Texture\", 2D) = \"gray\" {}\n    _Displacement(\"Displacement\", Range(0, 1.0)) = 0.3\n    _Tess(\"Tess Factor\", Range(1, 32.0)) = 3\n    _Glossiness(\"Smoothness\", Range(0,1)) = 0.5\n    _Metallic(\"Metallic\", Range(0,1)) = 0.0\n}\n\nSubShader\n{\n\nTags { \"RenderType\"=\"Opaque\" }\nLOD 300\n\nCGPROGRAM\n\n#pragma surface surf Standard addshadow fullforwardshadows vertex:disp tessellate:tessFixed nolightmap \n\n#pragma target 5.0\n\nstruct Input\n{\n    float2 uv_MainTex;\n};\n\nsampler2D _MainTex;\nsampler2D _NormalTex;\nhalf _Glossiness;\nhalf _Metallic;\nfixed4 _Color;\n\nstruct appdata\n{\n    float4 vertex   : POSITION;\n    float4 tangent  : TANGENT;\n    float3 normal   : NORMAL;\n    float2 texcoord : TEXCOORD0;\n};\n\nfloat _Tess;\nfloat _Displacement;\nsampler2D _DispTex;\n\nfloat4 tessFixed()\n{\n    return _Tess;\n}\n\nvoid disp(inout appdata v)\n{\n    float d = tex2Dlod(_DispTex, float4(v.texcoord.xy,0,0)).r * _Displacement;\n    v.vertex.xyz += v.normal * d;\n}\n\nvoid surf(Input IN, inout SurfaceOutputStandard o)\n{\n// @block SurfaceFunction\nfixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;\no.Albedo = c.rgb;\no.Metallic = _Metallic;\no.Smoothness = _Glossiness;\no.Alpha = c.a;\no.Normal = UnpackNormal(tex2D(_NormalTex, IN.uv_MainTex));\n// @endblock\n}\n\nENDCG\n\n}\n\nFallBack \"Diffuse\"\n\nCustomEditor \"uShaderTemplate.MaterialEditor\"\n\n}\n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders/Surface.shader.meta",
    "content": "fileFormatVersion: 2\nguid: d578a6d4407644041b24ce3049babf46\ntimeCreated: 1495458321\nlicenseType: Pro\nShaderImporter:\n  defaultTextures: []\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders/VertFrag.shader",
    "content": "Shader \"Custom/VertFrag\"\n{\n\nProperties\n{\n// @block Properties\n_MainTex(\"Texture\", 2D) = \"white\" {}\n// @endblock\n}\n\nSubShader\n{\n\nTags { \"Queue\"=\"Geometry\" \"RenderType\"=\"Opaque\" }\nLOD 100\n\nCGINCLUDE\n\n#include \"UnityCG.cginc\"\n\nstruct v2f\n{\n    float2 uv : TEXCOORD0;\n    UNITY_FOG_COORDS(1)\n    float4 vertex : SV_POSITION;\n};\n\n// @block VertexShader\nsampler2D _MainTex;\nfloat4 _MainTex_ST;\n\nv2f vert(appdata_full v)\n{\n    v2f o;\n    o.vertex = UnityObjectToClipPos(v.vertex);\n    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);\n    UNITY_TRANSFER_FOG(o,o.vertex);\n    return o;\n}\n// @endblock\n\n// @block FragmentShader\nfixed4 frag(v2f i) : SV_Target\n{\n    fixed4 col = tex2D(_MainTex, i.uv);\n    UNITY_APPLY_FOG(i.fogCoord, col);\n    return col;\n}\n// @endblock\n\nENDCG\n\nPass\n{\n    CGPROGRAM\n    #pragma vertex vert\n    #pragma fragment frag\n    #pragma multi_compile_fog\n    ENDCG\n}\n\n}\n\nCustomEditor \"uShaderTemplate.MaterialEditor\"\n\n}\n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders/VertFrag.shader.meta",
    "content": "fileFormatVersion: 2\nguid: e668248a8487547b7997f5d6854ea2d8\ntimeCreated: 1495382691\nlicenseType: Pro\nShaderImporter:\n  defaultTextures: []\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders.meta",
    "content": "fileFormatVersion: 2\nguid: 13468f0d9df7046fba8d127c4b693310\nfolderAsset: yes\ntimeCreated: 1495346462\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples.meta",
    "content": "fileFormatVersion: 2\nguid: b090363427a0342dd86e61389443d439\nfolderAsset: yes\ntimeCreated: 1495346384\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate/package.json",
    "content": "{\n    \"name\":\"com.hecomi.ushadertemplate\",\n    \"version\": \"1.0.0\",\n    \"displayName\": \"uShaderTemplate\",\n    \"description\": \"This is an Unity editor extension for generating shader code from template files.\",\n    \"license\": \"MIT License\",\n    \"author\": {\n        \"name\": \"hecomi\",\n        \"url\": \"https://tips.hecomi.com\"\n    },\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/hecomi/uShaderTemplate\"\n    },\n    \"samples\": [\n        {\n            \"displayName\": \"Samples\",\n            \"description\": \"Collection of samples for uShaderTemplate.\",\n            \"path\": \"Samples~\"\n        }\n    ]\n}\n"
  },
  {
    "path": "Assets/uShaderTemplate/package.json.meta",
    "content": "fileFormatVersion: 2\nguid: f6fb284ffdd781743a226884c89913ef\nTextScriptImporter:\n  externalObjects: {}\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "Assets/uShaderTemplate.meta",
    "content": "fileFormatVersion: 2\nguid: 5251585ef4ed3468595a16e360ffb916\nfolderAsset: yes\ntimeCreated: 1495345044\nlicenseType: Pro\nDefaultImporter:\n  userData: \n  assetBundleName: \n  assetBundleVariant: \n"
  },
  {
    "path": "LICENSE.md",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2017 hecomi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "Packages/manifest.json",
    "content": "{\n  \"dependencies\": {\n    \"com.unity.analytics\": \"3.5.3\",\n    \"com.unity.collab-proxy\": \"1.3.9\",\n    \"com.unity.ide.rider\": \"2.0.7\",\n    \"com.unity.ide.visualstudio\": \"2.0.7\",\n    \"com.unity.ide.vscode\": \"1.2.3\",\n    \"com.unity.test-framework\": \"1.1.24\",\n    \"com.unity.textmeshpro\": \"3.0.6\",\n    \"com.unity.timeline\": \"1.4.8\",\n    \"com.unity.ugui\": \"1.0.0\",\n    \"com.unity.modules.ai\": \"1.0.0\",\n    \"com.unity.modules.androidjni\": \"1.0.0\",\n    \"com.unity.modules.animation\": \"1.0.0\",\n    \"com.unity.modules.assetbundle\": \"1.0.0\",\n    \"com.unity.modules.audio\": \"1.0.0\",\n    \"com.unity.modules.cloth\": \"1.0.0\",\n    \"com.unity.modules.director\": \"1.0.0\",\n    \"com.unity.modules.imageconversion\": \"1.0.0\",\n    \"com.unity.modules.imgui\": \"1.0.0\",\n    \"com.unity.modules.jsonserialize\": \"1.0.0\",\n    \"com.unity.modules.particlesystem\": \"1.0.0\",\n    \"com.unity.modules.physics\": \"1.0.0\",\n    \"com.unity.modules.physics2d\": \"1.0.0\",\n    \"com.unity.modules.screencapture\": \"1.0.0\",\n    \"com.unity.modules.terrain\": \"1.0.0\",\n    \"com.unity.modules.terrainphysics\": \"1.0.0\",\n    \"com.unity.modules.tilemap\": \"1.0.0\",\n    \"com.unity.modules.ui\": \"1.0.0\",\n    \"com.unity.modules.uielements\": \"1.0.0\",\n    \"com.unity.modules.umbra\": \"1.0.0\",\n    \"com.unity.modules.unityanalytics\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequestassetbundle\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequestaudio\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequesttexture\": \"1.0.0\",\n    \"com.unity.modules.unitywebrequestwww\": \"1.0.0\",\n    \"com.unity.modules.vehicles\": \"1.0.0\",\n    \"com.unity.modules.video\": \"1.0.0\",\n    \"com.unity.modules.vr\": \"1.0.0\",\n    \"com.unity.modules.wind\": \"1.0.0\",\n    \"com.unity.modules.xr\": \"1.0.0\"\n  }\n}\n"
  },
  {
    "path": "Packages/packages-lock.json",
    "content": "{\n  \"dependencies\": {\n    \"com.unity.analytics\": {\n      \"version\": \"3.5.3\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.ugui\": \"1.0.0\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.collab-proxy\": {\n      \"version\": \"1.3.9\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {},\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ext.nunit\": {\n      \"version\": \"1.0.6\",\n      \"depth\": 1,\n      \"source\": \"registry\",\n      \"dependencies\": {},\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ide.rider\": {\n      \"version\": \"2.0.7\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.test-framework\": \"1.1.1\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ide.visualstudio\": {\n      \"version\": \"2.0.7\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.test-framework\": \"1.1.9\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ide.vscode\": {\n      \"version\": \"1.2.3\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {},\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.test-framework\": {\n      \"version\": \"1.1.24\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.ext.nunit\": \"1.0.6\",\n        \"com.unity.modules.imgui\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.textmeshpro\": {\n      \"version\": \"3.0.6\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.ugui\": \"1.0.0\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.timeline\": {\n      \"version\": \"1.4.8\",\n      \"depth\": 0,\n      \"source\": \"registry\",\n      \"dependencies\": {\n        \"com.unity.modules.director\": \"1.0.0\",\n        \"com.unity.modules.animation\": \"1.0.0\",\n        \"com.unity.modules.audio\": \"1.0.0\",\n        \"com.unity.modules.particlesystem\": \"1.0.0\"\n      },\n      \"url\": \"https://packages.unity.com\"\n    },\n    \"com.unity.ugui\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.ui\": \"1.0.0\",\n        \"com.unity.modules.imgui\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.ai\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.androidjni\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.animation\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.assetbundle\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.audio\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.cloth\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.director\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.audio\": \"1.0.0\",\n        \"com.unity.modules.animation\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.imageconversion\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.imgui\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.jsonserialize\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.particlesystem\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.physics\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.physics2d\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.screencapture\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.imageconversion\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.subsystems\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 1,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.jsonserialize\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.terrain\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.terrainphysics\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics\": \"1.0.0\",\n        \"com.unity.modules.terrain\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.tilemap\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics2d\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.ui\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.uielements\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.ui\": \"1.0.0\",\n        \"com.unity.modules.imgui\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\",\n        \"com.unity.modules.uielementsnative\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.uielementsnative\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 1,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.ui\": \"1.0.0\",\n        \"com.unity.modules.imgui\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.umbra\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.unityanalytics\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.unitywebrequest\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.unitywebrequestassetbundle\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.assetbundle\": \"1.0.0\",\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.unitywebrequestaudio\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n        \"com.unity.modules.audio\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.unitywebrequesttexture\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n        \"com.unity.modules.imageconversion\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.unitywebrequestwww\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\",\n        \"com.unity.modules.unitywebrequestassetbundle\": \"1.0.0\",\n        \"com.unity.modules.unitywebrequestaudio\": \"1.0.0\",\n        \"com.unity.modules.audio\": \"1.0.0\",\n        \"com.unity.modules.assetbundle\": \"1.0.0\",\n        \"com.unity.modules.imageconversion\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.vehicles\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.video\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.audio\": \"1.0.0\",\n        \"com.unity.modules.ui\": \"1.0.0\",\n        \"com.unity.modules.unitywebrequest\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.vr\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.jsonserialize\": \"1.0.0\",\n        \"com.unity.modules.physics\": \"1.0.0\",\n        \"com.unity.modules.xr\": \"1.0.0\"\n      }\n    },\n    \"com.unity.modules.wind\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {}\n    },\n    \"com.unity.modules.xr\": {\n      \"version\": \"1.0.0\",\n      \"depth\": 0,\n      \"source\": \"builtin\",\n      \"dependencies\": {\n        \"com.unity.modules.physics\": \"1.0.0\",\n        \"com.unity.modules.jsonserialize\": \"1.0.0\",\n        \"com.unity.modules.subsystems\": \"1.0.0\"\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "ProjectSettings/PackageManagerSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!114 &1\nMonoBehaviour:\n  m_ObjectHideFlags: 61\n  m_CorrespondingSourceObject: {fileID: 0}\n  m_PrefabInstance: {fileID: 0}\n  m_PrefabAsset: {fileID: 0}\n  m_GameObject: {fileID: 0}\n  m_Enabled: 1\n  m_EditorHideFlags: 0\n  m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}\n  m_Name: \n  m_EditorClassIdentifier: \n  m_EnablePreviewPackages: 0\n  m_EnablePackageDependencies: 0\n  m_AdvancedSettingsExpanded: 1\n  m_ScopedRegistriesSettingsExpanded: 1\n  oneTimeWarningShown: 0\n  m_Registries:\n  - m_Id: main\n    m_Name: \n    m_Url: https://packages.unity.com\n    m_Scopes: []\n    m_IsDefault: 1\n    m_Capabilities: 7\n  m_UserSelectedRegistryName: \n  m_UserAddingNewScopedRegistry: 0\n  m_RegistryInfoDraft:\n    m_ErrorMessage: \n    m_Original:\n      m_Id: \n      m_Name: \n      m_Url: \n      m_Scopes: []\n      m_IsDefault: 0\n      m_Capabilities: 0\n    m_Modified: 0\n    m_Name: \n    m_Url: \n    m_Scopes:\n    - \n    m_SelectedScopeIndex: 0\n"
  },
  {
    "path": "ProjectSettings/ProjectVersion.txt",
    "content": "m_EditorVersion: 2020.3.9f1\nm_EditorVersionWithRevision: 2020.3.9f1 (108be757e447)\n"
  },
  {
    "path": "ProjectSettings/VersionControlSettings.asset",
    "content": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!890905787 &1\nVersionControlSettings:\n  m_ObjectHideFlags: 0\n  m_Mode: Visible Meta Files\n  m_CollabEditorSettings:\n    inProgressEnabled: 1\n"
  },
  {
    "path": "README.md",
    "content": "uShaderTemplate\n===============\n\n**uShaderTemplate** is an editor asset to create shaders from templates.\n\nInstall\n-------\n\n- Unity Package\n  - Download the latest .unitypackage from [Release page](https://github.com/hecomi/uShaderTemplate/releases).\n- Git URL (UPM)\n  - Add `https://github.com/hecomi/uShaderTemplate.git#upm` to Package Manager.\n- Scoped Registry (UPM)\n  - Add a scoped registry to your project.\n    - URL: `https://registry.npmjs.com`\n    - Scope: `com.hecomi`\n  - Install uShaderTemplate in Package Manager. \n\nUsage\n-----\n\n1.  Prepare **Shader Template** file.\n2.  Create **Generator** from *Create > Shader > uShaderTemplate > Generator*.\n3.  Input *Shader Name* and select *Shader Template* from the inspector.\n4.  Edit items in *Conditions*, *Variables*, and codes in code editors.\n5.  Press *Export (Ctrl+R)* button to create a shader from the Generator.\n\nOverview\n--------\n\nGenerator is an asset file that manages a generated shader, save parameters,\nand provide an interface to customize the shader with some rules\nwritten in **shader template**. The following image is an example of a Generator\ninspector which is automatically generated from shader template.\n\n![Inspector](https://raw.githubusercontent.com/wiki/hecomi/uShaderTemplate/inspector.png)\n\nThe interface is generated from\n*uShaderTemplate > Examples > Editor > Resources > ShaderTemplates > 1. VertFrag.txt*.\nThis is the content of this file:\n\n**1. VertFrag.txt**\n\n```shader\nShader \"Custom/<Name>\"\n{\n\nProperties\n{\n@block Properties\n_MainTex(\"Texture\", 2D) = \"white\" {}\n@endblock\n}\n\nSubShader\n{\n\nTags { \"Queue\"=\"<Queue=Geometry|Transparent>\" \"RenderType\"=\"<RenderType=Opaque|Transparent>\" }\nLOD <LOD=100>\n\nCGINCLUDE\n\n#include \"UnityCG.cginc\"\n\nstruct v2f\n{\n    float2 uv : TEXCOORD0;\n@if UseFog : true\n    UNITY_FOG_COORDS(1)\n@endif\n    float4 vertex : SV_POSITION;\n};\n\n@block VertexShader\nsampler2D _MainTex;\nfloat4 _MainTex_ST;\n\nv2f vert(appdata_full v)\n{\n    v2f o;\n    o.vertex = UnityObjectToClipPos(v.vertex);\n    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);\n    UNITY_TRANSFER_FOG(o,o.vertex);\n    return o;\n}\n@endblock\n\n@block FragmentShader\nfixed4 frag(v2f i) : SV_Target\n{\n    fixed4 col = tex2D(_MainTex, i.uv);\n    UNITY_APPLY_FOG(i.fogCoord, col);\n    return col;\n}\n@endblock\n\nENDCG\n\nPass\n{\n    CGPROGRAM\n    #pragma vertex vert\n    #pragma fragment frag\n@if UseFog : true\n    #pragma multi_compile_fog\n@endif\n    ENDCG\n}\n\n}\n\nCustomEditor \"uShaderTemplate.MaterialEditor\"\n\n}\n```\n\nYou might have found some grammars like `@if foo`, `<Bar>`, `@block baz`,\nand these are special grammmars available in template file.\nShader variant like `#pragma multi_compile` and `#pragma shader_feature`\ncannot customize the section outside `CGPROGRAM`, but with these grammar,\nyou can customize the all parts of the shader.\n\nIf you put template files like this in *Resources > ShaderTemplates*,\nthey are automatically detected and shown in the *Shader Template* field\nin *Basic* section.\n\nGrammars in Shader Template\n---------------------------\n\n```shader\n// Condition:\n//   A toggle filed labeled \"Hoge Hoge\" will appear in Conditions section.\n//   Only when checked, the content will be output.\n@if HogeHoge\n#define HOGEHOGE\n@endif\n\n// You can use else block and give a default condition.\n@if HogeHoge2 : false\n#define HOGEHOGE2\n@else\n#define HOGEHOGE3\n@endif\n\n// Variable:\n//   The name with <> will appear in Variables section as a text field.\n//   You can give a default value with =, and =| will be pull-down list.\n#define Hoge <Hoge>\n#define Fuga <Fuga=Hoge> //\n#define Piyo <Piyo=Hoge|Fuga|Piyo>\n\n// Block:\n//    The content will be a code editor.\n//    Output shader has block like // @block ~ // @endblock and\n//    if you edit the content directly with your own editor like Vim,\n//    the result will be applied to the code editor in inspector.\n@block Moge\nfloat Moge2() { return _Move * _Moge; }\n@endblock\n```\n\nButtons\n-------\n\n![Buttons](https://raw.githubusercontent.com/wiki/hecomi/uShaderTemplate/buttons.png)\n\n* **Export(Ctrl+R)**\n  * Export shader from Generator. You can use *Ctrl + R* as a shortcut key\n    instead of pressing this button.\n* **Create Material**\n  * Create material from the generated shader.\n* **Reset to Default**\n  * Reset all parameters to the default parameters written in template.\n* **Update Template**\n  * If you edit the template file, please press this before the export.\n* **Reconvert All**\n  * Convert all generated shaders forcedly. This is useful when you edit\n    template file and want to apply the change to all shaders.\n\n\nConstants\n---------\n\n![Constants](https://raw.githubusercontent.com/wiki/hecomi/uShaderTemplate/constants.png)\n\nInstead of inputting variables in each inspector, you can use **Constants** asset\nas a shared variables among multiple Generators.\n\nSelect *Create > Shader > uShaderTemplate > Constants* and add *Name* and *Value*\npair to *Values* field of the created Constants asset. Then, drag and drop it to\nthe *Constants* field of Generators which you want to apply the parameters to.\nPlease remember that if you modify a parameter in Constants,\nyou have to *Reconvert All* to apply the change to all generated shaders.\n\nIn a shader template, you can specify the default `Constants` using `@constants` line if you want it.\n\n```shader\nShader \"Custom/<Name>\"\n{\n\n// you can insert this line anywhere in the template file.\n@constants uShaderTemplate/Constants/Custom Constants\n\nProperties\n{\n...\n```\n\n\nCallbacks\n---------\n\n`Generator` and `Constants` have virtual functions, `OnBeforeConvert()` and `OnAfterConvert()`.\nYou can create custom `Generator` and `Constants` inherited from these classes and override\nthem to add callbacks just before and after convert.\n"
  }
]