//#define UNITY_5 //#define DEVELOPER namespace P4Connect { #if DEVELOPER #if Unity_4_0 using UnityEditor; using UnityEngine; using System.Collections; public class PackageIcons { // This code is only used to package icons into an asset to be included in the distribution // It only runs under unity 4.X, Tha AssetBundle code has changed under unity 5.X // We build p4connect in Unity 4.X so it is portable to either 4.X or 5.X [MenuItem("Assets/PackageIcons")] static void DoPackageIcons() { Debug.Log("running 4.X asset packager"); // Build the resource file from the active selection. string [] assetNames = new string[Selection.objects.Length]; for (int i = 0; i < Selection.objects.Length; ++i) { assetNames[i] = System.IO.Path.GetFileName(Selection.objects[i].name); } BuildPipeline.BuildAssetBundleExplicitAssetNames(Selection.objects, assetNames, "Assets/P4Connect/Editor/Icons.pack", BuildAssetBundleOptions.UncompressedAssetBundle); } } #endif #if UNITY_5 using System; using UnityEditor; using UnityEngine; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using P4Connect; using Perforce.P4; using Object = UnityEngine.Object; public class PackageIcons { private static string _p4ConnectBundle = "P4Connect"; private static string _iconAssetPath = Path.GetFullPath(Main.RootPath + "Assets/P4Connect/Editor"); private static string _sourceIconsPath = Path.GetFullPath(Main.RootPath + "../src/Icons/"); private static string _assetIconsPath = Path.GetFullPath(Main.RootPath + "Assets/Icons/"); // This code is only used to package icons into an asset to be included in the distribution // It only runs under unity 4.X, Tha AssetBundle code has changed under unity 5.X // We build p4connect in Unity 4.X so it is portable to either 4.X or 5.X [MenuItem("Assets/CopyIcons")] static void CopyIconsIntoAssets() { //Debug.Log("fromDir: " + _sourceIconsPath); //Debug.Log("toDir: " + _assetIconsPath); Directory.CreateDirectory(_assetIconsPath); var files = Directory.GetFiles(_sourceIconsPath); foreach (var file in files) { var filename = Path.GetFileName(file); var newfile = System.IO.Path.Combine(_assetIconsPath, filename); if (System.IO.File.Exists(newfile)) // Make sure I can overwrite the file. { System.IO.File.SetAttributes(newfile, FileAttributes.Normal); } System.IO.File.Copy(file, newfile, true); } } [MenuItem("Assets/PackageIcons")] static void DoPackageIcons() { // Build the resource file from the images in the p4connect/main/src/Icons directory Debug.Log("running 5.X asset packager"); IList<string> names = new List<string>(); IList<Object> objs = new List<Object>(); Debug.Log("srcdir: " + _assetIconsPath); var files = Directory.GetFiles(_assetIconsPath); foreach (string f in files) { string assetPath = Utils.FullPathToAssetPath(f); var textureName = Path.GetFileNameWithoutExtension(assetPath); var extension = Path.GetExtension(assetPath); if (string.Equals(extension, ".jpg", StringComparison.InvariantCultureIgnoreCase) || string.Equals(extension, ".png", StringComparison.InvariantCultureIgnoreCase)) { Debug.Log("processing: " + textureName); var importer = AssetImporter.GetAtPath(assetPath); importer.assetBundleName = _p4ConnectBundle; names.Add(assetPath); } else { Debug.Log("skipping non texture: " + f); } } var build = new AssetBundleBuild { assetBundleName = _p4ConnectBundle, assetNames = names.ToArray() }; BuildPipeline.BuildAssetBundles(_iconAssetPath, new[]{ build }, BuildAssetBundleOptions.UncompressedAssetBundle, BuildTarget.StandaloneWindows); } } #endif #endif // DEVELOPER }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 20275 | Norman Morse |
Update source to match 2016.2 patch 2 release Much thrashing of source during refactor. Proper caching of asset statuses, reducing fstats issued. Some bug fixes by Liz Lam Cleanup of Pending changes, rework of initialization and play/stop play transitions |
||
#3 | 18462 | Norman Morse |
Final Changes needed for 2016.1 release New Icons. New Icon Packaging. Unity 4 compatibility changes. |
||
#2 | 18436 | Norman Morse |
A lot of clean up. PackageIcons was a mess Needed to remove GUIStyle Saving because textures are getting lost. |
||
#1 | 18418 | Norman Morse |
Many changes from the dev branch. Icons are packaged differently. Style Sheet is created / used New ConnectionWizard Dialog New PasswordDialog Generate -a tickets Update version to 2016.1.0.0 |
||
//guest/norman_morse/p4connect/main/src/P4Connect/P4Connect/P4Connect.PackageIcons.cs | |||||
#1 | 18385 | Norman Morse |
Mostly working, friday before release. Password needs styling. Debug Code needs to be disabled |