Full Code of hecomi/uShaderTemplate for AI

master 93f8e8ff750b cached
96 files
88.4 KB
25.9k tokens
90 symbols
1 requests
Download .txt
Repository: hecomi/uShaderTemplate
Branch: master
Commit: 93f8e8ff750b
Files: 96
Total size: 88.4 KB

Directory structure:
gitextract_rjpfz9kl/

├── .github/
│   └── workflows/
│       └── main.yml
├── .gitignore
├── Assets/
│   ├── uShaderTemplate/
│   │   ├── Editor/
│   │   │   ├── Resources/
│   │   │   │   ├── uShaderTemplate/
│   │   │   │   │   ├── Constants/
│   │   │   │   │   │   ├── Custom Constants.asset
│   │   │   │   │   │   ├── Custom Constants.asset.meta
│   │   │   │   │   │   ├── Default Constants.asset
│   │   │   │   │   │   └── Default Constants.asset.meta
│   │   │   │   │   ├── Constants.meta
│   │   │   │   │   ├── Fonts/
│   │   │   │   │   │   ├── LICENSE_OFL.txt
│   │   │   │   │   │   ├── LICENSE_OFL.txt.meta
│   │   │   │   │   │   └── NotoMono-Regular.ttf.meta
│   │   │   │   │   └── Fonts.meta
│   │   │   │   └── uShaderTemplate.meta
│   │   │   ├── Resources.meta
│   │   │   ├── Scripts/
│   │   │   │   ├── CodeEditor.cs
│   │   │   │   ├── CodeEditor.cs.meta
│   │   │   │   ├── ColorScheme.cs
│   │   │   │   ├── ColorScheme.cs.meta
│   │   │   │   ├── Common.cs
│   │   │   │   ├── Common.cs.meta
│   │   │   │   ├── Constants.cs
│   │   │   │   ├── Constants.cs.meta
│   │   │   │   ├── FileWatcher.cs
│   │   │   │   ├── FileWatcher.cs.meta
│   │   │   │   ├── Generator.cs
│   │   │   │   ├── Generator.cs.meta
│   │   │   │   ├── GeneratorEditor.cs
│   │   │   │   ├── GeneratorEditor.cs.meta
│   │   │   │   ├── MaterialEditor.cs
│   │   │   │   ├── MaterialEditor.cs.meta
│   │   │   │   ├── ShaderCodeEditor.cs
│   │   │   │   ├── ShaderCodeEditor.cs.meta
│   │   │   │   ├── ShaderHighlighter.cs
│   │   │   │   ├── ShaderHighlighter.cs.meta
│   │   │   │   ├── ShaderSyntax.cs
│   │   │   │   ├── ShaderSyntax.cs.meta
│   │   │   │   ├── ShaderTemplateParser.cs
│   │   │   │   ├── ShaderTemplateParser.cs.meta
│   │   │   │   ├── ShaderTemplateSelector.cs
│   │   │   │   ├── ShaderTemplateSelector.cs.meta
│   │   │   │   ├── Utils.cs
│   │   │   │   └── Utils.cs.meta
│   │   │   ├── Scripts.meta
│   │   │   ├── uShaderTemplate.Editor.asmdef
│   │   │   └── uShaderTemplate.Editor.asmdef.meta
│   │   ├── Editor.meta
│   │   ├── Examples/
│   │   │   ├── Editor/
│   │   │   │   ├── Generators/
│   │   │   │   │   ├── Surface.asset
│   │   │   │   │   ├── Surface.asset.meta
│   │   │   │   │   ├── VertFrag.asset
│   │   │   │   │   └── VertFrag.asset.meta
│   │   │   │   ├── Generators.meta
│   │   │   │   ├── Resources/
│   │   │   │   │   ├── ShaderTemplates/
│   │   │   │   │   │   ├── Examples/
│   │   │   │   │   │   │   ├── Surface.txt
│   │   │   │   │   │   │   ├── Surface.txt.meta
│   │   │   │   │   │   │   ├── VertFrag.txt
│   │   │   │   │   │   │   └── VertFrag.txt.meta
│   │   │   │   │   │   └── Examples.meta
│   │   │   │   │   └── ShaderTemplates.meta
│   │   │   │   └── Resources.meta
│   │   │   ├── Editor.meta
│   │   │   ├── Materials/
│   │   │   │   ├── Surface.mat
│   │   │   │   ├── Surface.mat.meta
│   │   │   │   ├── VertFrag.mat
│   │   │   │   └── VertFrag.mat.meta
│   │   │   ├── Materials.meta
│   │   │   ├── Shaders/
│   │   │   │   ├── Surface.shader
│   │   │   │   ├── Surface.shader.meta
│   │   │   │   ├── VertFrag.shader
│   │   │   │   └── VertFrag.shader.meta
│   │   │   └── Shaders.meta
│   │   ├── Examples.meta
│   │   ├── package.json
│   │   └── package.json.meta
│   └── uShaderTemplate.meta
├── LICENSE.md
├── Packages/
│   ├── manifest.json
│   └── packages-lock.json
├── ProjectSettings/
│   ├── AudioManager.asset
│   ├── ClusterInputManager.asset
│   ├── DynamicsManager.asset
│   ├── EditorBuildSettings.asset
│   ├── EditorSettings.asset
│   ├── GraphicsSettings.asset
│   ├── InputManager.asset
│   ├── NavMeshAreas.asset
│   ├── NetworkManager.asset
│   ├── PackageManagerSettings.asset
│   ├── Physics2DSettings.asset
│   ├── PresetManager.asset
│   ├── ProjectSettings.asset
│   ├── ProjectVersion.txt
│   ├── QualitySettings.asset
│   ├── TagManager.asset
│   ├── TimeManager.asset
│   ├── UnityConnectSettings.asset
│   ├── VFXManager.asset
│   └── VersionControlSettings.asset
└── README.md

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/workflows/main.yml
================================================
name: Create UPM branches and run NPM publish

on:
  push:
    tags:
      - v*

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Get tag name
        id: tag
        run: echo ::set-output name=name::${GITHUB_REF#refs/tags/v}

      - name: Create UPM Branch
        uses: hecomi/create-upm-branch-action@main
        with:
          git-tag: ${{ steps.tag.outputs.name }}
          pkg-root-dir-path: Assets/uShaderTemplate
          main-branch: master
          samples-dir: Examples

      - name: Setup node
        uses: actions/setup-node@v2
        with:
          registry-url: 'https://registry.npmjs.org'

      - name: NPM publish
        run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}


================================================
FILE: .gitignore
================================================
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/
.vsconfig

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*


================================================
FILE: Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants/Custom Constants.asset.meta
================================================
fileFormatVersion: 2
guid: cfee3bf03df3b40c3b654c2cfd4db724
timeCreated: 1495353467
licenseType: Pro
NativeFormatImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants/Default Constants.asset.meta
================================================
fileFormatVersion: 2
guid: 9c8b2f5a7a56c4e21bee7ca4ccfc6640
timeCreated: 1495353467
licenseType: Pro
NativeFormatImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants.meta
================================================
fileFormatVersion: 2
guid: 0808cee05a22541f1b7c328a1c052f38
folderAsset: yes
timeCreated: 1514605650
licenseType: Pro
DefaultImporter:
  externalObjects: {}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/LICENSE_OFL.txt
================================================
This Font Software is licensed under the SIL Open Font License,
Version 1.1.

This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.


================================================
FILE: Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/LICENSE_OFL.txt.meta
================================================
fileFormatVersion: 2
guid: e7f1e444a1fa94406a60546cb778466b
timeCreated: 1475660344
licenseType: Pro
TextScriptImporter:
  externalObjects: {}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/NotoMono-Regular.ttf.meta
================================================
fileFormatVersion: 2
guid: 278ecf23a382e4292b4a907449fd15f0
timeCreated: 1475660344
licenseType: Pro
TrueTypeFontImporter:
  externalObjects: {}
  serializedVersion: 4
  fontSize: 16
  forceTextureCase: -2
  characterSpacing: 0
  characterPadding: 1
  includeFontData: 1
  fontName: Noto Mono
  fontNames:
  - Noto Mono
  fallbackFontReferences:
  - {fileID: 12800000, guid: 9c8d17aeaa1c7bf47805458f830d46cb, type: 3}
  customCharacters: 
  fontRenderingMode: 0
  ascentCalculationMode: 1
  useLegacyBoundsCalculation: 0
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts.meta
================================================
fileFormatVersion: 2
guid: 30a3ca36b7ccf4deb8e21cfe35ca7fd8
folderAsset: yes
timeCreated: 1475660340
licenseType: Pro
DefaultImporter:
  externalObjects: {}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Resources/uShaderTemplate.meta
================================================
fileFormatVersion: 2
guid: 9cf019badb8c146e08ad33e26ab9e3a0
folderAsset: yes
timeCreated: 1495345278
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Resources.meta
================================================
fileFormatVersion: 2
guid: 22a5a44deb3d648c6abf24801723eca0
folderAsset: yes
timeCreated: 1495345065
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/CodeEditor.cs
================================================
using UnityEngine;
using UnityEditor;

namespace uShaderTemplate
{

public class CodeEditor
{
    public string controlName { get; set; }
    public Color backgroundColor { get; set; }
    public Color textColor { get; set; }
    public Color cursorColor { get; set; }

    string cachedCode { get; set; }
    string cachedHighlightedCode { get; set; }
    public System.Func<string, string> highlighter { get; set; }

    public bool isFocused 
    {
        get { return GUI.GetNameOfFocusedControl() == controlName; }
    }

    public CodeEditor(string controlName)
    {
        this.controlName = controlName;
        backgroundColor = Color.black;
        textColor = Color.white;
        highlighter = code => code;
    }

    public string Draw(string code, GUIStyle style, params GUILayoutOption[] options)
    {
        var preBackgroundColor = GUI.backgroundColor;
        var preColor = GUI.color;
        var preCursorColor = GUI.skin.settings.cursorColor;
        var preCursorFlashSpeed = GUI.skin.settings.cursorFlashSpeed;

        var backStyle = new GUIStyle(style);
        backStyle.normal.textColor = Color.clear;
        backStyle.hover.textColor = Color.clear;
        backStyle.active.textColor = Color.clear;
        backStyle.focused.textColor = Color.clear;

        GUI.backgroundColor = backgroundColor;
        GUI.color = textColor;
        GUI.skin.settings.cursorColor = cursorColor;
        GUI.SetNextControlName(controlName);

        // IMPORTANT: 
        // Sadly, we cannot use TextEditor with (EditorGUILayout|EditorGUI).TextArea()... X(
        // And GUILayout.TextArea() cannot handle TAB key... ;_;
        // GUI.TextArea needs a lot of tasks to implement basic functions... T_T
        var editedCode = EditorGUILayout.TextArea(code, backStyle, GUILayout.ExpandHeight(true));

        // So, this does not work...
        // var editor = GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl) as TextEditor;
        // CheckEvents(editor);

        if (editedCode != code) {
            code = editedCode;
        }

        if (string.IsNullOrEmpty(cachedHighlightedCode) || (cachedCode != code)) {
            cachedCode = code;
            cachedHighlightedCode = highlighter(code);
        }

        GUI.backgroundColor = Color.clear;
        GUI.color = textColor;
        GUI.skin.settings.cursorColor = Color.clear;

        var foreStyle = new GUIStyle(style);
        foreStyle.richText = true;
        foreStyle.normal.textColor = textColor;
        foreStyle.hover.textColor = textColor;
        foreStyle.active.textColor = textColor;
        foreStyle.focused.textColor = textColor;

        EditorGUI.TextArea(GUILayoutUtility.GetLastRect(), cachedHighlightedCode, foreStyle);

        GUI.backgroundColor = preBackgroundColor;
        GUI.color = preColor;
        GUI.skin.settings.cursorColor = preCursorColor;

        return code;
    }

