Skip to content

Commit

Permalink
Merge pull request #80 from Unity-Technologies/dev
Browse files Browse the repository at this point in the history
Code analysis & Doc update.
  • Loading branch information
alffanclub authored Mar 1, 2018
2 parents d8d6baa + e28d000 commit 728b1c3
Show file tree
Hide file tree
Showing 24 changed files with 790 additions and 744 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.4.0] - 2018-2-23
## [1.5.0] - 2018-02-28
- Code static analysis cleanup.
- Documentation updates.

## [1.4.0] - 2018-02-23
- Added a search bar to the main tab. Searches based on asset name.

## [1.3.0] - 2018-1-08
## [1.3.0] - 2018-01-08
- serialization fix for inspect tab (was causing entire window to potentially be blank).
- documentation fix

Expand Down
2 changes: 1 addition & 1 deletion Documentation/com.unity.assetbundlebrowser.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Lower left hand pane showing details of the bundles(s) selected in the Bundle Li

### Asset List

Upper right hand pane providing a list of assets contained in whichever bundles are selected in the Bundle List. Available functionality:
Upper right hand pane providing a list of assets contained in whichever bundles are selected in the Bundle List. The search field above this list will match with assets in any bundle. The Asset List will only display matching assets, and the Bundle List will only display bundles that contain matching assets. Available functionality:

* View all assets anticipated to be included in bundle. Sort asset list by any column header.

Expand Down
Binary file modified Documentation/images/browser_configure2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions Editor/AssetBundleBrowserMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ namespace AssetBundleBrowser
public class AssetBundleBrowserMain : EditorWindow, IHasCustomMenu, ISerializationCallbackReceiver
{

private static AssetBundleBrowserMain m_instance = null;
private static AssetBundleBrowserMain s_instance = null;
internal static AssetBundleBrowserMain instance
{
get
{
if (m_instance == null)
m_instance = GetWindow<AssetBundleBrowserMain>();
return m_instance;
if (s_instance == null)
s_instance = GetWindow<AssetBundleBrowserMain>();
return s_instance;
}
}

Expand Down Expand Up @@ -52,7 +52,7 @@ enum Mode
[MenuItem("Window/AssetBundle Browser", priority = 2050)]
static void ShowWindow()
{
m_instance = null;
s_instance = null;
instance.titleContent = new GUIContent("AssetBundles");
instance.Show();
}
Expand All @@ -62,7 +62,8 @@ static void ShowWindow()
List<AssetBundleDataSource.ABDataSource> m_DataSourceList = null;
public virtual void AddItemsToMenu(GenericMenu menu)
{
menu.AddItem(new GUIContent("Custom Sources"), multiDataSource, FlipDataSource);
if(menu != null)
menu.AddItem(new GUIContent("Custom Sources"), multiDataSource, FlipDataSource);
}
internal void FlipDataSource()
{
Expand All @@ -78,13 +79,13 @@ private void OnEnable()
m_ManageTab.OnEnable(subPos, this);
if(m_BuildTab == null)
m_BuildTab = new AssetBundleBuildTab();
m_BuildTab.OnEnable(subPos, this);
m_BuildTab.OnEnable(this);
if (m_InspectTab == null)
m_InspectTab = new AssetBundleInspectTab();
m_InspectTab.OnEnable(subPos, this);
m_InspectTab.OnEnable(subPos);

m_RefreshTexture = EditorGUIUtility.FindTexture("Refresh");

InitDataSources();
}
private void InitDataSources()
Expand Down Expand Up @@ -118,7 +119,6 @@ public void OnBeforeSerialize()
}
public void OnAfterDeserialize()
{
InitDataSources();
}

private Rect GetSubWindowArea()
Expand Down Expand Up @@ -152,7 +152,7 @@ private void OnGUI()
switch(m_Mode)
{
case Mode.Builder:
m_BuildTab.OnGUI(GetSubWindowArea());
m_BuildTab.OnGUI();
break;
case Mode.Inspect:
m_InspectTab.OnGUI(GetSubWindowArea());
Expand Down
7 changes: 3 additions & 4 deletions Editor/AssetBundleBuildTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ internal void OnDisable()
file.Close();

}
internal void OnEnable(Rect pos, EditorWindow parent)
internal void OnEnable(EditorWindow parent)
{
m_InspectTab = (parent as AssetBundleBrowserMain).m_InspectTab;

Expand Down Expand Up @@ -168,7 +168,7 @@ internal void OnEnable(Rect pos, EditorWindow parent)
}
}

