summaryrefslogtreecommitdiff
path: root/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs
blob: 1333926fdc33c936ab49b8293b0aa9da8f1247cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace XSToonDynamicPenetration {
	public class XSReimportMyShadersPlease : AssetPostprocessor {
		private static string xsFilePath = null;
		static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) {
			if (xsFilePath == null) {
				xsFilePath = XSStyles.findAssetPath("");
			}
			foreach (string str in importedAssets) {
				if (str.StartsWith(xsFilePath + "/Main/CGIncludes")) {
					Debug.Log("XS CGInclude updated: " + str.Replace(xsFilePath + "/Main/CGIncludes/", ""));
					string[] files = Directory.GetFiles(xsFilePath + "/Main/Shaders", "*.shader");
					foreach (string file in files) {
						AssetDatabase.ImportAsset(file, ImportAssetOptions.ForceUpdate);
					}
				}

				if (str.StartsWith(xsFilePath + "/Main/Patreon/CGIncludes")) {
					Debug.Log("XS CGInclude updated: " + str.Replace(xsFilePath + "/Main/Patreon/CGIncludes/", ""));
					string[] files = Directory.GetFiles(xsFilePath + "/Main/Patreon/Shaders", "*.shader");
					foreach (string file in files) {
						AssetDatabase.ImportAsset(file, ImportAssetOptions.ForceUpdate);
					}
				}

			}
		}
	}
}