From eb84bb298d2b95aec7b2ae12cbf25ac64f25379a Mon Sep 17 00:00:00 2001 From: tylermurphy534 Date: Sun, 6 Nov 2022 15:12:42 -0500 Subject: move to self host --- .../Includes/OrificeSetup.cs | 152 +++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 VRCSDK3AvatarsQuest/Assets/Resources/RalivDynamicPenetrationSystem/Includes/OrificeSetup.cs (limited to 'VRCSDK3AvatarsQuest/Assets/Resources/RalivDynamicPenetrationSystem/Includes/OrificeSetup.cs') diff --git a/VRCSDK3AvatarsQuest/Assets/Resources/RalivDynamicPenetrationSystem/Includes/OrificeSetup.cs b/VRCSDK3AvatarsQuest/Assets/Resources/RalivDynamicPenetrationSystem/Includes/OrificeSetup.cs new file mode 100644 index 00000000..961b661c --- /dev/null +++ b/VRCSDK3AvatarsQuest/Assets/Resources/RalivDynamicPenetrationSystem/Includes/OrificeSetup.cs @@ -0,0 +1,152 @@ +#if UNITY_EDITOR +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using UnityEngine.Experimental.Rendering; + +public class OrificeSetup : ScriptableWizard { + + public GameObject orifice; + private string errorInfo=""; + private int[] shapes; + private Material orificeMaterial; + + [MenuItem("Tools/Raliv/Orifice Setup")] + static void Setup() { + ScriptableWizard.DisplayWizard("Orifice Setup"); + } + + private List blendshapeNameList(Mesh m) { + List nameList = new List(); + nameList.Add("None"); + for (int i=0; i(); + Mesh mesh = meshRenderer.sharedMesh; + if (mesh.tangents.Length0) BlitShape(texture, mesh, shapes[0]-1, 0); + if (shapes[1]>0) BlitShape(texture, mesh, shapes[1]-1, 1); + if (shapes[2]>0) BlitShape(texture, mesh, shapes[2]-1, 2); + if (shapes[3]>0) BlitShape(texture, mesh, shapes[3]-1, 3); + texture.Apply(); + AssetDatabase.CreateAsset(texture, "Assets/RalivDynamicPenetrationSystem/MyData/"+orifice.name+".asset"); + AssetDatabase.SaveAssets(); + if (orifice.GetComponent()!=null) { + orificeMaterial.SetTexture("_OrificeData",(Texture2D)AssetDatabase. LoadAssetAtPath("Assets/RalivDynamicPenetrationSystem/MyData/"+orifice.name+".asset",typeof(Texture2D))); + } + } + } + + void FindOrificeMaterial(SkinnedMeshRenderer meshRenderer) { + for (int i=0;i()==null) { + EditorGUILayout.HelpBox("No skinned mesh renderer detected!", MessageType.Error); + } else { + if (orificeMaterial==null) { + FindOrificeMaterial(orifice.GetComponent()); + if (orificeMaterial==null) EditorGUILayout.HelpBox("Mesh does not have orifice material!", MessageType.Error); + } else { + EditorGUILayout.LabelField("Select blendshapes for penetration deformations", textStyle); + EditorGUILayout.LabelField("", textStyle); + EditorGUILayout.LabelField("Entrance", textStyle); + shapes[0] = EditorGUILayout.Popup(shapes[0], blendshapeNameList(orifice.GetComponent().sharedMesh).ToArray()); + EditorGUILayout.LabelField("Depth1", textStyle); + shapes[1] = EditorGUILayout.Popup(shapes[1], blendshapeNameList(orifice.GetComponent().sharedMesh).ToArray()); + EditorGUILayout.LabelField("Depth2", textStyle); + shapes[2] = EditorGUILayout.Popup(shapes[2], blendshapeNameList(orifice.GetComponent().sharedMesh).ToArray()); + EditorGUILayout.LabelField("Depth3", textStyle); + shapes[3] = EditorGUILayout.Popup(shapes[3], blendshapeNameList(orifice.GetComponent().sharedMesh).ToArray()); + EditorGUILayout.LabelField("", textStyle); + if (GUILayout.Button("Generate Texture")) { + CreateTexture(); + Close(); + } + } + } + } + } +} + +#endif \ No newline at end of file -- cgit v1.2.3-freya