static void Init() { // Get existing open window or if none, make a new one: TressFXEditorWindow window = (TressFXEditorWindow)EditorWindow.GetWindow(typeof(TressFXEditorWindow)); window.Show(); }
public static void CreateAssetTFXB() { string hairfilePath = EditorUtility.OpenFilePanel("Open TressFX Hair data", "", "tfxb"); string hairfileName = System.IO.Path.GetFileNameWithoutExtension(hairfilePath); // Create new hair asset TressFXHair newHairData = ScriptableObjectUtility.CreateAsset <TressFXHair> (hairfileName); // Open hair data Hair hair = Hair.Import(HairFormat.TFXB, hairfilePath, TressFXEditorWindow.GetImportSettings()); hair.CreateUVs(); newHairData.LoadHairData(hair); EditorUtility.SetDirty(newHairData); AssetDatabase.SaveAssets(); }
public static void CreateAssetOBJ() { string hairfilePath = EditorUtility.OpenFilePanel("Open OBJ Hair data", "", "obj"); string hairfileName = System.IO.Path.GetFileNameWithoutExtension(hairfilePath); // Create new hair asset TressFXHair newHairData = ScriptableObjectUtility.CreateAsset <TressFXHair>(hairfileName); // Open hair data Hair hair = Hair.Import(HairFormat.OBJ, hairfilePath, TressFXEditorWindow.GetImportSettings()); if (TressFXEditorWindow.normalizeVertexCountActive && TressFXEditorWindow.normalizeVertexCount > 2) { hair.NormalizeStrands(TressFXEditorWindow.normalizeVertexCount); } hair = hair.PrepareSimulationParamatersAssetConverter(TressFXEditorWindow.followHairCount, TressFXEditorWindow.maxRadiusAroundGuideHair, Application.dataPath + "/" + EditorPrefs.GetString("TressFXAssetConverterPath")); hair.CreateUVs(); newHairData.LoadHairData(hair); EditorUtility.SetDirty(newHairData); AssetDatabase.SaveAssets(); }