summaryrefslogtreecommitdiff
path: root/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor
diff options
context:
space:
mode:
Diffstat (limited to 'VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor')
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources.meta8
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources/MultiGradient_Object_Ico.pngbin0 -> 57419 bytes
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources/MultiGradient_Object_Ico.png.meta99
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSGradientEditor.cs483
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSGradientEditor.cs.meta11
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSMultiGradient.cs9
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSMultiGradient.cs.meta11
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs33
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs.meta11
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSStyles.cs320
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSStyles.cs.meta11
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSTextureMerger.cs240
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSTextureMerger.cs.meta11
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSToonInspector.cs734
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSToonInspector.cs.meta11
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSUpdater.cs210
-rw-r--r--VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSUpdater.cs.meta11
17 files changed, 2213 insertions, 0 deletions
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources.meta
new file mode 100644
index 00000000..19e4a1b9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: aca68975822e99b4bbae7f77e8ad97ab
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources/MultiGradient_Object_Ico.png b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources/MultiGradient_Object_Ico.png
new file mode 100644
index 00000000..6daac1ff
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources/MultiGradient_Object_Ico.png
Binary files differ
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources/MultiGradient_Object_Ico.png.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources/MultiGradient_Object_Ico.png.meta
new file mode 100644
index 00000000..b7bdefd6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/Resources/MultiGradient_Object_Ico.png.meta
@@ -0,0 +1,99 @@
+fileFormatVersion: 2
+guid: 46cf37146afb9a74782ce51bed717569
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 0
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ - serializedVersion: 2
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSGradientEditor.cs b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSGradientEditor.cs
new file mode 100644
index 00000000..6170b6f6
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSGradientEditor.cs
@@ -0,0 +1,483 @@
+using UnityEngine;
+using UnityEditor;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System;
+using UnityEditorInternal;
+
+namespace XSToonDynamicPenetration
+{
+ public class XSGradientEditor : EditorWindow
+ {
+ public List<int> gradients_index = new List<int>(new int[1] { 0 });
+ public List<Gradient> gradients = new List<Gradient>(5);
+ public Texture2D tex;
+
+ private string finalFilePath;
+
+ private bool isLinear = false;
+ private bool manualMaterial = false;
+ private enum Resolutions
+ {
+ Tiny64x8 = 64,
+ Small128x8 = 128,
+ Medium256x8 = 256,
+ Large512x8 = 512
+ }
+ private Resolutions res = Resolutions.Tiny64x8;
+ public static Material focusedMat;
+ private Material oldFocusedMat;
+ private Texture oldTexture;
+ private string rampProperty = "_Ramp";
+ private ReorderableList grad_index_reorderable;
+ private bool reorder;
+ private static GUIContent iconToolbarPlus;
+ private static GUIContent iconToolbarMinus;
+ private static GUIStyle preButton;
+ private static GUIStyle buttonBackground;
+ private bool changed;
+ private int loadGradIndex;
+ private XSMultiGradient xsmg;
+ private Vector2 scrollPos;
+
+ private bool dHelpText = false;
+ //private bool dAdvanced = false;
+
+ [MenuItem("Tools/Xiexe/XSToon/Gradient Editor")]
+ static public void Init()
+ {
+ XSGradientEditor window = EditorWindow.GetWindow<XSGradientEditor>(false, "XSToon: Gradient Editor", true);
+ window.minSize = new Vector2(450, 390);
+ }
+
+ public void OnGUI()
+ {
+ changed = false;
+ if (focusedMat != null)
+ {
+ XSStyles.ShurikenHeader("Current Material: " + focusedMat.name);
+ }
+ else
+ {
+ XSStyles.ShurikenHeader("Current Material: None");
+ }
+
+ if (preButton == null)
+ {
+ iconToolbarPlus = EditorGUIUtility.IconContent("Toolbar Plus", "Add Gradient");
+ iconToolbarMinus = EditorGUIUtility.IconContent("Toolbar Minus", "Remove Gradient");
+ preButton = new GUIStyle("RL FooterButton");
+ buttonBackground = new GUIStyle("RL Header");
+ }
+
+ if (gradients.Count == 0)
+ {
+ gradients.Add(new Gradient());
+ gradients.Add(new Gradient());
+ gradients.Add(new Gradient());
+ gradients.Add(new Gradient());
+ gradients.Add(new Gradient());
+ }
+
+ if (grad_index_reorderable == null)
+ {
+ makeReorderedList();
+ }
+
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ Rect r = EditorGUILayout.GetControlRect();
+ float rightEdge = r.xMax;
+ float leftEdge = rightEdge - 48f;
+ r = new Rect(leftEdge, r.y, rightEdge - leftEdge, r.height);
+ if (Event.current.type == EventType.Repaint) buttonBackground.Draw(r, false, false, false, false);
+ leftEdge += 18f;
+ EditorGUI.BeginDisabledGroup(gradients_index.Count == 5);
+ bool addE = GUI.Button(new Rect(leftEdge + 4, r.y, 25, 13), iconToolbarPlus, preButton);
+ EditorGUI.EndDisabledGroup();
+ EditorGUI.BeginDisabledGroup(gradients_index.Count == 1);
+ bool removeE = GUI.Button(new Rect(leftEdge - 19, r.y, 25, 13), iconToolbarMinus, preButton);
+ EditorGUI.EndDisabledGroup();
+
+ if (addE)
+ {
+ grad_index_reorderable.index++;
+ int wat = 0;
+ for (int i = 0; i < 5; i++)
+ {
+ if (!gradients_index.Contains(i))
+ {
+ wat = i;
+ break;
+ }
+ }
+ gradients_index.Add(wat);
+ changed = true;
+ }
+ if (removeE)
+ {
+ gradients_index.Remove(gradients_index[gradients_index.Count - 1]);
+ grad_index_reorderable.index--;
+ changed = true;
+ }
+
+ GUIStyle button = new GUIStyle(EditorStyles.miniButton);
+ button.normal = !reorder ? EditorStyles.miniButton.normal : EditorStyles.miniButton.onNormal;
+ if (GUILayout.Button(new GUIContent("Reorder", "Don't use Reorder if you want to undo a gradient change"), button, GUILayout.ExpandWidth(false)))
+ {
+ reorder = !reorder;
+ }
+ GUILayout.EndHorizontal();
+
+ SerializedObject serializedObject = new SerializedObject(this);
+ if (reorder)
+ {
+ grad_index_reorderable.DoLayoutList();
+ }
+ else
+ {
+ SerializedProperty colorGradients = serializedObject.FindProperty("gradients");
+ if (colorGradients.arraySize == 5)
+ {
+ for (int i = 0; i < gradients_index.Count; i++)
+ {
+ Rect _r = EditorGUILayout.GetControlRect();
+ _r.x += 16f;
+ _r.width -= 2f + 16f;
+ _r.height += 5f;
+ _r.y += 2f + (3f * i);
+ EditorGUI.PropertyField(_r, colorGradients.GetArrayElementAtIndex(gradients_index[i]), new GUIContent(""));
+ }
+ GUILayout.Space(Mathf.Lerp(9f, 24f, gradients_index.Count / 5f));
+ }
+ }
+ if (serializedObject.ApplyModifiedProperties()) changed = true;
+
+ if (oldFocusedMat != focusedMat)
+ {
+ changed = true;
+ if (this.oldTexture != null)
+ {
+ if (this.oldTexture == EditorGUIUtility.whiteTexture) this.oldTexture = null;
+ oldFocusedMat.SetTexture(rampProperty, this.oldTexture);
+ this.oldTexture = null;
+ }
+ oldFocusedMat = focusedMat;
+ }
+
+ Resolutions oldRes = res;
+ res = (Resolutions)EditorGUILayout.EnumPopup("Resolution: ", res);
+ if (oldRes != res) changed = true;
+
+ int width = (int)res;
+ int height = 30;
+ if (gradients_index.Count == 1)
+ {
+ height = 8;
+ }
+ else
+ {
+ height = 150;
+ }
+ if (tex == null)
+ {
+ tex = new Texture2D(width, height, TextureFormat.RGBA32, false);
+ }
+
+ bool old_isLinear = isLinear;
+ drawAdvancedOptions();
+ if (old_isLinear != isLinear)
+ {
+ changed = true;
+ }
+
+ if (manualMaterial)
+ {
+ focusedMat = (Material)EditorGUILayout.ObjectField(new GUIContent("", ""), focusedMat, typeof(Material), true);
+ }
+
+ if (focusedMat != null)
+ {
+ if (focusedMat.HasProperty("_Ramp"))
+ {
+ rampProperty = "_Ramp";
+ }
+ else
+ {
+ rampProperty = EditorGUILayout.TextField("Ramp Property Name", rampProperty);
+ if (!focusedMat.HasProperty(rampProperty))
+ {
+ GUILayout.Label("Property not found!");
+ }
+ }
+ }
+
+ if (changed)
+ {
+ updateTexture(width, height);
+ if (focusedMat != null)
+ {
+ if (focusedMat.HasProperty(rampProperty))
+ {
+ if (this.oldTexture == null)
+ {
+ if (focusedMat.GetTexture(rampProperty) == null)
+ {
+ this.oldTexture = EditorGUIUtility.whiteTexture;
+ }
+ else
+ {
+ this.oldTexture = focusedMat.GetTexture(rampProperty);
+ }
+ }
+ tex.wrapMode = TextureWrapMode.Clamp;
+ tex.Apply(false, false);
+ focusedMat.SetTexture(rampProperty, tex);
+ }
+ }
+ }
+
+ XSStyles.Separator();
+ drawMGInputOutput();
+
+
+ if (GUILayout.Button("Save Ramp"))
+ {
+ finalFilePath = XSStyles.findAssetPath(finalFilePath);
+ string path = EditorUtility.SaveFilePanel("Save Ramp as PNG", finalFilePath + "/Textures/Shadow Ramps/Generated", "gradient", "png");
+ if (path.Length != 0)
+ {
+ updateTexture(width, height);
+ bool success = GenTexture(tex, path);
+ if (success)
+ {
+ if (focusedMat != null)
+ {
+ string s = path.Substring(path.IndexOf("Assets"));
+ Texture ramp = AssetDatabase.LoadAssetAtPath<Texture>(s);
+ if (ramp != null)
+ {
+ focusedMat.SetTexture(rampProperty, ramp);
+ this.oldTexture = null;
+ }
+ }
+ }
+ }
+ }
+ drawHelpText();
+ }
+
+ Gradient reflessGradient(Gradient old_grad)
+ {
+ Gradient grad = new Gradient();
+ grad.SetKeys(old_grad.colorKeys, old_grad.alphaKeys);
+ grad.mode = old_grad.mode;
+ return grad;
+ }
+
+ List<int> reflessIndexes(List<int> old_indexes)
+ {
+ List<int> indexes = new List<int>();
+ for (int i = 0; i < old_indexes.Count; i++)
+ {
+ indexes.Add(old_indexes[i]);
+ }
+ return indexes;
+ }
+
+ void makeReorderedList()
+ {
+ grad_index_reorderable = new ReorderableList(gradients_index, typeof(int), true, false, false, false);
+ grad_index_reorderable.headerHeight = 0f;
+ grad_index_reorderable.footerHeight = 0f;
+ grad_index_reorderable.showDefaultBackground = true;
+
+ grad_index_reorderable.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
+ {
+ if (gradients.Count == 5)
+ {
+ Type editorGui = typeof(EditorGUI);
+ MethodInfo mi = editorGui.GetMethod("GradientField", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[2] { typeof(Rect), typeof(Gradient) }, null);
+ mi.Invoke(this, new object[2] { rect, gradients[gradients_index[index]] });
+ if (Event.current.type == EventType.Repaint)
+ {
+ changed = true;
+ }
+ }
+ };
+
+ grad_index_reorderable.onChangedCallback = (ReorderableList list) =>
+ {
+ changed = true;
+ };
+ }
+
+ void OnDestroy()
+ {
+ if (focusedMat != null)
+ {
+ if (this.oldTexture != null)
+ {
+ if (this.oldTexture == EditorGUIUtility.whiteTexture)
+ {
+ this.oldTexture = null;
+ }
+ focusedMat.SetTexture(rampProperty, this.oldTexture);
+ this.oldTexture = null;
+ }
+ focusedMat = null;
+ }
+ }
+
+ void updateTexture(int width, int height)
+ {
+ tex = new Texture2D(width, height, TextureFormat.RGBA32, false);
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ if (gradients_index.Count != 1)
+ {
+ int gradNum = Mathf.FloorToInt(y / 30f);
+ gradNum = Mathf.Abs(gradNum - 5) - 1;
+ if (gradNum >= gradients_index.Count)
+ {
+ tex.SetPixel(x, y, Color.white);
+ }
+ else
+ {
+ if (gradients[gradients_index[gradNum]] != null)
+ {
+ Color grad_col = gradients[gradients_index[gradNum]].Evaluate((float)x / (float)width);
+ tex.SetPixel(x, y, isLinear ? grad_col.gamma : grad_col);
+ }
+ else
+ {
+ tex.SetPixel(x, y, Color.white);
+ }
+ }
+ }
+ else
+ {
+ Color grad_col = gradients[gradients_index[0]].Evaluate((float)x / (float)width);
+ tex.SetPixel(x, y, isLinear ? grad_col.gamma : grad_col);
+ }
+ }
+ }
+ }
+
+ bool GenTexture(Texture2D tex, string path)
+ {
+ var pngData = tex.EncodeToPNG();
+ if (pngData != null)
+ {
+ File.WriteAllBytes(path, pngData);
+ AssetDatabase.Refresh();
+ return ChangeImportSettings(path);
+ }
+ return false;
+ }
+
+ bool ChangeImportSettings(string path)
+ {
+
+ string s = path.Substring(path.LastIndexOf("Assets"));
+ TextureImporter texture = (TextureImporter)TextureImporter.GetAtPath(s);
+ if (texture != null)
+ {
+ texture.wrapMode = TextureWrapMode.Clamp;
+ texture.maxTextureSize = 512;
+ texture.mipmapEnabled = false;
+ texture.textureCompression = TextureImporterCompression.Uncompressed;
+
+ // texture.sRGBTexture = !isLinear; // We already do the conversion in tex.SetPixel
+
+ texture.SaveAndReimport();
+ AssetDatabase.Refresh();
+ return true;
+
+ // shadowRamp = (Texture)Resources.Load(path);
+ // Debug.LogWarning(shadowRamp.ToString());
+ }
+ else
+ {
+ Debug.Log("Asset Path is Null, can't set to Clamped.\n You'll need to do it manually.");
+ }
+ return false;
+ }
+
+ void drawMGInputOutput()
+ {
+ GUILayout.BeginHorizontal();
+ XSMultiGradient old_xsmg = xsmg;
+ xsmg = (XSMultiGradient)EditorGUILayout.ObjectField("MultiGradient Preset", xsmg, typeof(XSMultiGradient), false, null);
+ if (xsmg != old_xsmg)
+ {
+ if (xsmg != null)
+ {
+ this.gradients = xsmg.gradients;
+ this.gradients_index = xsmg.order;
+ makeReorderedList();
+ }
+ else
+ {
+ List<Gradient> new_Grads = new List<Gradient>();
+ for (int i = 0; i < this.gradients.Count; i++)
+ {
+ new_Grads.Add(reflessGradient(this.gradients[i]));
+ }
+ this.gradients = new_Grads;
+ this.gradients_index = reflessIndexes(this.gradients_index);
+ makeReorderedList();
+ }
+ changed = true;
+ }
+
+ if (GUILayout.Button("Save New", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
+ {
+ finalFilePath = XSStyles.findAssetPath(finalFilePath);
+ string path = EditorUtility.SaveFilePanel("Save MultiGradient", (finalFilePath + "/Textures/Shadow Ramps/MGPresets"), "MultiGradient", "asset");
+ if (path.Length != 0)
+ {
+ path = path.Substring(Application.dataPath.Length - "Assets".Length);
+ XSMultiGradient _xsmg = ScriptableObject.CreateInstance<XSMultiGradient>();
+ _xsmg.uniqueName = Path.GetFileNameWithoutExtension(path);
+ foreach (Gradient grad in gradients)
+ {
+ _xsmg.gradients.Add(reflessGradient(grad));
+ }
+ _xsmg.order.AddRange(gradients_index.ToArray());
+ xsmg = _xsmg;
+ AssetDatabase.CreateAsset(_xsmg, path);
+ this.gradients = xsmg.gradients;
+ this.gradients_index = xsmg.order;
+ makeReorderedList();
+ AssetDatabase.SaveAssets();
+ }
+ }
+ GUILayout.EndHorizontal();
+ }
+
+ void drawAdvancedOptions()
+ {
+ GUILayout.BeginHorizontal();
+ isLinear = GUILayout.Toggle(isLinear, "Make Linear Texture");
+ manualMaterial = GUILayout.Toggle(manualMaterial, "Manual Material");
+ GUILayout.EndHorizontal();
+ }
+
+ void drawHelpText()
+ {
+ XSStyles.Separator();
+ dHelpText = XSStyles.ShurikenFoldout("Information", dHelpText);
+ if(dHelpText)
+ {
+ scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
+ XSStyles.HelpBox("You can use this to create a custom shadow ramp in realtime. \nIf you do not save, the ramp will be reverted back to what it was previously. \n\n - Click the Gradient box. \n - Choose resolution of the texture. \n - Save.", MessageType.Info);
+ XSStyles.HelpBox("Ramp textures support up to 5 ramps in one texture. That means you can have up to 5 ramps on a single material. You will need to author a ramp mask to choose which ramp to sample from. \n\nA texture that is fully black would sample from the bottom ramp, a texture that is fully white would sample from the top ramp, and a texture that is half gray would sample from the middle ramp. \n\n A quick tip would be that you can sample from each of the 5 ramps with 0, 0.25, 0.5, 0.75, and 1 on the texture. \n\nThe order of the gradients on the UI is the order that they will be on the texture.", MessageType.Info);
+ EditorGUILayout.EndScrollView();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSGradientEditor.cs.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSGradientEditor.cs.meta
new file mode 100644
index 00000000..93371d12
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSGradientEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2f402012dc1f97241afd53cce53f8253
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSMultiGradient.cs b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSMultiGradient.cs
new file mode 100644
index 00000000..860defde
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSMultiGradient.cs
@@ -0,0 +1,9 @@
+using System.Collections.Generic;
+using UnityEngine;
+namespace XSToonDynamicPenetration {
+ public class XSMultiGradient : ScriptableObject {
+ public string uniqueName = "New Gradient";
+ public List<Gradient> gradients = new List<Gradient>();
+ public List<int> order = new List<int>();
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSMultiGradient.cs.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSMultiGradient.cs.meta
new file mode 100644
index 00000000..a17bc010
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSMultiGradient.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2ba3b19d21291594ea250616ef4fcc77
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {fileID: 2800000, guid: be9c15115645ef049adaf17bee497ab7, type: 3}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs
new file mode 100644
index 00000000..1333926f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs
@@ -0,0 +1,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);
+ }
+ }
+
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs.meta
new file mode 100644
index 00000000..800bfd08
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSReimportMyShadersPlease.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2d7cac5f3a285194bb896fefb1e28bb0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSStyles.cs b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSStyles.cs
new file mode 100644
index 00000000..56cf791e
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSStyles.cs
@@ -0,0 +1,320 @@
+using System.Collections.Generic;
+using System.IO;
+using UnityEditor;
+using UnityEngine;
+namespace XSToonDynamicPenetration {
+ [InitializeOnLoad]
+ public class XSStyles : MonoBehaviour {
+ public static string ver = "2.2.4";
+
+ //Help URLs
+ public static string mainURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.xh0nk8x7ws1g";
+ public static string normalsURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.j7qze9btrmw8";
+ public static string shadowsURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.8l0gi0hntyfs";
+ public static string rimlightURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.tpxp2jrhrhxp";
+ public static string emissionsURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.zc983jrwb5x4";
+ public static string specularURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.gyu8l75mbtdq";
+ public static string reflURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.yqzg9axi3gi";
+ public static string sssURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.j2nk83f6azph";
+ public static string outlineURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE/edit#bookmark=id.jpaf9t25in8p";
+
+ public static string uiPath;
+ private static string patronpath;
+
+ public static class Styles {
+ public static GUIContent version = new GUIContent("XSToon v" + ver, "The currently installed version of XSToon.");
+ }
+
+ // Labels
+ public static void DoHeader(GUIContent HeaderText) {
+ GUILayout.Label(HeaderText, new GUIStyle(EditorStyles.boldLabel) {
+ alignment = TextAnchor.MiddleCenter,
+ wordWrap = true,
+ fontSize = 12
+ });
+ }
+
+ public static void doLabel(string text) {
+ GUILayout.Label(text, new GUIStyle(EditorStyles.label) {
+ alignment = TextAnchor.MiddleCenter,
+ wordWrap = true,
+ fontSize = 12
+ });
+ }
+
+ public static void doLabelLeft(string text) {
+ GUILayout.Label(text, new GUIStyle(EditorStyles.label) {
+ alignment = TextAnchor.MiddleLeft,
+ wordWrap = true,
+ fontSize = 12
+ });
+ }
+
+ public static void doLabelSmall(string text) {
+ GUILayout.Label(text, new GUIStyle(EditorStyles.label) {
+ alignment = TextAnchor.MiddleLeft,
+ wordWrap = true,
+ fontSize = 10
+ });
+ }
+ // ----
+
+ static public GUIStyle _LineStyle;
+ static public GUIStyle LineStyle {
+ get {
+ if (_LineStyle == null) {
+ _LineStyle = new GUIStyle();
+ _LineStyle.normal.background = EditorGUIUtility.whiteTexture;
+ _LineStyle.stretchWidth = true;
+ }
+
+ return _LineStyle;
+ }
+ }
+
+ //GUI Buttons
+ static public void callGradientEditor(Material focusedMat = null) {
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ GUI.skin = null;
+ if (GUILayout.Button("Open Gradient Editor", GUILayout.Width(200), GUILayout.Height(20))) {
+ XSGradientEditor.focusedMat = focusedMat;
+ XSGradientEditor.Init();
+ }
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+ }
+
+ static public void ResetAdv(Material material) {
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ GUI.skin = null;
+ if (GUILayout.Button("Reset ZTest / ZWrite", GUILayout.Width(200), GUILayout.Height(20))) {
+ material.SetFloat("_ZTest", 4);
+ material.SetFloat("_ZWrite", 1);
+ }
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+ }
+
+ static public void ResetAdvAll(Material material) {
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ GUI.skin = null;
+ if (GUILayout.Button("Reset All Advanced", GUILayout.Width(200), GUILayout.Height(20))) {
+ material.SetFloat("_colormask", 15);
+ material.SetFloat("_Stencil", 0);
+ material.SetFloat("_StencilComp", 0);
+ material.SetFloat("_StencilOp", 0);
+ material.SetFloat("_StencilFail", 0);
+ material.SetFloat("_StencilZFail", 0);
+ material.SetFloat("_ZWrite", 1);
+ material.SetFloat("_ZTest", 4);
+ material.SetFloat("_UseUV2forNormalsSpecular", 0);
+ material.SetFloat("_RampBaseAnchor", 0.5f);
+ }
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+ }
+
+ static public void CallResetAdv(Material material) {
+ material.SetFloat("_colormask", 15);
+ material.SetFloat("_Stencil", 0);
+ material.SetFloat("_StencilComp", 0);
+ material.SetFloat("_StencilOp", 0);
+ material.SetFloat("_StencilFail", 0);
+ material.SetFloat("_StencilZFail", 0);
+ material.SetFloat("_ZWrite", 1);
+ material.SetFloat("_ZTest", 4);
+ material.SetFloat("_UseUV2forNormalsSpecular", 0);
+ material.SetFloat("_RampBaseAnchor", 0.5f);
+ }
+ //------
+
+ //Help Box
+ public static void HelpBox(string message, MessageType type) {
+ EditorGUILayout.HelpBox(message, type);
+ }
+
+ //GUI Lines
+ static public void Separator() {
+ GUILayout.Space(4);
+ GUILine(new Color(.3f, .3f, .3f), 1);
+ GUILine(new Color(.9f, .9f, .9f), 1);
+ GUILayout.Space(4);
+ }
+
+ static public void SeparatorThin() {
+ GUILayout.Space(2);
+ GUILine(new Color(.1f, .1f, .1f), 1f);
+ GUILine(new Color(.3f, .3f, .3f), 1f);
+ GUILayout.Space(2);
+ }
+
+ static public void SeparatorBig() {
+ GUILayout.Space(10);
+ GUILine(new Color(.3f, .3f, .3f), 2);
+ GUILayout.Space(1);
+ GUILine(new Color(.3f, .3f, .3f), 2);
+ GUILine(new Color(.85f, .85f, .85f), 1);
+ GUILayout.Space(10);
+ }
+
+ static public void GUILine(float height = 2f) {
+ GUILine(Color.black, height);
+ }
+
+ static public void GUILine(Color color, float height = 2f) {
+ Rect position = GUILayoutUtility.GetRect(0f, float.MaxValue, height, height, LineStyle);
+
+ if (Event.current.type == EventType.Repaint) {
+ Color orgColor = GUI.color;
+ GUI.color = orgColor * color;
+ LineStyle.Draw(position, false, false, false, false);
+ GUI.color = orgColor;
+ }
+ }
+ // --------------
+
+ //Help Buttons
+ public static void helpPopup(string url) //bool showBox, string title, string message, string button)
+ {
+ if (GUILayout.Button("?", "helpButton", GUILayout.Width(16), GUILayout.Height(16))) {
+ Application.OpenURL(url);
+ // showBox = true;
+ // if (showBox == true)
+ // {
+ // EditorUtility.DisplayDialog(title,
+ // message, button);
+ // }
+ }
+ }
+
+ //Find Asset Path
+ public static string findAssetPath(string finalFilePath) {
+ string[] guids1 = AssetDatabase.FindAssets("XSUpdater", null);
+ string untouchedString = AssetDatabase.GUIDToAssetPath(guids1[0]);
+ string[] splitString = untouchedString.Split('/');
+
+ ArrayUtility.RemoveAt(ref splitString, splitString.Length - 1);
+ ArrayUtility.RemoveAt(ref splitString, splitString.Length - 1);
+
+ finalFilePath = string.Join("/", splitString);
+ return finalFilePath;
+ }
+
+ //exrta buttons
+ public static void githubButton(int Width, int Height) {
+ if (GUILayout.Button("Github", GUILayout.Width(Width), GUILayout.Height(Height))) {
+ Application.OpenURL("https://github.com/Xiexe");
+ }
+ }
+
+ public static void discordButton(int Width, int Height) {
+ if (GUILayout.Button("Discord", GUILayout.Width(Width), GUILayout.Height(Height))) {
+ Application.OpenURL("https://discord.gg/3JDeUTw");
+ }
+
+ }
+
+ public static void patreonButton(int Width, int Height) {
+ if (GUILayout.Button("Patreon", GUILayout.Width(Width), GUILayout.Height(Height))) {
+ Application.OpenURL("https://www.patreon.com/xiexe");
+ }
+ }
+
+ public static void openInfoPanel(int Width, int Height) {
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ if (GUILayout.Button("Updater | Documentation", GUILayout.Width(Width), GUILayout.Height(Height))) {
+ XSUpdater.Init();
+ }
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+ }
+
+ private static Rect DrawShuriken(string title, Vector2 contentOffset, int HeaderHeight) {
+ var style = new GUIStyle("ShurikenModuleTitle");
+ style.font = new GUIStyle(EditorStyles.boldLabel).font;
+ style.border = new RectOffset(15, 7, 4, 4);
+ style.fixedHeight = HeaderHeight;
+ style.contentOffset = contentOffset;
+ var rect = GUILayoutUtility.GetRect(16f, HeaderHeight, style);
+
+ GUI.Box(rect, title, style);
+ return rect;
+ }
+
+ private static Rect DrawShurikenCenteredTitle(string title, Vector2 contentOffset, int HeaderHeight) {
+ var style = new GUIStyle("ShurikenModuleTitle");
+ style.font = new GUIStyle(EditorStyles.boldLabel).font;
+ style.border = new RectOffset(15, 7, 4, 4);
+ style.fixedHeight = HeaderHeight;
+ style.contentOffset = contentOffset;
+ style.alignment = TextAnchor.MiddleCenter;
+ var rect = GUILayoutUtility.GetRect(16f, HeaderHeight, style);
+
+ GUI.Box(rect, title, style);
+ return rect;
+ }
+
+ public static bool ShurikenFoldout(string title, bool display) {
+ var rect = DrawShuriken(title, new Vector2(20f, -2f), 22);
+ 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 void ShurikenHeader(string title) {
+ DrawShuriken(title, new Vector2(6f, -2f), 22);
+ }
+
+ public static void ShurikenHeaderCentered(string title) {
+ DrawShurikenCenteredTitle(title, new Vector2(0f, -2f), 22);
+ }
+
+ public static void constrainedShaderProperty(MaterialEditor materialEditor, MaterialProperty prop, GUIContent style, int tabSize) {
+ EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(30));
+ materialEditor.ShaderProperty(prop, style, tabSize);
+ EditorGUILayout.EndHorizontal();
+ }
+
+ public static void DoFooter() {
+ EditorGUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ XSStyles.discordButton(70, 30);
+ XSStyles.patreonButton(70, 30);
+ XSStyles.githubButton(70, 30);
+ GUILayout.FlexibleSpace();
+ EditorGUILayout.EndHorizontal();
+
+ XSStyles.openInfoPanel(200, 20);
+ }
+
+ public static bool HelpBoxWithButton(GUIContent messageContent, GUIContent buttonContent) {
+ const float kButtonWidth = 60f;
+ const float kSpacing = 5f;
+ const float kButtonHeight = 20f;
+
+ // Reserve size of wrapped text
+ Rect contentRect = GUILayoutUtility.GetRect(messageContent, EditorStyles.helpBox);
+ // Reserve size of button
+ GUILayoutUtility.GetRect(1, kButtonHeight + kSpacing);
+
+ // Render background box with text at full height
+ contentRect.height += kButtonHeight + kSpacing;
+ GUI.Label(contentRect, messageContent, EditorStyles.helpBox);
+
+ // Button (align lower right)
+ Rect buttonRect = new Rect(contentRect.xMax - kButtonWidth - 4f, contentRect.yMax - kButtonHeight - 4f, kButtonWidth, kButtonHeight);
+ return GUI.Button(buttonRect, buttonContent);
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSStyles.cs.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSStyles.cs.meta
new file mode 100644
index 00000000..8b78ec11
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSStyles.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6fbe6c90b2cf2fd4db4c32d7f9702612
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSTextureMerger.cs b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSTextureMerger.cs
new file mode 100644
index 00000000..afb8f04f
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSTextureMerger.cs
@@ -0,0 +1,240 @@
+//Script created by Merlin and Xiexe.
+using System.Collections;
+using System.IO;
+using UnityEditor;
+using UnityEngine;
+namespace XSToonDynamicPenetration {
+ public class XSTextureMerger : EditorWindow {
+
+ private enum resolutions {
+ Tiny_256x256,
+ Small_512x512,
+ Medium_1024x1024,
+ Large_2048x2048,
+ VeryLarge_4096x4096,
+ Why_8192x8192
+ }
+
+ private enum EChannels {
+ None,
+ Red,
+ Green,
+ Blue,
+ Alpha
+ }
+
+ private enum ETextures {
+ None,
+ Tex1,
+ Tex2,
+ Tex3,
+ Tex4
+ }
+
+ private Texture2D[] textures = new Texture2D[4];
+ private EChannels[] texChannels = new EChannels[4];
+ private ETextures[] pickTexture = new ETextures[4];
+ private bool[] invertChannel = new bool[4];
+
+ private static int srcTex;
+ private resolutions res;
+ private Vector2 scrollPos;
+ private static int resolution;
+ private static string finalFilePath;
+ private static Color outColor;
+ private static Color[] texColors = new Color[4];
+
+ private static float progress;
+ [MenuItem("Tools/Xiexe/XSToon/Texture Merger")]
+ static public void Init() {
+ XSTextureMerger window = EditorWindow.GetWindow<XSTextureMerger>(false, "XSToon: Texture Merger", true);
+ window.minSize = new Vector2(500, 300);
+ window.maxSize = new Vector2(500, 500);
+ }
+
+ public void OnGUI() {
+ scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
+
+ GUILayout.BeginHorizontal();
+ GUILayout.Space(105);
+ XSStyles.doLabel("1");
+ GUILayout.Space(105);
+ XSStyles.doLabel("2");
+ GUILayout.Space(105);
+ XSStyles.doLabel("3");
+ GUILayout.Space(105);
+ XSStyles.doLabel("4");
+ GUILayout.EndHorizontal();
+
+ XSStyles.SeparatorThin();
+ GUILayout.BeginHorizontal();
+ for (int i = 0; i < 4; i++) {
+ EditorGUIUtility.labelWidth = 0.01f;
+ textures[i] = (Texture2D) EditorGUILayout.ObjectField(new GUIContent("", ""), textures[i], typeof(Texture2D), true);
+
+ }
+ GUILayout.EndHorizontal();
+
+ float oldLabelWidth = EditorGUIUtility.labelWidth;
+ EditorGUIUtility.labelWidth = 40;
+ GUIStyle headerStyle = EditorStyles.boldLabel;
+ headerStyle.alignment = TextAnchor.UpperLeft;
+ headerStyle.fontStyle = FontStyle.Bold;
+ headerStyle.stretchWidth = true;
+
+ XSStyles.SeparatorThin();
+ EditorGUILayout.BeginHorizontal();
+ GUILayout.Label("Output Channel:", headerStyle);
+
+ GUILayout.Label("R", headerStyle);
+ GUILayout.Label("G", headerStyle);
+ GUILayout.Label("B", headerStyle);
+ GUILayout.Label("A", headerStyle);
+ EditorGUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal();
+ GUILayout.Label("Src Texture:");
+ GUILayout.Space(20);
+ for (int i = 0; i < 4; i++) {
+ pickTexture[i] = (ETextures) EditorGUILayout.EnumPopup("", pickTexture[i]);
+ }
+ GUILayout.EndHorizontal();
+
+ GUILayout.BeginHorizontal();
+ GUILayout.Label("Src Channel:");
+ GUILayout.Space(17);
+ for (int i = 0; i < 4; i++) {
+ texChannels[i] = (EChannels) EditorGUILayout.EnumPopup("", texChannels[i]);
+ }
+ GUILayout.EndHorizontal();
+ GUILayout.BeginHorizontal();
+ GUILayout.Label("Invert Channel:");
+ for (int i = 0; i < 4; i++) {
+ invertChannel[i] = EditorGUILayout.Toggle("", invertChannel[i]);
+ }
+ GUILayout.EndHorizontal();
+
+ GUILayout.Space(20);
+ EditorGUILayout.EndScrollView();
+
+ //Button and Resolution
+ GUILayout.BeginVertical();
+ XSStyles.doLabel("Resolution");
+
+ GUILayout.BeginHorizontal();
+ GUILayout.Space(175);
+ res = (resolutions) EditorGUILayout.EnumPopup("", res);
+ GUILayout.Space(175);
+ GUILayout.EndHorizontal();
+
+ if (GUILayout.Button("Merge Channels")) {
+ if (progress < 2) {
+ EditorUtility.DisplayProgressBar("XSToon Texture Merger", "Merging and compressing new texture...", (float) (progress / 2));
+ }
+
+ //Set target textures to be ReadWriteable
+
+ for (int i = 0; i < textures.Length; i++) {
+ if (textures[i] == null)
+ break;
+
+ string texturePath = AssetDatabase.GetAssetPath(textures[i]);
+ TextureImporter texture = (TextureImporter) TextureImporter.GetAtPath(texturePath);
+ if (texture != null) {
+ texture.isReadable = true;
+ texture.SaveAndReimport();
+ }
+ }
+
+ switch (res) {
+ case resolutions.Tiny_256x256:
+ resolution = 256;
+ break;
+
+ case resolutions.Small_512x512:
+ resolution = 512;
+ break;
+
+ case resolutions.Medium_1024x1024:
+ resolution = 1024;
+ break;
+
+ case resolutions.Large_2048x2048:
+ resolution = 2048;
+ break;
+
+ case resolutions.VeryLarge_4096x4096:
+ resolution = 4096;
+ break;
+
+ case resolutions.Why_8192x8192:
+ resolution = 8192;
+ break;
+ }
+
+ XSStyles.findAssetPath(finalFilePath);
+ finalFilePath = EditorUtility.SaveFilePanel("Save Merged Texture", finalFilePath + "/Textures/", "mergedTex.png", "png");
+
+ Texture2D newTexture = new Texture2D(resolution, resolution, TextureFormat.RGBA32, false);
+
+ //Get Colors textures and write them to the proper channel
+
+ for (int y = 0; y < resolution; y++) {
+ for (int x = 0; x < resolution; x++) {
+ float u = x / (float) resolution;
+ float v = y / (float) resolution;
+
+ // Grab out the texture values into an array for later lookup. Could probably just be done at the moment the texture color is needed.
+ for (int i = 0; i < textures.Length; i++) {
+ if (textures[i] != null) {
+ texColors[i] = textures[i].GetPixelBilinear(u, v);
+ } else {
+ texColors[i] = new Color(0, 0, 0, 1);
+ }
+ }
+
+ Color outputColor = new Color(0, 0, 0, 1);
+
+ // Iterate the output RGBA channels
+ for (int i = 0; i < 4; i++) {
+ // Convert the enums to indices we can use. 'None' will turn into -1 which will be discarded as invalid.
+ int srcTexIdx = ((int) pickTexture[i]) - 1;
+ int srcChannelIdx = ((int) texChannels[i]) - 1;
+
+ // Go through each channel in the output color and assign it
+ if (srcTexIdx >= 0 && srcChannelIdx >= 0) {
+ outputColor[i] = texColors[srcTexIdx][srcChannelIdx];
+
+ //Allow you to invert specific channels.
+ if (invertChannel[i]) {
+ outputColor[i] = 1f - outputColor[i];
+ }
+ }
+ }
+
+ newTexture.SetPixel(x, y, outputColor);
+ }
+ }
+ progress += 1;
+ newTexture.Apply();
+ ExportTexture(newTexture);
+ }
+
+ GUILayout.Space(10);
+ GUILayout.EndVertical();
+
+ EditorGUIUtility.labelWidth = oldLabelWidth;
+ }
+
+ private static void ExportTexture(Texture2D newTexture) {
+ var pngData = newTexture.EncodeToPNG();
+
+ if (pngData != null) {
+ File.WriteAllBytes(finalFilePath, pngData);
+ AssetDatabase.Refresh();
+ }
+ progress += 1;
+ EditorUtility.ClearProgressBar();
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSTextureMerger.cs.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSTextureMerger.cs.meta
new file mode 100644
index 00000000..e08441a9
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSTextureMerger.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c8ee9dec630580044a70e2ebf30730db
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSToonInspector.cs b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSToonInspector.cs
new file mode 100644
index 00000000..108fffce
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSToonInspector.cs
@@ -0,0 +1,734 @@
+using UnityEditor;
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System;
+using System.Reflection;
+
+namespace XSToonDynamicPenetration
+{
+ public class XSToonInspector : ShaderGUI
+ {
+ BindingFlags bindingFlags = BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.Instance |
+ BindingFlags.Static;
+
+ //Assign all properties as null at first to stop hundreds of warnings spamming the log when script gets compiled.
+ //If they aren't we get warnings, because assigning with reflection seems to make Unity think that the properties never actually get used.
+ private MaterialProperty _VertexColorAlbedo = null;
+ private MaterialProperty _TilingMode = null;
+ private MaterialProperty _Culling = null;
+ private MaterialProperty _BlendMode = null;
+ private MaterialProperty _MainTex = null;
+ private MaterialProperty _HSVMask = null;
+ private MaterialProperty _Saturation = null;
+ private MaterialProperty _Hue = null;
+ private MaterialProperty _Value = null;
+ private MaterialProperty _Color = null;
+ private MaterialProperty _Cutoff = null;
+ private MaterialProperty _FadeDither = null;
+ private MaterialProperty _FadeDitherDistance = null;
+ private MaterialProperty _BumpMap = null;
+ private MaterialProperty _BumpScale = null;
+ private MaterialProperty _DetailNormalMap = null;
+ private MaterialProperty _DetailMask = null;
+ private MaterialProperty _DetailNormalMapScale = null;
+ private MaterialProperty _ReflectionMode = null;
+ private MaterialProperty _ReflectionBlendMode = null;
+ private MaterialProperty _MetallicGlossMap = null;
+ private MaterialProperty _BakedCubemap = null;
+ private MaterialProperty _Matcap = null;
+ private MaterialProperty _MatcapTintToDiffuse = null;
+ private MaterialProperty _MatcapTint = null;
+ private MaterialProperty _ReflectivityMask = null;
+ private MaterialProperty _Metallic = null;
+ private MaterialProperty _Glossiness = null;
+ private MaterialProperty _Reflectivity = null;
+ private MaterialProperty _ClearCoat = null;
+ private MaterialProperty _ClearcoatStrength = null;
+ private MaterialProperty _ClearcoatSmoothness = null;
+ private MaterialProperty _EmissionMap = null;
+ private MaterialProperty _ScaleWithLight = null;
+ private MaterialProperty _ScaleWithLightSensitivity = null;
+ private MaterialProperty _EmissionColor = null;
+ private MaterialProperty _EmissionToDiffuse = null;
+ private MaterialProperty _RimColor = null;
+ private MaterialProperty _RimIntensity = null;
+ private MaterialProperty _RimRange = null;
+ private MaterialProperty _RimThreshold = null;
+ private MaterialProperty _RimSharpness = null;
+ private MaterialProperty _RimAlbedoTint = null;
+ private MaterialProperty _RimCubemapTint = null;
+ private MaterialProperty _RimAttenEffect = null;
+ private MaterialProperty _SpecularSharpness = null;
+ private MaterialProperty _SpecularMap = null;
+ private MaterialProperty _SpecularIntensity = null;
+ private MaterialProperty _SpecularArea = null;
+ private MaterialProperty _AnisotropicSpecular = null;
+ private MaterialProperty _AnisotropicReflection = null;
+ private MaterialProperty _SpecularAlbedoTint = null;
+ private MaterialProperty _RampSelectionMask = null;
+ private MaterialProperty _Ramp = null;
+ private MaterialProperty _ShadowRim = null;
+ private MaterialProperty _ShadowRimRange = null;
+ private MaterialProperty _ShadowRimThreshold = null;
+ private MaterialProperty _ShadowRimSharpness = null;
+ private MaterialProperty _ShadowRimAlbedoTint = null;
+ private MaterialProperty _OcclusionMap = null;
+ private MaterialProperty _OcclusionIntensity = null;
+ private MaterialProperty _OcclusionMode = null;
+ private MaterialProperty _ThicknessMap = null;
+ private MaterialProperty _SSColor = null;
+ private MaterialProperty _SSDistortion = null;
+ private MaterialProperty _SSPower = null;
+ private MaterialProperty _SSScale = null;
+ private MaterialProperty _HalftoneDotSize = null;
+ private MaterialProperty _HalftoneDotAmount = null;
+ private MaterialProperty _HalftoneLineAmount = null;
+ private MaterialProperty _HalftoneLineIntensity = null;
+ private MaterialProperty _HalftoneType = null;
+ private MaterialProperty _UVSetAlbedo = null;
+ private MaterialProperty _UVSetNormal = null;
+ private MaterialProperty _UVSetDetNormal = null;
+ private MaterialProperty _UVSetDetMask = null;
+ private MaterialProperty _UVSetMetallic = null;
+ private MaterialProperty _UVSetSpecular = null;
+ private MaterialProperty _UVSetReflectivity = null;
+ private MaterialProperty _UVSetThickness = null;
+ private MaterialProperty _UVSetOcclusion = null;
+ private MaterialProperty _UVSetEmission = null;
+ private MaterialProperty _UVSetClipMap = null;
+ private MaterialProperty _UVSetDissolve = null;
+ private MaterialProperty _Stencil = null;
+ private MaterialProperty _StencilComp = null;
+ private MaterialProperty _StencilOp = null;
+ private MaterialProperty _OutlineAlbedoTint = null;
+ private MaterialProperty _OutlineLighting = null;
+ private MaterialProperty _OutlineMask = null;
+ private MaterialProperty _OutlineWidth = null;
+ private MaterialProperty _OutlineColor = null;
+ private MaterialProperty _OutlineNormalMode = null;
+ private MaterialProperty _OutlineUVSelect = null;
+ private MaterialProperty _ShadowSharpness = null;
+ private MaterialProperty _AdvMode = null;
+ private MaterialProperty _ClipMap = null;
+ private MaterialProperty _ClipAgainstVertexColorGreaterZeroFive = null;
+ private MaterialProperty _ClipAgainstVertexColorLessZeroFive = null;
+ private MaterialProperty _IOR = null;
+ private MaterialProperty _UseRefraction = null;
+ private MaterialProperty _RefractionModel = null;
+ private MaterialProperty _NormalMapMode = null;
+ private MaterialProperty _DissolveCoordinates = null;
+ private MaterialProperty _DissolveTexture = null;
+ private MaterialProperty _DissolveStrength = null;
+ private MaterialProperty _DissolveColor = null;
+ private MaterialProperty _DissolveProgress = null;
+ private MaterialProperty _UseClipsForDissolve = null;
+
+ //Material Properties for Dynamic Penetration System
+ private MaterialProperty _Squeeze = null;
+ private MaterialProperty _SqueezeDist = null;
+ private MaterialProperty _BulgeOffset = null;
+ private MaterialProperty _BulgePower = null;
+ private MaterialProperty _Length = null;
+ private MaterialProperty _EntranceStiffness = null;
+ private MaterialProperty _Curvature = null;
+ private MaterialProperty _ReCurvature = null;
+ private MaterialProperty _WriggleSpeed = null;
+ private MaterialProperty _Wriggle = null;
+ private MaterialProperty _OrificeChannel = null;
+ private MaterialProperty _OrificeData = null;
+ private MaterialProperty _EntryOpenDuration = null;
+ private MaterialProperty _Shape1Depth = null;
+ private MaterialProperty _Shape1Duration = null;
+ private MaterialProperty _Shape2Depth = null;
+ private MaterialProperty _Shape2Duration = null;
+ private MaterialProperty _Shape3Depth = null;
+ private MaterialProperty _Shape3Duration = null;
+ private MaterialProperty _BlendshapePower = null;
+ private MaterialProperty _BlendshapeBadScaleFix = null;
+
+ //--
+
+ //Material Properties for Patreon Plugins
+ private MaterialProperty _LeftRightPan = null;
+ private MaterialProperty _UpDownPan = null;
+ private MaterialProperty _Twitchyness = null;
+ private MaterialProperty _AttentionSpan = null;
+ private MaterialProperty _FollowPower = null;
+ private MaterialProperty _FollowLimit = null;
+ private MaterialProperty _LookSpeed = null;
+ private MaterialProperty _IrisSize = null;
+ private MaterialProperty _EyeOffsetLimit = null;
+ //--
+
+ private static bool showMainSettings = true;
+ private static bool showNormalMapSettings = false;
+ private static bool showShadows = true;
+ private static bool showSpecular = false;
+ private static bool showReflection = false;
+ private static bool showRimlight = false;
+ private static bool showHalftones = false;
+ private static bool showSubsurface = false;
+ private static bool showOutlines = false;
+ private static bool showEmission = false;
+ private static bool showAdvanced = false;
+ private static bool showEyeTracking = false;
+ private static bool showRefractionSettings = false;
+ private static bool showDissolveSettings = false;
+ private static bool showPenetrator = true;
+
+ private bool isPatreonShader = false;
+ private bool isEyeTracking = false;
+ private bool isOutlined = false;
+ private bool isCutout = false;
+ private bool isCutoutMasked = false;
+ private bool isDithered = false;
+ private bool isRefractive = false;
+ private bool isPenetratorShader = false;
+ private bool isOrificeShader = false;
+
+ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
+ {
+ Material material = materialEditor.target as Material;
+ Shader shader = material.shader;
+
+ isCutout = material.GetInt("_BlendMode") == 1;
+ isDithered = material.GetInt("_BlendMode") == 2;
+ isRefractive = material.GetInt("_UseRefraction") == 1;
+ isOutlined = shader.name.Contains("Outline");
+ isPatreonShader = shader.name.Contains("Patreon");
+ isEyeTracking = shader.name.Contains("EyeTracking");
+ isPenetratorShader = shader.name.Contains("Penetrator");
+ isOrificeShader = shader.name.Contains("Orifice");
+
+ //Find all material properties listed in the script using reflection, and set them using a loop only if they're of type MaterialProperty.
+ //This makes things a lot nicer to maintain and cleaner to look at.
+ foreach (var property in GetType().GetFields(bindingFlags))
+ {
+ if (property.FieldType == typeof(MaterialProperty))
+ {
+ try { property.SetValue(this, FindProperty(property.Name, props)); } catch { /*Is it really a problem if it doesn't exist?*/ }
+ }
+ }
+
+ EditorGUI.BeginChangeCheck();
+ {
+ XSStyles.ShurikenHeaderCentered("XSToon v" + XSStyles.ver);
+ material.SetShaderPassEnabled("Always", isRefractive);
+ materialEditor.ShaderProperty(_AdvMode, new GUIContent("Shader Mode", "Setting this to 'Advanced' will give you access to things such as stenciling, and other expiremental/advanced features."));
+ materialEditor.ShaderProperty(_Culling, new GUIContent("Culling Mode", "Changes the culling mode. 'Off' will result in a two sided material, while 'Front' and 'Back' will cull those sides respectively"));
+ materialEditor.ShaderProperty(_TilingMode, new GUIContent("Tiling Mode", "Setting this to Merged will tile and offset all textures based on the Main texture's Tiling/Offset."));
+ materialEditor.ShaderProperty(_BlendMode, new GUIContent("Blend Mode", "Blend mode of the material. (Opaque, transparent, cutout, etc.)"));
+ materialEditor.ShaderProperty(_UseRefraction, new GUIContent("Refraction", "Should this material be refractive? (Warning, this can be expensive!)"));
+
+ DoBlendModeSettings(material);
+ DrawPenetratorSettings(materialEditor);
+ DrawOrificeSettings(materialEditor);
+ DrawMainSettings(materialEditor);
+ DrawDissolveSettings(materialEditor);
+ DrawShadowSettings(materialEditor, material);
+ DrawOutlineSettings(materialEditor);
+ DrawNormalSettings(materialEditor);
+ DrawSpecularSettings(materialEditor);
+ DrawReflectionsSettings(materialEditor, material);
+ DrawRefractionSettings(materialEditor);
+ DrawEmissionSettings(materialEditor);
+ DrawRimlightSettings(materialEditor);
+ DrawHalfToneSettings(materialEditor);
+ DrawTransmissionSettings(materialEditor);
+ DrawAdvancedSettings(materialEditor);
+ DrawPatreonSettings(materialEditor);
+ XSStyles.DoFooter();
+ }
+ }
+
+ private void DoBlendModeSettings(Material material)
+ {
+ int mode = material.GetInt("_BlendMode");
+ switch (mode)
+ {
+ case 0: //Opaque
+ SetBlend(material, (int)UnityEngine.Rendering.BlendMode.One, (int)UnityEngine.Rendering.BlendMode.Zero, (int)UnityEngine.Rendering.RenderQueue.Geometry, 1, 0);
+ material.DisableKeyword("_ALPHABLEND_ON");
+ material.DisableKeyword("_ALPHATEST_ON");
+ break;
+
+ case 1: //Cutout
+ SetBlend(material, (int)UnityEngine.Rendering.BlendMode.One, (int)UnityEngine.Rendering.BlendMode.Zero, (int)UnityEngine.Rendering.RenderQueue.AlphaTest, 1, 0);
+ material.DisableKeyword("_ALPHABLEND_ON");
+ material.EnableKeyword("_ALPHATEST_ON");
+ break;
+
+ case 2: //Dithered
+ SetBlend(material, (int)UnityEngine.Rendering.BlendMode.One, (int)UnityEngine.Rendering.BlendMode.Zero, (int)UnityEngine.Rendering.RenderQueue.AlphaTest, 1, 0);
+ material.DisableKeyword("_ALPHABLEND_ON");
+ material.EnableKeyword("_ALPHATEST_ON");
+ break;
+
+ case 3: //Alpha To Coverage
+ SetBlend(material, (int)UnityEngine.Rendering.BlendMode.One, (int)UnityEngine.Rendering.BlendMode.Zero, (int)UnityEngine.Rendering.RenderQueue.AlphaTest, 1, 1);
+ material.DisableKeyword("_ALPHABLEND_ON");
+ material.EnableKeyword("_ALPHATEST_ON");
+ break;
+
+ case 4: //Transparent
+ SetBlend(material, (int)UnityEngine.Rendering.BlendMode.One, (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha, (int)UnityEngine.Rendering.RenderQueue.Transparent, 0, 0);
+ material.EnableKeyword("_ALPHABLEND_ON");
+ material.DisableKeyword("_ALPHATEST_ON");
+ break;
+
+ case 5: //Fade
+ SetBlend(material, (int)UnityEngine.Rendering.BlendMode.SrcAlpha, (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha, (int)UnityEngine.Rendering.RenderQueue.Transparent, 0, 0);
+ material.EnableKeyword("_ALPHABLEND_ON");
+ material.DisableKeyword("_ALPHATEST_ON");
+ break;
+
+ case 6: //Additive
+ SetBlend(material, (int)UnityEngine.Rendering.BlendMode.One, (int)UnityEngine.Rendering.BlendMode.One, (int)UnityEngine.Rendering.RenderQueue.Transparent, 0, 0);
+ material.DisableKeyword("_ALPHABLEND_ON");
+ material.DisableKeyword("_ALPHATEST_ON");
+ break;
+ }
+ }
+
+ private void SetBlend(Material material, int src, int dst, int renderQueue, int zwrite, int alphatocoverage)
+ {
+ material.SetInt("_SrcBlend", src);
+ material.SetInt("_DstBlend", dst);
+ material.SetInt("_ZWrite", zwrite);
+ material.SetInt("_AlphaToCoverage", alphatocoverage);
+
+ material.renderQueue = isRefractive ? (int)UnityEngine.Rendering.RenderQueue.Overlay - 1 : renderQueue;
+ }
+
+ private void DrawMainSettings(MaterialEditor materialEditor)
+ {
+ showMainSettings = XSStyles.ShurikenFoldout("Main Settings", showMainSettings);
+ if (showMainSettings)
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("Main Texture", "The main Albedo texture."), _MainTex, _Color);
+ if (isCutout)
+ {
+ materialEditor.ShaderProperty(_Cutoff, new GUIContent("Cutoff", "The Cutoff Amount"), 2);
+ }
+ materialEditor.ShaderProperty(_UVSetAlbedo, new GUIContent("UV Set", "The UV set to use for the Albedo Texture."), 2);
+ materialEditor.TextureScaleOffsetProperty(_MainTex);
+
+ materialEditor.TexturePropertySingleLine(new GUIContent("HSV Mask", "RGB Mask: R = Hue, G = Saturation, B = Brightness"), _HSVMask);
+ materialEditor.ShaderProperty(_Hue, new GUIContent("Hue", "Controls Hue of the final output from the shader."));
+ materialEditor.ShaderProperty(_Saturation, new GUIContent("Saturation", "Controls saturation of the final output from the shader."));
+ materialEditor.ShaderProperty(_Value, new GUIContent("Brightness", "Controls value of the final output from the shader."));
+
+ if (isDithered)
+ {
+ XSStyles.SeparatorThin();
+ materialEditor.ShaderProperty(_FadeDither, new GUIContent("Distance Fading", "Make the shader dither out based on the distance to the camera."));
+ materialEditor.ShaderProperty(_FadeDitherDistance, new GUIContent("Fade Threshold", "The distance at which the fading starts happening."));
+ }
+ }
+ }
+
+ private void DrawDissolveSettings(MaterialEditor materialEditor)
+ {
+ if (isCutout || isDithered)
+ {
+ showDissolveSettings = XSStyles.ShurikenFoldout("Dissolve", showDissolveSettings);
+ if (showDissolveSettings)
+ {
+ materialEditor.ShaderProperty(_DissolveCoordinates, new GUIContent("Dissolve Coordinates", "Should Dissolve happen in world space, texture space, or vertically?"));
+ materialEditor.TexturePropertySingleLine(new GUIContent("Dissolve Texture", "Noise texture used to control up dissolve pattern"), _DissolveTexture, _DissolveColor);
+ materialEditor.TextureScaleOffsetProperty(_DissolveTexture);
+ materialEditor.ShaderProperty(_UVSetDissolve, new GUIContent("UV Set", "The UV set to use for the Dissolve Texture."), 2);
+
+ materialEditor.ShaderProperty(_DissolveStrength, new GUIContent("Dissolve Sharpness", "Sharpness of the dissolve texture."));
+ materialEditor.ShaderProperty(_DissolveProgress, new GUIContent("Dissolve Progress", "Progress of the dissolve effect."));
+ }
+ }
+ }
+
+ private void DrawShadowSettings(MaterialEditor materialEditor, Material material)
+ {
+ showShadows = XSStyles.ShurikenFoldout("Shadows", showShadows);
+ if (showShadows)
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("Ramp Selection Mask", "A black to white mask that determins how far up on the multi ramp to sample. 0 for bottom, 1 for top, 0.5 for middle, 0.25, and 0.75 for mid bottom and mid top respectively."), _RampSelectionMask);
+
+ XSStyles.SeparatorThin();
+ if (_RampSelectionMask.textureValue != null)
+ {
+ string rampMaskPath = AssetDatabase.GetAssetPath(_RampSelectionMask.textureValue);
+ TextureImporter ti = (TextureImporter)TextureImporter.GetAtPath(rampMaskPath);
+ if (ti.sRGBTexture)
+ {
+ if (XSStyles.HelpBoxWithButton(new GUIContent("This texture is not marked as Linear.", "This is recommended for the mask"), new GUIContent("Fix Now")))
+ {
+ ti.sRGBTexture = false;
+ AssetDatabase.ImportAsset(rampMaskPath, ImportAssetOptions.ForceUpdate);
+ AssetDatabase.Refresh();
+ }
+ }
+ }
+
+ materialEditor.TexturePropertySingleLine(new GUIContent("Shadow Ramp", "Shadow Ramp, Dark to Light should be Left to Right"), _Ramp);
+ materialEditor.ShaderProperty(_ShadowSharpness, new GUIContent("Shadow Sharpness", "Controls the sharpness of recieved shadows, as well as the sharpness of 'shadows' from Vertex Lighting."));
+
+ XSStyles.SeparatorThin();
+ materialEditor.ShaderProperty(_OcclusionMode, new GUIContent("Occlusion Mode", "How to calculate the occlusion map contribution"));
+ materialEditor.TexturePropertySingleLine(new GUIContent("Occlusion Map", "Occlusion Map, used to darken areas on the model artifically."), _OcclusionMap);
+ materialEditor.ShaderProperty(_OcclusionIntensity, new GUIContent("Intensity", "Occlusion intensity"), 2);
+ materialEditor.ShaderProperty(_UVSetOcclusion, new GUIContent("UV Set", "The UV set to use for the Occlusion Texture"), 2);
+ materialEditor.TextureScaleOffsetProperty(_OcclusionMap);
+
+ XSStyles.SeparatorThin();
+ XSStyles.constrainedShaderProperty(materialEditor, _ShadowRim, new GUIContent("Shadow Rim", "Shadow Rim Color. Set to white to disable."), 0);
+ materialEditor.ShaderProperty(_ShadowRimAlbedoTint, new GUIContent("Shadow Rim Albedo Tint", "How much the Albedo texture should effect the Shadow Rim color."));
+ materialEditor.ShaderProperty(_ShadowRimRange, new GUIContent("Range", "Range of the Shadow Rim"), 2);
+ materialEditor.ShaderProperty(_ShadowRimThreshold, new GUIContent("Threshold", "Threshold of the Shadow Rim"), 2);
+ materialEditor.ShaderProperty(_ShadowRimSharpness, new GUIContent("Sharpness", "Sharpness of the Shadow Rim"), 2);
+ XSStyles.callGradientEditor(material);
+ }
+ }
+
+ private void DrawOutlineSettings(MaterialEditor materialEditor)
+ {
+ if (isOutlined)
+ {
+ showOutlines = XSStyles.ShurikenFoldout("Outlines", showOutlines);
+ if (showOutlines)
+ {
+ materialEditor.ShaderProperty(_OutlineNormalMode, new GUIContent("Outline Normal Mode", "How to calcuate the outline expand direction. Using mesh normals may result in split edges."));
+
+ if (_OutlineNormalMode.floatValue == 2)
+ materialEditor.ShaderProperty(_OutlineUVSelect, new GUIContent("Normals UV", "UV Channel to pull the modified normals from for outlines."));
+
+ materialEditor.ShaderProperty(_OutlineLighting, new GUIContent("Outline Lighting", "Makes outlines respect the lighting, or be emissive."));
+ materialEditor.ShaderProperty(_OutlineAlbedoTint, new GUIContent("Outline Albedo Tint", "Includes the color of the Albedo Texture in the calculation for the color of the outline."));
+ materialEditor.TexturePropertySingleLine(new GUIContent("Outline Mask", "Outline width mask, black will make the outline minimum width."), _OutlineMask);
+ materialEditor.ShaderProperty(_OutlineWidth, new GUIContent("Outline Width", "Width of the Outlines"));
+ XSStyles.constrainedShaderProperty(materialEditor, _OutlineColor, new GUIContent("Outline Color", "Color of the outlines"), 0);
+ }
+ }
+ }
+
+ private void DrawNormalSettings(MaterialEditor materialEditor)
+ {
+ showNormalMapSettings = XSStyles.ShurikenFoldout("Normal Maps", showNormalMapSettings);
+ if (showNormalMapSettings)
+ {
+ materialEditor.ShaderProperty(_NormalMapMode, new GUIContent("Normal Map Source", "How to alter the normals of the mesh, using which source?"));
+ if (_NormalMapMode.floatValue == 0)
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("Normal Map", "Normal Map"), _BumpMap);
+ materialEditor.ShaderProperty(_BumpScale, new GUIContent("Normal Strength", "Strength of the main Normal Map"), 2);
+ materialEditor.ShaderProperty(_UVSetNormal, new GUIContent("UV Set", "The UV set to use for the Normal Map"), 2);
+ materialEditor.TextureScaleOffsetProperty(_BumpMap);
+
+ XSStyles.SeparatorThin();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Detail Normal Map", "Detail Normal Map"), _DetailNormalMap);
+ materialEditor.ShaderProperty(_DetailNormalMapScale, new GUIContent("Detail Normal Strength", "Strength of the detail Normal Map"), 2);
+ materialEditor.ShaderProperty(_UVSetDetNormal, new GUIContent("UV Set", "The UV set to use for the Detail Normal Map"), 2);
+ materialEditor.TextureScaleOffsetProperty(_DetailNormalMap);
+
+ XSStyles.SeparatorThin();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Detail Mask", "Mask for Detail Maps"), _DetailMask);
+ materialEditor.ShaderProperty(_UVSetDetMask, new GUIContent("UV Set", "The UV set to use for the Detail Mask"), 2);
+ materialEditor.TextureScaleOffsetProperty(_DetailMask);
+ }
+ }
+ }
+
+ private void DrawSpecularSettings(MaterialEditor materialEditor)
+ {
+ showSpecular = XSStyles.ShurikenFoldout("Specular", showSpecular);
+ if (showSpecular)
+ {
+ XSStyles.SeparatorThin();
+
+ materialEditor.TexturePropertySingleLine(new GUIContent("Specular Map(R,G,B)", "Specular Map. Red channel controls Intensity, Green controls how much specular is tinted by Albedo, and Blue controls Smoothness (Only for Blinn-Phong, and GGX)."), _SpecularMap);
+ materialEditor.TextureScaleOffsetProperty(_SpecularMap);
+ materialEditor.ShaderProperty(_UVSetSpecular, new GUIContent("UV Set", "The UV set to use for the Specular Map"), 2);
+ materialEditor.ShaderProperty(_SpecularIntensity, new GUIContent("Intensity", "Specular Intensity."), 2);
+ materialEditor.ShaderProperty(_SpecularArea, new GUIContent("Roughness", "Roughness"), 2);
+ materialEditor.ShaderProperty(_SpecularAlbedoTint, new GUIContent("Albedo Tint", "How much the specular highlight should derive color from the albedo of the object."), 2);
+ materialEditor.ShaderProperty(_SpecularSharpness, new GUIContent("Sharpness", "How hard of and edge transitions should the specular have?"), 2);
+ materialEditor.ShaderProperty(_AnisotropicSpecular, new GUIContent("Anisotropy", "The amount of anisotropy the surface has - this will stretch the reflection along an axis (think bottom of a frying pan)"), 2);
+ }
+ }
+
+ private void DrawReflectionsSettings(MaterialEditor materialEditor, Material material)
+ {
+ showReflection = XSStyles.ShurikenFoldout("Reflections", showReflection);
+ if (showReflection)
+ {
+ materialEditor.ShaderProperty(_ReflectionMode, new GUIContent("Reflection Mode", "Reflection Mode."));
+
+ if (_ReflectionMode.floatValue == 0) // PBR
+ {
+ materialEditor.ShaderProperty(_ReflectionBlendMode, new GUIContent("Reflection Blend Mode", "Blend mode for reflection. Additive is Color + reflection, Multiply is Color * reflection, and subtractive is Color - reflection"));
+ materialEditor.ShaderProperty(_ClearCoat, new GUIContent("Clearcoat", "Clearcoat"));
+
+ XSStyles.SeparatorThin();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Fallback Cubemap", " Used as fallback in 'Unity' reflection mode if reflection probe is black."), _BakedCubemap);
+
+ XSStyles.SeparatorThin();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Metallic Map", "Metallic Map, Metallic on Red Channel, Smoothness on Alpha Channel. \nIf Clearcoat is enabled, Clearcoat Smoothness on Green Channel, Clearcoat Reflectivity on Blue Channel."), _MetallicGlossMap);
+ materialEditor.TextureScaleOffsetProperty(_MetallicGlossMap);
+ materialEditor.ShaderProperty(_UVSetMetallic, new GUIContent("UV Set", "The UV set to use for the Metallic Smoothness Map"), 2);
+ materialEditor.ShaderProperty(_AnisotropicReflection, new GUIContent("Anisotropy", "The amount of anisotropy the surface has - this will stretch the reflection along an axis (think bottom of a frying pan)"), 2);
+ materialEditor.ShaderProperty(_Metallic, new GUIContent("Metallic", "Metallic, set to 1 if using metallic map"), 2);
+ materialEditor.ShaderProperty(_Glossiness, new GUIContent("Smoothness", "Smoothness, set to 1 if using metallic map"), 2);
+ materialEditor.ShaderProperty(_ClearcoatSmoothness, new GUIContent("Clearcoat Smoothness", "Smoothness of the clearcoat."), 2);
+ materialEditor.ShaderProperty(_ClearcoatStrength, new GUIContent("Clearcoat Reflectivity", "The strength of the clearcoat reflection."), 2);
+ }
+ else if (_ReflectionMode.floatValue == 1) //Baked cube
+ {
+ materialEditor.ShaderProperty(_ReflectionBlendMode, new GUIContent("Reflection Blend Mode", "Blend mode for reflection. Additive is Color + reflection, Multiply is Color * reflection, and subtractive is Color - reflection"));
+ materialEditor.ShaderProperty(_ClearCoat, new GUIContent("Clearcoat", "Clearcoat"));
+
+ XSStyles.SeparatorThin();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Baked Cubemap", "Baked cubemap."), _BakedCubemap);
+
+ XSStyles.SeparatorThin();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Metallic Map", "Metallic Map, Metallic on Red Channel, Smoothness on Alpha Channel. \nIf Clearcoat is enabled, Clearcoat Smoothness on Green Channel, Clearcoat Reflectivity on Blue Channel."), _MetallicGlossMap);
+ materialEditor.TextureScaleOffsetProperty(_MetallicGlossMap);
+ materialEditor.ShaderProperty(_UVSetMetallic, new GUIContent("UV Set", "The UV set to use for the MetallicSmoothness Map"), 2);
+ materialEditor.ShaderProperty(_AnisotropicReflection, new GUIContent("Anisotropic", "Anisotropic, stretches reflection in an axis."), 2);
+ materialEditor.ShaderProperty(_Metallic, new GUIContent("Metallic", "Metallic, set to 1 if using metallic map"), 2);
+ materialEditor.ShaderProperty(_Glossiness, new GUIContent("Smoothness", "Smoothness, set to 1 if using metallic map"), 2);
+ materialEditor.ShaderProperty(_ClearcoatSmoothness, new GUIContent("Clearcoat Smoothness", "Smoothness of the clearcoat."), 2);
+ materialEditor.ShaderProperty(_ClearcoatStrength, new GUIContent("Clearcoat Reflectivity", "The strength of the clearcoat reflection."), 2);
+ }
+ else if (_ReflectionMode.floatValue == 2) //Matcap
+ {
+ materialEditor.ShaderProperty(_ReflectionBlendMode, new GUIContent("Reflection Blend Mode", "Blend mode for reflection. Additive is Color + reflection, Multiply is Color * reflection, and subtractive is Color - reflection"));
+
+ XSStyles.SeparatorThin();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Matcap", "Matcap Texture"), _Matcap, _MatcapTint);
+ materialEditor.ShaderProperty(_Glossiness, new GUIContent("Matcap Blur", "Matcap blur, blurs the Matcap, set to 1 for full clarity"), 2);
+ materialEditor.ShaderProperty(_MatcapTintToDiffuse, new GUIContent("Tint To Diffuse", "Tints matcap to diffuse color."), 2);
+ material.SetFloat("_Metallic", 0);
+ material.SetFloat("_ClearCoat", 0);
+ material.SetTexture("_MetallicGlossMap", null);
+ }
+ if (_ReflectionMode.floatValue != 3)
+ {
+ XSStyles.SeparatorThin();
+ materialEditor.TexturePropertySingleLine(new GUIContent("Reflectivity Mask", "Mask for reflections."), _ReflectivityMask);
+ materialEditor.TextureScaleOffsetProperty(_ReflectivityMask);
+ materialEditor.ShaderProperty(_UVSetReflectivity, new GUIContent("UV Set", "The UV set to use for the Reflectivity Mask"), 2);
+ materialEditor.ShaderProperty(_Reflectivity, new GUIContent("Reflectivity", "The strength of the reflections."), 2);
+ }
+ if (_ReflectionMode.floatValue == 3)
+ {
+ material.SetFloat("_Metallic", 0);
+ material.SetFloat("_ReflectionBlendMode", 0);
+ material.SetFloat("_ClearCoat", 0);
+ }
+ }
+ }
+
+ private void DrawEmissionSettings(MaterialEditor materialEditor)
+ {
+ showEmission = XSStyles.ShurikenFoldout("Emission", showEmission);
+ if (showEmission)
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("Emission Map", "Emissive map. White to black, unless you want multiple colors."), _EmissionMap, _EmissionColor);
+ materialEditor.TextureScaleOffsetProperty(_EmissionMap);
+ materialEditor.ShaderProperty(_UVSetEmission, new GUIContent("UV Set", "The UV set to use for the Emission Map"), 2);
+ materialEditor.ShaderProperty(_EmissionToDiffuse, new GUIContent("Tint To Diffuse", "Tints the emission to the Diffuse Color"), 2);
+
+ XSStyles.SeparatorThin();
+ materialEditor.ShaderProperty(_ScaleWithLight, new GUIContent("Scale w/ Light", "Scales the emission intensity based on how dark or bright the environment is."));
+ if (_ScaleWithLight.floatValue == 0)
+ materialEditor.ShaderProperty(_ScaleWithLightSensitivity, new GUIContent("Scaling Sensitivity", "How agressively the emission should scale with the light."));
+ }
+ }
+
+ private void DrawRimlightSettings(MaterialEditor materialEditor)
+ {
+ showRimlight = XSStyles.ShurikenFoldout("Rimlight", showRimlight);
+ if (showRimlight)
+ {
+ materialEditor.ShaderProperty(_RimColor, new GUIContent("Rimlight Tint", "The Tint of the Rimlight."));
+ materialEditor.ShaderProperty(_RimAlbedoTint, new GUIContent("Rim Albedo Tint", "How much the Albedo texture should effect the rimlight color."));
+ materialEditor.ShaderProperty(_RimCubemapTint, new GUIContent("Rim Environment Tint", "How much the Environment cubemap should effect the rimlight color."));
+ materialEditor.ShaderProperty(_RimAttenEffect, new GUIContent("Rim Attenuation Effect", "How much should realtime shadows mask out the rimlight?"));
+ materialEditor.ShaderProperty(_RimIntensity, new GUIContent("Rimlight Intensity", "Strength of the Rimlight."));
+ materialEditor.ShaderProperty(_RimRange, new GUIContent("Range", "Range of the Rim"), 2);
+ materialEditor.ShaderProperty(_RimThreshold, new GUIContent("Threshold", "Threshold of the Rim"), 2);
+ materialEditor.ShaderProperty(_RimSharpness, new GUIContent("Sharpness", "Sharpness of the Rim"), 2);
+ }
+ }
+
+ private void DrawHalfToneSettings(MaterialEditor materialEditor)
+ {
+ showHalftones = XSStyles.ShurikenFoldout("Halftones", showHalftones);
+ if (showHalftones)
+ {
+ materialEditor.ShaderProperty(_HalftoneType, new GUIContent("Halftone Style", "Controls where halftone and stippling effects are drawn."));
+
+ if (_HalftoneType.floatValue == 1 || _HalftoneType.floatValue == 2)
+ {
+ materialEditor.ShaderProperty(_HalftoneDotSize, new GUIContent("Stippling Scale", "How large should the stippling pattern be?"));
+ materialEditor.ShaderProperty(_HalftoneDotAmount, new GUIContent("Stippling Density", "How dense is the stippling effect?"));
+ }
+
+ if (_HalftoneType.floatValue == 0 || _HalftoneType.floatValue == 2)
+ {
+ materialEditor.ShaderProperty(_HalftoneLineAmount, new GUIContent("Halftone Line Count", "How many lines should the halftone shadows have?"));
+ materialEditor.ShaderProperty(_HalftoneLineIntensity, new GUIContent("Halftone Line Intensity", "How dark should the halftone lines be?"));
+ }
+ }
+ }
+
+ private void DrawTransmissionSettings(MaterialEditor materialEditor)
+ {
+ showSubsurface = XSStyles.ShurikenFoldout("Transmission", showSubsurface);
+ if (showSubsurface)
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("Thickness Map", "Thickness Map, used to mask areas where transmission can happen"), _ThicknessMap);
+ materialEditor.TextureScaleOffsetProperty(_ThicknessMap);
+ materialEditor.ShaderProperty(_UVSetThickness, new GUIContent("UV Set", "The UV set to use for the Thickness Map"), 2);
+ XSStyles.constrainedShaderProperty(materialEditor, _SSColor, new GUIContent("Transmission Color", "Transmission Color"), 2);
+ materialEditor.ShaderProperty(_SSDistortion, new GUIContent("Transmission Distortion", "How much the Transmission should follow the normals of the mesh and/or normal map."), 2);
+ materialEditor.ShaderProperty(_SSPower, new GUIContent("Transmission Power", "Subsurface Power"), 2);
+ materialEditor.ShaderProperty(_SSScale, new GUIContent("Transmission Scale", "Subsurface Scale"), 2);
+ }
+ }
+
+ private void DrawRefractionSettings(MaterialEditor materialEditor)
+ {
+ if (isRefractive)
+ {
+ showRefractionSettings = XSStyles.ShurikenFoldout("Refraction", showRefractionSettings);
+ if (showRefractionSettings)
+ {
+ materialEditor.ShaderProperty(_RefractionModel, new GUIContent("Refraction Model", "Refraction technique"));
+ materialEditor.ShaderProperty(_IOR, new GUIContent("Index of Refraction", "The index of refraction of the material. Glass: 1.5, Crystal: 2.0, Ice: 1.309, Water: 1.325"));
+ }
+ }
+ }
+
+ private void DrawAdvancedSettings(MaterialEditor materialEditor)
+ {
+ if (_AdvMode.floatValue == 1)
+ {
+ showAdvanced = XSStyles.ShurikenFoldout("Advanced Settings", showAdvanced);
+ if (showAdvanced)
+ {
+ materialEditor.ShaderProperty(_VertexColorAlbedo, new GUIContent("Vertex Color Albedo", "Multiplies the vertex color of the mesh by the Albedo texture to derive the final Albedo color."));
+ if (isDithered || isCutout)
+ {
+ materialEditor.ShaderProperty(_UseClipsForDissolve, new GUIContent("Control Dissolve With Clip"));
+ materialEditor.TexturePropertySingleLine(new GUIContent("Clip Map (RGBA)", "Used to control clipping in an advanced manner, read tooltip for Clip Mask Vectors below."), _ClipMap);
+ materialEditor.TextureScaleOffsetProperty(_ClipMap);
+ materialEditor.ShaderProperty(_UVSetClipMap, new GUIContent("UV Set", "The UV set to use for the Clip Map"), 2);
+ materialEditor.ShaderProperty(_ClipAgainstVertexColorGreaterZeroFive, new GUIContent("Clip Mask > 0.5 Opacity", "Uses the Clip Map RGBA channels as a multiplier for clipping."));
+ _ClipAgainstVertexColorGreaterZeroFive.vectorValue = ClampVec4(_ClipAgainstVertexColorGreaterZeroFive.vectorValue);
+ materialEditor.ShaderProperty(_ClipAgainstVertexColorLessZeroFive, new GUIContent("Clip Mask Color < 0.5 Opacity", "Uses the Clip Map RGBA channels as a multiplier for clipping."));
+ _ClipAgainstVertexColorLessZeroFive.vectorValue = ClampVec4(_ClipAgainstVertexColorLessZeroFive.vectorValue);
+ }
+
+ materialEditor.ShaderProperty(_Stencil, _Stencil.displayName);
+ materialEditor.ShaderProperty(_StencilComp, _StencilComp.displayName);
+ materialEditor.ShaderProperty(_StencilOp, _StencilOp.displayName);
+
+ materialEditor.RenderQueueField();
+ }
+ }
+ }
+
+ private void DrawPatreonSettings(MaterialEditor materialEditor)
+ {
+ //Plugins for Patreon releases
+ if (isPatreonShader)
+ {
+ if (isEyeTracking)
+ {
+ showEyeTracking = XSStyles.ShurikenFoldout("Eye Tracking Settings", showEyeTracking);
+ if (showEyeTracking)
+ {
+ materialEditor.ShaderProperty(_LeftRightPan, new GUIContent("Left Right Adj.", "Adjusts the eyes manually left or right."));
+ materialEditor.ShaderProperty(_UpDownPan, new GUIContent("Up Down Adj.", "Adjusts the eyes manually up or down."));
+
+ XSStyles.SeparatorThin();
+ materialEditor.ShaderProperty(_AttentionSpan, new GUIContent("Attention Span", "How often should the eyes look at the target; 0 = never, 1 = always, 0.5 = half of the time."));
+ materialEditor.ShaderProperty(_FollowPower, new GUIContent("Follow Power", "The influence the target has on the eye"));
+ materialEditor.ShaderProperty(_LookSpeed, new GUIContent("Look Speed", "How fast the eye transitions to looking at the target"));
+ materialEditor.ShaderProperty(_Twitchyness, new GUIContent("Refocus Frequency", "How much should the eyes look around near the target?"));
+
+ XSStyles.SeparatorThin();
+ materialEditor.ShaderProperty(_IrisSize, new GUIContent("Iris Size", "Size of the iris"));
+ materialEditor.ShaderProperty(_FollowLimit, new GUIContent("Follow Limit", "Limits the angle from the front of the face on how far the eyes can track/rotate."));
+ materialEditor.ShaderProperty(_EyeOffsetLimit, new GUIContent("Offset Limit", "Limit for how far the eyes can turn"));
+ }
+ }
+ }
+ //
+ }
+
+ private void DrawPenetratorSettings(MaterialEditor materialEditor)
+ {
+ //Plugin for Dynamic Penetration System
+ if(isPenetratorShader)
+ {
+ showPenetrator = XSStyles.ShurikenFoldout("Dynamic Penetration System", showPenetrator);
+ if (showPenetrator) {
+ materialEditor.ShaderProperty(_Squeeze, new GUIContent("Squeeze Minimum Size", "Minimum diameter the penetrator squeezes to when entering an orifice"));
+ materialEditor.ShaderProperty(_SqueezeDist, new GUIContent("Squeeze Smoothness", "How far along the length the penetrator is squeezed when entering an orifice (Squeeze Smoothing)"));
+ materialEditor.ShaderProperty(_BulgePower, new GUIContent("Bulge Amount", "How much the penetrator bulges when entering an orifice"));
+ materialEditor.ShaderProperty(_BulgeOffset, new GUIContent("Bulge Length", "How far along the length the buldge goes"));
+ materialEditor.ShaderProperty(_Length, new GUIContent("Length of Penetrator Model", "Set this to zero, then slowly increase it until your model is fully visible"));
+ materialEditor.ShaderProperty(_EntranceStiffness, new GUIContent("Entrance Stiffness", "Reduces tip bending when entering an orifice"));
+ materialEditor.ShaderProperty(_Curvature, new GUIContent("Curvature", "You see those warriors from Hammerfell? They've got curved swords. Curved. Swords!"));
+ materialEditor.ShaderProperty(_ReCurvature, new GUIContent("ReCurvature", "S curve"));
+ materialEditor.ShaderProperty(_Wriggle, new GUIContent("Wriggle Amount", "The amount of wriggle"));
+ materialEditor.ShaderProperty(_WriggleSpeed, new GUIContent("Wriggle Speed", "How fast the penetrator wriggles!"));
+ XSStyles.SeparatorThin();
+ materialEditor.ShaderProperty(_OrificeChannel, new GUIContent("OrificeChannel", "Set to 1 to make the penetrator to only interact with channel 1 orifices"));
+ }
+ }
+ //
+ }
+
+ private void DrawOrificeSettings(MaterialEditor materialEditor)
+ {
+ //Plugin for Dynamic Penetration System
+ if(isOrificeShader)
+ {
+ showPenetrator = XSStyles.ShurikenFoldout("Dynamic Penetration System", showPenetrator);
+ if (showPenetrator)
+ {
+ materialEditor.TexturePropertySingleLine(new GUIContent("OrificeData", "Generate with Tools > Raliv > Orifice Setup"), _OrificeData);
+ materialEditor.ShaderProperty(_EntryOpenDuration, new GUIContent("Entry Trigger Duration", "How much penetration it takes the entry deformation to activate"));
+ materialEditor.ShaderProperty(_Shape1Depth, new GUIContent("Shape 1 Trigger Depth", "Penetration depth at which shape 1 begins deforming"));
+ materialEditor.ShaderProperty(_Shape1Duration, new GUIContent("Shape 1 Trigger Duration", "How much penetration it takes shape 1 deformation to activate"));
+ materialEditor.ShaderProperty(_Shape2Depth, new GUIContent("Shape 2 Trigger Depth", "Penetration depth at which shape 2 begins deforming"));
+ materialEditor.ShaderProperty(_Shape2Duration, new GUIContent("Shape 2 Trigger Duration", "How much penetration it takes shape 2 deformation to activate"));
+ materialEditor.ShaderProperty(_Shape3Depth, new GUIContent("Shape 3 Trigger Depth", "Penetration depth at which shape 3 begins deforming"));
+ materialEditor.ShaderProperty(_Shape3Duration, new GUIContent("Shape 3 Trigger Duration", "How much penetration it takes shape 3 deformation to activate"));
+ materialEditor.ShaderProperty(_BlendshapePower, new GUIContent("Blend Shape Power", "Adjusts the amount the mesh deforms"));
+ materialEditor.ShaderProperty(_BlendshapeBadScaleFix, new GUIContent("Blend Shape Bad Scale Fix", "If your model has 100s in its scale, and you can't figure out how to fix it"));
+ XSStyles.SeparatorThin();
+ materialEditor.ShaderProperty(_OrificeChannel, new GUIContent("OrificeChannel", "Set to 1 to make the penetrator to only interact with channel 1 orifices"));
+ }
+ }
+ //
+ }
+
+
+
+ private Vector4 ClampVec4(Vector4 vec)
+ {
+ Vector4 value = vec;
+ value.x = Mathf.Clamp01(value.x);
+ value.y = Mathf.Clamp01(value.y);
+ value.z = Mathf.Clamp01(value.z);
+ value.w = Mathf.Clamp01(value.w);
+ return value;
+ }
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSToonInspector.cs.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSToonInspector.cs.meta
new file mode 100644
index 00000000..4935b9aa
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSToonInspector.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c544548cc23a44b40be4d0d21eaf6ff1
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSUpdater.cs b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSUpdater.cs
new file mode 100644
index 00000000..0d9d6dd5
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSUpdater.cs
@@ -0,0 +1,210 @@
+using UnityEngine;
+using UnityEngine.Networking;
+using UnityEditor;
+using System.Collections.Generic;
+using System.IO;
+namespace XSToonDynamicPenetration
+{
+ public class XSUpdater : EditorWindow
+ {
+ [MenuItem("Tools/Xiexe/XSToon/About - Updater")]
+ // Use this for initialization
+ static public void Init()
+ {
+ XSUpdater window = EditorWindow.GetWindow<XSUpdater>(true, "XSToon: Docs & Updater", true);
+ window.minSize = new Vector2(400, 300);
+ window.maxSize = new Vector2(401, 501);
+ }
+
+ private static string[] patrons = {};
+ private static string path;
+
+ static int tab = 0;
+ static string updateUrl = "https://api.github.com/repos/Xiexe/Xiexes-Unity-Shaders/releases/latest";
+ static string docsURL = "https://docs.google.com/document/d/1xJ4PID_nwqVm_UCsO2c2gEdiEoWoCGeM_GDK_L8-aZE";
+ static string patronsURL = "https://raw.githubusercontent.com/Xiexe/thefoxden/master/assets/patronlist/patronlist.txt";
+
+ static UnityWebRequest www;
+ static string changelog;
+ static string publishdate;
+ static string curVer;
+ static string downloadLink;
+ bool hasCalledPatronlist = false;
+ static bool showInfo = false;
+ Vector2 scrollPos;
+
+ public void OnGUI()
+ {
+ tab = GUILayout.Toolbar (tab, new string[] {"Documentation", "Updater", "Social"});
+ XSStyles.SeparatorThin();
+ switch(tab) {
+ case 0:
+ //show Docs from git
+ XSStyles.doLabel("You can find Documentation here.");
+ if(GUILayout.Button("Open Documentation"))
+ Application.OpenURL(docsURL);
+
+ break;
+
+ case 1:
+ EditorGUI.BeginChangeCheck();
+
+ XSStyles.HelpBox("The currently installed version is: v" + XSStyles.ver + "\n\nTo check for updates, use the update button. If you choose to download an update, you will need to manually overwrite the old install by extracting the .zip into the project using the windows explorer. \n\nDo not drag the update directly into Unity - it won't ask to overwrite - it'll just create a duplicate and break.", MessageType.Info);
+ XSStyles.SeparatorThin();
+ if (GUILayout.Button("Check for Updates"))
+ {
+ req(updateUrl);
+ EditorApplication.update += changelogEditorUpdate;
+ showInfo = true;
+ }
+
+ if(showInfo){
+
+ scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
+ Repaint();
+ XSStyles.doLabelLeft("Newest version: ");
+ XSStyles.doLabelSmall(curVer);
+ XSStyles.SeparatorThin();
+
+ XSStyles.doLabelLeft("Release Date: ");
+ XSStyles.doLabelSmall(publishdate);
+ XSStyles.SeparatorThin();
+
+ XSStyles.doLabelLeft("Changelog: ");
+ XSStyles.doLabelSmall(changelog);
+
+ EditorGUILayout.EndScrollView();
+ XSStyles.SeparatorThin();
+ if (GUILayout.Button("Download")){
+ Application.OpenURL(downloadLink);
+ }
+
+ }
+ else{
+ XSStyles.doLabel("Hit 'Check for Updates' to begin");
+ }
+ EditorGUI.EndChangeCheck();
+
+ break;
+
+ case 2:
+ //show Patrons
+
+ XSStyles.doLabel("Thank you to my patreon supporters, and the people who have helped me along the way, you guys are great!\n Note: You must be in the Discord server to show on this list.");
+ XSStyles.SeparatorThin();
+ XSStyles.doLabel("Current Patrons");
+ XSStyles.SeparatorThin();
+ scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
+ if(!hasCalledPatronlist)
+ {
+ hasCalledPatronlist = true;
+ req(patronsURL);
+ EditorApplication.update += EditorUpdate;
+ }
+ for(int i = 0; i < patrons.Length; i++)
+ {
+ XSStyles.doLabel(" - " + patrons[i]);
+ }
+ EditorGUILayout.EndScrollView();
+
+ XSStyles.SeparatorThin();
+ //show social links
+ EditorGUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ XSStyles.discordButton(70, 30);
+ XSStyles.patreonButton(70, 30);
+ XSStyles.githubButton(70, 30);
+ GUILayout.FlexibleSpace();
+ EditorGUILayout.EndHorizontal();
+ break;
+ }
+
+
+ }
+
+ static void req(string url)
+ {
+ www = UnityWebRequest.Get(url);
+ www.SendWebRequest();
+ //Debug.Log("Checking for updates...");
+ }
+ static void EditorUpdate()
+ {
+ while (!www.isDone)
+ return;
+
+ if (www.isNetworkError)
+ Debug.Log(www.error);
+ else
+ {
+ patrons = www.downloadHandler.text.Split('\n');
+ Debug.Log("Fetching Patron list of: " + patrons.Length);
+ }
+ EditorApplication.update -= EditorUpdate;
+ }
+
+ static void updateHandler(string apiResult)
+ {
+ gitAPI git = JsonUtility.FromJson<gitAPI>(apiResult);
+ bool option = EditorUtility.DisplayDialog("XSToon: Updater",
+ "You are on version: \nv" + XSStyles.ver + "\n\nThe latest version is: \n" + git.tag_name + "\n\n You can view the changelog either on my Discord, or at the Github page for this release." + "\n\nWould you like to update?",
+ "Download", "Cancel");
+
+ switch (option)
+ {
+ case true:
+ Application.OpenURL(git.zipball_url);
+ break;
+
+ case false:
+ Debug.Log("Cancelled Update.");
+ break;
+ }
+ // Debug.Log(apiResult);
+ }
+
+ static void changelogEditorUpdate()
+ {
+ while (!www.isDone)
+ return;
+
+ if (www.isNetworkError)
+ Debug.Log(www.error);
+ else
+ fetchChangelog(www.downloadHandler.text);
+
+ EditorApplication.update -= changelogEditorUpdate;
+ }
+
+ static void fetchChangelog(string apiResult)
+ {
+ gitAPI git = JsonUtility.FromJson<gitAPI>(apiResult);
+
+ publishdate = git.published_at;
+ curVer = git.tag_name;
+ changelog = git.body;
+ downloadLink = git.zipball_url;
+ //oldChangelog =
+
+ // Debug.Log(git.body);
+ // Debug.Log(apiResult);
+ // Debug.Log(git.tag_name);
+ // Debug.Log(git.html_url);
+ // Debug.Log(git.published_at);
+ // Debug.Log(git.zipball_url);
+ // Debug.Log(git.body);
+
+ }
+
+ public class gitAPI
+ {
+ public string name;
+ public string tag_name;
+ public string html_url;
+ public string published_at;
+ public string zipball_url;
+ public string body;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSUpdater.cs.meta b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSUpdater.cs.meta
new file mode 100644
index 00000000..37802156
--- /dev/null
+++ b/VRCSDK3Avatars/Assets/Resources/RalivDynamicPenetrationSystem/Plugins/Xiexes-Unity-Shaders-development/Editor/XSUpdater.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0610a99a2460971418b9abfff1af85a8
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: