移除报错的VFolders
This commit is contained in:
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c1da0cc833e64f4c96ba170387ea7a6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "VFolders",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3331bc437f3a24586b7e86e7bdd62b5e
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb4ae53db31ef4fdfbfc47484afb8192
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,102 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor.SceneManagement;
|
||||
using static VFolders.Libs.VUtils;
|
||||
using static VFolders.Libs.VGUI;
|
||||
// using static VTools.VDebug;
|
||||
|
||||
namespace VFolders
|
||||
{
|
||||
[FilePath("Library/vFolders Cache.asset", FilePathAttribute.Location.ProjectFolder)]
|
||||
public class VFoldersCache : ScriptableSingleton<VFoldersCache>
|
||||
{
|
||||
|
||||
public Texture2D GetIcon(int key)
|
||||
{
|
||||
if (instance.iconTextures_byKey.ContainsKey(key))
|
||||
return instance.iconTextures_byKey[key];
|
||||
|
||||
if (instance.iconTextureDatas_byKey.ContainsKey(key))
|
||||
return instance.iconTextures_byKey[key] = instance.iconTextureDatas_byKey[key].GetTexture();
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public void AddIcon(int key, Texture2D icon)
|
||||
{
|
||||
instance.iconTextures_byKey[key] = icon;
|
||||
instance.iconTextureDatas_byKey[key] = new TextureData(icon);
|
||||
|
||||
instance.Save(true);
|
||||
|
||||
}
|
||||
public bool HasIcon(int key) => instance.iconTextureDatas_byKey.ContainsKey(key);
|
||||
|
||||
public Dictionary<int, Texture2D> iconTextures_byKey = new();
|
||||
public SerializableDictionary<int, TextureData> iconTextureDatas_byKey = new();
|
||||
|
||||
[System.Serializable]
|
||||
public class TextureData
|
||||
{
|
||||
public byte[] rawData;
|
||||
public int width;
|
||||
public int height;
|
||||
public TextureFormat format;
|
||||
public int mipCount;
|
||||
public float pixelsPerPoint;
|
||||
|
||||
public TextureData(Texture2D t)
|
||||
{
|
||||
rawData = t.GetRawTextureData();
|
||||
width = t.width;
|
||||
height = t.height;
|
||||
format = t.format;
|
||||
mipCount = t.mipmapCount;
|
||||
pixelsPerPoint = t.GetPropertyValue<float>("pixelsPerPoint");
|
||||
|
||||
}
|
||||
|
||||
public Texture2D GetTexture()
|
||||
{
|
||||
var t = new Texture2D(width, height, format, mipCount, false);
|
||||
t.LoadRawTextureData(rawData);
|
||||
t.SetPropertyValue("pixelsPerPoint", pixelsPerPoint);
|
||||
t.hideFlags = HideFlags.DontSave;
|
||||
t.Apply();
|
||||
|
||||
return t;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public SerializableDictionary<string, FolderState> folderStates_byGuid = new();
|
||||
|
||||
[System.Serializable]
|
||||
public class FolderState
|
||||
{
|
||||
public bool isEmpty;
|
||||
|
||||
public List<string> contentMinimapIconNames = new();
|
||||
|
||||
public string autoIconName = "";
|
||||
|
||||
public bool needsUpdate;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69c14c9fceb5b4c968f55fe5786a0bee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,521 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using Type = System.Type;
|
||||
using static VFolders.Libs.VUtils;
|
||||
using static VFolders.Libs.VGUI;
|
||||
// using static VTools.VDebug;
|
||||
using static VFolders.VFolders;
|
||||
using static VFolders.VFoldersData;
|
||||
using static VFolders.VFoldersCache;
|
||||
|
||||
|
||||
|
||||
namespace VFolders
|
||||
{
|
||||
public class VFoldersController
|
||||
{
|
||||
|
||||
public void UpdateExpandQueue()
|
||||
{
|
||||
if (treeViewAnimatesExpansion) return;
|
||||
|
||||
if (!expandQueue_toAnimate.Any())
|
||||
{
|
||||
if (!expandQueue_toCollapseAfterAnimation.Any()) return;
|
||||
|
||||
foreach (var id in expandQueue_toCollapseAfterAnimation)
|
||||
SetExpanded_withoutAnimation(id, false);
|
||||
|
||||
expandQueue_toCollapseAfterAnimation.Clear();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var iid = expandQueue_toAnimate.First().id;
|
||||
var expand = expandQueue_toAnimate.First().expand;
|
||||
|
||||
|
||||
if (expandedIds.Contains(iid) != expand)
|
||||
SetExpanded_withAnimation(iid, expand);
|
||||
|
||||
expandQueue_toAnimate.RemoveAt(0);
|
||||
|
||||
|
||||
window.Repaint();
|
||||
|
||||
}
|
||||
|
||||
public List<ExpandQueueEntry> expandQueue_toAnimate = new();
|
||||
public List<int> expandQueue_toCollapseAfterAnimation = new();
|
||||
|
||||
public struct ExpandQueueEntry { public int id; public bool expand; }
|
||||
|
||||
public bool animatingExpansion => expandQueue_toAnimate.Any() || expandQueue_toCollapseAfterAnimation.Any();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void UpdateScrollAnimation()
|
||||
{
|
||||
if (!animatingScroll) return;
|
||||
|
||||
|
||||
var lerpSpeed = 10;
|
||||
|
||||
var lerpedScrollPos = MathUtil.SmoothDamp(currentScrollPos, targetScrollPos, lerpSpeed, ref scrollPosDerivative, editorDeltaTime);
|
||||
|
||||
SetScrollPos(lerpedScrollPos);
|
||||
|
||||
window.Repaint();
|
||||
|
||||
|
||||
|
||||
if (lerpedScrollPos.DistanceTo(targetScrollPos) > .4f) return;
|
||||
|
||||
SetScrollPos(targetScrollPos);
|
||||
|
||||
animatingScroll = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public float targetScrollPos;
|
||||
public float scrollPosDerivative;
|
||||
|
||||
public bool animatingScroll;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void UpdateHighlightAnimation()
|
||||
{
|
||||
if (!animatingHighlight) return;
|
||||
|
||||
|
||||
var lerpSpeed = 1.2f;
|
||||
|
||||
MathUtil.SmoothDamp(ref highlightAmount, 0, lerpSpeed, ref highlightDerivative, editorDeltaTime);
|
||||
|
||||
window.Repaint();
|
||||
|
||||
|
||||
|
||||
if (highlightAmount > .05f) return;
|
||||
|
||||
highlightAmount = 0;
|
||||
|
||||
animatingHighlight = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public float highlightAmount;
|
||||
public float highlightDerivative;
|
||||
|
||||
public bool animatingHighlight;
|
||||
|
||||
public string folderToHighlight;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void UpdateState()
|
||||
{
|
||||
isOneColumn = window.GetFieldValue<int>("m_ViewMode") == 0;
|
||||
|
||||
treeViewController = window.GetFieldValue(isOneColumn ? "m_AssetTree" : "m_FolderTree");
|
||||
treeViewControllerData = treeViewController?.GetPropertyValue("data");
|
||||
|
||||
|
||||
|
||||
var treeViewState = treeViewController?.GetPropertyValue<TreeViewState>("state");
|
||||
|
||||
currentScrollPos = treeViewState?.scrollPos.y ?? 0;
|
||||
|
||||
expandedIds = treeViewState?.expandedIDs ?? new List<int>();
|
||||
|
||||
|
||||
|
||||
var treeViewAnimator = treeViewController?.GetMemberValue("m_ExpansionAnimator");
|
||||
var treeViewAnimatorSetup = treeViewAnimator?.GetMemberValue("m_Setup");
|
||||
|
||||
treeViewAnimatesScroll = treeViewController?.GetMemberValue<UnityEditor.AnimatedValues.AnimFloat>("m_FramingAnimFloat").isAnimating ?? false;
|
||||
|
||||
treeViewAnimatesExpansion = treeViewAnimator?.GetMemberValue<bool>("isAnimating") ?? false;
|
||||
|
||||
}
|
||||
|
||||
bool isOneColumn;
|
||||
|
||||
object treeViewController;
|
||||
object treeViewControllerData;
|
||||
|
||||
public float currentScrollPos;
|
||||
|
||||
public List<int> expandedIds = new();
|
||||
|
||||
public bool treeViewAnimatesScroll;
|
||||
public bool treeViewAnimatesExpansion;
|
||||
|
||||
public int GetRowIndex(int instanceId)
|
||||
{
|
||||
return treeViewControllerData.InvokeMethod<int>("GetRow", instanceId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void ToggleExpanded(TreeViewItem item)
|
||||
{
|
||||
SetExpanded_withAnimation(item.id, !expandedIds.Contains(item.id));
|
||||
|
||||
window.Repaint();
|
||||
|
||||
}
|
||||
|
||||
public void CollapseAll()
|
||||
{
|
||||
|
||||
var idsToCollapse_roots = expandedIds.Where(id => EditorUtility.InstanceIDToObject(id).GetPath() is string path &&
|
||||
path.HasParentPath() &&
|
||||
(path.GetParentPath() == "Assets" || path.GetParentPath() == "Packages"));
|
||||
|
||||
|
||||
var idsToCollapse_children = expandedIds.Where(id => EditorUtility.InstanceIDToObject(id).GetPath() is string path &&
|
||||
!path.IsNullOrEmpty() &&
|
||||
path != "Assets" &&
|
||||
path != "Packages" &&
|
||||
!idsToCollapse_roots.Contains(id));
|
||||
|
||||
|
||||
expandQueue_toCollapseAfterAnimation = idsToCollapse_children.ToList();
|
||||
|
||||
expandQueue_toAnimate = idsToCollapse_roots.Select(id => new ExpandQueueEntry { id = id, expand = false })
|
||||
.OrderBy(row => GetRowIndex(row.id)).ToList();
|
||||
|
||||
|
||||
StartScrollAnimation(targetScrollPos: 0);
|
||||
|
||||
|
||||
window.Repaint();
|
||||
|
||||
}
|
||||
|
||||
public void Isolate(TreeViewItem targetItem)
|
||||
{
|
||||
|
||||
List<TreeViewItem> getParents(TreeViewItem item)
|
||||
{
|
||||
var parents = new List<TreeViewItem>();
|
||||
|
||||
while (item.parent != null)
|
||||
parents.Add(item = item.parent);
|
||||
|
||||
return parents;
|
||||
|
||||
}
|
||||
|
||||
var targetItemParents = getParents(targetItem);
|
||||
|
||||
|
||||
|
||||
var expandedVisibleItems = new List<TreeViewItem>();
|
||||
|
||||
foreach (var expandedId in expandedIds)
|
||||
if (GetRowIndex(expandedId) is int rowIndex && rowIndex != -1)
|
||||
expandedVisibleItems.Add(treeViewControllerData.InvokeMethod<TreeViewItem>("GetItem", rowIndex));
|
||||
|
||||
|
||||
|
||||
var itemsToCollapse = expandedVisibleItems.ToList();
|
||||
|
||||
itemsToCollapse.Remove(targetItem);
|
||||
itemsToCollapse.RemoveAll(r => targetItemParents.Contains(r));
|
||||
itemsToCollapse.RemoveAll(r => itemsToCollapse.Intersect(getParents(r)).Any());
|
||||
|
||||
|
||||
|
||||
expandQueue_toAnimate = itemsToCollapse.Select(item => new ExpandQueueEntry { id = item.id, expand = false })
|
||||
.Append(new ExpandQueueEntry { id = targetItem.id, expand = true })
|
||||
.OrderBy(r => GetRowIndex(r.id)).ToList();
|
||||
|
||||
|
||||
window.Repaint();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void StartExpandAnimation(List<int> targetExpandedIds)
|
||||
{
|
||||
|
||||
var toExpand = targetExpandedIds.Except(expandedIds).ToHashSet();
|
||||
var toCollapse = expandedIds.Except(targetExpandedIds).ToHashSet();
|
||||
|
||||
|
||||
|
||||
// hanlde non-animated expansions/collapses
|
||||
|
||||
bool hasParentToCollapse(int id)
|
||||
{
|
||||
var o = Resources.InstanceIDToObject(id);
|
||||
|
||||
if (!o) return false;
|
||||
|
||||
|
||||
var assetPath = AssetDatabase.GetAssetPath(o);
|
||||
|
||||
if (!assetPath.HasParentPath()) return false;
|
||||
if (assetPath == "Assets") return false;
|
||||
|
||||
|
||||
var parentAsset = AssetDatabase.LoadAssetAtPath<DefaultAsset>(assetPath.GetParentPath());
|
||||
|
||||
if (!parentAsset) return false; // packages item
|
||||
|
||||
|
||||
var parentId = parentAsset.GetInstanceID();
|
||||
|
||||
return toCollapse.Contains(parentId)
|
||||
|| hasParentToCollapse(parentId);
|
||||
|
||||
}
|
||||
bool areAllParentsExpanded(int id)
|
||||
{
|
||||
var o = Resources.InstanceIDToObject(id);
|
||||
|
||||
if (!o) return true;
|
||||
|
||||
|
||||
var assetPath = AssetDatabase.GetAssetPath(o);
|
||||
|
||||
if (!assetPath.HasParentPath()) return true;
|
||||
if (assetPath == "Assets") return true;
|
||||
|
||||
|
||||
var parentAsset = AssetDatabase.LoadAssetAtPath<DefaultAsset>(assetPath.GetParentPath());
|
||||
|
||||
if (!parentAsset) return true; // packages item
|
||||
|
||||
|
||||
var parentId = parentAsset.GetInstanceID();
|
||||
|
||||
return expandedIds.Contains(parentId)
|
||||
&& areAllParentsExpanded(parentId);
|
||||
|
||||
}
|
||||
|
||||
var toExpand_beforeAnimation = toExpand.Where(id => !areAllParentsExpanded(id)).ToHashSet();
|
||||
var toCollapse_afterAnimation = toCollapse.Where(id => hasParentToCollapse(id)).ToHashSet();
|
||||
|
||||
|
||||
foreach (var id in toExpand_beforeAnimation)
|
||||
SetExpanded_withoutAnimation(id, true);
|
||||
|
||||
foreach (var id in toCollapse_afterAnimation)
|
||||
expandQueue_toCollapseAfterAnimation.Add(id);
|
||||
|
||||
|
||||
toExpand.ExceptWith(toExpand_beforeAnimation);
|
||||
toCollapse.ExceptWith(toCollapse_afterAnimation);
|
||||
|
||||
|
||||
|
||||
|
||||
// setup animation
|
||||
|
||||
expandQueue_toAnimate = toCollapse.Select(id => new ExpandQueueEntry { id = id, expand = false })
|
||||
.Concat(toExpand.Select(id => new ExpandQueueEntry { id = id, expand = true }))
|
||||
.OrderBy(r => GetRowIndex(r.id)).ToList();
|
||||
|
||||
}
|
||||
|
||||
public void SetExpandedIds(List<int> targetExpandedIds)
|
||||
{
|
||||
treeViewControllerData.InvokeMethod("SetExpandedIDs", targetExpandedIds.ToArray());
|
||||
}
|
||||
public void SetExpanded_withAnimation(int instanceId, bool expanded)
|
||||
{
|
||||
treeViewController.InvokeMethod("ChangeFoldingForSingleItem", instanceId, expanded);
|
||||
}
|
||||
public void SetExpanded_withoutAnimation(int instanceId, bool expanded)
|
||||
{
|
||||
treeViewControllerData.InvokeMethod("SetExpanded", instanceId, expanded);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void StartScrollAnimation(float targetScrollPos)
|
||||
{
|
||||
if (targetScrollPos.DistanceTo(currentScrollPos) < .05f) return;
|
||||
|
||||
this.targetScrollPos = targetScrollPos;
|
||||
|
||||
animatingScroll = true;
|
||||
|
||||
}
|
||||
|
||||
public void SetScrollPos(float targetScrollPos)
|
||||
{
|
||||
treeViewController.GetPropertyValue<TreeViewState>("state").scrollPos = Vector2.up * targetScrollPos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void RevealFolder(string path, bool expand, bool highlight, bool snapToTopMargin)
|
||||
{
|
||||
|
||||
int getId(string path) => AssetDatabase.LoadAssetAtPath<DefaultAsset>(path).GetInstanceID();
|
||||
|
||||
|
||||
var idsToExpand = new List<int>();
|
||||
|
||||
if (expand)
|
||||
idsToExpand.Add(getId(path));
|
||||
|
||||
var cur = path;
|
||||
while (!(cur = cur.GetParentPath()).IsNullOrEmpty())
|
||||
idsToExpand.Add(getId(cur));
|
||||
|
||||
idsToExpand.RemoveAll(r => expandedIds.Contains(r));
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var id in idsToExpand.SkipLast(1))
|
||||
SetExpanded_withoutAnimation(id, true);
|
||||
|
||||
if (idsToExpand.Any())
|
||||
SetExpanded_withAnimation(idsToExpand.Last(), true);
|
||||
|
||||
|
||||
|
||||
|
||||
var rowCount = treeViewControllerData.GetMemberValue<ICollection>("m_Rows").Count;
|
||||
var maxScrollPos = rowCount * 16 - window.position.height + (isOneColumn ? 49.9f : 45.9f);
|
||||
|
||||
var rowIndex = treeViewControllerData.InvokeMethod<int>("GetRow", getId(path));
|
||||
var rowPos = rowIndex * 16f + (isOneColumn ? 11 : 23);
|
||||
|
||||
var scrollAreaHeight = window.GetMemberValue<Rect>("m_TreeViewRect").height;
|
||||
|
||||
|
||||
|
||||
|
||||
var margin = 48;
|
||||
|
||||
var targetScrollPos = 0f;
|
||||
|
||||
if (snapToTopMargin)
|
||||
targetScrollPos = (rowPos - margin).Min(maxScrollPos)
|
||||
.Max(0);
|
||||
else
|
||||
targetScrollPos = currentScrollPos.Min(rowPos - margin)
|
||||
.Max(rowPos - scrollAreaHeight + margin)
|
||||
.Min(maxScrollPos)
|
||||
.Max(0);
|
||||
if (targetScrollPos < 25)
|
||||
targetScrollPos = 0;
|
||||
|
||||
StartScrollAnimation(targetScrollPos);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!highlight) return;
|
||||
|
||||
highlightAmount = 2.2f;
|
||||
|
||||
animatingHighlight = true;
|
||||
|
||||
folderToHighlight = path;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void OpenFolder(string path)
|
||||
{
|
||||
// update search
|
||||
window.GetMemberValue("m_SearchFilter").InvokeMethod("ClearSearch");
|
||||
window.GetMemberValue("m_SearchFilter").SetMemberValue("folders", new[] { path });
|
||||
|
||||
|
||||
// update folder tree
|
||||
window.GetMemberValue("m_FolderTree").InvokeMethod("SetSelection", new[] { AssetDatabase.LoadAssetAtPath<DefaultAsset>(path).GetInstanceID() }, false);
|
||||
|
||||
|
||||
// update list area
|
||||
var listAreaRect = window.GetMemberValue("m_ListAreaRect");
|
||||
var searchFilter = window.GetMemberValue("m_SearchFilter");
|
||||
var checkThumbnails = false;
|
||||
var assetToInstanceId = (System.Func<string, int>)((s) => typeof(AssetDatabase).InvokeMethod<int>("GetMainAssetInstanceID", s));
|
||||
|
||||
window.GetMemberValue("m_ListArea")?.InvokeMethod("InitForSearch", listAreaRect, HierarchyType.Assets, searchFilter, checkThumbnails, assetToInstanceId);
|
||||
|
||||
|
||||
// updat breadcrumbs
|
||||
window.GetMemberValue<IList>("m_BreadCrumbs").Clear();
|
||||
|
||||
|
||||
|
||||
// pretty much the same as ProjectBrowser.ShowFolderContents()
|
||||
// but without m_FolderTree.SetSelection()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public VFoldersController(EditorWindow window) => this.window = window;
|
||||
|
||||
public EditorWindow window;
|
||||
|
||||
public VFoldersGUI gui => VFolders.guis_byWindow[window];
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 380edf2cfb553464d9f7ec73602e93d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,145 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEditor;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor.SceneManagement;
|
||||
using static VFolders.Libs.VUtils;
|
||||
using static VFolders.Libs.VGUI;
|
||||
// using static VTools.VDebug;
|
||||
|
||||
|
||||
namespace VFolders
|
||||
{
|
||||
public class VFoldersData : ScriptableObject, ISerializationCallbackReceiver
|
||||
{
|
||||
|
||||
public SerializableDictionary<string, FolderData> folderDatas_byGuid = new();
|
||||
|
||||
[System.Serializable]
|
||||
public class FolderData
|
||||
{
|
||||
public string iconNameOrGuid = "";
|
||||
public int colorIndex = 0;
|
||||
|
||||
public bool isIconRecursive;
|
||||
public bool isColorRecursive;
|
||||
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize() => VFolders.OnDataSerialization();
|
||||
public void OnAfterDeserialize() { }
|
||||
|
||||
|
||||
|
||||
|
||||
public List<Bookmark> bookmarks = new();
|
||||
|
||||
[System.Serializable]
|
||||
public class Bookmark
|
||||
{
|
||||
|
||||
public string name => isDeleted ? "Deleted" : guid.ToPath().GetFilename();
|
||||
|
||||
|
||||
public bool isDeleted => !AssetDatabase.IsValidFolder(guid.ToPath());
|
||||
|
||||
|
||||
|
||||
public Bookmark(Object o) => guid = o.GetGuid();
|
||||
|
||||
public string guid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[CustomEditor(typeof(VFoldersData))]
|
||||
class Editor : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var style = new GUIStyle(EditorStyles.label) { wordWrap = true };
|
||||
|
||||
void normal()
|
||||
{
|
||||
if (storeDataInMetaFiles) return;
|
||||
|
||||
SetGUIEnabled(false);
|
||||
BeginIndent(0);
|
||||
|
||||
Space(10);
|
||||
EditorGUILayout.LabelField("This file stores data about which icons and colors are assigned to folders, along with bookmarks from navigation bar.", style);
|
||||
|
||||
Space(6);
|
||||
GUILayout.Label("If there are multiple people working on the project, it's better to store icon and color data in .meta files of folders to avoid merge conflicts. To do that, click the ⋮ button at the top right corner and enable Team Mode.", style);
|
||||
|
||||
EndIndent(10);
|
||||
ResetGUIEnabled();
|
||||
}
|
||||
void meta()
|
||||
{
|
||||
if (!storeDataInMetaFiles) return;
|
||||
|
||||
SetGUIEnabled(false);
|
||||
BeginIndent(0);
|
||||
|
||||
Space(10);
|
||||
EditorGUILayout.LabelField("Icon and color data is currently stored in folders .meta files of folders, and this file only contains bookmarks from navigation bar.", style);
|
||||
|
||||
Space(6);
|
||||
GUILayout.Label("If you want all data to be stored in this file, click the ⋮ button at the top right corner and disable Team Mode.", style);
|
||||
|
||||
EndIndent(10);
|
||||
ResetGUIEnabled();
|
||||
}
|
||||
|
||||
normal();
|
||||
meta();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static bool storeDataInMetaFiles { get => EditorPrefsCached.GetBool("vFolders-teamModeEnabled", false); set => EditorPrefsCached.SetBool("vFolders-teamModeEnabled", value); }
|
||||
|
||||
|
||||
|
||||
[ContextMenu("Enable Team Mode", isValidateFunction: false, priority: 1)]
|
||||
public void EnableTeamMode()
|
||||
{
|
||||
var option = EditorUtility.DisplayDialogComplex("Licensing notice",
|
||||
"To use vFolders 2 within a team, licenses must be purchased for each individual user as per the Asset Store EULA.\n\n Sharing one license across the team is illegal and considered piracy.",
|
||||
"Acknowledge",
|
||||
"Cancel",
|
||||
"Purchase more seats");
|
||||
if (option == 0)
|
||||
storeDataInMetaFiles = true;
|
||||
|
||||
if (option == 2)
|
||||
Application.OpenURL("https://prf.hn/click/camref:1100lGLBn/pubref:teammode/destination:https://assetstore.unity.com/packages/tools/utilities/vfolders-2-255470");
|
||||
// Application.OpenURL("https://assetstore.unity.com/packages/slug/255470");
|
||||
|
||||
}
|
||||
|
||||
[ContextMenu("Disable Team Mode", isValidateFunction: false, priority: 2)]
|
||||
public void DisableTeamMode() => storeDataInMetaFiles = false;
|
||||
|
||||
[ContextMenu("Enable Team Mode", isValidateFunction: true, priority: 1)] bool asd() => !storeDataInMetaFiles;
|
||||
[ContextMenu("Disable Team Mode", isValidateFunction: true, priority: 2)] bool ads() => storeDataInMetaFiles;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: adb9c12a8c6c949f7af83a3d238359d0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0743ead56bea942af9c21d27c5c45b62
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,403 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using Type = System.Type;
|
||||
using static VFolders.Libs.VUtils;
|
||||
using static VFolders.Libs.VGUI;
|
||||
// using static VTools.VDebug;
|
||||
using static VFolders.VFolders;
|
||||
using static VFolders.VFoldersData;
|
||||
using static VFolders.VFoldersCache;
|
||||
|
||||
|
||||
|
||||
namespace VFolders
|
||||
{
|
||||
[System.Serializable]
|
||||
public class VFoldersHistory
|
||||
{
|
||||
|
||||
public void CheckTreeStateChange()
|
||||
{
|
||||
if (!VFoldersMenu.navigationBarEnabled) return;
|
||||
if (!isOneColumn) return;
|
||||
|
||||
if (lastTreeState == null) { lastTreeState = new() { scrollPos = currentScrollPos, expandedIds = expandedIds.ToList() }; return; }
|
||||
|
||||
|
||||
var curTreeState = new TreeState();
|
||||
|
||||
var targetScrollPosChanged = false;
|
||||
var targetExpandedIdsChanged = false;
|
||||
|
||||
|
||||
|
||||
void set_curState_scrollPos()
|
||||
{
|
||||
if (controller.animatingScroll)
|
||||
curTreeState.scrollPos = controller.targetScrollPos;
|
||||
else
|
||||
curTreeState.scrollPos = currentScrollPos;
|
||||
|
||||
}
|
||||
void set_curState_expandedIds()
|
||||
{
|
||||
var expandedIdsHashset = expandedIds.ToHashSet();
|
||||
|
||||
|
||||
|
||||
if (treeViewAnimatesExpansion)
|
||||
if (animatingItemTragetExpanded_fromTreeViewExpandAnimator == true)
|
||||
expandedIdsHashset.UnionWith(new HashSet<int>() { animatingItemId_fromTreeViewExpandAnimator });
|
||||
else
|
||||
expandedIdsHashset.ExceptWith(new HashSet<int>() { animatingItemId_fromTreeViewExpandAnimator });
|
||||
|
||||
|
||||
|
||||
if (controller.animatingExpansion)
|
||||
{
|
||||
foreach (var r in controller.expandQueue_toAnimate)
|
||||
if (r.expand)
|
||||
expandedIdsHashset.UnionWith(new HashSet<int>() { r.id });
|
||||
else
|
||||
expandedIdsHashset.ExceptWith(new HashSet<int>() { r.id });
|
||||
|
||||
expandedIdsHashset.ExceptWith(controller.expandQueue_toCollapseAfterAnimation.ToHashSet());
|
||||
}
|
||||
|
||||
|
||||
curTreeState.expandedIds = expandedIdsHashset.ToList();
|
||||
|
||||
}
|
||||
|
||||
void checkScrollPosChange()
|
||||
{
|
||||
if (framesSinceLastExpansionAnimation < 2) return;
|
||||
if (framesSinceLastScrollAnimation < 2) return;
|
||||
|
||||
if (curTreeState.scrollPos == lastTreeState.scrollPos) return;
|
||||
|
||||
|
||||
|
||||
if (EditorApplication.timeSinceStartup - lastScrollTime > 2 || lastTargetStateChangeWasExpandedIds)
|
||||
targetScrollPosChanged = true;
|
||||
|
||||
lastScrollTime = EditorApplication.timeSinceStartup;
|
||||
|
||||
}
|
||||
void checkExpandedIdsChange()
|
||||
{
|
||||
if (lastTreeState.expandedIds.ToHashSet().SetEquals(curTreeState.expandedIds.ToHashSet())) return;
|
||||
|
||||
targetExpandedIdsChanged = true;
|
||||
|
||||
// lastTargetState.expandedIds.LogAll("lastTargetState");
|
||||
// curTargetState.expandedIds.LogAll("curTargetState");
|
||||
|
||||
}
|
||||
|
||||
void registerStateChange()
|
||||
{
|
||||
if (!targetScrollPosChanged && !targetExpandedIdsChanged) return;
|
||||
|
||||
|
||||
prevTreeStates.Add(lastTreeState);
|
||||
nextTreeStates.Clear();
|
||||
|
||||
lastTargetStateChangeWasExpandedIds = targetExpandedIdsChanged;
|
||||
|
||||
|
||||
if (prevTreeStates.Count > 50)
|
||||
prevTreeStates.RemoveAt(0);
|
||||
|
||||
|
||||
// if (targetScrollPosChanged && targetExpandedIdsChanged)
|
||||
// "expand and scroll".Log();
|
||||
// else if (targetScrollPosChanged)
|
||||
// "scroll".Log();
|
||||
// else if (targetExpandedIdsChanged)
|
||||
// "expand".Log();
|
||||
|
||||
}
|
||||
|
||||
void updateCountersSinceAnimation()
|
||||
{
|
||||
if (controller.animatingExpansion || treeViewAnimatesExpansion)
|
||||
framesSinceLastExpansionAnimation = 0;
|
||||
else
|
||||
framesSinceLastExpansionAnimation++;
|
||||
|
||||
if (controller.animatingScroll || treeViewAnimatesScroll)
|
||||
framesSinceLastScrollAnimation = 0;
|
||||
else
|
||||
framesSinceLastScrollAnimation++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
set_curState_scrollPos();
|
||||
set_curState_expandedIds();
|
||||
|
||||
checkScrollPosChange();
|
||||
checkExpandedIdsChange();
|
||||
|
||||
registerStateChange();
|
||||
|
||||
updateCountersSinceAnimation();
|
||||
|
||||
|
||||
lastTreeState = curTreeState;
|
||||
|
||||
}
|
||||
|
||||
int framesSinceLastExpansionAnimation;
|
||||
int framesSinceLastScrollAnimation;
|
||||
|
||||
public double lastScrollTime = 0;
|
||||
|
||||
bool lastTargetStateChangeWasExpandedIds;
|
||||
|
||||
[System.NonSerialized] TreeState lastTreeState = null;
|
||||
|
||||
|
||||
|
||||
public void CheckFolderPathChange()
|
||||
{
|
||||
if (!VFoldersMenu.navigationBarEnabled) return;
|
||||
if (isOneColumn) return;
|
||||
|
||||
var curFolderPath = window.GetMemberValue("m_SearchFilter").GetMemberValue<string[]>("folders").FirstOrDefault();
|
||||
|
||||
if (curFolderPath.IsNullOrEmpty()) return;
|
||||
|
||||
if (lastFolderPath.IsNullOrEmpty()) lastFolderPath = curFolderPath;
|
||||
if (curFolderPath == lastFolderPath) return;
|
||||
|
||||
|
||||
prevFolderPaths.Add(lastFolderPath);
|
||||
nextFolderPaths.Clear();
|
||||
|
||||
if (prevFolderPaths.Count > 50)
|
||||
prevFolderPaths.RemoveAt(0);
|
||||
|
||||
|
||||
lastFolderPath = curFolderPath;
|
||||
|
||||
}
|
||||
|
||||
string lastFolderPath = "";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void UpdateState()
|
||||
{
|
||||
if (!VFoldersMenu.navigationBarEnabled) return;
|
||||
|
||||
|
||||
isOneColumn = window.GetFieldValue<int>("m_ViewMode") == 0;
|
||||
|
||||
var treeViewController = window.GetFieldValue(isOneColumn ? "m_AssetTree" : "m_FolderTree");
|
||||
var treeViewControllerData = treeViewController?.GetPropertyValue("data");
|
||||
|
||||
|
||||
|
||||
var treeViewControllerState = treeViewController?.GetPropertyValue<TreeViewState>("state");
|
||||
|
||||
currentScrollPos = treeViewControllerState?.scrollPos.y ?? 0;
|
||||
|
||||
expandedIds = treeViewControllerState?.expandedIDs ?? new List<int>();
|
||||
|
||||
|
||||
|
||||
var treeViewAnimator = treeViewController?.GetMemberValue("m_ExpansionAnimator");
|
||||
var treeViewAnimatorSetup = treeViewAnimator?.GetMemberValue("m_Setup");
|
||||
|
||||
treeViewAnimatesScroll = treeViewController?.GetMemberValue<UnityEditor.AnimatedValues.AnimFloat>("m_FramingAnimFloat").isAnimating ?? false;
|
||||
|
||||
treeViewAnimatesExpansion = treeViewAnimator?.GetMemberValue<bool>("isAnimating") ?? false;
|
||||
animatingItemTragetExpanded_fromTreeViewExpandAnimator = treeViewAnimatorSetup?.GetMemberValue<bool>("expanding") ?? false;
|
||||
animatingItemId_fromTreeViewExpandAnimator = treeViewAnimatorSetup?.GetMemberValue("item").GetMemberValue<int>("id") ?? 0;
|
||||
|
||||
}
|
||||
|
||||
public bool isOneColumn;
|
||||
public bool isTwoColumns => !isOneColumn;
|
||||
|
||||
public bool isSearchActive;
|
||||
|
||||
public float currentScrollPos;
|
||||
|
||||
public List<int> expandedIds = new();
|
||||
|
||||
public bool treeViewAnimatesScroll;
|
||||
|
||||
public bool treeViewAnimatesExpansion;
|
||||
public bool animatingItemTragetExpanded_fromTreeViewExpandAnimator;
|
||||
public int animatingItemId_fromTreeViewExpandAnimator;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void MoveBack_OneColumn(bool withAnimation = true)
|
||||
{
|
||||
var prevState = prevTreeStates.Last();
|
||||
|
||||
prevTreeStates.Remove(prevState);
|
||||
nextTreeStates.Add(lastTreeState);
|
||||
lastTreeState = prevState;
|
||||
|
||||
|
||||
if (withAnimation)
|
||||
{
|
||||
controller.StartScrollAnimation(prevState.scrollPos);
|
||||
controller.StartExpandAnimation(prevState.expandedIds);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller.SetScrollPos(prevState.scrollPos);
|
||||
controller.SetExpandedIds(prevState.expandedIds);
|
||||
}
|
||||
|
||||
}
|
||||
public void MoveForward_OneColumn(bool withAnimation = true)
|
||||
{
|
||||
var nextState = nextTreeStates.Last();
|
||||
|
||||
nextTreeStates.Remove(nextState);
|
||||
prevTreeStates.Add(lastTreeState);
|
||||
lastTreeState = nextState;
|
||||
|
||||
|
||||
if (withAnimation)
|
||||
{
|
||||
controller.StartScrollAnimation(nextState.scrollPos);
|
||||
controller.StartExpandAnimation(nextState.expandedIds);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller.SetScrollPos(nextState.scrollPos);
|
||||
controller.SetExpandedIds(nextState.expandedIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<TreeState> prevTreeStates = new();
|
||||
public List<TreeState> nextTreeStates = new();
|
||||
|
||||
|
||||
|
||||
public void MoveBack_TwoColumns(bool withAnimation = true)
|
||||
{
|
||||
var prevPath = prevFolderPaths.Last();
|
||||
|
||||
prevFolderPaths.RemoveLast();
|
||||
nextFolderPaths.Add(lastFolderPath);
|
||||
lastFolderPath = prevPath;
|
||||
|
||||
|
||||
if (withAnimation)
|
||||
{
|
||||
controller.RevealFolder(prevPath, expand: false, highlight: false, snapToTopMargin: false);
|
||||
controller.OpenFolder(prevPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.InvokeMethod("ShowFolderContents", AssetDatabase.LoadAssetAtPath<DefaultAsset>(prevPath).GetInstanceID(), true);
|
||||
}
|
||||
|
||||
}
|
||||
public void MoveForward_TwoColumns(bool withAnimation = true)
|
||||
{
|
||||
var nextPath = nextFolderPaths.Last();
|
||||
|
||||
nextFolderPaths.RemoveLast();
|
||||
prevFolderPaths.Add(lastFolderPath);
|
||||
lastFolderPath = nextPath;
|
||||
|
||||
|
||||
if (withAnimation)
|
||||
{
|
||||
controller.RevealFolder(nextPath, expand: false, highlight: false, snapToTopMargin: false);
|
||||
controller.OpenFolder(nextPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.InvokeMethod("ShowFolderContents", AssetDatabase.LoadAssetAtPath<DefaultAsset>(nextPath).GetInstanceID(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<string> prevFolderPaths = new();
|
||||
public List<string> nextFolderPaths = new();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class TreeState
|
||||
{
|
||||
public List<int> expandedIds = new();
|
||||
|
||||
public float scrollPos;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public VFoldersHistory(EditorWindow window) => this.window = window;
|
||||
|
||||
EditorWindow window;
|
||||
|
||||
VFoldersGUI gui => VFolders.guis_byWindow[window];
|
||||
VFoldersController controller => VFolders.controllers_byWindow[window];
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class VFoldersHistorySingleton : ScriptableSingleton<VFoldersHistorySingleton>
|
||||
{
|
||||
public SerializableDictionary<EditorWindow, VFoldersHistory> histories_byWindow = new();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d3e0e15bb2714894bdfb696f7509428
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
// this file was present in a previus version and is supposed to be deleted now
|
||||
// but asset store update delivery system doesn't allow deleting files
|
||||
// so instead this file is now emptied
|
||||
// feel free to delete it if you want
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc2d205dd3ec1446d843e566b05c2eda
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2528d4639fe84d44bfdfde62c65dc86
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,128 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using static VFolders.Libs.VUtils;
|
||||
using static VFolders.Libs.VGUI;
|
||||
// using static VTools.VDebug;
|
||||
|
||||
|
||||
namespace VFolders
|
||||
{
|
||||
class VFoldersMenu
|
||||
{
|
||||
|
||||
public static bool navigationBarEnabled { get => EditorPrefsCached.GetBool("vFolders-navigationBarEnabled", false); set => EditorPrefsCached.SetBool("vFolders-navigationBarEnabled", value); }
|
||||
public static bool twoLineNamesEnabled { get => EditorPrefsCached.GetBool("vFolders-twoLineNamesEnabled", false); set => EditorPrefsCached.SetBool("vFolders-twoLineNamesEnabled", value); }
|
||||
|
||||
public static bool autoIconsEnabled { get => EditorPrefsCached.GetBool("vFolders-autoIconsEnabled", false); set => EditorPrefsCached.SetBool("vFolders-autoIconsEnabled", value); }
|
||||
public static bool hierarchyLinesEnabled { get => EditorPrefsCached.GetBool("vFolders-hierarchyLinesEnabled", false); set => EditorPrefsCached.SetBool("vFolders-hierarchyLinesEnabled", value); }
|
||||
public static bool zebraStripingEnabled { get => EditorPrefsCached.GetBool("vFolders-zebraStripingEnabled", false); set => EditorPrefsCached.SetBool("vFolders-zebraStripingEnabled", value); }
|
||||
public static bool contentMinimapEnabled { get => EditorPrefsCached.GetBool("vFolders-contentMinimapEnabled", false); set => EditorPrefsCached.SetBool("vFolders-contentMinimapEnabled", value); }
|
||||
public static bool backgroundColorsEnabled { get => EditorPrefsCached.GetBool("vFolders-backgroundColorsEnabled", false); set => EditorPrefsCached.SetBool("vFolders-backgroundColorsEnabled", value); }
|
||||
public static bool minimalModeEnabled { get => EditorPrefsCached.GetBool("vFolders-minimalModeEnabled", false); set => EditorPrefsCached.SetBool("vFolders-minimalModeEnabled", value); }
|
||||
public static bool foldersFirstEnabled { get => EditorPrefsCached.GetBool("vFolders-foldersFirstEnabled", false); set => EditorPrefsCached.SetBool("vFolders-foldersFirstEnabled", value); }
|
||||
public static bool toggleExpandedEnabled { get => EditorPrefsCached.GetBool("vFolders-toggleExpandedEnabled", true); set => EditorPrefsCached.SetBool("vFolders-toggleExpandedEnabled", value); }
|
||||
public static bool collapseEverythingElseEnabled { get => EditorPrefsCached.GetBool("vFolders-collapseEverythingElseEnabled", true); set => EditorPrefsCached.SetBool("vFolders-collapseEverythingElseEnabled", value); }
|
||||
public static bool collapseEverythingEnabled { get => EditorPrefsCached.GetBool("vFolders-collapseEverythingEnabled", true); set => EditorPrefsCached.SetBool("vFolders-collapseEverythingEnabled", value); }
|
||||
|
||||
public static bool pluginDisabled { get => EditorPrefsCached.GetBool("vFolders-pluginDisabled", false); set => EditorPrefsCached.SetBool("vFolders-pluginDisabled", value); }
|
||||
|
||||
|
||||
|
||||
|
||||
const string dir = "Tools/vFolders/";
|
||||
|
||||
const string navigationBar = dir + "Navigation bar";
|
||||
const string autoIcons = dir + "Automatic icons";
|
||||
const string twoLineNames = dir + "Two-line names";
|
||||
const string hierarchyLines = dir + "Hierarchy lines";
|
||||
const string backgroundColors = dir + "Background colors";
|
||||
const string minimalMode = dir + "Minimal mode";
|
||||
const string zebraStriping = dir + "Zebra striping";
|
||||
const string contentMinimap = dir + "Content minimap";
|
||||
const string foldersFirst = dir + "Sort folders first";
|
||||
|
||||
const string toggleExpanded = dir + "E to expand \u2215 collapse folder";
|
||||
const string collapseEverythingElse = dir + "Shift-E to isolate folder";
|
||||
const string collapseEverything = dir + "Ctrl-Shift-E to collapse all folders";
|
||||
|
||||
const string disablePlugin = dir + "Disable vFolders";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[MenuItem(dir + "Features", false, 1)] static void daasddsas() { }
|
||||
[MenuItem(dir + "Features", true, 1)] static bool dadsdasas123() => false;
|
||||
|
||||
[MenuItem(navigationBar, false, 2)] static void dadsaadsdsadasdsadadsas() { navigationBarEnabled = !navigationBarEnabled; EditorApplication.RepaintProjectWindow(); }
|
||||
[MenuItem(navigationBar, true, 2)] static bool dadsaddasdsasadadsdasadsas() { Menu.SetChecked(navigationBar, navigationBarEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(twoLineNames, false, 3)] static void dadsadaddssadass() { twoLineNamesEnabled = !twoLineNamesEnabled; EditorApplication.RepaintProjectWindow(); }
|
||||
[MenuItem(twoLineNames, true, 3)] static bool dadsaddasdsaasddsas() { Menu.SetChecked(twoLineNames, twoLineNamesEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(autoIcons, false, 4)] static void dadsadadsas() { autoIconsEnabled = !autoIconsEnabled; VFolders.folderInfoCache.Clear(); EditorApplication.RepaintProjectWindow(); }
|
||||
[MenuItem(autoIcons, true, 4)] static bool dadsaddasadsas() { Menu.SetChecked(autoIcons, autoIconsEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(hierarchyLines, false, 5)] static void dadsadadsadass() { hierarchyLinesEnabled = !hierarchyLinesEnabled; EditorApplication.RepaintProjectWindow(); }
|
||||
[MenuItem(hierarchyLines, true, 5)] static bool dadsaddasaasddsas() { Menu.SetChecked(hierarchyLines, hierarchyLinesEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(zebraStriping, false, 6)] static void dadsadaddsasadsadass() { zebraStripingEnabled = !zebraStripingEnabled; EditorApplication.RepaintProjectWindow(); }
|
||||
[MenuItem(zebraStriping, true, 6)] static bool dadsaddadassadsaasddsas() { Menu.SetChecked(zebraStriping, zebraStripingEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(contentMinimap, false, 7)] static void dadsadadasdsadass() { contentMinimapEnabled = !contentMinimapEnabled; EditorApplication.RepaintProjectWindow(); }
|
||||
[MenuItem(contentMinimap, true, 7)] static bool dadsadddasasaasddsas() { Menu.SetChecked(contentMinimap, contentMinimapEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(backgroundColors, false, 8)] static void dadsadadsadsadass() { backgroundColorsEnabled = !backgroundColorsEnabled; EditorApplication.RepaintProjectWindow(); }
|
||||
[MenuItem(backgroundColors, true, 8)] static bool dadsaddasadsaasddsas() { Menu.SetChecked(backgroundColors, backgroundColorsEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(minimalMode, false, 9)] static void dadsadadsaddsasadass() { minimalModeEnabled = !minimalModeEnabled; EditorApplication.RepaintProjectWindow(); }
|
||||
[MenuItem(minimalMode, true, 9)] static bool dadsaddasadsadsaasddsas() { Menu.SetChecked(minimalMode, minimalModeEnabled); return !pluginDisabled; }
|
||||
#if UNITY_EDITOR_OSX
|
||||
[MenuItem(foldersFirst, false, 10)] static void dadsdsfaadsdadsas() { foldersFirstEnabled = !foldersFirstEnabled; EditorApplication.RepaintProjectWindow(); if (!foldersFirstEnabled) UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation(); }
|
||||
[MenuItem(foldersFirst, true, 10)] static bool dadsasdfdadsdasadsas() { Menu.SetChecked(foldersFirst, foldersFirstEnabled); return !pluginDisabled; }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
[MenuItem(dir + "Shortcuts", false, 101)] static void dadsas() { }
|
||||
[MenuItem(dir + "Shortcuts", true, 101)] static bool dadsas123() => false;
|
||||
|
||||
[MenuItem(toggleExpanded, false, 102)] static void dadsadsadasdsadadsas() => toggleExpandedEnabled = !toggleExpandedEnabled;
|
||||
[MenuItem(toggleExpanded, true, 102)] static bool dadsaddsasadadsdasadsas() { Menu.SetChecked(toggleExpanded, toggleExpandedEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(collapseEverythingElse, false, 103)] static void dadsadsasdadasdsadadsas() => collapseEverythingElseEnabled = !collapseEverythingElseEnabled;
|
||||
[MenuItem(collapseEverythingElse, true, 103)] static bool dadsaddsdasasadadsdasadsas() { Menu.SetChecked(collapseEverythingElse, collapseEverythingElseEnabled); return !pluginDisabled; }
|
||||
|
||||
[MenuItem(collapseEverything, false, 104)] static void dadsadsdasadasdsadadsas() => collapseEverythingEnabled = !collapseEverythingEnabled;
|
||||
[MenuItem(collapseEverything, true, 104)] static bool dadsaddssdaasadadsdasadsas() { Menu.SetChecked(collapseEverything, collapseEverythingEnabled); return !pluginDisabled; }
|
||||
|
||||
|
||||
|
||||
|
||||
[MenuItem(dir + "More", false, 1001)] static void daasadsddsas() { }
|
||||
[MenuItem(dir + "More", true, 1001)] static bool dadsadsdasas123() => false;
|
||||
|
||||
[MenuItem(dir + "Open manual", false, 1002)]
|
||||
static void dadadssadsas() => Application.OpenURL("https://kubacho-lab.gitbook.io/vfolders-2");
|
||||
|
||||
[MenuItem(dir + "Join our Discord", false, 1003)]
|
||||
static void dadasdsas() => Application.OpenURL("https://discord.gg/pUektnZeJT");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[MenuItem(disablePlugin, false, 10001)] static void dadsadsdasadasdasdsadadsas() { pluginDisabled = !pluginDisabled; UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation(); }
|
||||
[MenuItem(disablePlugin, true, 10001)] static bool dadsaddssdaasadsadadsdasadsas() { Menu.SetChecked(disablePlugin, pluginDisabled); return true; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f118e09f35fa241fda19f1f3b1e7c5a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
// this file was present in a previus version and is supposed to be deleted now
|
||||
// but asset store update delivery system doesn't allow deleting files
|
||||
// so instead this file is now emptied
|
||||
// feel free to delete it if you want
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec6d8bc24e3ec4cb6b055630a6425686
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30acd0784e948403f8f15047ab22692c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,268 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEditorInternal;
|
||||
using static VFolders.Libs.VUtils;
|
||||
using static VFolders.Libs.VGUI;
|
||||
// using static VTools.VDebug;
|
||||
|
||||
|
||||
namespace VFolders
|
||||
{
|
||||
public class VFoldersPalette : ScriptableObject
|
||||
{
|
||||
public List<Color> colors = new();
|
||||
|
||||
public bool colorsEnabled;
|
||||
|
||||
public float colorSaturation = 1;
|
||||
public float colorBrightness = 1;
|
||||
public bool colorGradientsEnabled = true;
|
||||
|
||||
public void ResetColors()
|
||||
{
|
||||
colors.Clear();
|
||||
|
||||
for (int i = 0; i < colorsCount; i++)
|
||||
colors.Add(GetDefaultColor(i));
|
||||
|
||||
colorsEnabled = true;
|
||||
|
||||
this.Dirty();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Color GetDefaultColor(int colorIndex)
|
||||
{
|
||||
Color color = default;
|
||||
|
||||
void grey()
|
||||
{
|
||||
if (colorIndex >= greyColorsCount) return;
|
||||
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
color = Greyscale(EditorGUIUtility.isProSkin ? .16f : .9f);
|
||||
#else
|
||||
color = Greyscale(EditorGUIUtility.isProSkin ? .315f : .9f);
|
||||
#endif
|
||||
|
||||
}
|
||||
void rainbowDarkTheme()
|
||||
{
|
||||
if (colorIndex < greyColorsCount) return;
|
||||
if (!isDarkTheme) return;
|
||||
|
||||
|
||||
var t = (colorIndex - greyColorsCount.ToFloat()) / rainbowColorsCount;
|
||||
|
||||
if (colorIndex == 0)
|
||||
t += .01f;
|
||||
|
||||
if (colorIndex == 1)
|
||||
t -= .02f;
|
||||
|
||||
if (colorIndex == 2)
|
||||
t -= .015f;
|
||||
|
||||
if (colorIndex == 3)
|
||||
t -= .01f;
|
||||
|
||||
if (colorIndex == 4)
|
||||
t += .02f;
|
||||
|
||||
if (colorIndex == 5)
|
||||
t += .01f;
|
||||
|
||||
|
||||
if (colorIndex == 8)
|
||||
t -= .01f;
|
||||
|
||||
|
||||
// color = HSLToRGB(t, .61f, .57f);
|
||||
color = ColorUtils.HSLToRGB(t, .61f, .57f);
|
||||
|
||||
|
||||
if (colorIndex == 0)
|
||||
color *= 1.16f;
|
||||
|
||||
if (colorIndex == 1)
|
||||
color *= 1.17f;
|
||||
|
||||
if (colorIndex == 2)
|
||||
color *= 1.03f;
|
||||
|
||||
if (colorIndex == 6)
|
||||
color *= 1.2f;
|
||||
|
||||
if (colorIndex == 7)
|
||||
color *= 1.55f;
|
||||
|
||||
if (colorIndex == 8)
|
||||
color *= 1.2f;
|
||||
|
||||
if (colorIndex == 9)
|
||||
color *= 1.08f;
|
||||
|
||||
|
||||
color.a = .1f;
|
||||
|
||||
}
|
||||
void rainbowLightTheme()
|
||||
{
|
||||
if (colorIndex < greyColorsCount) return;
|
||||
if (isDarkTheme) return;
|
||||
|
||||
color = ColorUtils.HSLToRGB((colorIndex - greyColorsCount.ToFloat()) / rainbowColorsCount, .99f, .75f);
|
||||
|
||||
if (colorIndex == 0)
|
||||
color *= 1.1f;
|
||||
|
||||
if (colorIndex == 1)
|
||||
color *= 1.05f;
|
||||
|
||||
color.a = .1f;
|
||||
|
||||
}
|
||||
|
||||
grey();
|
||||
rainbowDarkTheme();
|
||||
rainbowLightTheme();
|
||||
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
public static int greyColorsCount = 0;
|
||||
public static int rainbowColorsCount = 10;
|
||||
public static int colorsCount => greyColorsCount + rainbowColorsCount;
|
||||
|
||||
|
||||
|
||||
|
||||
public List<IconRow> iconRows = new();
|
||||
|
||||
[System.Serializable]
|
||||
public class IconRow
|
||||
{
|
||||
public List<string> builtinIcons = new(); // names
|
||||
public List<string> customIcons = new(); // guids
|
||||
|
||||
public bool enabled = true;
|
||||
|
||||
public bool isCustom => !builtinIcons.Any() || customIcons.Any();
|
||||
public bool isEmpty => !builtinIcons.Any() && !customIcons.Any();
|
||||
public int iconCount => builtinIcons.Count + customIcons.Count;
|
||||
|
||||
public IconRow(string[] builtinIcons) => this.builtinIcons = builtinIcons.ToList();
|
||||
public IconRow() { }
|
||||
|
||||
}
|
||||
|
||||
public void ResetIcons()
|
||||
{
|
||||
iconRows.Clear();
|
||||
|
||||
iconRows.Add(new IconRow(new[]
|
||||
{
|
||||
"SceneAsset Icon",
|
||||
"Prefab Icon",
|
||||
"PrefabModel Icon",
|
||||
"Material Icon",
|
||||
"Texture Icon",
|
||||
"Mesh Icon",
|
||||
"cs Script Icon",
|
||||
"Shader Icon",
|
||||
"ComputeShader Icon",
|
||||
"ScriptableObject Icon",
|
||||
|
||||
}));
|
||||
iconRows.Add(new IconRow(new[]
|
||||
{
|
||||
"Light Icon",
|
||||
"LightProbes Icon",
|
||||
"LightmapParameters Icon",
|
||||
"LightingDataAsset Icon",
|
||||
"Cubemap Icon"
|
||||
|
||||
}));
|
||||
iconRows.Add(new IconRow(new[]
|
||||
{
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
"PhysicsMaterial Icon",
|
||||
#else
|
||||
"PhysicMaterial Icon",
|
||||
#endif
|
||||
"BoxCollider Icon",
|
||||
"TerrainCollider Icon",
|
||||
"MeshCollider Icon",
|
||||
"WheelCollider Icon",
|
||||
"Rigidbody Icon",
|
||||
|
||||
}));
|
||||
iconRows.Add(new IconRow(new[]
|
||||
{
|
||||
"AudioClip Icon",
|
||||
"AudioMixerController Icon",
|
||||
"AudioMixerGroup Icon",
|
||||
"AudioEchoFilter Icon",
|
||||
"AudioSource Icon",
|
||||
|
||||
}));
|
||||
iconRows.Add(new IconRow(new[]
|
||||
{
|
||||
"TextAsset Icon",
|
||||
"AssemblyDefinitionAsset Icon",
|
||||
"TerrainData Icon",
|
||||
"Terrain Icon",
|
||||
"AnimatorController Icon",
|
||||
"AnimationClip Icon",
|
||||
"Font Icon",
|
||||
"RawImage Icon",
|
||||
"Settings Icon",
|
||||
|
||||
}));
|
||||
|
||||
this.Dirty();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[ContextMenu("Export palette")]
|
||||
public void Export()
|
||||
{
|
||||
var packagePath = EditorUtility.SaveFilePanel("Export vFolders Palette", "", this.GetPath().GetFilename(withExtension: false), "unitypackage");
|
||||
|
||||
var iconPaths = iconRows.SelectMany(r => r.customIcons).Select(r => r.ToPath()).Where(r => !r.IsNullOrEmpty());
|
||||
|
||||
AssetDatabase.ExportPackage(iconPaths.Append(this.GetPath()).ToArray(), packagePath);
|
||||
|
||||
EditorUtility.RevealInFinder(packagePath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Reset()
|
||||
{
|
||||
ResetColors();
|
||||
ResetIcons();
|
||||
|
||||
VFolders.folderInfoCache.Clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 618f730fcd14941fab38169a7dde8c64
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 085d323b143d5403fb4beda728e65139
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,783 +0,0 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEditor.SceneManagement;
|
||||
using Type = System.Type;
|
||||
using static VFolders.VFolders;
|
||||
using static VFolders.VFoldersData;
|
||||
using static VFolders.VFoldersPalette;
|
||||
using static VFolders.VFoldersCache;
|
||||
using static VFolders.Libs.VUtils;
|
||||
using static VFolders.Libs.VGUI;
|
||||
// using static VTools.VDebug;
|
||||
|
||||
|
||||
namespace VFolders
|
||||
{
|
||||
public class VFoldersPaletteWindow : EditorWindow
|
||||
{
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
if (!palette) { Close(); return; }
|
||||
|
||||
int hoveredColorIndex = -1;
|
||||
string hoveredIconNameOrGuid = null;
|
||||
|
||||
void background()
|
||||
{
|
||||
position.SetPos(0, 0).Draw(windowBackground);
|
||||
}
|
||||
void outline()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.OSXEditor) return;
|
||||
|
||||
position.SetPos(0, 0).DrawOutline(Greyscale(.1f));
|
||||
|
||||
}
|
||||
void colors()
|
||||
{
|
||||
if (!palette.colorsEnabled) return;
|
||||
|
||||
var rowRect = this.position.SetPos(paddingX, paddingY).SetHeight(cellSize);
|
||||
|
||||
|
||||
void color(int i)
|
||||
{
|
||||
var cellRect = rowRect.MoveX(i * cellSize).SetWidth(cellSize).SetHeightFromMid(cellSize);
|
||||
|
||||
void backgroundSelected()
|
||||
{
|
||||
if (!colorIndexes_initial.Contains(i)) return;
|
||||
|
||||
cellRect.Resize(1).DrawRounded(selectedBackground, 2);
|
||||
|
||||
}
|
||||
void backgroundHovered()
|
||||
{
|
||||
if (!cellRect.IsHovered()) return;
|
||||
|
||||
cellRect.Resize(1).DrawRounded(this.hoveredBackground, 2);
|
||||
|
||||
}
|
||||
void crossIcon()
|
||||
{
|
||||
if (i != 0) return;
|
||||
|
||||
GUI.DrawTexture(cellRect.SetSizeFromMid(iconSize), EditorIcons.GetIcon("CrossIcon"));
|
||||
|
||||
}
|
||||
void colorOutline()
|
||||
{
|
||||
if (i == 0) return;
|
||||
|
||||
var outlineColor = i <= VFoldersPalette.greyColorsCount ? Greyscale(.0f, .4f) : Greyscale(.15f, .2f);
|
||||
|
||||
cellRect.Resize(3).DrawRounded(outlineColor, 4);
|
||||
|
||||
}
|
||||
void color()
|
||||
{
|
||||
if (i == 0) return;
|
||||
|
||||
var brightness = palette.colorBrightness;
|
||||
var saturation = palette.colorSaturation;
|
||||
var drawGradients = palette.colorGradientsEnabled;
|
||||
|
||||
if (!palette.colorGradientsEnabled)
|
||||
brightness *= isDarkTheme ? .75f : .97f;
|
||||
|
||||
if (i <= VFoldersPalette.greyColorsCount)
|
||||
{
|
||||
saturation = brightness = 1;
|
||||
drawGradients = false;
|
||||
}
|
||||
|
||||
|
||||
var colorRaw = palette ? palette.colors[i - 1] : VFoldersPalette.GetDefaultColor(i - 1);
|
||||
|
||||
var color = MathUtil.Lerp(Greyscale(.2f), colorRaw, brightness);
|
||||
|
||||
Color.RGBToHSV(color, out float h, out float s, out float v);
|
||||
color = Color.HSVToRGB(h, s * saturation, v);
|
||||
|
||||
color = MathUtil.Lerp(color, colorRaw, .5f).SetAlpha(1);
|
||||
|
||||
|
||||
|
||||
|
||||
cellRect.Resize(4).DrawRounded(color, 3);
|
||||
|
||||
if (drawGradients)
|
||||
cellRect.Resize(4).AddWidthFromRight(-2).DrawCurtainLeft(GUIColors.windowBackground.SetAlpha(.45f));
|
||||
|
||||
}
|
||||
void recursiveIndicator()
|
||||
{
|
||||
if (!curEvent.isRepaint) return;
|
||||
|
||||
|
||||
var isRecursive = folderDatas.First().colorIndex == i && folderDatas.First().isColorRecursive;
|
||||
|
||||
if (!isRecursive) return;
|
||||
|
||||
|
||||
|
||||
var iconRect = cellRect.SetSizeFromMid(16).Move(-6, -7);
|
||||
var shadowRect = iconRect.Resize(3).Move(2, 1).AddWidthFromRight(3);
|
||||
var shadowRadius = 4;
|
||||
|
||||
shadowRect.DrawBlurred(GUIColors.windowBackground, shadowRadius);
|
||||
|
||||
|
||||
SetGUIColor(Color.white * 2);
|
||||
|
||||
GUI.DrawTexture(iconRect, EditorIcons.GetIcon("UnityEditor.SceneHierarchyWindow@2x"));
|
||||
|
||||
ResetGUIColor();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void setHovered()
|
||||
{
|
||||
if (!cellRect.IsHovered()) return;
|
||||
|
||||
hoveredColorIndex = i;
|
||||
|
||||
}
|
||||
void closeOnClick()
|
||||
{
|
||||
if (!cellRect.IsHovered()) return;
|
||||
if (!curEvent.isMouseUp) return;
|
||||
|
||||
curEvent.Use();
|
||||
|
||||
Close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
cellRect.MarkInteractive();
|
||||
|
||||
backgroundSelected();
|
||||
backgroundHovered();
|
||||
crossIcon();
|
||||
colorOutline();
|
||||
color();
|
||||
recursiveIndicator();
|
||||
|
||||
setHovered();
|
||||
closeOnClick();
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < palette.colors.Count + 1; i++)
|
||||
color(i);
|
||||
|
||||
}
|
||||
void icons()
|
||||
{
|
||||
void row(int i, IconRow iconRow)
|
||||
{
|
||||
var rowRect = this.position.SetPos(paddingX, paddingY).SetHeight(cellSize).MoveY(palette.colorsEnabled ? cellSize + spaceAfterColors : 0).MoveY(i * (cellSize + rowSpacing));
|
||||
|
||||
var isFirstEnabledRow = palette.iconRows.First(r => r.enabled) == iconRow;
|
||||
|
||||
|
||||
void icon(int i)
|
||||
{
|
||||
var cellRect = rowRect.MoveX(i * cellSize).SetWidth(cellSize).SetHeightFromMid(cellSize);
|
||||
|
||||
var isCrossIcon = isFirstEnabledRow && i == 0;
|
||||
var actualIconIndex = isFirstEnabledRow ? i - 1 : i;
|
||||
var isCustomIcon = !isCrossIcon && actualIconIndex >= iconRow.builtinIcons.Count;
|
||||
var iconNameOrGuid = isCrossIcon ? "" : isCustomIcon ? iconRow.customIcons[actualIconIndex - iconRow.builtinIcons.Count] : iconRow.builtinIcons[actualIconIndex];
|
||||
|
||||
|
||||
void backgroundSelected()
|
||||
{
|
||||
if (!iconNamesOrGuids_initial.Contains(iconNameOrGuid)) return;
|
||||
|
||||
cellRect.Resize(1).DrawRounded(selectedBackground, 2);
|
||||
|
||||
}
|
||||
void backgroundHovered()
|
||||
{
|
||||
if (!cellRect.IsHovered()) return;
|
||||
|
||||
cellRect.Resize(1).DrawRounded(this.hoveredBackground, 2);
|
||||
|
||||
}
|
||||
void crossIcon()
|
||||
{
|
||||
if (!isCrossIcon) return;
|
||||
|
||||
GUI.DrawTexture(cellRect.SetSizeFromMid(iconSize), EditorIcons.GetIcon("CrossIcon"));
|
||||
|
||||
}
|
||||
void normalIcon()
|
||||
{
|
||||
if (isCrossIcon) return;
|
||||
|
||||
var iconNameOrPath = iconNameOrGuid?.Length == 32 ? iconNameOrGuid.ToPath() : iconNameOrGuid;
|
||||
var icon = EditorIcons.GetIcon(iconNameOrPath) ?? Texture2D.blackTexture;
|
||||
|
||||
var iconRect = cellRect.SetSizeFromMid(iconSize);
|
||||
|
||||
if (icon.width < icon.height) iconRect = iconRect.SetWidthFromMid(iconRect.height * icon.width / icon.height);
|
||||
if (icon.height < icon.width) iconRect = iconRect.SetHeightFromMid(iconRect.width * icon.height / icon.width);
|
||||
|
||||
|
||||
GUI.DrawTexture(iconRect, icon);
|
||||
|
||||
}
|
||||
void recursiveIndicator()
|
||||
{
|
||||
if (!curEvent.isRepaint) return;
|
||||
|
||||
|
||||
var isRecursive = folderDatas.First().iconNameOrGuid == iconNameOrGuid && folderDatas.First().isIconRecursive;
|
||||
|
||||
if (!isRecursive) return;
|
||||
|
||||
|
||||
|
||||
var iconRect = cellRect.SetSizeFromMid(16).Move(-6, -7);
|
||||
var shadowRect = iconRect.Resize(3).Move(2, 1).AddWidthFromRight(3);
|
||||
var shadowRadius = 4;
|
||||
|
||||
shadowRect.DrawBlurred(GUIColors.windowBackground, shadowRadius);
|
||||
|
||||
|
||||
|
||||
SetGUIColor(Color.white * 2);
|
||||
|
||||
GUI.DrawTexture(iconRect, EditorIcons.GetIcon("UnityEditor.SceneHierarchyWindow@2x"));
|
||||
|
||||
ResetGUIColor();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void setHovered()
|
||||
{
|
||||
if (!cellRect.IsHovered()) return;
|
||||
|
||||
hoveredIconNameOrGuid = iconNameOrGuid;
|
||||
|
||||
}
|
||||
void closeOnClick()
|
||||
{
|
||||
if (!cellRect.IsHovered()) return;
|
||||
if (!curEvent.isMouseUp) return;
|
||||
|
||||
curEvent.Use();
|
||||
|
||||
Close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
cellRect.MarkInteractive();
|
||||
|
||||
backgroundSelected();
|
||||
backgroundHovered();
|
||||
crossIcon();
|
||||
normalIcon();
|
||||
recursiveIndicator();
|
||||
|
||||
setHovered();
|
||||
closeOnClick();
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (int j = 0; j < iconRow.iconCount + (isFirstEnabledRow ? 1 : 0); j++)
|
||||
icon(j);
|
||||
|
||||
}
|
||||
|
||||
|
||||
var i = 0;
|
||||
|
||||
foreach (var iconRow in palette.iconRows)
|
||||
{
|
||||
if (!iconRow.enabled) continue;
|
||||
if (iconRow.isEmpty) continue;
|
||||
|
||||
row(i, iconRow);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
void editPaletteButton()
|
||||
{
|
||||
var buttonRect = position.SetPos(0, 0).SetWidthFromRight(16).SetHeightFromBottom(16).Move(-14, -14);
|
||||
var buttonColor = isDarkTheme ? Greyscale(.6f) : Greyscale(1, .6f);
|
||||
|
||||
if (!IconButton(buttonRect, "Toolbar Plus", 16, buttonColor)) return;
|
||||
|
||||
|
||||
palette.SelectInInspector(frameInProject: false);
|
||||
|
||||
this.Close();
|
||||
|
||||
}
|
||||
|
||||
void setColorsAndIcons()
|
||||
{
|
||||
if (!curEvent.isLayout) return;
|
||||
|
||||
|
||||
if (palette.iconRows.Any(r => r.enabled))
|
||||
if (hoveredIconNameOrGuid != null)
|
||||
SetIcon(hoveredIconNameOrGuid, isRecursive: curEvent.holdingAlt);
|
||||
else
|
||||
SetInitialIcons();
|
||||
|
||||
|
||||
if (palette.colorsEnabled)
|
||||
if (hoveredColorIndex != -1)
|
||||
SetColor(hoveredColorIndex, isRecursive: curEvent.holdingAlt);
|
||||
else
|
||||
SetInitialColors();
|
||||
|
||||
}
|
||||
void updatePosition()
|
||||
{
|
||||
if (!curEvent.isLayout) return;
|
||||
|
||||
void calcDeltaTime()
|
||||
{
|
||||
deltaTime = (float)(EditorApplication.timeSinceStartup - lastLayoutTime);
|
||||
|
||||
if (deltaTime > .05f)
|
||||
deltaTime = .0166f;
|
||||
|
||||
lastLayoutTime = EditorApplication.timeSinceStartup;
|
||||
|
||||
}
|
||||
void resetCurPos()
|
||||
{
|
||||
if (currentPosition != default) return;
|
||||
|
||||
currentPosition = position.position; // position.position is always int, which can't be used for lerping
|
||||
|
||||
}
|
||||
void lerpCurPos()
|
||||
{
|
||||
var speed = 9;
|
||||
|
||||
MathUtil.SmoothDamp(ref currentPosition, targetPosition, speed, ref positionDeriv, deltaTime);
|
||||
// MathfUtils.Lerp(ref currentPosition, targetPosition, speed, deltaTime);
|
||||
|
||||
}
|
||||
void setCurPos()
|
||||
{
|
||||
position = position.SetPos(currentPosition);
|
||||
}
|
||||
|
||||
calcDeltaTime();
|
||||
resetCurPos();
|
||||
lerpCurPos();
|
||||
setCurPos();
|
||||
|
||||
if (!currentPosition.magnitude.Approx(targetPosition.magnitude))
|
||||
Repaint();
|
||||
|
||||
}
|
||||
void closeOnEscape()
|
||||
{
|
||||
if (!curEvent.isKeyDown) return;
|
||||
if (curEvent.keyCode != KeyCode.Escape) return;
|
||||
|
||||
SetInitialColors();
|
||||
SetInitialIcons();
|
||||
|
||||
Close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
RecordUndoOnDatas();
|
||||
|
||||
background();
|
||||
outline();
|
||||
colors();
|
||||
icons();
|
||||
editPaletteButton();
|
||||
|
||||
setColorsAndIcons();
|
||||
updatePosition();
|
||||
closeOnEscape();
|
||||
|
||||
|
||||
|
||||
VFolders.folderInfoCache.Clear();
|
||||
|
||||
EditorApplication.RepaintProjectWindow();
|
||||
|
||||
EditorApplication.delayCall += EditorApplication.RepaintProjectWindow; // to show icons that will be generated in update
|
||||
|
||||
}
|
||||
|
||||
static float iconSize => 14;
|
||||
static float iconSpacing => 6;
|
||||
static float cellSize => iconSize + iconSpacing;
|
||||
static float spaceAfterColors => 13;
|
||||
public float rowSpacing = 1;
|
||||
static float paddingX => 12;
|
||||
static float paddingY => 12;
|
||||
|
||||
Color windowBackground => isDarkTheme ? Greyscale(.23f) : Greyscale(.75f);
|
||||
Color selectedBackground => isDarkTheme ? new Color(.3f, .5f, .7f, .8f) : new Color(.3f, .5f, .7f, .6f) * 1.25f;
|
||||
Color hoveredBackground => isDarkTheme ? Greyscale(1, .3f) : Greyscale(0, .1f);
|
||||
|
||||
public Vector2 targetPosition;
|
||||
public Vector2 currentPosition;
|
||||
Vector2 positionDeriv;
|
||||
float deltaTime;
|
||||
double lastLayoutTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SetIcon(string iconNameOrGuid, bool isRecursive)
|
||||
{
|
||||
foreach (var r in folderDatas)
|
||||
{
|
||||
r.isIconRecursive = isRecursive; // setting it firstbecause iconNameOrGuid setter relies on isIconRecursive
|
||||
r.iconNameOrGuid = iconNameOrGuid;
|
||||
}
|
||||
}
|
||||
void SetColor(int colorIndex, bool isRecursive)
|
||||
{
|
||||
foreach (var r in folderDatas)
|
||||
{
|
||||
r.isColorRecursive = isRecursive;
|
||||
r.colorIndex = colorIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void SetInitialIcons()
|
||||
{
|
||||
for (int i = 0; i < folderDatas.Count; i++)
|
||||
{
|
||||
folderDatas[i].isIconRecursive = isIconRecursives_initial[i];
|
||||
folderDatas[i].iconNameOrGuid = iconNamesOrGuids_initial[i];
|
||||
}
|
||||
}
|
||||
void SetInitialColors()
|
||||
{
|
||||
for (int i = 0; i < folderDatas.Count; i++)
|
||||
{
|
||||
folderDatas[i].isColorRecursive = isColorRecursives_initial[i];
|
||||
folderDatas[i].colorIndex = colorIndexes_initial[i];
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveEmptyFolderDatas()
|
||||
{
|
||||
if (VFoldersData.storeDataInMetaFiles) return; // empties removed from meta files in SaveData()
|
||||
|
||||
var toRemove = folderDatas.Select(r => r.folderData).Where(r => r.iconNameOrGuid == "" && r.colorIndex == 0);
|
||||
|
||||
foreach (var r in toRemove)
|
||||
data.folderDatas_byGuid.RemoveValue(r);
|
||||
|
||||
if (toRemove.Any())
|
||||
Undo.CollapseUndoOperations(Undo.GetCurrentGroup() - 1);
|
||||
|
||||
}
|
||||
|
||||
void RecordUndoOnDatas()
|
||||
{
|
||||
if (!VFoldersData.storeDataInMetaFiles)
|
||||
if (data)
|
||||
data.RecordUndo();
|
||||
|
||||
if (VFoldersData.storeDataInMetaFiles)
|
||||
foreach (var r in guids)
|
||||
AssetImporter.GetAtPath(r.ToPath()).RecordUndo();
|
||||
|
||||
}
|
||||
void MarkDatasDirty()
|
||||
{
|
||||
if (!VFoldersData.storeDataInMetaFiles)
|
||||
if (data)
|
||||
data.Dirty();
|
||||
|
||||
if (VFoldersData.storeDataInMetaFiles)
|
||||
VFolders.folderDatasFromMetaFiles_byGuid.Clear();
|
||||
|
||||
}
|
||||
void SaveData()
|
||||
{
|
||||
if (!VFoldersData.storeDataInMetaFiles) return;
|
||||
// if (!VFoldersData.storeDataInMetaFiles) { data.Save(); return; }
|
||||
|
||||
for (int i = 0; i < guids.Count; i++)
|
||||
if (folderDatas[i].iconNameOrGuid == "" && folderDatas[i].colorIndex == 0)
|
||||
AssetImporter.GetAtPath(guids[i].ToPath()).userData = "";
|
||||
else
|
||||
AssetImporter.GetAtPath(guids[i].ToPath()).userData = JsonUtility.ToJson(folderDatas[i].folderData);
|
||||
|
||||
for (int i = 0; i < guids.Count; i++)
|
||||
AssetImporter.GetAtPath(guids[i].ToPath()).SaveAndReimport();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void OnLostFocus()
|
||||
{
|
||||
if (curEvent.holdingAlt && EditorWindow.focusedWindow?.GetType().Name == "ProjectBrowser")
|
||||
CloseNextFrameIfNotRefocused();
|
||||
else
|
||||
Close();
|
||||
|
||||
}
|
||||
|
||||
void CloseNextFrameIfNotRefocused()
|
||||
{
|
||||
EditorApplication.delayCall += () => { if (EditorWindow.focusedWindow != this) Close(); };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void RepaintOnAlt() // Update
|
||||
{
|
||||
if (curEvent.holdingAlt != wasHoldingAlt)
|
||||
if (EditorWindow.mouseOverWindow is VFoldersPaletteWindow paletteWindow)
|
||||
paletteWindow.Repaint();
|
||||
|
||||
wasHoldingAlt = curEvent.holdingAlt;
|
||||
|
||||
}
|
||||
|
||||
static bool wasHoldingAlt;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void Init(List<string> guids)
|
||||
{
|
||||
void createData()
|
||||
{
|
||||
if (VFolders.data) return;
|
||||
|
||||
VFolders.data = ScriptableObject.CreateInstance<VFoldersData>();
|
||||
|
||||
AssetDatabase.CreateAsset(VFolders.data, GetScriptPath("VFolders").GetParentPath().CombinePath("vFolders Data.asset"));
|
||||
|
||||
}
|
||||
void createPalette()
|
||||
{
|
||||
if (VFolders.palette) return;
|
||||
|
||||
VFolders.palette = ScriptableObject.CreateInstance<VFoldersPalette>();
|
||||
|
||||
AssetDatabase.CreateAsset(VFolders.palette, GetScriptPath("VFolders").GetParentPath().CombinePath("vFolders Palette.asset"));
|
||||
|
||||
}
|
||||
void setSize()
|
||||
{
|
||||
if (!palette.colorsEnabled && !palette.iconRows.Any(r => r.enabled && !r.isEmpty)) // somehow happened on first palette window opening in 2022.3.50
|
||||
palette.InvokeMethod("Reset");
|
||||
|
||||
|
||||
|
||||
var rowCellCounts = new List<int>();
|
||||
|
||||
if (palette.colorsEnabled)
|
||||
rowCellCounts.Add(palette.colors.Count + 1);
|
||||
|
||||
foreach (var r in palette.iconRows.Where(r => r.enabled && !r.isEmpty))
|
||||
rowCellCounts.Add(r.iconCount + (r == palette.iconRows.First(r => r.enabled) ? 1 : 0));
|
||||
|
||||
var width = paddingX
|
||||
+ rowCellCounts.Max() * cellSize
|
||||
+ (rowCellCounts.Last() == rowCellCounts.Max() ? cellSize : 0)
|
||||
+ paddingX;
|
||||
|
||||
|
||||
|
||||
var iconRowCount = palette.iconRows.Count(r => r.enabled && !r.isEmpty);
|
||||
|
||||
var height = paddingY
|
||||
+ (palette.colorsEnabled ? cellSize : 0)
|
||||
+ (palette.colorsEnabled && palette.iconRows.Any(r => r.enabled && !r.isEmpty) ? spaceAfterColors : 0)
|
||||
+ cellSize * iconRowCount
|
||||
+ rowSpacing * (iconRowCount - 1)
|
||||
+ paddingY;
|
||||
|
||||
|
||||
position = position.SetSize(width, height).SetPos(targetPosition);
|
||||
|
||||
}
|
||||
void getFolderDatas()
|
||||
{
|
||||
folderDatas.Clear();
|
||||
|
||||
foreach (var guid in guids)
|
||||
folderDatas.Add(new FolderDataWrapper(guid));
|
||||
|
||||
}
|
||||
void getInitialState()
|
||||
{
|
||||
iconNamesOrGuids_initial = folderDatas.Select(r => r.iconNameOrGuid).ToList();
|
||||
colorIndexes_initial = folderDatas.Select(r => r.colorIndex).ToList();
|
||||
|
||||
isIconRecursives_initial = folderDatas.Select(r => r.isIconRecursive).ToList();
|
||||
isColorRecursives_initial = folderDatas.Select(r => r.isColorRecursive).ToList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.guids = guids;
|
||||
|
||||
RecordUndoOnDatas();
|
||||
|
||||
createData();
|
||||
createPalette();
|
||||
setSize();
|
||||
getFolderDatas();
|
||||
getInitialState();
|
||||
|
||||
Undo.undoRedoPerformed -= EditorApplication.RepaintProjectWindow;
|
||||
Undo.undoRedoPerformed += EditorApplication.RepaintProjectWindow;
|
||||
|
||||
EditorApplication.update -= RepaintOnAlt;
|
||||
EditorApplication.update += RepaintOnAlt;
|
||||
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
RemoveEmptyFolderDatas();
|
||||
MarkDatasDirty();
|
||||
SaveData();
|
||||
|
||||
EditorApplication.update -= RepaintOnAlt;
|
||||
|
||||
}
|
||||
|
||||
public List<string> guids = new();
|
||||
public List<FolderDataWrapper> folderDatas = new();
|
||||
|
||||
public List<string> iconNamesOrGuids_initial = new();
|
||||
public List<int> colorIndexes_initial = new();
|
||||
|
||||
public List<bool> isIconRecursives_initial = new();
|
||||
public List<bool> isColorRecursives_initial = new();
|
||||
|
||||
static VFoldersPalette palette => VFolders.palette;
|
||||
static VFoldersData data => VFolders.data;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void CreateInstance(Vector2 position)
|
||||
{
|
||||
instance = ScriptableObject.CreateInstance<VFoldersPaletteWindow>();
|
||||
|
||||
instance.ShowPopup();
|
||||
|
||||
instance.position = instance.position.SetPos(position).SetSize(200, 300);
|
||||
instance.targetPosition = position;
|
||||
|
||||
}
|
||||
|
||||
public static VFoldersPaletteWindow instance;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class FolderDataWrapper
|
||||
{
|
||||
public string iconNameOrGuid
|
||||
{
|
||||
get
|
||||
{
|
||||
if (folderData != null && folderData.iconNameOrGuid != "")
|
||||
if (folderData.iconNameOrGuid == "none") return "";
|
||||
else return folderData.iconNameOrGuid ?? "";
|
||||
|
||||
else if (VFoldersMenu.autoIconsEnabled && folderState.autoIconName != "")
|
||||
return folderState.autoIconName;
|
||||
|
||||
else return "";
|
||||
|
||||
}
|
||||
set
|
||||
{
|
||||
if (VFoldersMenu.autoIconsEnabled && folderState.autoIconName != "")
|
||||
if (value == folderState.autoIconName && !folderData.isIconRecursive)
|
||||
folderData.iconNameOrGuid = "";
|
||||
else if (value == "")
|
||||
folderData.iconNameOrGuid = "none";
|
||||
else
|
||||
folderData.iconNameOrGuid = value;
|
||||
|
||||
|
||||
else folderData.iconNameOrGuid = value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public bool isIconRecursive { get => folderData.isIconRecursive; set => folderData.isIconRecursive = value; }
|
||||
|
||||
public int colorIndex { get => folderData.colorIndex; set => folderData.colorIndex = value; }
|
||||
public bool isColorRecursive { get => folderData.isColorRecursive; set => folderData.isColorRecursive = value; }
|
||||
|
||||
|
||||
public FolderDataWrapper(string guid)
|
||||
{
|
||||
folderData = VFolders.GetFolderData(guid, createDataIfDoesntExist: true);
|
||||
folderState = VFolders.GetFolderState(guid);
|
||||
}
|
||||
|
||||
public FolderData folderData;
|
||||
public FolderState folderState;
|
||||
|
||||
|
||||
// used as an interlayer between folderData and palette window to account for automatic icons
|
||||
// it's the only structural difference between vFolders' PaletteWindow and vHierarchy's
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68011e63381a84f3bacee6e5ee9e0b82
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user