    void CheckEvents(TextEditor editor)
    {
        // ...
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/CodeEditor.cs.meta
================================================
fileFormatVersion: 2
guid: 62d234cb567694d2789ade8d5cab6a89
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ColorScheme.cs
================================================
namespace uShaderTemplate
{

namespace ColorScheme
{
    // http://ethanschoonover.com/solarized
    public static class Solarized
    {
        public const string base03  = "#002b36";
        public const string base02  = "#073642";
        public const string base01  = "#586e75";
        public const string base00  = "#657b83";
        public const string base0   = "#839496";
        public const string base1   = "#93a1a1";
        public const string base2   = "#eee8d5";
        public const string base3   = "#fdf6e3";
        public const string yellow  = "#b58900";
        public const string orange  = "#cb4b16";
        public const string red     = "#dc322f";
        public const string magenta = "#d33682";
        public const string violet  = "#6c71c4";
        public const string blue    = "#268bd2";
        public const string cyan    = "#2aa198";
        public const string green   = "#859900";
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ColorScheme.cs.meta
================================================
fileFormatVersion: 2
guid: 9cb8608d376b04cab8df8562d02cca44
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/Common.cs
================================================
using uShaderTemplate.ColorScheme;

namespace uShaderTemplate
{

namespace Common
{

public static class Color
{ 
    public const string background = Solarized.base03;
    public const string color = "#ffffff";
    public const string cursorColor = "#ffffff";
    public const string type = Solarized.yellow;
    public const string keyword = Solarized.green;
    public const string symbol = Solarized.base1;
    public const string digit = Solarized.violet;
    public const string str = Solarized.violet;
    public const string comment = Solarized.base01;
    public const string cgprogram = Solarized.blue;
    public const string unity = Solarized.magenta;
    public const string user1 = Solarized.orange;
    public const string user2 = Solarized.cyan;
}

public static class Editor
{
    public const string font = "uShaderTemplate/Font/NotoMono-regular";
    public const int fontSize = 12;
    public const bool wordWrap = false;
    public const int height = 200;
}

public static class Setting
{
    public const int menuOrder = 1000;
    public const string menuPlace = "Shader/uShaderTemplate/";
    public const string defaultConstants = "uShaderTemplate/Constants/Default Constants";
    public const string templateDirectoryPath = "ShaderTemplates";
    public const string templateFileExtension = ".txt";
}

}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/Common.cs.meta
================================================
fileFormatVersion: 2
guid: 4a29e724630f4487cb646107886e433f
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/Constants.cs
================================================
using UnityEngine;

namespace uShaderTemplate
{

[System.Serializable]
public struct Constant
{
    public string name;
    public string value;
}

[CreateAssetMenu(
    menuName = Common.Setting.menuPlace + "Constants", 
    order = Common.Setting.menuOrder + 1)]
public class Constants : ScriptableObject
{
    public Constant[] values;
    public virtual void OnBeforeConvert() {}
    public virtual void OnAfterConvert() {}
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/Constants.cs.meta
================================================
fileFormatVersion: 2
guid: 0b69f41837370415ab1f75789505044f
timeCreated: 1495353387
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/FileWatcher.cs
================================================
using System.IO;
using UnityEngine.Events;

namespace uShaderTemplate
{

public class FileWatcher
{
    FileSystemWatcher watcher_;
    bool hasChanged_ = false;
    FileSystemEventHandler onChangedHandler_;
    RenamedEventHandler onRenamedHandler_;

    public UnityEvent onChanged = new UnityEvent();

    public void Start(string path)
    {
        watcher_ = new System.IO.FileSystemWatcher();
        watcher_.Path = Path.GetDirectoryName(path);
        watcher_.NotifyFilter = 
            NotifyFilters.LastAccess | 
            NotifyFilters.LastWrite |
            NotifyFilters.FileName | 
            NotifyFilters.DirectoryName;
        watcher_.Filter = Path.GetFileName(path);

        onChangedHandler_ = new FileSystemEventHandler(OnChanged);
        onRenamedHandler_ = new RenamedEventHandler(OnRenamed);
        watcher_.Changed += onChangedHandler_;
        watcher_.Created += onChangedHandler_;
        watcher_.Deleted += onChangedHandler_;
        watcher_.Renamed += onRenamedHandler_;

        watcher_.EnableRaisingEvents = true;
    }

    public void Stop()
    {
        if (watcher_ != null) {
            watcher_.EnableRaisingEvents = false;
            watcher_.Changed -= onChangedHandler_;
            watcher_.Created -= onChangedHandler_;
            watcher_.Deleted -= onChangedHandler_;
            watcher_.Renamed -= onRenamedHandler_;
        }
    }

    public void Update()
    {
        if (hasChanged_) {
            hasChanged_ = false;
            onChanged.Invoke();
        }
    }

    void OnChanged(object source, FileSystemEventArgs e)
    {
        hasChanged_ = true;
    }

    void OnRenamed(object source, RenamedEventArgs e)
    {
        hasChanged_ = true;
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/FileWatcher.cs.meta
================================================
fileFormatVersion: 2
guid: fc635ea546c084c8291db4721c1d416a
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/Generator.cs
================================================
using UnityEngine;
using System.Collections.Generic;

namespace uShaderTemplate
{

[System.Serializable]
public struct ShaderVariables
{
    public string key;
    public string value;
}

[System.Serializable]
public struct ShaderCondition
{
    public string key;
    public bool value;
}

[System.Serializable]
public struct ShaderBlock
{
    public string key;
    public string value;
    public bool folded;
}

[CreateAssetMenu(
    menuName = Common.Setting.menuPlace + "Generator", 
    order = Common.Setting.menuOrder)]
public class Generator : ScriptableObject
{
    public string shaderName = "";
    public Shader shaderReference = null;
    public string shaderTemplate = "";

    public List<ShaderVariables> variables = new List<ShaderVariables>();
    public List<ShaderCondition> conditions = new List<ShaderCondition>();
    public List<ShaderBlock> blocks = new List<ShaderBlock>();
    public Constants constants;

    public bool basicFolded = true;
    public bool conditionsFolded = false;
    public bool variablesFolded = false;
    public bool materialsFolded = false;
    public bool constantsFolded = false;

    public virtual void OnBeforeConvert() {}
    public virtual void OnAfterConvert() {}
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/Generator.cs.meta
================================================
fileFormatVersion: 2
guid: 3acd6fe57257048db802c1c4c2b75248
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/GeneratorEditor.cs
================================================
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
using System.IO;

namespace uShaderTemplate
{

[CustomEditor(typeof(Generator))]
public class GeneratorEditor : Editor
{
    SerializedProperty name_;
    SerializedProperty shader_;

    SerializedProperty basicFolded_;
    SerializedProperty materialsFolded_;

    SerializedProperty conditions_;
    SerializedProperty conditionsFolded_;

    SerializedProperty variables_;
    SerializedProperty variablesFolded_;

    SerializedProperty constants_;
    SerializedProperty constantsFolded_;

    SerializedProperty blocks_;
    Dictionary<string, ShaderCodeEditor> editors_ = new Dictionary<string, ShaderCodeEditor>();

    ShaderTemplateSelector template_;
    ShaderTemplateParser templateParser_;

    FileWatcher watcher_ = new FileWatcher();

    string errorMessage_;

    Dictionary<string, Func<string, string>> toConstFuncs_;
    bool constVarsFolded_ = false;

    bool hasShaderReference
    {
        get { return shader_.objectReferenceValue != null; }
    }

    void OnEnable()
    {
        name_ = serializedObject.FindProperty("shaderName");
        shader_ = serializedObject.FindProperty("shaderReference");
        variables_ = serializedObject.FindProperty("variables");
        variablesFolded_ = serializedObject.FindProperty("variablesFolded");
        conditions_ = serializedObject.FindProperty("conditions");
        conditionsFolded_ = serializedObject.FindProperty("conditionsFolded");
        blocks_ = serializedObject.FindProperty("blocks");
        basicFolded_ = serializedObject.FindProperty("basicFolded");
        materialsFolded_ = serializedObject.FindProperty("materialsFolded");
        constants_ = serializedObject.FindProperty("constants");
        constantsFolded_ = serializedObject.FindProperty("constantsFolded");

        template_ = new ShaderTemplateSelector(serializedObject.FindProperty("shaderTemplate"));
        template_.onChange.AddListener(OnTemplateChanged);

        watcher_.onChanged.AddListener(CheckShaderUpdate);
        if (hasShaderReference) {
            watcher_.Start(GetShaderPath());
        }

        CheckShaderUpdate();
    }

    void OnDisable()
    {
        if (template_ != null) {
            template_.onChange.RemoveListener(OnTemplateChanged);
        }
        if (watcher_ != null) {
            watcher_.Stop();
            watcher_.onChanged.RemoveListener(CheckShaderUpdate);
        }
    }

    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        watcher_.Update();

        HandleKeyEvents();

        if (templateParser_ == null) {
            OnTemplateChanged();
        }

        DrawBasics();
        DrawConditions();
        DrawVariables();
        DrawBlocks();
        DrawConstants();
        DrawMaterialReferences();

        EditorGUILayout.Separator();

        DrawButtons();
        DrawMessages();

        EditorGUILayout.Separator();

        serializedObject.ApplyModifiedProperties();
    }

    SerializedProperty FindProperty(SerializedProperty array, string key, string keyName = "key")
    {
        for (int i = 0; i < array.arraySize; ++i) {
            var prop = array.GetArrayElementAtIndex(i);
            var keyProp = prop.FindPropertyRelative(keyName);
            if (keyProp.stringValue == key) {
                return prop;
            }
        }
        return null;
    }

    SerializedProperty AddProperty(SerializedProperty array, string key)
    {
        var prop = FindProperty(array, key);
        if (prop != null) return prop;

        var index = array.arraySize;
        array.InsertArrayElementAtIndex(index);
        return array.GetArrayElementAtIndex(index);
    }

    void DrawBasics()
    {
        basicFolded_.boolValue = Utils.Foldout("Basic", basicFolded_.boolValue);
        if (basicFolded_.boolValue) {
            ++EditorGUI.indentLevel;
            EditorGUILayout.PropertyField(name_);
            EditorGUILayout.PropertyField(shader_);
            template_.Draw();
            --EditorGUI.indentLevel;
        }
    }

    void DrawConditions()
    {
        if (templateParser_.conditions.Count == 0) {
            return;
        }

        conditionsFolded_.boolValue = Utils.Foldout("Conditions", conditionsFolded_.boolValue);
        if (!conditionsFolded_.boolValue) return;

        ++EditorGUI.indentLevel;

        foreach (var kv in templateParser_.conditions) {
            var prop = FindProperty(conditions_, kv.Key);
            var value = prop.FindPropertyRelative("value");
            var name = Utils.ToSpacedCamel(kv.Key);

            var isSelected = EditorGUILayout.Toggle(name, value.boolValue);
            if (value.boolValue != isSelected) {
                value.boolValue = isSelected;
            }
        }

        --EditorGUI.indentLevel;
    }

    void DrawBlocks()
    {
        foreach (var kv in templateParser_.blocks) {
            var prop = FindProperty(blocks_, kv.Key);
            var value = prop.FindPropertyRelative("value");
            var folded = prop.FindPropertyRelative("folded");

            var name = Utils.ToSpacedCamel(kv.Key);
            ShaderCodeEditor editor = null;

            if (editors_.ContainsKey(name)) {
                editor = editors_[name];
            } else {
                editor = new ShaderCodeEditor(name, value, folded);
                editors_.Add(name, editor);
            }

            editor.Draw();
        }
    }

    void DrawVariables()
    {
        if (templateParser_.variables.Count == 0) {
            return;
        }

        variablesFolded_.boolValue = Utils.Foldout("Variables", variablesFolded_.boolValue);
        if (!variablesFolded_.boolValue) return;

        ++EditorGUI.indentLevel;

        var constVars = new Dictionary<string, string>();

        foreach (var kv in templateParser_.variables) {
            var prop = FindProperty(variables_, kv.Key);
            if (prop == null) continue;
            var value = prop.FindPropertyRelative("value");

            var name = Utils.ToSpacedCamel(kv.Key);
            var constValue = ToConstVariable(kv.Key);
            string changedValue;

            if (constValue != null) {
                changedValue = constValue;
                constVars.Add(name, constValue);
            } else {
                if (kv.Value.Count <= 1) {
                    changedValue = EditorGUILayout.TextField(name, value.stringValue);
                } else {
                    var index = kv.Value.IndexOf(value.stringValue);
                    if (index == -1) index = 0;
                    index = EditorGUILayout.Popup(name, index, kv.Value.ToArray());
                    changedValue = kv.Value[index];
                }
            }

            if (value.stringValue != changedValue) {
                value.stringValue = changedValue;
            }
        }

        if (constVars.Count > 0) {
            constVarsFolded_ = EditorGUILayout.Foldout(constVarsFolded_, "Constants");
            if (constVarsFolded_) {
                ++EditorGUI.indentLevel;
                foreach (var kv in constVars) {
                    Utils.ReadOnlyTextField(kv.Key, kv.Value);
                }
                --EditorGUI.indentLevel;
            }
        }

        --EditorGUI.indentLevel;
    }

    void DrawConstants()
    {
        constantsFolded_.boolValue = Utils.Foldout("Constants", constantsFolded_.boolValue);
        if (!constantsFolded_.boolValue) return;

        ++EditorGUI.indentLevel;
        EditorGUILayout.BeginHorizontal(); 
        {
            EditorGUILayout.PropertyField(constants_);
            if (templateParser_ != null && templateParser_.constants) {
                var style = new GUIStyle(EditorStyles.miniButtonLeft);
                style.fixedWidth = 64;
                if (GUILayout.Button("Use Default", style)) {
                    constants_.objectReferenceValue = templateParser_.constants;
                }
            }
        } 
        EditorGUILayout.EndHorizontal();
        --EditorGUI.indentLevel;
    }

    void DrawMaterialReferences()
    {
        materialsFolded_.boolValue = Utils.Foldout("Material References", materialsFolded_.boolValue);
        if (!materialsFolded_.boolValue) return;

        ++EditorGUI.indentLevel;
        var materials = Utils.FindMaterialsUsingShader(shader_.objectReferenceValue as Shader);
        if (materials.Count > 0) {
            foreach (var material in materials) {
                EditorGUILayout.ObjectField(material, typeof(Material), false);
            }
        } else {
            EditorGUILayout.LabelField("No material using this shader.");
        }
        --EditorGUI.indentLevel;
    }

    void DrawButtons()
    {
        EditorGUILayout.BeginHorizontal();
        {
            var buttonFontSize = GUI.skin.label.fontSize;
            var buttonPadding = new RectOffset(12, 12, 6, 6);

            GUILayout.FlexibleSpace();
            var style = new GUIStyle(EditorStyles.miniButtonLeft);
            style.fontSize = buttonFontSize;
            style.padding = buttonPadding;
            if (GUILayout.Button("Export (Ctrl+R)", style)) {
                ExportShaderWithErrorCheck();
            }

            style = new GUIStyle(EditorStyles.miniButtonMid);
            style.fontSize = buttonFontSize;
            style.padding = buttonPadding;
            if (GUILayout.Button("Create Material", style)) {
                CreateMaterial();
            }

            style = new GUIStyle(EditorStyles.miniButtonMid);
            style.fontSize = buttonFontSize;
            style.padding = buttonPadding;
            if (GUILayout.Button("Reset to Default", style)) {
                ResetToDefault();
            }

            style = new GUIStyle(EditorStyles.miniButtonMid);
            style.fontSize = buttonFontSize;
            style.padding = buttonPadding;
            if (GUILayout.Button("Update Template", style)) {
                OnTemplateChanged();
            }

            style = new GUIStyle(EditorStyles.miniButtonRight);
            style.fontSize = buttonFontSize;
            style.padding = buttonPadding;
            if (GUILayout.Button("Reconvert All", style)) {
                ReconvertAll();
            }
        }
        EditorGUILayout.EndHorizontal();
    }

    void DrawMessages()
    {
        if (!string.IsNullOrEmpty(errorMessage_)) {
            EditorGUILayout.HelpBox(errorMessage_, MessageType.Error, true);
        }
    }

    string ToConstVariable(string name)
    {
        if (name == "Name") {
            return name_.stringValue;
        } else if (constants_ != null) {
            var constants = (Constants)constants_.objectReferenceValue;
            foreach (var kv in constants.values) {
                if (kv.name == name) return kv.value;
            }
        }
        return null;
    }

    void OnTemplateChanged()
    {
        templateParser_ = new ShaderTemplateParser(template_.text);

        constants_.objectReferenceValue = 
            templateParser_.constants ??
            Resources.Load<Constants>(Common.Setting.defaultConstants);

        foreach (var kv in templateParser_.conditions) {
            if (FindProperty(conditions_, kv.Key) != null) continue;
            var prop = AddProperty(conditions_, kv.Key);
            prop.FindPropertyRelative("key").stringValue = kv.Key;
            prop.FindPropertyRelative("value").boolValue = kv.Value;
        }

        foreach (var kv in templateParser_.blocks) {
            if (FindProperty(blocks_, kv.Key) != null) continue;
            var prop = AddProperty(blocks_, kv.Key);
            prop.FindPropertyRelative("key").stringValue = kv.Key;
            prop.FindPropertyRelative("value").stringValue = kv.Value;
            prop.FindPropertyRelative("folded").boolValue = false;
        }

        foreach (var kv in templateParser_.variables) {
            if (FindProperty(variables_, kv.Key) != null) continue;
            var prop = AddProperty(variables_, kv.Key);
            var hasDefaultValue = (kv.Value.Count >= 1);
            prop.FindPropertyRelative("key").stringValue = kv.Key;
            prop.FindPropertyRelative("value").stringValue = hasDefaultValue ? kv.Value[0] : "";
        }
    }

    string GetShaderName()
    {
        var name = name_.stringValue;
        if (string.IsNullOrEmpty(name)) {
            throw new System.Exception(string.Format("Shader name of \"{0}\" is empty.", target.name));
        }
        return name_.stringValue;
    }

    string GetOutputDirPath()
    {
        if (hasShaderReference) {
            return Path.GetDirectoryName(AssetDatabase.GetAssetPath(shader_.objectReferenceValue));
        }
        return Path.GetDirectoryName(AssetDatabase.GetAssetPath(target));
    }

    string GetShaderPath()
    {
        return string.Format("{0}/{1}.shader", GetOutputDirPath(), GetShaderName());
    }

    void ReImport()
    {
        var outputPath = GetShaderPath();
        AssetDatabase.ImportAsset(outputPath);
        shader_.objectReferenceValue = AssetDatabase.LoadAssetAtPath<Shader>(outputPath);
    }

    void ExportShader()
    {
        var info = new ShaderTemplateConvertInfo();

        foreach (var kv in templateParser_.conditions) {
            var prop = FindProperty(conditions_, kv.Key);
            var value = prop.FindPropertyRelative("value");
            info.conditions.Add(kv.Key, value.boolValue);
        }

        foreach (var kv in templateParser_.blocks) {
            var prop = FindProperty(blocks_, kv.Key);
            var value = prop.FindPropertyRelative("value");
            info.blocks.Add(kv.Key, value.stringValue);
        }

        foreach (var kv in templateParser_.variables) {
            var prop = FindProperty(variables_, kv.Key);
            var value = prop.FindPropertyRelative("value");
            var constValue = ToConstVariable(kv.Key);
            if (constValue != null) {
                value.stringValue = constValue;
            }
            info.variables.Add(kv.Key, value.stringValue);
        }

        var code = templateParser_.Convert(info);

        // rename if generator has a shader reference.
        if (hasShaderReference) {
            var shaderFilePath = AssetDatabase.GetAssetPath(shader_.objectReferenceValue);
            var shaderFileName = Path.GetFileNameWithoutExtension(shaderFilePath);
            var newFilePath = GetShaderPath();

            if (GetShaderName() != shaderFileName) {
                if (File.Exists(newFilePath)) {
                    throw new System.Exception(
                        string.Format("attempted to rename {0} to {1}, but target file existed.",
                            shaderFilePath, newFilePath));
                }
                AssetDatabase.RenameAsset(shaderFilePath, GetShaderName());
            }
        }

        using (var writer = new StreamWriter(GetShaderPath())) {
            writer.Write(code);
        }

        ReImport();

        if (hasShaderReference) {
            watcher_.Start(GetShaderPath());
        }
    }

    void ExportShaderWithErrorCheck()
    {
        ClearError();

        var generator = target as Generator;
        generator.OnBeforeConvert();

        try {
            ExportShader();
        } catch (Exception e) {
            AddError(e.Message);
        }

        generator.OnAfterConvert();
    }

    void ResetToDefault()
    {
        blocks_.ClearArray();
        conditions_.ClearArray();
        variables_.ClearArray();
        OnTemplateChanged();
    }

    public void Reconvert()
    {
        CheckShaderUpdate();
        OnTemplateChanged();
        ExportShaderWithErrorCheck();
    }

    void ReconvertAll()
    {
        Debug.LogFormat("<color=blue>Reconvert started.\n------------------------------</color>"); 
        var generators = Utils.FindAllAssets<Generator>();
        foreach (var generator in generators) {
            try {
                if (target == generator) {
                    Debug.LogFormat("<color=green>{0}</color>", GetShaderPath());
                    Reconvert();
                } else {
                    var editor = Editor.CreateEditor(generator) as GeneratorEditor;
                    Debug.LogFormat("<color=green>{0}</color>", editor.GetShaderPath());
                    editor.Reconvert();
                }
            } catch (System.Exception e) {
                Debug.LogFormat("<color=red>Error: " + e.Message + "</color>"); 
            }
        }
        Debug.LogFormat("<color=blue>------------------------------\nReconvert finished.</color>"); 
    }

    void CheckShaderUpdate()
    {
        if (!hasShaderReference) return;

        ClearError();
        try {
            var shaderPath = GetShaderPath();
            using (var reader = new StreamReader(shaderPath)) {
                var code = reader.ReadToEnd();
                var parser = new ShaderTemplateParser(code);
                foreach (var kv in parser.blocks) {
                    var prop = FindProperty(blocks_, kv.Key);
                    if (prop != null) {
                        var value = prop.FindPropertyRelative("value");
                        value.stringValue = kv.Value;
                    }
                }
            }
        } catch (System.Exception e) {
            AddError(e.Message);
        }
    }

    void CreateMaterial()
    {
        var material = new Material(shader_.objectReferenceValue as Shader);
        var path = string.Format("{0}/{1}.mat", GetOutputDirPath(), GetShaderName());
        ProjectWindowUtil.CreateAsset(material, path);
    }

    void HandleKeyEvents()
    {
        var e = Event.current;
        var isKeyPressing = e.type == EventType.KeyUp;
        if (isKeyPressing && e.control && e.keyCode == KeyCode.R) {
            ExportShaderWithErrorCheck();
        }
    }

    void ClearError()
    {
        errorMessage_ = "";
    }

    void AddError(string error)
    {
        if (!string.IsNullOrEmpty(errorMessage_)) {
            errorMessage_ += "\n";
        }
        errorMessage_ += error;
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/GeneratorEditor.cs.meta
================================================
fileFormatVersion: 2
guid: f0e7677688d9d41f385006d35eb6ce88
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/MaterialEditor.cs
================================================
using UnityEngine;
using UnityEditor;

namespace uShaderTemplate
{

public class MaterialEditor : ShaderGUI
{
    bool folded_ = true;
    Editor cachedEditor_;

    override public void OnGUI(
        UnityEditor.MaterialEditor materialEditor, 
        MaterialProperty[] properties)
	{
        if (!cachedEditor_) {
            var material = materialEditor.target as Material;
            var shader = material.shader;
            var generators = Utils.FindAllAssets<Generator>();
            Generator targetGenerator = null;
            foreach (var generator in generators) {
                if (generator.shaderReference == shader) {
                    targetGenerator = generator;
                    break;
                }
            }
            if (targetGenerator) {
                cachedEditor_ = Editor.CreateEditor(targetGenerator);
            }
        }

        if (cachedEditor_) {
            cachedEditor_.OnInspectorGUI();
            EditorGUILayout.Separator();
        }

        folded_ = Utils.Foldout("Material Properties", folded_);
        if (folded_) {
            ++EditorGUI.indentLevel;
            base.OnGUI(materialEditor, properties);
            --EditorGUI.indentLevel;
        }
	}
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/MaterialEditor.cs.meta
================================================
fileFormatVersion: 2
guid: b2fe1cb944fe14609899b7870ce5e639
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderCodeEditor.cs
================================================
using UnityEngine;
using UnityEditor;

namespace uShaderTemplate
{

public class ShaderCodeEditor
{
    public string name { get; private set; }
    public SerializedProperty value { get; private set; }
    public SerializedProperty folded { get; private set; }

    CodeEditor editor_;
    Vector2 scrollPos_;
    Font font_;

    public string code
    {
        get { return value != null ? value.stringValue : ""; }
        private set { this.value.stringValue = value; }
    }

    public ShaderCodeEditor(string name, SerializedProperty value, SerializedProperty folded)
    {
        this.name = name;
        this.value = value;
        this.folded = folded;

        font_ = Resources.Load<Font>(Common.Editor.font);

        Color color, bgColor, cursorColor;
        ColorUtility.TryParseHtmlString(Common.Color.background, out bgColor);
        ColorUtility.TryParseHtmlString(Common.Color.color, out color);
        ColorUtility.TryParseHtmlString(Common.Color.cursorColor, out cursorColor);

        editor_ = new CodeEditor(name);
        editor_.backgroundColor = bgColor;
        editor_.textColor = color;
        editor_.cursorColor = cursorColor;
        editor_.highlighter = ShaderHighlighter.Highlight;
    }

    public void Draw()
    {
        var preFolded = folded.boolValue;
        folded.boolValue = Utils.Foldout(name, folded.boolValue);

        if (!folded.boolValue) {
            if (preFolded) {
                GUI.FocusControl("");
            }
            return;
        }

        if (!preFolded) {
            GUI.FocusControl(name);
        }

        var height = GUILayout.Height(Common.Editor.height);
        scrollPos_ = EditorGUILayout.BeginScrollView(scrollPos_, height);
        {
            var style = new GUIStyle(GUI.skin.textArea);
            style.padding = new RectOffset(6, 6, 6, 6);
            style.font = font_;
            style.fontSize = Common.Editor.fontSize;
            style.wordWrap = Common.Editor.wordWrap;

            var editedCode = editor_.Draw(code, style, GUILayout.ExpandHeight(true));
            if (editedCode != code) {
                code = editedCode;
            }
        }
        EditorGUILayout.EndScrollView();

        EditorGUILayout.Space();
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderCodeEditor.cs.meta
================================================
fileFormatVersion: 2
guid: 79cc0d829733b429c9476e482f714b82
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderHighlighter.cs
================================================
using System.Text.RegularExpressions;
using System.Collections.Generic;

namespace uShaderTemplate
{

public static class ShaderHighlighter
{
    static Regex regex;
    static MatchEvaluator evaluator;
    static Dictionary<string, string> colorTable = new Dictionary<string, string> {
        { "symbol",      Common.Color.symbol },
        { "digit",       Common.Color.digit },
        { "str",         Common.Color.str },
        { "comment",     Common.Color.comment },
        { "type",        Common.Color.type },
        { "keyword",     Common.Color.keyword },
        { "cgprogram",   Common.Color.cgprogram },
        { "user1",       Common.Color.user1 },
        { "user2",       Common.Color.user2 },
        { "unity",       Common.Color.unity },
    };

    static string ToColoredCode(string code, string color)
    {
        return "<color=" + color + ">" + code + "</color>";
    }

    [UnityEditor.InitializeOnLoadMethod]
    static void Init()
    {
        var forwardSeparator = "(?<![0-9a-zA-Z_])";
        var backwardSeparator = "(?![0-9a-zA-Z_])";
        var pattern1 = "(?<{0}>({1}))";
        var pattern2 = string.Format("(?<{0}>{2}({1}){3})", "{0}", "{1}", forwardSeparator, backwardSeparator);

        var patterns = new string[] { 
            string.Format(pattern1, "comment", string.Join("|", ShaderSyntax.comment)),
            string.Format(pattern2, "type", string.Join("|", ShaderSyntax.type)),
            string.Format(pattern2, "keyword", string.Join("|", ShaderSyntax.keyword)),
            string.Format(pattern2, "user1", string.Join("|", ShaderSyntax.user1)),
            string.Format(pattern2, "user2", string.Join("|", ShaderSyntax.user2)),
            string.Format(pattern2, "cgprogram", string.Join("|", ShaderSyntax.cgprogram)),
            string.Format(pattern2, "unity", string.Join("|", ShaderSyntax.unity)),
            string.Format(pattern1, "str", string.Join("|", ShaderSyntax.str)),
            string.Format(pattern1, "digit", string.Join("|", ShaderSyntax.digit)),
            string.Format(pattern1, "symbol", string.Join("|", ShaderSyntax.symbol)),
        };
        var combinedPattern = "(" + string.Join("|", patterns) + ")";

        regex = new Regex(combinedPattern, RegexOptions.Compiled);

        evaluator = new MatchEvaluator(match => { 
            foreach (var pair in colorTable) {
                if (match.Groups[pair.Key].Success) {
                    return ToColoredCode(match.Value, pair.Value);
                }
            }
            return match.Value;
        });
    }

    public static string Highlight(string code)
    {
        return regex.Replace(code, evaluator);
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderHighlighter.cs.meta
================================================
fileFormatVersion: 2
guid: 5ac75baca8c8f4d35b934f94decfb6b6
timeCreated: 1495351861
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderSyntax.cs
================================================
using System.Text.RegularExpressions;
using System.Collections.Generic;

namespace uShaderTemplate
{

public static class ShaderSyntax
{
    public static readonly string[] type = new string[] {
        "void",
        "fixed",
        "fixed[1-4]",
        "fixed[1-4]x[1-4]",
        "half",
        "half[1-4]",
        "half[1-4]x[1-4]",
        "float",
        "float[1-4]",
        "float[1-4]x[1-4]",
    };

    public static readonly string[] keyword = new string[] {
        "#include",
        "#define",
        "return",
        "out",
        "inout",
        "inline",
    };

    public static readonly string[] symbol = new string[] {
        @"[{}()=;,+\-*/<>|]+",
    };

    public static readonly string[] digit = new string[] {
        @"(?<![a-zz_Z_])[+-]?[0-9]+\.?[0-9]?(([eE][+-]?)?[0-9]+)?"
    };

    public static readonly string[] str = new string[] {
        "(\"[^\"\\n]*?\")"
    };

    public static readonly string[] comment = new string[] {
        @"/\*[\s\S]*?\*/|//.*"
    };

    public static readonly string[] cgprogram = new string[] {
        "abs",
        "acos",
        "all",
        "any",
        "asin",
        "atan",
        "atan2",
        "bitCount",
        "bitfieldExtract",
        "bitfieldInsert",
        "bitfieldReverse",
        "ceil",
        "clamp",
        "clip",
        "cos",
        "cosh",
        "cross",
        "ddx",
        "ddy",
        "degrees",
        "determinant",
        "distance",
        "dot",
        "exp",
        "exp2",
        "faceforward",
        "findLSB",
        "findMSB",
        "floatToIntBits",
        "floatToRawIntBits",
        "floor",
        "fmod",
        "frac",
        "frexp",
        "fwidth",
        "intBitsToFloat",
        "inverse",
        "isfinite",
        "isinf",
        "isnan",
        "ldexp",
        "length",
        "lerp",
        "lit",
        "log",
        "log10",
        "log2",
        "max",
        "min",
        "modf",
        "mul",
        "normalize",
        "pack",
        "pow",
        "radians",
        "reflect",
        "refract",
        "round",
        "rsqrt",
        "saturate",
        "sign",
        "sin",
        "sincos",
        "sinh",
        "smoothstep",
        "sqrt",
        "step",
        "tan",
        "tanh",
        "tex1D",
        "tex2D",
        "tex3D",
        "transpose",
        "trunc",
        "unpack",
    };

    public static readonly string[] unity = new string[] {
        "UNITY_MATRIX_MVP",
        "UNITY_MATRIX_MV",
        "UNITY_MATRIX_V",
        "UNITY_MATRIX_P",
        "UNITY_MATRIX_VP",
        "UNITY_MATRIX_T_MV",
        "UNITY_MATRIX_IT_MV",
        "unity_ObjectToWorld",
        "unity_WorldToObject",
        "_WorldSpaceCameraPos",
        "_ProjectionParams",
        "_ScreenParams",
        "_ZBufferParams",
        "unity_OrthoParams",
        "unity_CameraProjection",
        "unity_CameraInvProjection",
        "unity_CameraWorldClipPlanes",
        "_Time",
        "_SinTime",
        "_CosTime",
        "unity_DeltaTime",
        "_LightColor0",
        "_WorldSpaceLightPos0",
        "_LightMatrix0",
        "unity_4LightPosX0",
        "unity_4LightAtten0",
        "unity_LightColor",
        "_LightColor",
        "_LightMatrix0",
        "unity_LightColor",
        "unity_LightPosition",
        "unity_LightAtten",
        "unity_SpotDirection",
        "unity_AmbientSky",
        "unity_AmbientEquator",
        "unity_AmbientGround",
        "UNITY_LIGHTMODEL_AMBIENT",
        "unity_FogColor",
        "unity_FogParams",
        "unity_LODFade",
    };

    public static readonly string[] user1 = new string[] {
        "DistanceFunction",
        "PostEffect",
    };

    public static readonly string[] user2 = new string[] {
        "Rand",
        "Mod",
        "SmoothMin",
        "Repeat",
        "Rotate",
        "TwistX",
        "TwistY",
        "TwistZ",
        "ToLocal",
        "ToWorld",
        "GetDepth",
        "Sphere",
        "RoundBox",
        "Box",
        "Torus",
        "Plane",
        "Cylinder",
        "HexagonalPrismX",
        "HexagonalPrismY",
        "HexagonalPrismZ",
        "PI",
        "_Scale",
    };
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderSyntax.cs.meta
================================================
fileFormatVersion: 2
guid: fe815b6c248854d5aa4ddbff23ab32c6
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateParser.cs
================================================
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace uShaderTemplate
{

public class ShaderTemplateConvertInfo
{
    public Dictionary<string, bool> conditions = new Dictionary<string, bool>();
    public Dictionary<string, string> blocks = new Dictionary<string, string>();
    public Dictionary<string, string> variables = new Dictionary<string, string>();
}

public class ShaderTemplateParser
{
    static readonly string conditionPattern = 
        @"@if\s*(?<Cond>[^:\s\n]+)(?:\s*:\s*)?(?<Init>[^\s\n]+)?\s*\n" + 
        @"(?<TrueValue>[^@]*?)" + 
        @"((\s*@else\s*)\n" +
        @"(?<FalseValue>[^@]*?))?" + 
        @"\n\s*@endif";
    static readonly string blockPattern = 
        @"@block\s*(?<Block>[^\s\n]+)\s*\n" +
        @"(?<Value>[\s\S]*?)" +
        @"\n\s*(:?//\s*)*?@endblock";
    static readonly string variablePattern = 
        @"<(?<Name>[^=\s\n]+)(?:\s*=\s*(?<Value>[^\s\n|>]+)(\s*\|\s*(?<Value>[^\s\n|>]+))*)?\s*>";
    static readonly string constantsPattern =
        @"@constants\s*(?<Path>[^\n]+)";

    public string code { get; set; }

    public Dictionary<string, bool> conditions { get; private set; }
    public Dictionary<string, string> blocks { get; private set; }
    public Dictionary<string, List<string>> variables { get; private set; }
    public Constants constants { get; private set; }

    public ShaderTemplateParser(string code)
    {
        this.code = code;
        conditions = new Dictionary<string, bool>();
        blocks = new Dictionary<string, string>();
        variables = new Dictionary<string, List<string>>();
        Parse();
    }

    void Parse()
    {
        ParseConstants();
        ParseConditions();
        ParseBlocks();
        ParseVariables();
    }

    public string Convert(ShaderTemplateConvertInfo info)
    {
        if (constants != null) {
            constants.OnBeforeConvert();
        }

        var code = this.code;
        code = WriteConstants(code);
        code = WriteConditions(code, info);
        code = WriteBlocks(code, info);
        code = WriteVariables(code, info);
        code = code.Replace("\r\n", "\n");
        var regex = new Regex(@"\n\n\n+");
        code = regex.Replace(code, "\n\n");

        if (constants != null) {
            constants.OnAfterConvert();
        }

        return code;
    }

    void ParseConstants()
    {
        var regex = new Regex(constantsPattern);
        var matches = regex.Matches(code);
        if (matches.Count > 0) {
            var path = matches[0].Groups["Path"].Value;
            constants = UnityEngine.Resources.Load<Constants>(path);
        }
    }

    string WriteConstants(string code)
    {
        var regex = new Regex(constantsPattern);
        var evaluator = new MatchEvaluator(match => "");
        return regex.Replace(code, evaluator);
    }

    void ParseConditions()
    {
        conditions.Clear();

        var regex = new Regex(conditionPattern);
        var matches = regex.Matches(code);
        foreach (Match match in matches) {
            var cond = match.Groups["Cond"].Value;
            if (conditions.ContainsKey(cond)) continue;
            bool init = false;
            if (match.Groups["Init"].Success) {
                init = bool.Parse(match.Groups["Init"].Value);
            }
            conditions.Add(cond, init);
        }
    }

    string WriteConditions(string code, ShaderTemplateConvertInfo info)
    {
        var regex = new Regex(conditionPattern);
        var evaluator = new MatchEvaluator(match => {
            var cond = match.Groups["Cond"].Value;
            var trueValue = match.Groups["TrueValue"].Value;
            var falseValue = match.Groups["FalseValue"].Value;
            if (!info.conditions.ContainsKey(cond)) {
                throw new System.Exception(string.Format("The key \"{0}\" is not found in the given conditions.", cond));
            }
            return (info.conditions[cond]) ? trueValue : falseValue;
        });

        var preCode = code;
        code = regex.Replace(code, evaluator);
        while (code != preCode) {
            preCode = code;
            code = regex.Replace(code, evaluator);
        }

        return code;
    }

    void ParseBlocks()
    {
        blocks.Clear();

        var regex = new Regex(blockPattern);
        var matches = regex.Matches(code);
        foreach (Match match in matches) {
            var block = match.Groups["Block"].Value;
            var value = match.Groups["Value"].Value;
            blocks.Add(block, value);
        }
    }

    string WriteBlocks(string code, ShaderTemplateConvertInfo info)
    {
        var regex = new Regex(blockPattern);
        var evaluator = new MatchEvaluator(match => {
            var block = match.Groups["Block"].Value;
            var value = info.blocks[block];
            if (!info.blocks.ContainsKey(block)) {
                throw new System.Exception(string.Format("The key \"{0}\" is not found in the given blocks.", block));
            }
            return string.Format("// @block {0}\n{1}\n// @endblock", block, value);
        });
        return regex.Replace(code, evaluator);
    }

    void ParseVariables()
    {
        variables.Clear();

        var regex = new Regex(variablePattern);
        var matches = regex.Matches(code);
        foreach (Match match in matches) {
            var variable = match.Groups["Name"].Value;
            if (!variables.ContainsKey(variable)) {
                var values = new List<string>();
                foreach (Capture capture in match.Groups["Value"].Captures) {
                    values.Add(capture.Value);
                }
                variables.Add(variable, values);
            }
        }
    }

    string WriteVariables(string code, ShaderTemplateConvertInfo info)
    {
        var regex = new Regex(variablePattern);
        var evaluator = new MatchEvaluator(match => {
            var variable = match.Groups["Name"].Value;
            if (!info.variables.ContainsKey(variable)) {
                throw new System.Exception(string.Format("The key \"{0}\" is not found in the given variables.", variable));
            }
            return info.variables[variable];
        });
        return regex.Replace(code, evaluator);
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateParser.cs.meta
================================================
fileFormatVersion: 2
guid: bcb46db3577114bb4aadb54b6309e9e1
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateSelector.cs
================================================
using UnityEngine;
using UnityEngine.Events;
using UnityEditor;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace uShaderTemplate
{

public class ShaderTemplateSelector
{
    public SerializedProperty prop { get; private set; }

    public class OnChangeEventHandler : UnityEvent {}
    public OnChangeEventHandler onChange = new OnChangeEventHandler();

    struct TemplateInfo
    {
        public string name;
        public string path;
    }
    List<TemplateInfo> list_ = new List<TemplateInfo>();

    public string selected
    {
        get { return prop.stringValue; }
    }

    public string text
    {
        get {
            if (string.IsNullOrEmpty(prop.stringValue)) {
                prop.stringValue = list_[0].name;
            }
            var dir = Common.Setting.templateDirectoryPath;
            var asset = Resources.Load<TextAsset>(dir + "/" + prop.stringValue);
            return asset ? asset.text : "";
        }
    }

    public ShaderTemplateSelector(SerializedProperty prop)
    {
        this.prop = prop;

        var paths = Utils.GetShaderTemplatePathList();
        foreach (var path in paths) {
            if (Path.GetExtension(path) == Common.Setting.templateFileExtension) {
                var index = path.IndexOf(Common.Setting.templateDirectoryPath);
                var name = path
                    .Substring(index + Common.Setting.templateDirectoryPath.Length + 1)
                    .Replace(Common.Setting.templateFileExtension, "");
                var info = new TemplateInfo() {
                    name = name,
                    path = path,
                };
                list_.Add(info);
            }
        }
    }

    public void Draw()
    {
        var currentIndex = list_.Select(x => x.name).ToList().IndexOf(prop.stringValue);
        if (currentIndex == -1) currentIndex = 0;

        EditorGUILayout.BeginHorizontal(); {
            var selectedIndex = EditorGUILayout.Popup(
                "Shader Template", 
                currentIndex, 
                list_.Select(x => x.name).ToArray());
            var selected = list_[selectedIndex];

            var openButtonStyle = EditorStyles.miniButton;
            openButtonStyle.fixedWidth = 36;
            if (GUILayout.Button("Edit", openButtonStyle)) {
                var asset = AssetDatabase.LoadAssetAtPath(selected.path, typeof(Object));
                AssetDatabase.OpenAsset(asset);
            }

            var pre = prop.stringValue;
            var cur = selected.name;
            if (pre != cur) {
                prop.stringValue = cur;
                onChange.Invoke();
            }
        } EditorGUILayout.EndHorizontal();
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateSelector.cs.meta
================================================
fileFormatVersion: 2
guid: a8acd5a733ea24db89ac81f30cb3f9d4
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/Utils.cs
================================================
using UnityEngine;
using UnityEngine.Assertions;
using UnityEditor;
using System.IO;
using System.Collections.Generic;

namespace uShaderTemplate
{

public static class Utils
{
    public static HashSet<string> GetShaderTemplatePathList()
    {
        var files = Resources.LoadAll<TextAsset>(Common.Setting.templateDirectoryPath);
        var list = new HashSet<string>();
        foreach (var file in files) {
            var path = AssetDatabase.GetAssetPath(file);
            list.Add(path);
        }
        return list;
    }

    public static bool Foldout(string title, bool display)
    {
        var style = new GUIStyle("ShurikenModuleTitle");
        style.font = new GUIStyle(EditorStyles.label).font;
        style.border = new RectOffset(15, 7, 4, 4);
        style.fixedHeight = 22;
        style.contentOffset = new Vector2(20f, -2f);

        var rect = GUILayoutUtility.GetRect(16f, 22f, style);
        GUI.Box(rect, title, style);

        var e = Event.current;

        var toggleRect = new Rect(rect.x + 4f, rect.y + 2f, 13f, 13f);
        if (e.type == EventType.Repaint) {
            EditorStyles.foldout.Draw(toggleRect, false, false, display, false);
        }
        
        if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) {
            display = !display;
            e.Use();
        }

        return display;
    }

    public static string ToSpacedCamel(string str)
    {
        return System.Text.RegularExpressions.Regex.Replace(str, @"([A-Z][^A-Z]+)", @"$1 ");
    }

    public static void ReadOnlyTextField(string label, string text)
    {
        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField(label, GUILayout.Width(EditorGUIUtility.labelWidth - 4));
            EditorGUILayout.SelectableLabel(text, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));
        }
        EditorGUILayout.EndHorizontal();
    }

    public static List<T> FindAllAssets<T>(string query) where T : Object
    {
        var list = new List<T>();
        var guids = AssetDatabase.FindAssets(query);
        foreach (var guid in guids) {
            var path = AssetDatabase.GUIDToAssetPath(guid);
            var obj = AssetDatabase.LoadAssetAtPath<T>(path);
            if (obj) list.Add(obj);
        }
        return list;
    }

    public static List<T> FindAllAssets<T>() where T : Object
    {
        return FindAllAssets<T>("t:" + typeof(T));
    }

    public static List<Material> FindMaterialsUsingShader(Shader shader)
    {
        var materials = new List<Material>();
        var allMaterials = FindAllAssets<Material>("t:Material");
        foreach (var material in allMaterials) {
            if (material.shader == shader) {
                materials.Add(material);
            }
        }
        return materials;
    }
}

}

================================================
FILE: Assets/uShaderTemplate/Editor/Scripts/Utils.cs.meta
================================================
fileFormatVersion: 2
guid: 925b388b01b594c7698c988bb6d6ae93
timeCreated: 1495345065
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/Scripts.meta
================================================
fileFormatVersion: 2
guid: aa9023223e4924f0b9c0b34c0d3080a1
folderAsset: yes
timeCreated: 1495350799
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor/uShaderTemplate.Editor.asmdef
================================================
{
    "name": "uShaderTemplate.Editor",
    "rootNamespace": "",
    "references": [],
    "includePlatforms": [
        "Editor"
    ],
    "excludePlatforms": [],
    "allowUnsafeCode": false,
    "overrideReferences": false,
    "precompiledReferences": [],
    "autoReferenced": true,
    "defineConstraints": [],
    "versionDefines": [],
    "noEngineReferences": false
}

================================================
FILE: Assets/uShaderTemplate/Editor/uShaderTemplate.Editor.asmdef.meta
================================================
fileFormatVersion: 2
guid: a0c568dd17c433c488d48cb56a032e0b
AssemblyDefinitionImporter:
  externalObjects: {}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Editor.meta
================================================
fileFormatVersion: 2
guid: 1dc0de322bc9d4c928c2515ca6c0b497
folderAsset: yes
timeCreated: 1495345051
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Generators/Surface.asset.meta
================================================
fileFormatVersion: 2
guid: 88c90c500f31b4686bae88f3a389e73f
timeCreated: 1495458303
licenseType: Pro
NativeFormatImporter:
  mainObjectFileID: 11400000
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Generators/VertFrag.asset.meta
================================================
fileFormatVersion: 2
guid: a0068c12e7d1a4937b32899156d170d1
timeCreated: 1495382657
licenseType: Pro
NativeFormatImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Generators.meta
================================================
fileFormatVersion: 2
guid: d17285a28a5464c8cb0d2066d7d2560e
folderAsset: yes
timeCreated: 1495350945
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/Surface.txt
================================================
Shader "Custom/<Name>"
{

@constants uShaderTemplate/Constants/Custom Constants

Properties
{
    _Color("Color", Color) = (1,1,1,1)
    _MainTex("Albedo (RGB)", 2D) = "white" {}
    _NormalTex("Normalmap", 2D) = "bump" {}
@if UseTesselation : false
    _DispTex("Disp Texture", 2D) = "gray" {}
    _Displacement("Displacement", Range(0, 1.0)) = 0.3
    _Tess("Tess Factor", Range(1, 32.0)) = 3
@endif
    _Glossiness("Smoothness", Range(0,1)) = 0.5
    _Metallic("Metallic", Range(0,1)) = 0.0
}

SubShader
{

Tags { "RenderType"="Opaque" }
LOD <LOD=200>

CGPROGRAM

@if UseTesselation
#pragma surface surf <LightModel=Standard|StandardSpecular|Lambert|BlinnPhong> addshadow fullforwardshadows vertex:disp tessellate:tessFixed nolightmap <Option>
@else
#pragma surface surf <LightModel=Standard|StandardSpecular|Lambert|BlinnPhong> fullforwardshadows <Option>
@endif

@if UseTesselation
#pragma target 5.0
@else
#pragma target 3.0
@endif

struct Input
{
    float2 uv_MainTex;
};

sampler2D _MainTex;
sampler2D _NormalTex;
half _Glossiness;
half _Metallic;
fixed4 _Color;

@if UseTesselation
struct appdata
{
    float4 vertex   : POSITION;
    float4 tangent  : TANGENT;
    float3 normal   : NORMAL;
    float2 texcoord : TEXCOORD0;
};

float _Tess;
float _Displacement;
sampler2D _DispTex;

float4 tessFixed()
{
    return _Tess;
}

void disp(inout appdata v)
{
    float d = tex2Dlod(_DispTex, float4(v.texcoord.xy,0,0)).r * _Displacement;
    v.vertex.xyz += v.normal * d;
}
@endif

void surf(Input IN, inout <SurfaceFunctionInput=SurfaceOutputStandard|SurfaceOutputStandardSpecular|SurfaceOutput> o)
{
@block SurfaceFunction
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
o.Normal = UnpackNormal(tex2D(_NormalTex, IN.uv_MainTex));
@endblock
}

ENDCG

}

FallBack "Diffuse"

CustomEditor "uShaderTemplate.MaterialEditor"

}


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/Surface.txt.meta
================================================
fileFormatVersion: 2
guid: 43bf8662976fb470b986a9f654977189
timeCreated: 1495457698
licenseType: Pro
TextScriptImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/VertFrag.txt
================================================
Shader "Custom/<Name>"
{

Properties
{
@block Properties
_MainTex("Texture", 2D) = "white" {}
@endblock
}

SubShader
{

Tags { "Queue"="<Queue=Geometry|Transparent>" "RenderType"="<RenderType=Opaque|Transparent>" }
LOD <LOD=100>

CGINCLUDE

#include "UnityCG.cginc"

struct v2f
{
    float2 uv : TEXCOORD0;
@if UseFog : true
    UNITY_FOG_COORDS(1)
@endif
    float4 vertex : SV_POSITION;
};

@block VertexShader
sampler2D _MainTex;
float4 _MainTex_ST;

v2f vert(appdata_full v)
{
    v2f o;
    o.vertex = UnityObjectToClipPos(v.vertex);
    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
    UNITY_TRANSFER_FOG(o,o.vertex);
    return o;
}
@endblock

@block FragmentShader
fixed4 frag(v2f i) : SV_Target
{
    fixed4 col = tex2D(_MainTex, i.uv);
    UNITY_APPLY_FOG(i.fogCoord, col);
    return col;
}
@endblock

ENDCG

Pass
{
    CGPROGRAM
    #pragma vertex vert
    #pragma fragment frag
@if UseFog : true
    #pragma multi_compile_fog
@endif
    ENDCG
}

}

CustomEditor "uShaderTemplate.MaterialEditor"

}


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/VertFrag.txt.meta
================================================
fileFormatVersion: 2
guid: 606d21f85fa4348baa28d511ebe46d5d
timeCreated: 1495382484
licenseType: Pro
TextScriptImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples.meta
================================================
fileFormatVersion: 2
guid: b54e9e82905204f31afb0390f6bed8a7
folderAsset: yes
timeCreated: 1514533371
licenseType: Pro
DefaultImporter:
  externalObjects: {}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates.meta
================================================
fileFormatVersion: 2
guid: cd4d10a21be924728ae1d8b6a53576bd
folderAsset: yes
timeCreated: 1495348314
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor/Resources.meta
================================================
fileFormatVersion: 2
guid: dc5bf9f6e92bd4787a0ea1d3a7ce5629
folderAsset: yes
timeCreated: 1495348310
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Editor.meta
================================================
fileFormatVersion: 2
guid: 09890211325254c11a0addaf79b580cf
folderAsset: yes
timeCreated: 1495348306
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Materials/Surface.mat.meta
================================================
fileFormatVersion: 2
guid: aa9bfc87f3c6443fe8bc35cecfd72a61
timeCreated: 1495458388
licenseType: Pro
NativeFormatImporter:
  mainObjectFileID: 2100000
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Materials/VertFrag.mat.meta
================================================
fileFormatVersion: 2
guid: 90705d78cb60a418395eea6f6df87e87
timeCreated: 1495382706
licenseType: Pro
NativeFormatImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Materials.meta
================================================
fileFormatVersion: 2
guid: e212224d38dfe42c8b1ddc1d65561bf7
folderAsset: yes
timeCreated: 1495382701
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Shaders/Surface.shader
================================================
Shader "Custom/Surface"
{

Properties
{
    _Color("Color", Color) = (1,1,1,1)
    _MainTex("Albedo (RGB)", 2D) = "white" {}
    _NormalTex("Normalmap", 2D) = "bump" {}
    _DispTex("Disp Texture", 2D) = "gray" {}
    _Displacement("Displacement", Range(0, 1.0)) = 0.3
    _Tess("Tess Factor", Range(1, 32.0)) = 3
    _Glossiness("Smoothness", Range(0,1)) = 0.5
    _Metallic("Metallic", Range(0,1)) = 0.0
}

SubShader
{

Tags { "RenderType"="Opaque" }
LOD 300

CGPROGRAM

#pragma surface surf Standard addshadow fullforwardshadows vertex:disp tessellate:tessFixed nolightmap 

#pragma target 5.0

struct Input
{
    float2 uv_MainTex;
};

sampler2D _MainTex;
sampler2D _NormalTex;
half _Glossiness;
half _Metallic;
fixed4 _Color;

struct appdata
{
    float4 vertex   : POSITION;
    float4 tangent  : TANGENT;
    float3 normal   : NORMAL;
    float2 texcoord : TEXCOORD0;
};

float _Tess;
float _Displacement;
sampler2D _DispTex;

float4 tessFixed()
{
    return _Tess;
}

void disp(inout appdata v)
{
    float d = tex2Dlod(_DispTex, float4(v.texcoord.xy,0,0)).r * _Displacement;
    v.vertex.xyz += v.normal * d;
}

void surf(Input IN, inout SurfaceOutputStandard o)
{
// @block SurfaceFunction
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
o.Normal = UnpackNormal(tex2D(_NormalTex, IN.uv_MainTex));
// @endblock
}

ENDCG

}

FallBack "Diffuse"

CustomEditor "uShaderTemplate.MaterialEditor"

}


================================================
FILE: Assets/uShaderTemplate/Examples/Shaders/Surface.shader.meta
================================================
fileFormatVersion: 2
guid: d578a6d4407644041b24ce3049babf46
timeCreated: 1495458321
licenseType: Pro
ShaderImporter:
  defaultTextures: []
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Shaders/VertFrag.shader
================================================
Shader "Custom/VertFrag"
{

Properties
{
// @block Properties
_MainTex("Texture", 2D) = "white" {}
// @endblock
}

SubShader
{

Tags { "Queue"="Geometry" "RenderType"="Opaque" }
LOD 100

CGINCLUDE

#include "UnityCG.cginc"

struct v2f
{
    float2 uv : TEXCOORD0;
    UNITY_FOG_COORDS(1)
    float4 vertex : SV_POSITION;
};

// @block VertexShader
sampler2D _MainTex;
float4 _MainTex_ST;

v2f vert(appdata_full v)
{
    v2f o;
    o.vertex = UnityObjectToClipPos(v.vertex);
    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
    UNITY_TRANSFER_FOG(o,o.vertex);
    return o;
}
// @endblock

// @block FragmentShader
fixed4 frag(v2f i) : SV_Target
{
    fixed4 col = tex2D(_MainTex, i.uv);
    UNITY_APPLY_FOG(i.fogCoord, col);
    return col;
}
// @endblock

ENDCG

Pass
{
    CGPROGRAM
    #pragma vertex vert
    #pragma fragment frag
    #pragma multi_compile_fog
    ENDCG
}

}

CustomEditor "uShaderTemplate.MaterialEditor"

}


================================================
FILE: Assets/uShaderTemplate/Examples/Shaders/VertFrag.shader.meta
================================================
fileFormatVersion: 2
guid: e668248a8487547b7997f5d6854ea2d8
timeCreated: 1495382691
licenseType: Pro
ShaderImporter:
  defaultTextures: []
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples/Shaders.meta
================================================
fileFormatVersion: 2
guid: 13468f0d9df7046fba8d127c4b693310
folderAsset: yes
timeCreated: 1495346462
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/Examples.meta
================================================
fileFormatVersion: 2
guid: b090363427a0342dd86e61389443d439
folderAsset: yes
timeCreated: 1495346384
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate/package.json
================================================
{
    "name":"com.hecomi.ushadertemplate",
    "version": "1.0.0",
    "displayName": "uShaderTemplate",
    "description": "This is an Unity editor extension for generating shader code from template files.",
    "license": "MIT License",
    "author": {
        "name": "hecomi",
        "url": "https://tips.hecomi.com"
    },
    "repository": {
        "type": "git",
        "url": "https://github.com/hecomi/uShaderTemplate"
    },
    "samples": [
        {
            "displayName": "Samples",
            "description": "Collection of samples for uShaderTemplate.",
            "path": "Samples~"
        }
    ]
}


================================================
FILE: Assets/uShaderTemplate/package.json.meta
================================================
fileFormatVersion: 2
guid: f6fb284ffdd781743a226884c89913ef
TextScriptImporter:
  externalObjects: {}
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: Assets/uShaderTemplate.meta
================================================
fileFormatVersion: 2
guid: 5251585ef4ed3468595a16e360ffb916
folderAsset: yes
timeCreated: 1495345044
licenseType: Pro
DefaultImporter:
  userData: 
  assetBundleName: 
  assetBundleVariant: 


================================================
FILE: LICENSE.md
================================================
The MIT License (MIT)

Copyright (c) 2017 hecomi

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: Packages/manifest.json
================================================
{
  "dependencies": {
    "com.unity.analytics": "3.5.3",
    "com.unity.collab-proxy": "1.3.9",
    "com.unity.ide.rider": "2.0.7",
    "com.unity.ide.visualstudio": "2.0.7",
    "com.unity.ide.vscode": "1.2.3",
    "com.unity.test-framework": "1.1.24",
    "com.unity.textmeshpro": "3.0.6",
    "com.unity.timeline": "1.4.8",
    "com.unity.ugui": "1.0.0",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}


================================================
FILE: Packages/packages-lock.json
================================================
{
  "dependencies": {
    "com.unity.analytics": {
      "version": "3.5.3",
      "depth": 0,
      "source": "registry",
      "dependencies": {
        "com.unity.ugui": "1.0.0"
      },
      "url": "https://packages.unity.com"
    },
    "com.unity.collab-proxy": {
      "version": "1.3.9",
      "depth": 0,
      "source": "registry",
      "dependencies": {},
      "url": "https://packages.unity.com"
    },
    "com.unity.ext.nunit": {
      "version": "1.0.6",
      "depth": 1,
      "source": "registry",
      "dependencies": {},
      "url": "https://packages.unity.com"
    },
    "com.unity.ide.rider": {
      "version": "2.0.7",
      "depth": 0,
      "source": "registry",
      "dependencies": {
        "com.unity.test-framework": "1.1.1"
      },
      "url": "https://packages.unity.com"
    },
    "com.unity.ide.visualstudio": {
      "version": "2.0.7",
      "depth": 0,
      "source": "registry",
      "dependencies": {
        "com.unity.test-framework": "1.1.9"
      },
      "url": "https://packages.unity.com"
    },
    "com.unity.ide.vscode": {
      "version": "1.2.3",
      "depth": 0,
      "source": "registry",
      "dependencies": {},
      "url": "https://packages.unity.com"
    },
    "com.unity.test-framework": {
      "version": "1.1.24",
      "depth": 0,
      "source": "registry",
      "dependencies": {
        "com.unity.ext.nunit": "1.0.6",
        "com.unity.modules.imgui": "1.0.0",
        "com.unity.modules.jsonserialize": "1.0.0"
      },
      "url": "https://packages.unity.com"
    },
    "com.unity.textmeshpro": {
      "version": "3.0.6",
      "depth": 0,
      "source": "registry",
      "dependencies": {
        "com.unity.ugui": "1.0.0"
      },
      "url": "https://packages.unity.com"
    },
    "com.unity.timeline": {
      "version": "1.4.8",
      "depth": 0,
      "source": "registry",
      "dependencies": {
        "com.unity.modules.director": "1.0.0",
        "com.unity.modules.animation": "1.0.0",
        "com.unity.modules.audio": "1.0.0",
        "com.unity.modules.particlesystem": "1.0.0"
      },
      "url": "https://packages.unity.com"
    },
    "com.unity.ugui": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.ui": "1.0.0",
        "com.unity.modules.imgui": "1.0.0"
      }
    },
    "com.unity.modules.ai": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.androidjni": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.animation": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.assetbundle": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.audio": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.cloth": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.physics": "1.0.0"
      }
    },
    "com.unity.modules.director": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.audio": "1.0.0",
        "com.unity.modules.animation": "1.0.0"
      }
    },
    "com.unity.modules.imageconversion": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.imgui": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.jsonserialize": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.particlesystem": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.physics": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.physics2d": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.screencapture": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.imageconversion": "1.0.0"
      }
    },
    "com.unity.modules.subsystems": {
      "version": "1.0.0",
      "depth": 1,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.jsonserialize": "1.0.0"
      }
    },
    "com.unity.modules.terrain": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.terrainphysics": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.physics": "1.0.0",
        "com.unity.modules.terrain": "1.0.0"
      }
    },
    "com.unity.modules.tilemap": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.physics2d": "1.0.0"
      }
    },
    "com.unity.modules.ui": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.uielements": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.ui": "1.0.0",
        "com.unity.modules.imgui": "1.0.0",
        "com.unity.modules.jsonserialize": "1.0.0",
        "com.unity.modules.uielementsnative": "1.0.0"
      }
    },
    "com.unity.modules.uielementsnative": {
      "version": "1.0.0",
      "depth": 1,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.ui": "1.0.0",
        "com.unity.modules.imgui": "1.0.0",
        "com.unity.modules.jsonserialize": "1.0.0"
      }
    },
    "com.unity.modules.umbra": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.unityanalytics": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.unitywebrequest": "1.0.0",
        "com.unity.modules.jsonserialize": "1.0.0"
      }
    },
    "com.unity.modules.unitywebrequest": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.unitywebrequestassetbundle": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.assetbundle": "1.0.0",
        "com.unity.modules.unitywebrequest": "1.0.0"
      }
    },
    "com.unity.modules.unitywebrequestaudio": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.unitywebrequest": "1.0.0",
        "com.unity.modules.audio": "1.0.0"
      }
    },
    "com.unity.modules.unitywebrequesttexture": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.unitywebrequest": "1.0.0",
        "com.unity.modules.imageconversion": "1.0.0"
      }
    },
    "com.unity.modules.unitywebrequestwww": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.unitywebrequest": "1.0.0",
        "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
        "com.unity.modules.unitywebrequestaudio": "1.0.0",
        "com.unity.modules.audio": "1.0.0",
        "com.unity.modules.assetbundle": "1.0.0",
        "com.unity.modules.imageconversion": "1.0.0"
      }
    },
    "com.unity.modules.vehicles": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.physics": "1.0.0"
      }
    },
    "com.unity.modules.video": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.audio": "1.0.0",
        "com.unity.modules.ui": "1.0.0",
        "com.unity.modules.unitywebrequest": "1.0.0"
      }
    },
    "com.unity.modules.vr": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.jsonserialize": "1.0.0",
        "com.unity.modules.physics": "1.0.0",
        "com.unity.modules.xr": "1.0.0"
      }
    },
    "com.unity.modules.wind": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {}
    },
    "com.unity.modules.xr": {
      "version": "1.0.0",
      "depth": 0,
      "source": "builtin",
      "dependencies": {
        "com.unity.modules.physics": "1.0.0",
        "com.unity.modules.jsonserialize": "1.0.0",
        "com.unity.modules.subsystems": "1.0.0"
      }
    }
  }
}


