Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AssetIdRemapUtility/Editor/AssetIdRemapBuilderEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static string namespaceRemapFilePath
[SerializeField] string m_SourceDirectory;
[SerializeField] string m_DestinationDirectory;

[SerializeField] TreeViewState m_TreeViewState;
[SerializeField] TreeViewState<int> m_TreeViewState;
[SerializeField] MultiColumnHeaderState m_MultiColumnHeaderState;
[SerializeField] bool m_DetailsExpanded;

Expand Down Expand Up @@ -85,7 +85,7 @@ void OnEnable()
// Check whether there is already a serialized view state (state
// that survived assembly reloading)
if (m_TreeViewState == null)
m_TreeViewState = new TreeViewState();
m_TreeViewState = new TreeViewState<int>();

if (m_MultiColumnHeaderState == null)
m_MultiColumnHeaderState = new MultiColumnHeaderState(new MultiColumnHeaderState.Column[]
Expand Down
19 changes: 6 additions & 13 deletions AssetIdRemapUtility/Editor/AssetIdRemapBuilderTreeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;

namespace UnityEngine.ProBuilder.AssetIdRemapUtility
{
sealed class AssetIdRemapBuilderTreeView : TreeView
sealed class AssetIdRemapBuilderTreeView : TreeView<int>
{
AssetIdRemapObject m_RemapObject = null;
const float k_RowHeight = 20f;
Expand All @@ -24,7 +23,7 @@ public AssetIdRemapObject remapObject
set { m_RemapObject = value; }
}

public AssetIdRemapBuilderTreeView(TreeViewState state, MultiColumnHeader header)
public AssetIdRemapBuilderTreeView(TreeViewState<int> state, MultiColumnHeader header)
: base(state, header)
{
rowHeight = 20f;
Expand All @@ -33,13 +32,11 @@ public AssetIdRemapBuilderTreeView(TreeViewState state, MultiColumnHeader header
extraSpaceBeforeIconAndLabel = 18f;
}

#pragma warning disable CS0618 // Type or member is obsolete
protected override TreeViewItem BuildRoot()
protected override TreeViewItem<int> BuildRoot()
{
StringTupleTreeElement root = new StringTupleTreeElement(0, -1, -1, "Root", "", "");

var all = new List<TreeViewItem>();
#pragma warning restore CS0618
var all = new List<TreeViewItem<int>>();

int index = 1;

Expand Down Expand Up @@ -108,9 +105,7 @@ void CellGUI(Rect rect, StringTupleTreeElement item, int visibleColumn, ref RowG
GUI.Label(rect, m_CellContents);
}

#pragma warning disable CS0618 // Type or member is obsolete
protected override bool DoesItemMatchSearch(TreeViewItem element, string search)
#pragma warning restore CS0618
protected override bool DoesItemMatchSearch(TreeViewItem<int> element, string search)
{
StringTupleTreeElement tup = element as StringTupleTreeElement;

Expand Down Expand Up @@ -201,9 +196,7 @@ protected override void CommandEventHandling()
}
}

#pragma warning disable CS0618 // Type or member is obsolete
class StringTupleTreeElement : TreeViewItem
#pragma warning restore CS0618
class StringTupleTreeElement : TreeViewItem<int>
{
public string item1;
public string item2;
Expand Down
14 changes: 5 additions & 9 deletions AssetIdRemapUtility/Editor/AssetIdRemapEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@
AssetTreeView m_AssetsToDeleteTreeView;
MultiColumnHeader m_MultiColumnHeader;
Rect m_AssetTreeRect = new Rect(0, 0, 0, 0);
#pragma warning disable CS0618 // Type or member is obsolete

[SerializeField]
TreeViewState m_TreeViewState = null;
#pragma warning restore CS0618
TreeViewState<int> m_TreeViewState = null;

Check warning on line 134 in AssetIdRemapUtility/Editor/AssetIdRemapEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

AssetIdRemapUtility/Editor/AssetIdRemapEditor.cs#L134

Added line #L134 was not covered by tests

[SerializeField]
MultiColumnHeaderState m_MultiColumnHeaderState = null;
GUIContent m_AssetTreeSettingsContent = null;
Expand Down Expand Up @@ -178,10 +178,8 @@
Debug.LogWarning("Could not find a valid asset id remap file!");
}

#pragma warning disable CS0618 // Type or member is obsolete
if (m_TreeViewState == null)
m_TreeViewState = new TreeViewState();
#pragma warning restore CS0618
m_TreeViewState = new TreeViewState<int>();

Check warning on line 182 in AssetIdRemapUtility/Editor/AssetIdRemapEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

AssetIdRemapUtility/Editor/AssetIdRemapEditor.cs#L182

Added line #L182 was not covered by tests

if (m_MultiColumnHeaderState == null)
m_MultiColumnHeaderState = new MultiColumnHeaderState(new MultiColumnHeaderState.Column[]
Expand Down Expand Up @@ -477,9 +475,7 @@
m_ConversionReadyState = GetReadyState();
}

#pragma warning disable CS0618 // Type or member is obsolete
bool RemoveAssetStoreFiles(TreeViewItem root, StringBuilder log)
#pragma warning restore CS0618
bool RemoveAssetStoreFiles(TreeViewItem<int> root, StringBuilder log)
{
AssetTreeItem node = root as AssetTreeItem;

Expand Down
16 changes: 6 additions & 10 deletions AssetIdRemapUtility/Editor/AssetTreeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

namespace UnityEngine.ProBuilder.AssetIdRemapUtility
{
#pragma warning disable CS0618 // Type or member is obsolete
sealed class AssetTreeItem : TreeViewItem
#pragma warning restore CS0618
sealed class AssetTreeItem : TreeViewItem<int>
{
string m_RelativePath;
string m_FullPath;
Expand Down Expand Up @@ -101,8 +99,7 @@
}
}

#pragma warning disable CS0618 // Type or member is obsolete
class AssetTreeView : TreeView
class AssetTreeView : TreeView<int>
{
string m_RootDirectory = null;
GUIContent m_TempContent = new GUIContent();
Expand Down Expand Up @@ -134,13 +131,13 @@
m_FileIgnorePatterns = regexStrings.Select(x => new Regex(x));
}

public AssetTreeView(TreeViewState state, MultiColumnHeader header) : base(state, header)
public AssetTreeView(TreeViewState<int> state, MultiColumnHeader header) : base(state, header)

Check warning on line 134 in AssetIdRemapUtility/Editor/AssetTreeView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

AssetIdRemapUtility/Editor/AssetTreeView.cs#L134

Added line #L134 was not covered by tests
{
showBorder = true;
columnIndexForTreeFoldouts = 0;
rowHeight = 18f;
}
protected override TreeViewItem BuildRoot()
protected override TreeViewItem<int> BuildRoot()
{
AssetTreeItem root = new AssetTreeItem(0, Application.dataPath, "")
{
Expand All @@ -151,7 +148,7 @@
if (string.IsNullOrEmpty(m_RootDirectory) || !Directory.Exists(m_RootDirectory))
{
// if root has no children and you SetupDepthsFromParentsAndChildren nullrefs are thrown
var list = new List<TreeViewItem>() {};
var list = new List<TreeViewItem<int>>() {};

Check warning on line 151 in AssetIdRemapUtility/Editor/AssetTreeView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

AssetIdRemapUtility/Editor/AssetTreeView.cs#L151

Added line #L151 was not covered by tests
SetupParentsAndChildrenFromDepths(root, list);
}
else
Expand Down Expand Up @@ -196,7 +193,7 @@
PopulateAssetTree(dir, leaf, ref nodeIdIndex);
}

public void ApplyEnabledFilters(TreeViewItem root)
public void ApplyEnabledFilters(TreeViewItem<int> root)
{
AssetTreeItem node = root as AssetTreeItem;
AssetTreeItem parent = root.parent as AssetTreeItem;
Expand Down Expand Up @@ -309,5 +306,4 @@
GatherTreeItems(child as AssetTreeItem, list);
}
}
#pragma warning restore CS0618 // Type or member is obsolete
}
2 changes: 0 additions & 2 deletions Editor/EditorCore/HierarchyListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ static void ObjectEventChangesPublished(ref ObjectChangeEventStream stream)

static GameObject InstanceIDToObject(int instanceId)
{
#pragma warning disable CS0618
return UnityEditor.EditorUtility.InstanceIDToObject(instanceId) as GameObject;
#pragma warning restore CS0618
}
#endif

Expand Down