public static bool SelectDirectory(UnityEngine.Object _srcAsset, out string directoryPath, out string objName) { directoryPath = ""; objName = ""; string assetPath = AssetDatabase.GetAssetPath(_srcAsset); string fbxDirectory = (Application.dataPath.Remove(Application.dataPath.Length - 6, 6) + assetPath.Remove(assetPath.LastIndexOf('/'))).Replace("/", @"\"); string folderPath = EditorUtility.OpenFolderPanel("Select Directory", fbxDirectory, ""); if (folderPath.Length == 0) { return(false); } directoryPath = UEPath.FilePathToAssetPath(folderPath) + "/"; objName = UEPath.GetPathName(assetPath); return(true); }
void ProceedGUI() { EditorGUILayout.LabelField("Select Optimize AnimationClip Asset"); m_OptimizeAsset = (AnimationClip)EditorGUILayout.ObjectField(m_OptimizeAsset, typeof(AnimationClip), false); if (!m_OptimizeAsset) { return; } m_OptimizeScale = EditorGUILayout.Toggle("Wipe Scale:", m_OptimizeScale); m_OptimizePresicion = EditorGUILayout.IntSlider("Float Presicion", m_OptimizePresicion, 2, 8); if (GUILayout.Button("Optimize")) { if (UEAsset.SaveFilePath(out string filePath, "anim", UEPath.RemoveExtension(UEPath.GetPathName(AssetDatabase.GetAssetPath(m_OptimizeAsset))) + "_O")) { AnimationClip clip = OptimizeAnimation(m_OptimizeAsset, m_OptimizePresicion, m_OptimizeScale); string assetPath = UEPath.FilePathToAssetPath(filePath); AssetDatabase.CreateAsset(clip, assetPath); } } }
void OnGUI() { EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField("Select Target FBX Source"); m_ModelPrefab = EditorGUILayout.ObjectField(m_ModelPrefab, typeof(GameObject), false) as GameObject; ModelImporter importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(Selection.activeObject)) as ModelImporter; if (importer != null) { m_ModelPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GetAssetPath(Selection.activeObject)); } else { importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(m_ModelPrefab)) as ModelImporter; } if (!importer) { EditorGUILayout.LabelField("<Color=#FF0000>Select FBX Model</Color>", UEGUIStyle_Window.m_ErrorLabel); return; } m_GenerateUV = (enum_VertexData)EditorGUILayout.EnumPopup("Generate UV:", m_GenerateUV); if (m_GenerateUV != enum_VertexData.None && GUILayout.Button("Generate")) { if (UEAsset.SaveFilePath(out string filePath, "prefab", UEPath.RemoveExtension(UEPath.GetPathName(AssetDatabase.GetAssetPath(m_ModelPrefab))) + "_SN")) { GenerateSkinnedTarget(UEPath.FilePathToAssetPath(filePath), m_ModelPrefab, m_GenerateUV); } } EditorGUILayout.EndVertical(); }