Skip to content

Commit

Permalink
Merge pull request #64 from Unity-Technologies/dev
Browse files Browse the repository at this point in the history
serialization fix for inspect tab to prevent occasional blank window …
  • Loading branch information
alffanclub authored Jan 9, 2018
2 parents 9679833 + cace890 commit 2cb223f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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.3.0] - 2018-1-08
- serialization fix for inspect tab (was causing entire window to potentially be blank).
- documentation fix

## [1.2.0] - 2017-12-08
- Added asmdef to keep browser in its own assembly
- minor null check fixes
Expand Down
40 changes: 26 additions & 14 deletions Editor/InspectTab/AssetBundleInspectTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,14 @@ internal void RefreshBundles()

foreach(var folder in m_Data.BundleFolders)
{
if(Directory.Exists(folder.Path))
if(Directory.Exists(folder.path))
{
AddFilePathToList(folder.Path, folder.Path);
AddFilePathToList(folder.path, folder.path);
}
else
{
Debug.Log("Expected folder not found: " + folder);
pathsToRemove.Add(folder.Path);
pathsToRemove.Add(folder.path);
}
}
foreach (var path in pathsToRemove)
Expand Down Expand Up @@ -364,7 +364,7 @@ internal void AddPath(string newPath)
}
else
{
possibleFolderData.IgnoredFiles.Remove(newPath);
possibleFolderData.ignoredFiles.Remove(newPath);
}
}
}
Expand All @@ -382,20 +382,22 @@ internal void RemovePath(string pathToRemove)

internal void RemoveFolder(string pathToRemove)
{
m_BundleFolders.Remove(BundleFolders.FirstOrDefault(bfd => bfd.Path == pathToRemove));
m_BundleFolders.Remove(BundleFolders.FirstOrDefault(bfd => bfd.path == pathToRemove));
}

internal bool FolderIgnoresFile(string folderPath, string filePath)
{
var bundleFolderData = BundleFolders.FirstOrDefault(bfd => bfd.Path == folderPath);
return bundleFolderData != null && bundleFolderData.IgnoredFiles.Contains(filePath);
if (BundleFolders == null)
return false;
var bundleFolderData = BundleFolders.FirstOrDefault(bfd => bfd.path == folderPath);
return bundleFolderData != null && bundleFolderData.ignoredFiles.Contains(filePath);
}

internal BundleFolderData FolderDataContainingFilePath(string filePath)
{
foreach (var bundleFolderData in BundleFolders)
{
if (Path.GetFullPath(filePath).StartsWith(Path.GetFullPath(bundleFolderData.Path)))
if (Path.GetFullPath(filePath).StartsWith(Path.GetFullPath(bundleFolderData.path)))
{
return bundleFolderData;
}
Expand All @@ -407,7 +409,7 @@ private bool BundleFolderContains(string folderPath)
{
foreach(var bundleFolderData in BundleFolders)
{
if(Path.GetFullPath(bundleFolderData.Path) == Path.GetFullPath(folderPath))
if(Path.GetFullPath(bundleFolderData.path) == Path.GetFullPath(folderPath))
{
return true;
}
Expand All @@ -418,14 +420,24 @@ private bool BundleFolderContains(string folderPath)
[System.Serializable]
internal class BundleFolderData
{
internal string Path;
[SerializeField]
internal string path;

internal IList<string> IgnoredFiles;
[SerializeField]
private List<string> m_ignoredFiles;
internal List<string> ignoredFiles
{
get
{
if (m_ignoredFiles == null)
m_ignoredFiles = new List<string>();
return m_ignoredFiles;
}
}

internal BundleFolderData(string path)
internal BundleFolderData(string p)
{
Path = path;
IgnoredFiles = new List<string>();
path = p;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Editor/InspectTab/InspectSingleBundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ private void DrawBundleData()
var possibleFolderData = m_inspectTabData.FolderDataContainingFilePath(currentPath);
if (possibleFolderData != null)
{
if (!possibleFolderData.IgnoredFiles.Contains(currentPath))
possibleFolderData.IgnoredFiles.Add(currentPath);
if (!possibleFolderData.ignoredFiles.Contains(currentPath))
possibleFolderData.ignoredFiles.Add(currentPath);

if(m_assetBundleInspectTab != null)
m_assetBundleInspectTab.RefreshBundles();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.unity.assetbundlebrowser",
"version": "1.2.0",
"version": "1.3.0",
"unity": "2018.1",
"description": "Editor tool used to manually manage Asset Bundle configuration.",
"keywords": ["asset", "bundle", "bundles", "assetbundles"],
Expand Down

0 comments on commit 2cb223f

Please sign in to comment.