================================================
FILE: ProjectSettings/PackageManagerSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
  m_ObjectHideFlags: 61
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
  m_Name: 
  m_EditorClassIdentifier: 
  m_EnablePreviewPackages: 0
  m_EnablePackageDependencies: 0
  m_AdvancedSettingsExpanded: 1
  m_ScopedRegistriesSettingsExpanded: 1
  oneTimeWarningShown: 0
  m_Registries:
  - m_Id: main
    m_Name: 
    m_Url: https://packages.unity.com
    m_Scopes: []
    m_IsDefault: 1
    m_Capabilities: 7
  m_UserSelectedRegistryName: 
  m_UserAddingNewScopedRegistry: 0
  m_RegistryInfoDraft:
    m_ErrorMessage: 
    m_Original:
      m_Id: 
      m_Name: 
      m_Url: 
      m_Scopes: []
      m_IsDefault: 0
      m_Capabilities: 0
    m_Modified: 0
    m_Name: 
    m_Url: 
    m_Scopes:
    - 
    m_SelectedScopeIndex: 0


================================================
FILE: ProjectSettings/ProjectVersion.txt
================================================
m_EditorVersion: 2020.3.9f1
m_EditorVersionWithRevision: 2020.3.9f1 (108be757e447)


================================================
FILE: ProjectSettings/VersionControlSettings.asset
================================================
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!890905787 &1
VersionControlSettings:
  m_ObjectHideFlags: 0
  m_Mode: Visible Meta Files
  m_CollabEditorSettings:
    inProgressEnabled: 1