internal void OnGUI(Rect pos)
internal void OnGUI()
{
m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
bool newState = false;
Expand Down Expand Up @@ -200,8 +200,7 @@ internal void OnGUI(Rect pos)
EditorGUILayout.Space();
GUILayout.BeginHorizontal();
var newPath = EditorGUILayout.TextField("Output Path", m_UserData.m_OutputPath);
if ( (newPath != m_UserData.m_OutputPath) &&
(newPath != string.Empty) )
if (!System.String.IsNullOrEmpty(newPath) && newPath != m_UserData.m_OutputPath)
{
m_UserData.m_UseDefaultPath = false;
m_UserData.m_OutputPath = newPath;
Expand Down
30 changes: 25 additions & 5 deletions Editor/AssetBundleDataSource/ABDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,44 @@ namespace AssetBundleBrowser.AssetBundleDataSource
/// <summary>
/// Build Info struct used by ABDataSource to pass needed build data around.
/// </summary>
public partial struct ABBuildInfo
public partial class ABBuildInfo
{
/// <summary>
/// Directory to place build result
/// </summary>
public string outputDirectory;
public string outputDirectory
{
get { return m_outputDirectory; }
set { m_outputDirectory = value; }
}
private string m_outputDirectory;
/// <summary>
/// Standard asset bundle build options.
/// </summary>
public BuildAssetBundleOptions options;
public BuildAssetBundleOptions options
{
get { return m_options; }
set { m_options = value; }
}
private BuildAssetBundleOptions m_options;
/// <summary>
/// Target platform for build.
/// </summary>
public BuildTarget buildTarget;
public BuildTarget buildTarget
{
get { return m_buildTarget; }
set { m_buildTarget = value; }
}
private BuildTarget m_buildTarget;
/// <summary>
/// Callback for build event.
/// </summary>
public Action<string> onBuild;
public Action<string> onBuild
{
get { return m_onBuild; }
set { m_onBuild = value; }
}
private Action<string> m_onBuild;
}

/// <summary>
Expand Down
32 changes: 19 additions & 13 deletions Editor/AssetBundleDataSource/ABDataSourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,30 @@ internal static List<Type> CustomABDataSourceTypes {
}
}

private static List<Type> BuildCustomABDataSourceList() {
var list = new List<Type>(Assembly
.GetExecutingAssembly()
.GetTypes()
.Where(t => t != typeof(ABDataSource))
.Where(t => typeof(ABDataSource).IsAssignableFrom(t)) );


private static List<Type> BuildCustomABDataSourceList()
{
var properList = new List<Type>();
properList.Add(null); //empty spot for "default"
for(int count = 0; count < list.Count; count++)
var x = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in x)
{
if(list[count].Name == "AssetDatabaseABDataSource")
properList[0] = list[count];
else
properList.Add(list[count]);
var list = new List<Type>(
assembly
.GetTypes()
.Where(t => t != typeof(ABDataSource))
.Where(t => typeof(ABDataSource).IsAssignableFrom(t)));


for (int count = 0; count < list.Count; count++)
{
if (list[count].Name == "AssetDatabaseABDataSource")
properList[0] = list[count];
else if(list[count] != null)
properList.Add(list[count]);
}
}


return properList;
}
}
Expand Down
6 changes: 6 additions & 0 deletions Editor/AssetBundleDataSource/AssetDatabaseABDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public bool CanSpecifyBuildOptions {
}

public bool BuildAssetBundles (ABBuildInfo info) {
if(info == null)
{
Debug.Log("Error in build");
return false;
}

var buildManifest = BuildPipeline.BuildAssetBundles(info.outputDirectory, info.options, info.buildTarget);
if (buildManifest == null)
{
Expand Down
8 changes: 4 additions & 4 deletions Editor/AssetBundleManageTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal class AssetBundleManageTab
[SerializeField]
float m_VerticalSplitterPercentLeft;
const float k_SplitterWidth = 3f;
private static float m_UpdateDelay = 0f;
private static float s_UpdateDelay = 0f;

SearchField m_searchField;

Expand Down Expand Up @@ -76,10 +76,10 @@ internal void OnEnable(Rect pos, EditorWindow parent)
internal void Update()
{
var t = Time.realtimeSinceStartup;
if (t - m_UpdateDelay > 0.1f ||
m_UpdateDelay > t) //something went strangely wrong if this second check is true.
if (t - s_UpdateDelay > 0.1f ||
s_UpdateDelay > t) //something went strangely wrong if this second check is true.
{
m_UpdateDelay = t - 0.001f;
s_UpdateDelay = t - 0.001f;

if(AssetBundleModel.Model.Update())
{
Expand Down
Loading

0 comments on commit 728b1c3

Please sign in to comment.