/** ExportPackage * * a_assets_path : アセットフォルダからの相対パス。 * */ public static void ExportPackage(Fee.File.Path a_assets_path, string a_package_name, UnityEditor.ExportPackageOptions a_option) { try{ string t_path = "Assets/" + a_assets_path.GetNormalizePath(); UnityEngine.Debug.Log("ExportPackage : " + t_path + " : " + a_package_name); UnityEditor.AssetDatabase.ExportPackage(t_path, a_package_name, a_option); }catch (System.Exception t_exception) { UnityEngine.Debug.LogError(t_exception.Message); } }
/** FindAnimationClip */ private static void FindAnimationClip_Directory(Fee.File.Path a_path, System.Collections.Generic.List <FindItem> a_out_list) { //ディレクトリ内のファイルを列挙。 System.Collections.Generic.List <string> t_name_list = Fee.EditorTool.Utility.CreateFileNameList(a_path); foreach (string t_file_name_item in t_name_list) { if (System.Text.RegularExpressions.Regex.IsMatch(t_file_name_item, "^.*\\.(fbx)$") == true) { FindAnimationClip(new File.Path(a_path.GetNormalizePath() + "/" + t_file_name_item), a_out_list); } } }
/** ファイルを列挙。 * * a_assets_path : アセットフォルダからの相対パス。 * */ public static System.Collections.Generic.List <string> CreateFileNameList(Fee.File.Path a_assets_path) { System.Collections.Generic.List <string> t_list = new System.Collections.Generic.List <string>(); { try{ string[] t_fullpath_list = System.IO.Directory.GetFiles(Fee.File.Path.CreateAssetsPath().GetPath(), a_assets_path.GetNormalizePath() + "/", System.IO.SearchOption.TopDirectoryOnly); for (int ii = 0; ii < t_fullpath_list.Length; ii++) { string t_name = System.IO.Path.GetFileName(t_fullpath_list[ii]); if (t_name.Length > 0) { t_list.Add(t_name); } } }catch (System.Exception t_exception) { UnityEngine.Debug.LogError(t_exception.Message); } } return(t_list); }
/** ファイル検索。 * * return == フルパス。 * */ public static Fee.File.Path FindFile(Fee.File.Path a_assets_path, string a_find_name) { string[] t_dir_list = System.IO.Directory.GetDirectories(Fee.File.Path.CreateAssetsPath().GetPath(), a_assets_path.GetNormalizePath() + "/", System.IO.SearchOption.AllDirectories); for (int ii = 0; ii < t_dir_list.Length; ii++) { string[] t_file_list = System.IO.Directory.GetFiles(t_dir_list[ii], a_find_name, System.IO.SearchOption.TopDirectoryOnly); if (t_file_list != null) { if (t_file_list.Length > 0) { UnityEngine.Debug.Log("FindFile : " + a_find_name + " : " + t_file_list[0]); return(new Fee.File.Path(t_file_list[0])); } } } return(null); }
/** ディレクトリを列挙。 * * a_assets_path : アセットフォルダからの相対パス。 * */ public static System.Collections.Generic.List <string> CreateDirectoryNameList(Fee.File.Path a_assets_path) { System.Collections.Generic.List <string> t_list = new System.Collections.Generic.List <string>(); { string[] t_fullpath_list = System.IO.Directory.GetDirectories(Fee.File.Path.CreateAssetsPath().GetPath(), a_assets_path.GetNormalizePath() + "/", System.IO.SearchOption.TopDirectoryOnly); for (int ii = 0; ii < t_fullpath_list.Length; ii++) { string t_name = System.IO.Path.GetFileName(t_fullpath_list[ii]); if (t_name.Length > 0) { t_list.Add(t_name); } } } return(t_list); }
/** マップチップテクスチャーを分割。 * * a_use_count == true : 重複する場合に名前を最後にカウントを付ける。 * */ public static void Parse(UnityEngine.Texture2D a_texture, int a_tip_size, Fee.File.Path a_path_out_directory, bool a_use_count) { if (a_texture != null) { if (a_tip_size > 0) { Tool.Assert((a_texture.width % a_tip_size) == 0); Tool.Assert((a_texture.height % a_tip_size) == 0); int t_xx_max = a_texture.width / a_tip_size; int t_yy_max = a_texture.height / a_tip_size; for (int yy = 0; yy < t_yy_max; yy++) { for (int xx = 0; xx < t_xx_max; xx++) { //テクスチャー作成。 UnityEngine.Texture2D t_new_texture = Fee.EditorTool.Utility.CreateTextureFromTexture(a_texture, xx * a_tip_size, yy * a_tip_size, a_tip_size, a_tip_size); //PNGコンバート。 byte[] t_binary = UnityEngine.ImageConversion.EncodeToPNG(t_new_texture); //MD5. string t_md5 = Fee.MD5.MD5.CalcMD5(t_binary); if (a_use_count == true) { //パス。 Fee.File.Path t_path = null; { int t_count = 0; while (true) { if (t_count <= 0) { t_path = new Fee.File.Path(a_path_out_directory.GetNormalizePath() + "/" + t_md5 + ".png"); } else { t_path = new Fee.File.Path(a_path_out_directory.GetNormalizePath() + "/" + t_md5 + "_" + t_count.ToString() + ".png"); } //ファイル出力。 if (Fee.EditorTool.Utility.IsExistFile(t_path) == false) { Fee.EditorTool.Utility.WriteBinaryFile(t_path, t_binary, false); break; } t_count++; } } } else { //パス。 Fee.File.Path t_path = new Fee.File.Path(a_path_out_directory.GetNormalizePath() + "/" + t_md5 + ".png"); //ファイル出力。 if (Fee.EditorTool.Utility.IsExistFile(t_path) == false) { Fee.EditorTool.Utility.WriteBinaryFile(t_path, t_binary, false); } } } } } else { Tool.Assert(false); } } else { Tool.Assert(false); } }