================================================
FILE: README.md
================================================
uShaderTemplate
===============

**uShaderTemplate** is an editor asset to create shaders from templates.

Install
-------

- Unity Package
  - Download the latest .unitypackage from [Release page](https://github.com/hecomi/uShaderTemplate/releases).
- Git URL (UPM)
  - Add `https://github.com/hecomi/uShaderTemplate.git#upm` to Package Manager.
- Scoped Registry (UPM)
  - Add a scoped registry to your project.
    - URL: `https://registry.npmjs.com`
    - Scope: `com.hecomi`
  - Install uShaderTemplate in Package Manager. 

Usage
-----

1.  Prepare **Shader Template** file.
2.  Create **Generator** from *Create > Shader > uShaderTemplate > Generator*.
3.  Input *Shader Name* and select *Shader Template* from the inspector.
4.  Edit items in *Conditions*, *Variables*, and codes in code editors.
5.  Press *Export (Ctrl+R)* button to create a shader from the Generator.

Overview
--------

Generator is an asset file that manages a generated shader, save parameters,
and provide an interface to customize the shader with some rules
written in **shader template**. The following image is an example of a Generator
inspector which is automatically generated from shader template.

![Inspector](https://raw.githubusercontent.com/wiki/hecomi/uShaderTemplate/inspector.png)

The interface is generated from
*uShaderTemplate > Examples > Editor > Resources > ShaderTemplates > 1. VertFrag.txt*.
This is the content of this file:

**1. VertFrag.txt**

```shader
Shader "Custom/<Name>"
{

Properties
{
@block Properties
_MainTex("Texture", 2D) = "white" {}
@endblock
}

SubShader
{

Tags { "Queue"="<Queue=Geometry|Transparent>" "RenderType"="<RenderType=Opaque|Transparent>" }
LOD <LOD=100>

CGINCLUDE

#include "UnityCG.cginc"

struct v2f
{
    float2 uv : TEXCOORD0;
@if UseFog : true
    UNITY_FOG_COORDS(1)
@endif
    float4 vertex : SV_POSITION;
};

@block VertexShader
sampler2D _MainTex;
float4 _MainTex_ST;

v2f vert(appdata_full v)
{
    v2f o;
    o.vertex = UnityObjectToClipPos(v.vertex);
    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
    UNITY_TRANSFER_FOG(o,o.vertex);
    return o;
}
@endblock

@block FragmentShader
fixed4 frag(v2f i) : SV_Target
{
    fixed4 col = tex2D(_MainTex, i.uv);
    UNITY_APPLY_FOG(i.fogCoord, col);
    return col;
}
@endblock

ENDCG

Pass
{
    CGPROGRAM
    #pragma vertex vert
    #pragma fragment frag
@if UseFog : true
    #pragma multi_compile_fog
@endif
    ENDCG
}

}

CustomEditor "uShaderTemplate.MaterialEditor"

}
```

You might have found some grammars like `@if foo`, `<Bar>`, `@block baz`,
and these are special grammmars available in template file.
Shader variant like `#pragma multi_compile` and `#pragma shader_feature`
cannot customize the section outside `CGPROGRAM`, but with these grammar,
you can customize the all parts of the shader.

If you put template files like this in *Resources > ShaderTemplates*,
they are automatically detected and shown in the *Shader Template* field
in *Basic* section.

Grammars in Shader Template
---------------------------

```shader
// Condition:
//   A toggle filed labeled "Hoge Hoge" will appear in Conditions section.
//   Only when checked, the content will be output.
@if HogeHoge
#define HOGEHOGE
@endif

// You can use else block and give a default condition.
@if HogeHoge2 : false
#define HOGEHOGE2
@else
#define HOGEHOGE3
@endif

// Variable:
//   The name with <> will appear in Variables section as a text field.
//   You can give a default value with =, and =| will be pull-down list.
#define Hoge <Hoge>
#define Fuga <Fuga=Hoge> //
#define Piyo <Piyo=Hoge|Fuga|Piyo>

// Block:
//    The content will be a code editor.
//    Output shader has block like // @block ~ // @endblock and
//    if you edit the content directly with your own editor like Vim,
//    the result will be applied to the code editor in inspector.
@block Moge
float Moge2() { return _Move * _Moge; }
@endblock
```

Buttons
-------

![Buttons](https://raw.githubusercontent.com/wiki/hecomi/uShaderTemplate/buttons.png)

* **Export(Ctrl+R)**
  * Export shader from Generator. You can use *Ctrl + R* as a shortcut key
    instead of pressing this button.
* **Create Material**
  * Create material from the generated shader.
* **Reset to Default**
  * Reset all parameters to the default parameters written in template.
* **Update Template**
  * If you edit the template file, please press this before the export.
* **Reconvert All**
  * Convert all generated shaders forcedly. This is useful when you edit
    template file and want to apply the change to all shaders.


Constants
---------

![Constants](https://raw.githubusercontent.com/wiki/hecomi/uShaderTemplate/constants.png)

Instead of inputting variables in each inspector, you can use **Constants** asset
as a shared variables among multiple Generators.

Select *Create > Shader > uShaderTemplate > Constants* and add *Name* and *Value*
pair to *Values* field of the created Constants asset. Then, drag and drop it to
the *Constants* field of Generators which you want to apply the parameters to.
Please remember that if you modify a parameter in Constants,
you have to *Reconvert All* to apply the change to all generated shaders.

In a shader template, you can specify the default `Constants` using `@constants` line if you want it.

```shader
Shader "Custom/<Name>"
{

// you can insert this line anywhere in the template file.
@constants uShaderTemplate/Constants/Custom Constants

Properties
{
...
```


Callbacks
---------

`Generator` and `Constants` have virtual functions, `OnBeforeConvert()` and `OnAfterConvert()`.
You can create custom `Generator` and `Constants` inherited from these classes and override
them to add callbacks just before and after convert.
Download .txt
gitextract_rjpfz9kl/

├── .github/
│   └── workflows/
│       └── main.yml
├── .gitignore
├── Assets/
│   ├── uShaderTemplate/
│   │   ├── Editor/
│   │   │   ├── Resources/
│   │   │   │   ├── uShaderTemplate/
│   │   │   │   │   ├── Constants/
│   │   │   │   │   │   ├── Custom Constants.asset
│   │   │   │   │   │   ├── Custom Constants.asset.meta
│   │   │   │   │   │   ├── Default Constants.asset
│   │   │   │   │   │   └── Default Constants.asset.meta
│   │   │   │   │   ├── Constants.meta
│   │   │   │   │   ├── Fonts/
│   │   │   │   │   │   ├── LICENSE_OFL.txt
│   │   │   │   │   │   ├── LICENSE_OFL.txt.meta
│   │   │   │   │   │   └── NotoMono-Regular.ttf.meta
│   │   │   │   │   └── Fonts.meta
│   │   │   │   └── uShaderTemplate.meta
│   │   │   ├── Resources.meta
│   │   │   ├── Scripts/
│   │   │   │   ├── CodeEditor.cs
│   │   │   │   ├── CodeEditor.cs.meta
│   │   │   │   ├── ColorScheme.cs
│   │   │   │   ├── ColorScheme.cs.meta
│   │   │   │   ├── Common.cs
│   │   │   │   ├── Common.cs.meta
│   │   │   │   ├── Constants.cs
│   │   │   │   ├── Constants.cs.meta
│   │   │   │   ├── FileWatcher.cs
│   │   │   │   ├── FileWatcher.cs.meta
│   │   │   │   ├── Generator.cs
│   │   │   │   ├── Generator.cs.meta
│   │   │   │   ├── GeneratorEditor.cs
│   │   │   │   ├── GeneratorEditor.cs.meta
│   │   │   │   ├── MaterialEditor.cs
│   │   │   │   ├── MaterialEditor.cs.meta
│   │   │   │   ├── ShaderCodeEditor.cs
│   │   │   │   ├── ShaderCodeEditor.cs.meta
│   │   │   │   ├── ShaderHighlighter.cs
│   │   │   │   ├── ShaderHighlighter.cs.meta
│   │   │   │   ├── ShaderSyntax.cs
│   │   │   │   ├── ShaderSyntax.cs.meta
│   │   │   │   ├── ShaderTemplateParser.cs
│   │   │   │   ├── ShaderTemplateParser.cs.meta
│   │   │   │   ├── ShaderTemplateSelector.cs
│   │   │   │   ├── ShaderTemplateSelector.cs.meta
│   │   │   │   ├── Utils.cs
│   │   │   │   └── Utils.cs.meta
│   │   │   ├── Scripts.meta
│   │   │   ├── uShaderTemplate.Editor.asmdef
│   │   │   └── uShaderTemplate.Editor.asmdef.meta
│   │   ├── Editor.meta
│   │   ├── Examples/
│   │   │   ├── Editor/
│   │   │   │   ├── Generators/
│   │   │   │   │   ├── Surface.asset
│   │   │   │   │   ├── Surface.asset.meta
│   │   │   │   │   ├── VertFrag.asset
│   │   │   │   │   └── VertFrag.asset.meta
│   │   │   │   ├── Generators.meta
│   │   │   │   ├── Resources/
│   │   │   │   │   ├── ShaderTemplates/
│   │   │   │   │   │   ├── Examples/
│   │   │   │   │   │   │   ├── Surface.txt
│   │   │   │   │   │   │   ├── Surface.txt.meta
│   │   │   │   │   │   │   ├── VertFrag.txt
│   │   │   │   │   │   │   └── VertFrag.txt.meta
│   │   │   │   │   │   └── Examples.meta
│   │   │   │   │   └── ShaderTemplates.meta
│   │   │   │   └── Resources.meta
│   │   │   ├── Editor.meta
│   │   │   ├── Materials/
│   │   │   │   ├── Surface.mat
│   │   │   │   ├── Surface.mat.meta
│   │   │   │   ├── VertFrag.mat
│   │   │   │   └── VertFrag.mat.meta
│   │   │   ├── Materials.meta
│   │   │   ├── Shaders/
│   │   │   │   ├── Surface.shader
│   │   │   │   ├── Surface.shader.meta
│   │   │   │   ├── VertFrag.shader
│   │   │   │   └── VertFrag.shader.meta
│   │   │   └── Shaders.meta
│   │   ├── Examples.meta
│   │   ├── package.json
│   │   └── package.json.meta
│   └── uShaderTemplate.meta
├── LICENSE.md
├── Packages/
│   ├── manifest.json
│   └── packages-lock.json
├── ProjectSettings/
│   ├── AudioManager.asset
│   ├── ClusterInputManager.asset
│   ├── DynamicsManager.asset
│   ├── EditorBuildSettings.asset
│   ├── EditorSettings.asset
│   ├── GraphicsSettings.asset
│   ├── InputManager.asset
│   ├── NavMeshAreas.asset
│   ├── NetworkManager.asset
│   ├── PackageManagerSettings.asset
│   ├── Physics2DSettings.asset
│   ├── PresetManager.asset
│   ├── ProjectSettings.asset
│   ├── ProjectVersion.txt
│   ├── QualitySettings.asset
│   ├── TagManager.asset
│   ├── TimeManager.asset
│   ├── UnityConnectSettings.asset
│   ├── VFXManager.asset
│   └── VersionControlSettings.asset
└── README.md
Download .txt
SYMBOL INDEX (90 symbols across 14 files)

FILE: Assets/uShaderTemplate/Editor/Scripts/CodeEditor.cs
  class CodeEditor (line 7) | public class CodeEditor
    method CodeEditor (line 23) | public CodeEditor(string controlName)
    method Draw (line 31) | public string Draw(string code, GUIStyle style, params GUILayoutOption...
    method CheckEvents (line 88) | void CheckEvents(TextEditor editor)

FILE: Assets/uShaderTemplate/Editor/Scripts/ColorScheme.cs
  class Solarized (line 7) | public static class Solarized

FILE: Assets/uShaderTemplate/Editor/Scripts/Common.cs
  class Color (line 9) | public static class Color
  class Editor (line 26) | public static class Editor
  class Setting (line 34) | public static class Setting

FILE: Assets/uShaderTemplate/Editor/Scripts/Constants.cs
  type Constant (line 6) | [System.Serializable]
  class Constants (line 13) | [CreateAssetMenu(
    method OnBeforeConvert (line 19) | public virtual void OnBeforeConvert() {}
    method OnAfterConvert (line 20) | public virtual void OnAfterConvert() {}

FILE: Assets/uShaderTemplate/Editor/Scripts/FileWatcher.cs
  class FileWatcher (line 7) | public class FileWatcher
    method Start (line 16) | public void Start(string path)
    method Stop (line 37) | public void Stop()
    method Update (line 48) | public void Update()
    method OnChanged (line 56) | void OnChanged(object source, FileSystemEventArgs e)
    method OnRenamed (line 61) | void OnRenamed(object source, RenamedEventArgs e)

FILE: Assets/uShaderTemplate/Editor/Scripts/Generator.cs
  type ShaderVariables (line 7) | [System.Serializable]
  type ShaderCondition (line 14) | [System.Serializable]
  type ShaderBlock (line 21) | [System.Serializable]
  class Generator (line 29) | [CreateAssetMenu(
    method OnBeforeConvert (line 49) | public virtual void OnBeforeConvert() {}
    method OnAfterConvert (line 50) | public virtual void OnAfterConvert() {}

FILE: Assets/uShaderTemplate/Editor/Scripts/GeneratorEditor.cs
  class GeneratorEditor (line 10) | [CustomEditor(typeof(Generator))]
    method OnEnable (line 46) | void OnEnable()
    method OnDisable (line 71) | void OnDisable()
    method OnInspectorGUI (line 82) | public override void OnInspectorGUI()
    method FindProperty (line 110) | SerializedProperty FindProperty(SerializedProperty array, string key, ...
    method AddProperty (line 122) | SerializedProperty AddProperty(SerializedProperty array, string key)
    method DrawBasics (line 132) | void DrawBasics()
    method DrawConditions (line 144) | void DrawConditions()
    method DrawBlocks (line 169) | void DrawBlocks()
    method DrawVariables (line 190) | void DrawVariables()
    method DrawConstants (line 245) | void DrawConstants()
    method DrawMaterialReferences (line 266) | void DrawMaterialReferences()
    method DrawButtons (line 283) | void DrawButtons()
    method DrawMessages (line 329) | void DrawMessages()
    method ToConstVariable (line 336) | string ToConstVariable(string name)
    method OnTemplateChanged (line 349) | void OnTemplateChanged()
    method GetShaderName (line 381) | string GetShaderName()
    method GetOutputDirPath (line 390) | string GetOutputDirPath()
    method GetShaderPath (line 398) | string GetShaderPath()
    method ReImport (line 403) | void ReImport()
    method ExportShader (line 410) | void ExportShader()
    method ExportShaderWithErrorCheck (line 465) | void ExportShaderWithErrorCheck()
    method ResetToDefault (line 481) | void ResetToDefault()
    method Reconvert (line 489) | public void Reconvert()
    method ReconvertAll (line 496) | void ReconvertAll()
    method CheckShaderUpdate (line 517) | void CheckShaderUpdate()
    method CreateMaterial (line 540) | void CreateMaterial()
    method HandleKeyEvents (line 547) | void HandleKeyEvents()
    method ClearError (line 556) | void ClearError()
    method AddError (line 561) | void AddError(string error)

FILE: Assets/uShaderTemplate/Editor/Scripts/MaterialEditor.cs
  class MaterialEditor (line 7) | public class MaterialEditor : ShaderGUI
    method OnGUI (line 12) | override public void OnGUI(

FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderCodeEditor.cs
  class ShaderCodeEditor (line 7) | public class ShaderCodeEditor
    method ShaderCodeEditor (line 23) | public ShaderCodeEditor(string name, SerializedProperty value, Seriali...
    method Draw (line 43) | public void Draw()

FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderHighlighter.cs
  class ShaderHighlighter (line 7) | public static class ShaderHighlighter
    method ToColoredCode (line 24) | static string ToColoredCode(string code, string color)
    method Init (line 29) | [UnityEditor.InitializeOnLoadMethod]
    method Highlight (line 63) | public static string Highlight(string code)

FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderSyntax.cs
  class ShaderSyntax (line 7) | public static class ShaderSyntax

FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateParser.cs
  class ShaderTemplateConvertInfo (line 7) | public class ShaderTemplateConvertInfo
  class ShaderTemplateParser (line 14) | public class ShaderTemplateParser
    method ShaderTemplateParser (line 38) | public ShaderTemplateParser(string code)
    method Parse (line 47) | void Parse()
    method Convert (line 55) | public string Convert(ShaderTemplateConvertInfo info)
    method ParseConstants (line 77) | void ParseConstants()
    method WriteConstants (line 87) | string WriteConstants(string code)
    method ParseConditions (line 94) | void ParseConditions()
    method WriteConditions (line 111) | string WriteConditions(string code, ShaderTemplateConvertInfo info)
    method ParseBlocks (line 134) | void ParseBlocks()
    method WriteBlocks (line 147) | string WriteBlocks(string code, ShaderTemplateConvertInfo info)
    method ParseVariables (line 161) | void ParseVariables()
    method WriteVariables (line 179) | string WriteVariables(string code, ShaderTemplateConvertInfo info)

FILE: Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateSelector.cs
  class ShaderTemplateSelector (line 11) | public class ShaderTemplateSelector
    class OnChangeEventHandler (line 15) | public class OnChangeEventHandler : UnityEvent {}
    type TemplateInfo (line 18) | struct TemplateInfo
    method ShaderTemplateSelector (line 42) | public ShaderTemplateSelector(SerializedProperty prop)
    method Draw (line 62) | public void Draw()

FILE: Assets/uShaderTemplate/Editor/Scripts/Utils.cs
  class Utils (line 10) | public static class Utils
    method GetShaderTemplatePathList (line 12) | public static HashSet<string> GetShaderTemplatePathList()
    method Foldout (line 23) | public static bool Foldout(string title, bool display)
    method ToSpacedCamel (line 49) | public static string ToSpacedCamel(string str)
    method ReadOnlyTextField (line 54) | public static void ReadOnlyTextField(string label, string text)
    method FindAllAssets (line 64) | public static List<T> FindAllAssets<T>(string query) where T : Object
    method FindAllAssets (line 76) | public static List<T> FindAllAssets<T>() where T : Object
    method FindMaterialsUsingShader (line 81) | public static List<Material> FindMaterialsUsingShader(Shader shader)
Condensed preview — 96 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (102K chars).
[
  {
    "path": ".github/workflows/main.yml",
    "chars": 864,
    "preview": "name: Create UPM branches and run NPM publish\n\non:\n  push:\n    tags:\n      - v*\n\njobs:\n  update:\n    runs-on: ubuntu-lat"
  },
  {
    "path": ".gitignore",
    "chars": 1343,
    "preview": "# This .gitignore file should be placed at the root of your Unity project directory\n#\n# Get latest from https://github.c"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants/Custom Constants.asset.meta",
    "chars": 179,
    "preview": "fileFormatVersion: 2\nguid: cfee3bf03df3b40c3b654c2cfd4db724\ntimeCreated: 1495353467\nlicenseType: Pro\nNativeFormatImporte"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants/Default Constants.asset.meta",
    "chars": 179,
    "preview": "fileFormatVersion: 2\nguid: 9c8b2f5a7a56c4e21bee7ca4ccfc6640\ntimeCreated: 1495353467\nlicenseType: Pro\nNativeFormatImporte"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Constants.meta",
    "chars": 213,
    "preview": "fileFormatVersion: 2\nguid: 0808cee05a22541f1b7c328a1c052f38\nfolderAsset: yes\ntimeCreated: 1514605650\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/LICENSE_OFL.txt",
    "chars": 4301,
    "preview": "This Font Software is licensed under the SIL Open Font License,\nVersion 1.1.\n\nThis license is copied below, and is also "
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/LICENSE_OFL.txt.meta",
    "chars": 199,
    "preview": "fileFormatVersion: 2\nguid: e7f1e444a1fa94406a60546cb778466b\ntimeCreated: 1475660344\nlicenseType: Pro\nTextScriptImporter:"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts/NotoMono-Regular.ttf.meta",
    "chars": 577,
    "preview": "fileFormatVersion: 2\nguid: 278ecf23a382e4292b4a907449fd15f0\ntimeCreated: 1475660344\nlicenseType: Pro\nTrueTypeFontImporte"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate/Fonts.meta",
    "chars": 213,
    "preview": "fileFormatVersion: 2\nguid: 30a3ca36b7ccf4deb8e21cfe35ca7fd8\nfolderAsset: yes\ntimeCreated: 1475660340\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources/uShaderTemplate.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: 9cf019badb8c146e08ad33e26ab9e3a0\nfolderAsset: yes\ntimeCreated: 1495345278\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Resources.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: 22a5a44deb3d648c6abf24801723eca0\nfolderAsset: yes\ntimeCreated: 1495345065\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/CodeEditor.cs",
    "chars": 2998,
    "preview": "using UnityEngine;\nusing UnityEditor;\n\nnamespace uShaderTemplate\n{\n\npublic class CodeEditor\n{\n    public string control"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/CodeEditor.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: 62d234cb567694d2789ade8d5cab6a89\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ColorScheme.cs",
    "chars": 932,
    "preview": "namespace uShaderTemplate\n{\n\nnamespace ColorScheme\n{\n    // http://ethanschoonover.com/solarized\n    public static clas"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ColorScheme.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: 9cb8608d376b04cab8df8562d02cca44\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Common.cs",
    "chars": 1333,
    "preview": "using uShaderTemplate.ColorScheme;\n\nnamespace uShaderTemplate\n{\n\nnamespace Common\n{\n\npublic static class Color\n{ \n    p"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Common.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: 4a29e724630f4487cb646107886e433f\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Constants.cs",
    "chars": 433,
    "preview": "using UnityEngine;\n\nnamespace uShaderTemplate\n{\n\n[System.Serializable]\npublic struct Constant\n{\n    public string name;"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Constants.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: 0b69f41837370415ab1f75789505044f\ntimeCreated: 1495353387\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/FileWatcher.cs",
    "chars": 1735,
    "preview": "using System.IO;\nusing UnityEngine.Events;\n\nnamespace uShaderTemplate\n{\n\npublic class FileWatcher\n{\n    FileSystemWatch"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/FileWatcher.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: fc635ea546c084c8291db4721c1d416a\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Generator.cs",
    "chars": 1231,
    "preview": "using UnityEngine;\nusing System.Collections.Generic;\n\nnamespace uShaderTemplate\n{\n\n[System.Serializable]\npublic struct "
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Generator.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: 3acd6fe57257048db802c1c4c2b75248\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/GeneratorEditor.cs",
    "chars": 18227,
    "preview": "using UnityEngine;\nusing UnityEditor;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace uShad"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/GeneratorEditor.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: f0e7677688d9d41f385006d35eb6ce88\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/MaterialEditor.cs",
    "chars": 1237,
    "preview": "using UnityEngine;\nusing UnityEditor;\n\nnamespace uShaderTemplate\n{\n\npublic class MaterialEditor : ShaderGUI\n{\n    bool "
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/MaterialEditor.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: b2fe1cb944fe14609899b7870ce5e639\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderCodeEditor.cs",
    "chars": 2255,
    "preview": "using UnityEngine;\nusing UnityEditor;\n\nnamespace uShaderTemplate\n{\n\npublic class ShaderCodeEditor\n{\n    public string n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderCodeEditor.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: 79cc0d829733b429c9476e482f714b82\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderHighlighter.cs",
    "chars": 2685,
    "preview": "using System.Text.RegularExpressions;\nusing System.Collections.Generic;\n\nnamespace uShaderTemplate\n{\n\npublic static cla"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderHighlighter.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: 5ac75baca8c8f4d35b934f94decfb6b6\ntimeCreated: 1495351861\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderSyntax.cs",
    "chars": 4232,
    "preview": "using System.Text.RegularExpressions;\nusing System.Collections.Generic;\n\nnamespace uShaderTemplate\n{\n\npublic static cla"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderSyntax.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: fe815b6c248854d5aa4ddbff23ab32c6\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateParser.cs",
    "chars": 6299,
    "preview": "using System.Collections.Generic;\nusing System.Text.RegularExpressions;\n\nnamespace uShaderTemplate\n{\n\npublic class Shad"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateParser.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: bcb46db3577114bb4aadb54b6309e9e1\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateSelector.cs",
    "chars": 2729,
    "preview": "using UnityEngine;\nusing UnityEngine.Events;\nusing UnityEditor;\nusing System.Collections.Generic;\nusing System.IO;\nusin"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/ShaderTemplateSelector.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: a8acd5a733ea24db89ac81f30cb3f9d4\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Utils.cs",
    "chars": 2857,
    "preview": "using UnityEngine;\nusing UnityEngine.Assertions;\nusing UnityEditor;\nusing System.IO;\nusing System.Collections.Generic;\n"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts/Utils.cs.meta",
    "chars": 262,
    "preview": "fileFormatVersion: 2\nguid: 925b388b01b594c7698c988bb6d6ae93\ntimeCreated: 1495345065\nlicenseType: Pro\nMonoImporter:\n  ser"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/Scripts.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: aa9023223e4924f0b9c0b34c0d3080a1\nfolderAsset: yes\ntimeCreated: 1495350799\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Editor/uShaderTemplate.Editor.asmdef",
    "chars": 377,
    "preview": "{\n    \"name\": \"uShaderTemplate.Editor\",\n    \"rootNamespace\": \"\",\n    \"references\": [],\n    \"includePlatforms\": [\n       "
  },
  {
    "path": "Assets/uShaderTemplate/Editor/uShaderTemplate.Editor.asmdef.meta",
    "chars": 166,
    "preview": "fileFormatVersion: 2\nguid: a0c568dd17c433c488d48cb56a032e0b\nAssemblyDefinitionImporter:\n  externalObjects: {}\n  userData"
  },
  {
    "path": "Assets/uShaderTemplate/Editor.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: 1dc0de322bc9d4c928c2515ca6c0b497\nfolderAsset: yes\ntimeCreated: 1495345051\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Generators/Surface.asset.meta",
    "chars": 208,
    "preview": "fileFormatVersion: 2\nguid: 88c90c500f31b4686bae88f3a389e73f\ntimeCreated: 1495458303\nlicenseType: Pro\nNativeFormatImporte"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Generators/VertFrag.asset.meta",
    "chars": 179,
    "preview": "fileFormatVersion: 2\nguid: a0068c12e7d1a4937b32899156d170d1\ntimeCreated: 1495382657\nlicenseType: Pro\nNativeFormatImporte"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Generators.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: d17285a28a5464c8cb0d2066d7d2560e\nfolderAsset: yes\ntimeCreated: 1495350945\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/Surface.txt",
    "chars": 1920,
    "preview": "Shader \"Custom/<Name>\"\n{\n\n@constants uShaderTemplate/Constants/Custom Constants\n\nProperties\n{\n    _Color(\"Color\", Color)"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/Surface.txt.meta",
    "chars": 177,
    "preview": "fileFormatVersion: 2\nguid: 43bf8662976fb470b986a9f654977189\ntimeCreated: 1495457698\nlicenseType: Pro\nTextScriptImporter:"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/VertFrag.txt",
    "chars": 1010,
    "preview": "Shader \"Custom/<Name>\"\n{\n\nProperties\n{\n@block Properties\n_MainTex(\"Texture\", 2D) = \"white\" {}\n@endblock\n}\n\nSubShader\n{\n\n"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples/VertFrag.txt.meta",
    "chars": 177,
    "preview": "fileFormatVersion: 2\nguid: 606d21f85fa4348baa28d511ebe46d5d\ntimeCreated: 1495382484\nlicenseType: Pro\nTextScriptImporter:"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates/Examples.meta",
    "chars": 213,
    "preview": "fileFormatVersion: 2\nguid: b54e9e82905204f31afb0390f6bed8a7\nfolderAsset: yes\ntimeCreated: 1514533371\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources/ShaderTemplates.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: cd4d10a21be924728ae1d8b6a53576bd\nfolderAsset: yes\ntimeCreated: 1495348314\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor/Resources.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: dc5bf9f6e92bd4787a0ea1d3a7ce5629\nfolderAsset: yes\ntimeCreated: 1495348310\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Editor.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: 09890211325254c11a0addaf79b580cf\nfolderAsset: yes\ntimeCreated: 1495348306\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Materials/Surface.mat.meta",
    "chars": 207,
    "preview": "fileFormatVersion: 2\nguid: aa9bfc87f3c6443fe8bc35cecfd72a61\ntimeCreated: 1495458388\nlicenseType: Pro\nNativeFormatImporte"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Materials/VertFrag.mat.meta",
    "chars": 179,
    "preview": "fileFormatVersion: 2\nguid: 90705d78cb60a418395eea6f6df87e87\ntimeCreated: 1495382706\nlicenseType: Pro\nNativeFormatImporte"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Materials.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: e212224d38dfe42c8b1ddc1d65561bf7\nfolderAsset: yes\ntimeCreated: 1495382701\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders/Surface.shader",
    "chars": 1492,
    "preview": "Shader \"Custom/Surface\"\n{\n\nProperties\n{\n    _Color(\"Color\", Color) = (1,1,1,1)\n    _MainTex(\"Albedo (RGB)\", 2D) = \"white"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders/Surface.shader.meta",
    "chars": 195,
    "preview": "fileFormatVersion: 2\nguid: d578a6d4407644041b24ce3049babf46\ntimeCreated: 1495458321\nlicenseType: Pro\nShaderImporter:\n  d"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders/VertFrag.shader",
    "chars": 929,
    "preview": "Shader \"Custom/VertFrag\"\n{\n\nProperties\n{\n// @block Properties\n_MainTex(\"Texture\", 2D) = \"white\" {}\n// @endblock\n}\n\nSubSh"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders/VertFrag.shader.meta",
    "chars": 195,
    "preview": "fileFormatVersion: 2\nguid: e668248a8487547b7997f5d6854ea2d8\ntimeCreated: 1495382691\nlicenseType: Pro\nShaderImporter:\n  d"
  },
  {
    "path": "Assets/uShaderTemplate/Examples/Shaders.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: 13468f0d9df7046fba8d127c4b693310\nfolderAsset: yes\ntimeCreated: 1495346462\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/Examples.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: b090363427a0342dd86e61389443d439\nfolderAsset: yes\ntimeCreated: 1495346384\nlicenseType: Pro\nDe"
  },
  {
    "path": "Assets/uShaderTemplate/package.json",
    "chars": 625,
    "preview": "{\n    \"name\":\"com.hecomi.ushadertemplate\",\n    \"version\": \"1.0.0\",\n    \"displayName\": \"uShaderTemplate\",\n    \"descriptio"
  },
  {
    "path": "Assets/uShaderTemplate/package.json.meta",
    "chars": 158,
    "preview": "fileFormatVersion: 2\nguid: f6fb284ffdd781743a226884c89913ef\nTextScriptImporter:\n  externalObjects: {}\n  userData: \n  ass"
  },
  {
    "path": "Assets/uShaderTemplate.meta",
    "chars": 191,
    "preview": "fileFormatVersion: 2\nguid: 5251585ef4ed3468595a16e360ffb916\nfolderAsset: yes\ntimeCreated: 1495345044\nlicenseType: Pro\nDe"
  },
  {
    "path": "LICENSE.md",
    "chars": 1073,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2017 hecomi\n\nPermission is hereby granted, free of charge, to any person obtaining "
  },
  {
    "path": "Packages/manifest.json",
    "chars": 1756,
    "preview": "{\n  \"dependencies\": {\n    \"com.unity.analytics\": \"3.5.3\",\n    \"com.unity.collab-proxy\": \"1.3.9\",\n    \"com.unity.ide.ride"
  },
  {
    "path": "Packages/packages-lock.json",
    "chars": 9055,
    "preview": "{\n  \"dependencies\": {\n    \"com.unity.analytics\": {\n      \"version\": \"3.5.3\",\n      \"depth\": 0,\n      \"source\": \"registry"
  },
  {
    "path": "ProjectSettings/PackageManagerSettings.asset",
    "chars": 1003,
    "preview": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!114 &1\nMonoBehaviour:\n  m_ObjectHideFlags: 61\n  m_CorrespondingSourceObj"
  },
  {
    "path": "ProjectSettings/ProjectVersion.txt",
    "chars": 83,
    "preview": "m_EditorVersion: 2020.3.9f1\nm_EditorVersionWithRevision: 2020.3.9f1 (108be757e447)\n"
  },
  {
    "path": "ProjectSettings/VersionControlSettings.asset",
    "chars": 188,
    "preview": "%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!890905787 &1\nVersionControlSettings:\n  m_ObjectHideFlags: 0\n  m_Mode: Vi"
  },
  {
    "path": "README.md",
    "chars": 5719,
    "preview": "uShaderTemplate\n===============\n\n**uShaderTemplate** is an editor asset to create shaders from templates.\n\nInstall\n-----"
  }
]

// ... and 23 more files (download for full content)

About this extraction

This page contains the full source code of the hecomi/uShaderTemplate GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 96 files (88.4 KB), approximately 25.9k tokens, and a symbol index with 90 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!