destroyed proj

This commit is contained in:
2025-03-15 12:37:32 +01:00
parent be2b7c5a44
commit 4872192479
426 changed files with 22755 additions and 3101 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6eeab58dea03d6649b73b74861f55312
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 31f20cb97742f2f4d948452249a89d6d
timeCreated: 1502706485
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Demo/DemoColors.unity
uploadId: 716077

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: aa2219c016490de4ea3249875a0fdc97
timeCreated: 1502706485
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Demo/DemoComponents.unity
uploadId: 716077

View File

@@ -0,0 +1,6 @@
This software includes third-party software subject to the associated copyrights, as follows:
Name: Unity-Reorderable-List
Repo: https://github.com/cfoulston/Unity-Reorderable-List
License: MIT (https://github.com/cfoulston/Unity-Reorderable-List/blob/master/LICENSE)
Copyright (c) 2017 Chris Foulston

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 080d95922e5bb36408c013f72c278870
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/NOTICES.txt
uploadId: 716077

Binary file not shown.

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 338f04d1760f4ca49a47e14bb0bf4e9e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/QuickStart.pdf
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4d28b25f9acea2446a92a376b467f673
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3a4659fa6059d5c41a7154e883f8a9c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c0e52a2f833afe545b555cb1edb01dcd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
[SuppressMessage("ReSharper", "ConvertIfStatementToNullCoalescingExpression")]
public static class ColorHelper
{
public static readonly Color POPUP_BORDER_CLR_FREE = new Color(0.51f, 0.51f, 0.51f);
public static readonly Color POPUP_BORDER_CLR_PRO = new Color(0.13f, 0.13f, 0.13f);
public static readonly Color POPUP_BACKGROUND_CLR_FREE = new Color(0.83f, 0.83f, 0.83f);
public static readonly Color POPUP_BACKGROUND_CLR_PRO = new Color(0.18f, 0.18f, 0.18f);
public static readonly Color SEPARATOR_CLR_1_FREE = new Color(0.65f, 0.65f, 0.65f, 1f);
public static readonly Color SEPARATOR_CLR_2_FREE = new Color(0.9f, 0.9f, 0.9f, 1f);
public static readonly Color SEPARATOR_CLR_1_PRO = new Color(0.13f, 0.13f, 0.13f, 1f);
public static readonly Color SEPARATOR_CLR_2_PRO = new Color(0.22f, 0.22f, 0.22f, 1f);
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f5afe207c4e956942a1f9bef022c3a98
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Helpers/ColorHelper.cs
uploadId: 716077

View File

@@ -0,0 +1,227 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
[SuppressMessage("ReSharper", "ConvertIfStatementToNullCoalescingExpression")]
public static class HierarchyEditorUtility
{
private static Texture2D _editIcon;
private static Texture2D _settingsIcon;
private static Texture2D _filterIcon;
private static Texture2D _deleteIcon;
private static Texture2D _foldoutFirstIcon;
private static Texture2D _foldoutMiddleIcon;
private static Texture2D _foldoutLastIcon;
private static Texture2D _foldoutLevelsIcon;
private static string _projectName;
private static string _projectPath;
private static string _tempDir;
//---------------------------------------------------------------------
// Project
//---------------------------------------------------------------------
[SuppressMessage("ReSharper", "InvertIf")]
public static string ProjectName
{
get
{
if (_projectName == null)
{
var path = Application.dataPath.Split('/');
_projectName = path[path.Length - 2];
}
return _projectName;
}
}
[SuppressMessage("ReSharper", "InvertIf")]
public static string ProjectPath
{
get
{
if (_projectPath == null)
{
_projectPath = Path.GetDirectoryName(Application.dataPath);
}
return _projectPath;
}
}
[SuppressMessage("ReSharper", "InvertIf")]
public static string TempDir
{
get
{
if (_tempDir == null)
{
_tempDir = $"{ProjectPath}/Temp";
}
return _tempDir;
}
}
//---------------------------------------------------------------------
// Windows
//---------------------------------------------------------------------
public static IEnumerable<EditorWindow> GetAllWindowsByType(string type)
{
var objectList = Resources.FindObjectsOfTypeAll(typeof(EditorWindow));
var windows = from obj in objectList where obj.GetType().ToString() == type select (EditorWindow) obj;
return windows;
}
//---------------------------------------------------------------------
// Scene
//---------------------------------------------------------------------
public static void UpdateSceneConfigVisibility(bool isVisible)
{
var rulesetInstances = HierarchyRulesetV2.Instances;
if (rulesetInstances == null || rulesetInstances.Count < 1) return;
foreach (var ruleset in rulesetInstances)
{
if (ruleset == null) return;
ruleset.transform.hideFlags = isVisible
? HideFlags.None
: HideFlags.HideInHierarchy;
}
EditorApplication.DirtyHierarchyWindowSorting();
}
public static string GetTransformPath(Transform transform)
{
var path = transform.name;
while (transform.parent != null)
{
transform = transform.parent;
path = $"{transform.name}/{path}";
}
return $"/{path}";
}
//---------------------------------------------------------------------
// GUI
//---------------------------------------------------------------------
public static bool SearchField(ref string query, ref Enum filter, Enum defaultFilter, params GUILayoutOption[] options)
{
var queryBefore = query;
var filterBefore = filter;
var changed = false;
GUILayout.BeginHorizontal();
var queryRect = GUILayoutUtility.GetRect(GUIContent.none, "ToolbarSearchTextFieldPopup", options);
queryRect.x += 2f;
queryRect.width -= 13f;
var filterRect = queryRect;
filterRect.width = 20f;
filter = EditorGUI.EnumPopup(filterRect, filter, "label");
if (!Equals(filter, filterBefore)) changed = true;
query = EditorGUI.TextField(queryRect, GUIContent.none, query, "ToolbarSearchTextField");
if (query != null && !query.Equals(queryBefore)) changed = true;
var cancelRect = queryRect;
cancelRect.x += queryRect.width;
cancelRect.width = 12f;
if (GUI.Button(cancelRect, GUIContent.none, "ToolbarSearchCancelButton"))
{
query = string.Empty;
filter = defaultFilter;
changed = true;
// workaround for bug with selected text
GUIUtility.keyboardControl = 0;
}
GUILayout.EndHorizontal();
return changed;
}
//---------------------------------------------------------------------
// Icons
//---------------------------------------------------------------------
public static Texture2D GetEditIcon()
{
return GetTexture(ref _editIcon, HierarchyEditorTexture.IcnEdit);
}
public static Texture2D GetSettingsButtonIcon()
{
return GetTexture(ref _settingsIcon, HierarchyEditorTexture.IcnSettings);
}
public static Texture2D GetFilterButtonIcon()
{
return GetTexture(ref _filterIcon, HierarchyEditorTexture.IcnFilter);
}
public static Texture2D GetDeleteButtonIcon()
{
return GetTexture(ref _deleteIcon, HierarchyEditorTexture.IcnDelete);
}
public static Texture2D GetFoldoutIcon(SiblingIndex index)
{
switch (index)
{
case SiblingIndex.First:
return GetTexture(ref _foldoutFirstIcon, HierarchyEditorTexture.IcnFoldoutFirst);
case SiblingIndex.Middle:
return GetTexture(ref _foldoutMiddleIcon, HierarchyEditorTexture.IcnFoldoutMiddle);
case SiblingIndex.Last:
return GetTexture(ref _foldoutLastIcon, HierarchyEditorTexture.IcnFoldoutLast);
default:
throw new ArgumentOutOfRangeException("index", index, null);
}
}
public static Texture2D GetFoldoutLevelsIcon()
{
return GetTexture(ref _foldoutLevelsIcon, HierarchyEditorTexture.IcnFoldoutLevels);
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private static Texture2D GetTexture(ref Texture2D texture, HierarchyEditorTexture type)
{
if (texture == null)
texture = HierarchyEditorTexturesStorage.GetTexture(type);
return texture;
}
//---------------------------------------------------------------------
// Nested
//---------------------------------------------------------------------
public enum SiblingIndex
{
First,
Middle,
Last
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 706f956b3ade11845b3ebc2c47f0fe00
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Helpers/HierarchyEditorUtility.cs
uploadId: 716077

View File

@@ -0,0 +1,124 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
[InitializeOnLoad]
public static class HierarchyWindowAdapter
{
private const string EDITOR_WINDOW_TYPE = "UnityEditor.SceneHierarchyWindow";
private const double EDITOR_WINDOWS_CACHE_TTL = 2;
private const BindingFlags INSTANCE_PRIVATE = BindingFlags.Instance | BindingFlags.NonPublic;
private const BindingFlags INSTANCE_PUBLIC = BindingFlags.Instance | BindingFlags.Public;
private static readonly FieldInfo SCENE_HIERARCHY_FIELD;
private static readonly FieldInfo TREE_VIEW_FIELD;
private static readonly PropertyInfo TREE_VIEW_DATA_PROPERTY;
private static readonly MethodInfo TREE_VIEW_ITEMS_METHOD;
private static readonly PropertyInfo TREE_VIEW_OBJECT_PROPERTY;
// Windows cache
private static double _nextWindowsUpdate;
private static EditorWindow[] _windowsCache;
//---------------------------------------------------------------------
// Ctor
//---------------------------------------------------------------------
static HierarchyWindowAdapter()
{
// Reflection
var assembly = Assembly.GetAssembly(typeof(EditorWindow));
var hierarchyWindowType = assembly.GetType("UnityEditor.SceneHierarchyWindow");
SCENE_HIERARCHY_FIELD = hierarchyWindowType.GetField("m_SceneHierarchy", INSTANCE_PRIVATE);
var sceneHierarchyType = assembly.GetType("UnityEditor.SceneHierarchy");
TREE_VIEW_FIELD = sceneHierarchyType.GetField("m_TreeView", INSTANCE_PRIVATE);
var treeViewType = assembly.GetType("UnityEditor.IMGUI.Controls.TreeViewController");
TREE_VIEW_DATA_PROPERTY = treeViewType.GetProperty("data", INSTANCE_PUBLIC);
var treeViewDataType = assembly.GetType("UnityEditor.GameObjectTreeViewDataSource");
TREE_VIEW_ITEMS_METHOD = treeViewDataType.GetMethod("GetRows", INSTANCE_PUBLIC);
var treeViewItem = assembly.GetType("UnityEditor.GameObjectTreeViewItem");
TREE_VIEW_OBJECT_PROPERTY = treeViewItem.GetProperty("objectPPTR", INSTANCE_PUBLIC);
// Callbacks
HierarchyRulesetV2.OnRulesetChangeCallback += ApplyDefaultIconsToAll;
}
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static EditorWindow GetFirstHierarchyWindow()
{
return GetAllHierarchyWindows().FirstOrDefault();
}
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "InvertIf")]
public static IEnumerable<EditorWindow> GetAllHierarchyWindows(bool forceUpdate = false)
{
if (forceUpdate || _nextWindowsUpdate < EditorApplication.timeSinceStartup)
{
_nextWindowsUpdate = EditorApplication.timeSinceStartup + EDITOR_WINDOWS_CACHE_TTL;
_windowsCache = HierarchyEditorUtility.GetAllWindowsByType(EDITOR_WINDOW_TYPE).ToArray();
}
return _windowsCache;
}
public static void ApplyIconByInstanceId(int instanceId, Texture2D icon)
{
var hierarchyWindows = GetAllHierarchyWindows();
foreach (var window in hierarchyWindows)
{
var treeViewItems = GetTreeViewItems(window);
var treeViewItem = treeViewItems.FirstOrDefault(item => item.id == instanceId);
if (treeViewItem != null) treeViewItem.icon = icon;
}
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private static IEnumerable<TreeViewItem> GetTreeViewItems(EditorWindow window)
{
var sceneHierarchy = SCENE_HIERARCHY_FIELD.GetValue(window);
var treeView = TREE_VIEW_FIELD.GetValue(sceneHierarchy);
var treeViewData = TREE_VIEW_DATA_PROPERTY.GetValue(treeView, null);
var treeViewItems = (IEnumerable<TreeViewItem>) TREE_VIEW_ITEMS_METHOD.Invoke(treeViewData, null);
return treeViewItems;
}
private static void ApplyDefaultIconsToAll()
{
var hierarchyWindows = GetAllHierarchyWindows(true);
foreach (var window in hierarchyWindows)
{
var treeViewItems = GetTreeViewItems(window);
foreach (var item in treeViewItems)
{
var gameObject = TREE_VIEW_OBJECT_PROPERTY.GetValue(item, null);
if (gameObject == null) continue;
item.icon = PrefabUtility.GetIconForGameObject((GameObject) gameObject);
}
}
EditorApplication.RepaintHierarchyWindow();
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f23b31e6bba538a4cae0907091949e50
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Helpers/HierarchyWindowAdapter.cs
uploadId: 716077

View File

@@ -0,0 +1,24 @@
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
internal static class RHLogger
{
private const string TAG = "<b>[RH]</b>";
public static void Log(string message)
{
Debug.Log($"{TAG} {message}");
}
public static void LogWarning(string message)
{
Debug.LogWarning($"{TAG} {message}");
}
public static void LogError(string message)
{
Debug.LogError($"{TAG} {message}");
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7f02ac93f4c0323408795cc555a9241b
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Helpers/RHLogger.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1b51128ba8e08d8498b38a08a4377290
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
using System.IO;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using static Borodar.RainbowHierarchy.HierarchyRulesetV2;
using static Borodar.RainbowHierarchy.RHLogger;
namespace Borodar.RainbowHierarchy
{
[InitializeOnLoad]
public static class EditorProxyInitializer
{
static EditorProxyInitializer()
{
HierarchyEditorProxy.UpdateOldRuleset = (gameObject) =>
{
var dialogResult = EditorUtility.DisplayDialog
(
"Rainbow Hierarchy Update",
"This scene contains a ruleset from the older Rainbow Hierarchy version. Do you want to update it now?",
"Yes",
"No"
);
if (!dialogResult) return;
var scene = gameObject.scene;
var sceneName = scene.name;
var filePath = $"{HierarchyEditorUtility.TempDir}/{sceneName}.{EXTENSION}";
// Export old ruleset and override version
if (gameObject.TryGetComponent<HierarchyRuleset>(out var rulesetV1))
{
HierarchyRulesetExporter.ExportRulesetV1(rulesetV1, filePath);
Object.DestroyImmediate(rulesetV1);
}
else
{
LogError($"Cannot find ruleset component on: {gameObject.name}");
return;
}
gameObject.AddComponent<HierarchyRulesetV2>();
// Import ruleset data (all upgrade steps will be done automatically)
HierarchyRulesetImporter.ImportRuleset(filePath);
EditorSceneManager.SaveScene(scene);
File.Delete(filePath);
Log($"Ruleset successfully updated to latest version: {sceneName}");
};
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 490a06b1f08a54f43aee59f4a25d7580
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Port/EditorProxyInitializer.cs
uploadId: 716077

View File

@@ -0,0 +1,119 @@
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
using static Borodar.RainbowHierarchy.HierarchyRulesetV2;
using static Borodar.RainbowHierarchy.RHLogger;
namespace Borodar.RainbowHierarchy
{
public static class HierarchyRulesetExporter
{
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static void Export()
{
var dirPath = EditorUtility.SaveFolderPanel("Export Rulesets", "", "");
if (string.IsNullOrEmpty(dirPath)) return;
ExportRuleset(dirPath);
ExportCustomIcons(dirPath);
}
public static void ExportRulesetV1(HierarchyRuleset ruleset, string filePath)
{
ConvertObjectRefsToPathsV1(ruleset);
var rulesetJson = EditorJsonUtility.ToJson(ruleset);
var wrapper = new HierarchyRulesetWrapper {
Version = HierarchyRuleset.VERSION,
RulesetJson = rulesetJson
};
var wrapperJson = EditorJsonUtility.ToJson(wrapper, true);
File.WriteAllText(filePath, wrapperJson);
Log($"Ruleset successfully exported:\n{filePath}");
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private static void ExportRuleset(string dirPath)
{
foreach (var ruleset in Instances)
{
ConvertObjectRefsToPaths(ruleset);
var rulesetJson = EditorJsonUtility.ToJson(ruleset);
var wrapper = new HierarchyRulesetWrapper { RulesetJson = rulesetJson };
var wrapperJson = EditorJsonUtility.ToJson(wrapper, true);
var sceneName = ruleset.gameObject.scene.name;
var filePath = $"{dirPath}/{sceneName}.{EXTENSION}";
File.WriteAllText(filePath, wrapperJson);
Log($"Ruleset successfully exported:\n{filePath}");
}
}
private static void ConvertObjectRefsToPaths(HierarchyRulesetV2 ruleset)
{
foreach (var rule in ruleset.Rules)
{
if (rule.Type != HierarchyRule.KeyType.Object) continue;
if (rule.GameObject == null) continue;
var transform = rule.GameObject.transform;
var path = HierarchyEditorUtility.GetTransformPath(transform);
rule.Name = path;
}
}
private static void ConvertObjectRefsToPathsV1(HierarchyRuleset ruleset)
{
foreach (var rule in ruleset.Rules)
{
if (rule.Type != HierarchyRule.KeyType.Object) continue;
if (rule.GameObject == null) continue;
var transform = rule.GameObject.transform;
var path = HierarchyEditorUtility.GetTransformPath(transform);
rule.Name = path;
}
}
private static void ExportCustomIcons(string dirPath)
{
foreach (var ruleset in Instances)
{
var roots = new Object[] { ruleset };
var allDependencies = EditorUtility.CollectDependencies(roots);
var textureDependencies = (from dependency in allDependencies
where dependency is Texture2D
select AssetDatabase.GetAssetPath(dependency))
.ToArray();
var sceneName = ruleset.gameObject.scene.name;
if (!textureDependencies.Any())
{
Log($"There is no custom icons in ruleset: {sceneName}.\nSkipping package export.");
continue;
}
var packagePath = $"{dirPath}/{sceneName}.unitypackage";
AssetDatabase.ExportPackage(textureDependencies, packagePath);
Log($"Package with custom icons successfully exported:\n{packagePath}");
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fb37551f26ecf5249ad80c84af95358f
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Port/HierarchyRulesetExporter.cs
uploadId: 716077

View File

@@ -0,0 +1,131 @@
using System.IO;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
using static Borodar.RainbowHierarchy.HierarchyRulesetV2;
using static Borodar.RainbowHierarchy.RHLogger;
namespace Borodar.RainbowHierarchy
{
public static class HierarchyRulesetImporter
{
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static void Import()
{
var path = EditorUtility.OpenFilePanel("Import Ruleset", "", EXTENSION);
if (string.IsNullOrEmpty(path)) return;
ImportCustomIcons(path);
ImportRuleset(path);
}
public static void ImportRuleset(string path)
{
var wrapperJson = File.ReadAllText(path);
var wrapper = new HierarchyRulesetWrapper();
EditorJsonUtility.FromJsonOverwrite(wrapperJson, wrapper);
if (wrapper.Version < VERSION)
{
UpdateFromOlderVersions(wrapper);
}
var activeScene = SceneManager.GetActiveScene();
var activeRuleset = GetRulesetByScene(activeScene, true);
Undo.RecordObject(activeRuleset, "Hierarchy Ruleset Import");
EditorJsonUtility.FromJsonOverwrite(wrapper.RulesetJson, activeRuleset);
ConvertPathsToObjectRefs(activeRuleset);
Log("Ruleset successfully imported.");
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private static void UpdateFromOlderVersions(HierarchyRulesetWrapper wrapper)
{
if (wrapper.Version <= 1)
{
// Convert all icon IDs to xxx00 (e.g 5432 -> 543200)
wrapper.RulesetJson = Regex.Replace(
wrapper.RulesetJson,
"\"IconType\":[1-9]\\d*",
match => $"{match}00");
// Convert all background IDs to xxx00 (e.g 5432 -> 543200)
wrapper.RulesetJson = Regex.Replace(
wrapper.RulesetJson,
"\"BackgroundType\":[1-9]\\d*",
match => $"{match}00");
// Replace particular values
wrapper.RulesetJson = wrapper.RulesetJson
// General
.Replace("\"IconType\":100000,", "\"IconType\":125650,") // CmpAssemblyDefinitionAsset
.Replace("\"IconType\":101000,", "\"IconType\":125250,") // CmpCsScript
.Replace("\"IconType\":102000,", "\"IconType\":125000,") // CmpDefaultAsset
.Replace("\"IconType\":111000,", "\"IconType\":125750,") // CmpShader
.Replace("\"IconType\":112000,", "\"IconType\":125150,") // CmpTextAsset
.Replace("\"IconType\":115000,", "\"IconType\":125550,") // CmpVisualTreeAsset
// Miscellaneous
.Replace("\"IconType\":181000,", "\"IconType\":117000,") // Animation
.Replace("\"IconType\":182000,", "\"IconType\":117350,") // Animator
// Rendering
.Replace("\"IconType\":293000,", "\"IconType\":169500,") // Light
.Replace("\"IconType\":294000,", "\"IconType\":169550,") // LightProbeGroup
.Replace("\"IconType\":295000,", "\"IconType\":169560,") // LightProbeProxyVolume
;
}
}
private static void ConvertPathsToObjectRefs(HierarchyRulesetV2 ruleset)
{
for (var i = ruleset.Rules.Count - 1; i >= 0; i--)
{
var rule = ruleset.Rules[i];
if (rule.Type != HierarchyRule.KeyType.Object) continue;
if (string.IsNullOrEmpty(rule.Name))
{
ruleset.Rules.RemoveAt(i);
continue;
}
var gameObject = GameObject.Find(rule.Name);
if (gameObject != null)
{
// Replace
rule.GameObject = gameObject;
rule.Name = string.Empty;
}
else
{
// Delete
ruleset.Rules.RemoveAt(i);
}
}
}
private static void ImportCustomIcons(string path)
{
var importDir = Path.GetDirectoryName(path);
var importFileName = Path.GetFileNameWithoutExtension(path);
var packagePath = $"{importDir}/{importFileName}.unitypackage";
if (!File.Exists(packagePath))
{
Log("There is no package with custom icons. Skipping package import.");
return;
}
AssetDatabase.ImportPackage(packagePath, true);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5163ed631bd3bed4e90800fb96800cac
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Port/HierarchyRulesetImporter.cs
uploadId: 716077

View File

@@ -0,0 +1,11 @@
namespace Borodar.RainbowHierarchy
{
internal sealed class HierarchyRulesetWrapper
{
#pragma warning disable 414
public int Version = HierarchyRulesetV2.VERSION;
#pragma warning restore 414
public string RulesetJson;
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: afb932c346aec4c478e65191a53801a8
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Port/HierarchyRulesetWrapper.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0b4b81ad75c9b784783e362a89368bac
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,209 @@
using System.Diagnostics.CodeAnalysis;
using UnityEditor;
using UnityEngine;
using static Borodar.RainbowHierarchy.HierarchyEditorUtility;
namespace Borodar.RainbowHierarchy
{
public static class HierarchyPreferences
{
private const float PREF_LABEL_WIDTH = 150f;
private const string EDIT_MODIFIER_PKEY = "Borodar.RainbowHierarchy.EditMod.";
private const string EDIT_MODIFIER_HINT = "Modifier key that is used to show configuration dialogue when clicking on an object in the hierarchy.";
private const EventModifiers EDIT_MODIFIER_DEFAULT = EventModifiers.Alt;
private const string DRAG_MODIFIER_PKEY = "Borodar.RainbowHierarchy.DragMod.";
private const string DRAG_MODIFIER_HINT = "Modifier key that is used to drag configuration dialogue.";
private const EventModifiers DRAG_MODIFIER_DEFAULT = EventModifiers.Shift;
private const string HIDE_CONFIG_PKEY = "Borodar.RainbowHierarchy.HideConfig.";
private const string HIDE_CONFIG_HINT = "Change this setting to show/hide the RainbowHierarchyConf object in the hierarchy window.";
private const bool HIDE_CONFIG_DEFAULT = false;
private const string HIERARCHY_TREE_PKEY = "Borodar.RainbowHierarchy.ShowHierarchyTree.";
private const string HIERARCHY_TREE_HINT = "Change this setting to show/hide the \"branches\" in the hierarchy window.";
private const bool HIERARCHY_TREE_DEFAULT = true;
private const string ROW_SHADING_PKEY = "Borodar.RainbowHierarchy.RowShading.";
private const string ROW_SHADING_HINT = "Change this setting to enable/disable row shading in the hierarchy window.";
private const bool ROW_SHADING_DEFAULT = true;
private static readonly EditorPrefsModifierKey EDIT_MODIFIER_PREF;
private static readonly EditorPrefsModifierKey DRAG_MODIFIER_PREF;
private static readonly EditorPrefsBoolean HIDE_CONFIG_PREF;
private static readonly EditorPrefsBoolean HIERARCHY_TREE_PREF;
private static readonly EditorPrefsBoolean ROW_SHADING_PREF;
private static EventModifiers _editModifier;
private static EventModifiers _dragModifier;
public static bool HideConfig;
//---------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------
public static bool ShowHierarchyTree { get; private set; }
public static bool DrawRowShading { get; private set; }
//---------------------------------------------------------------------
// Ctors
//---------------------------------------------------------------------
static HierarchyPreferences()
{
// General
var editModifierLabel = new GUIContent("Edit Modifier", EDIT_MODIFIER_HINT);
EDIT_MODIFIER_PREF = new EditorPrefsModifierKey(EDIT_MODIFIER_PKEY + ProjectName, EDIT_MODIFIER_DEFAULT, editModifierLabel);
EDIT_MODIFIER_PREF.Changed += OnEditModifierChanged;
_editModifier = EDIT_MODIFIER_PREF.Value;
var dragModifierLabel = new GUIContent("Drag Modifier", DRAG_MODIFIER_HINT);
DRAG_MODIFIER_PREF = new EditorPrefsModifierKey(DRAG_MODIFIER_PKEY + ProjectName, DRAG_MODIFIER_DEFAULT, dragModifierLabel);
DRAG_MODIFIER_PREF.Changed += OnDragModifierChanged;
_dragModifier = DRAG_MODIFIER_PREF.Value;
var hideConfigLabel = new GUIContent("Hide Config", HIDE_CONFIG_HINT);
HIDE_CONFIG_PREF = new EditorPrefsBoolean(HIDE_CONFIG_PKEY + ProjectName, HIDE_CONFIG_DEFAULT, hideConfigLabel, PREF_LABEL_WIDTH);
HIDE_CONFIG_PREF.Changed += OnHideConfigChanged;
HideConfig = HIDE_CONFIG_PREF.Value;
// Enhancements
var hierarchyTreeLabel = new GUIContent("Hierarchy Tree", HIERARCHY_TREE_HINT);
HIERARCHY_TREE_PREF = new EditorPrefsBoolean(HIERARCHY_TREE_PKEY + ProjectName, HIERARCHY_TREE_DEFAULT, hierarchyTreeLabel, PREF_LABEL_WIDTH);
HIERARCHY_TREE_PREF.Changed += OnHierarchyTreeChanged;
ShowHierarchyTree = HIERARCHY_TREE_PREF.Value;
var rowShadingLabel = new GUIContent("Row Shading", ROW_SHADING_HINT);
ROW_SHADING_PREF = new EditorPrefsBoolean(ROW_SHADING_PKEY + ProjectName, ROW_SHADING_DEFAULT, rowShadingLabel, PREF_LABEL_WIDTH);
ROW_SHADING_PREF.Changed += OnRowShadingChanged;
DrawRowShading = ROW_SHADING_PREF.Value;
}
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
[SettingsProvider]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public static SettingsProvider CreateSettingProvider()
{
return new SettingsProvider("Borodar/RainbowHierarchy", SettingsScope.Project)
{
label = AssetInfo.NAME,
guiHandler = OnGUI
};
}
public static bool IsEditModifierPressed(Event e)
{
return (e.modifiers & _editModifier) == _editModifier;
}
public static bool IsDragModifierPressed(Event e)
{
return (e.modifiers & _dragModifier) == _dragModifier;
}
//---------------------------------------------------------------------
// Messages
//---------------------------------------------------------------------
private static void OnGUI(string searchContext)
{
DrawGeneralSection();
DrawEnhancementsSection();
DrawImportExportSection();
DrawVersionAtBottom();
}
//---------------------------------------------------------------------
// OnChange
//---------------------------------------------------------------------
private static void OnEditModifierChanged(EventModifiers value)
{
_editModifier = value;
}
private static void OnDragModifierChanged(EventModifiers value)
{
_dragModifier = value;
}
private static void OnHideConfigChanged(bool value)
{
HideConfig = value;
UpdateSceneConfigVisibility(!value);
}
private static void OnHierarchyTreeChanged(bool value)
{
ShowHierarchyTree = value;
EditorApplication.RepaintHierarchyWindow();
}
private static void OnRowShadingChanged(bool value)
{
DrawRowShading = value;
EditorApplication.RepaintHierarchyWindow();
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private static void DrawGeneralSection()
{
DrawHeader("General");
EDIT_MODIFIER_PREF.Draw();
DRAG_MODIFIER_PREF.Draw();
TinySeparator();
HIDE_CONFIG_PREF.Draw();
}
private static void DrawEnhancementsSection()
{
DrawHeader("Enhancements");
HIERARCHY_TREE_PREF.Draw();
TinySeparator();
ROW_SHADING_PREF.Draw();
}
private static void DrawImportExportSection()
{
DrawHeader("Import / Export Ruleset (Current Scene)");
EditorGUILayout.BeginHorizontal();
{
if (GUILayout.Button("Import")) HierarchyRulesetImporter.Import();;
if (GUILayout.Button("Export")) HierarchyRulesetExporter.Export();
}
EditorGUILayout.EndHorizontal();
}
private static void DrawVersionAtBottom()
{
GUILayout.FlexibleSpace();
EditorGUILayout.LabelField("Version " + AssetInfo.VERSION, EditorStyles.centeredGreyMiniLabel);
}
private static void DrawHeader(string label)
{
EditorGUILayout.Separator();
EditorGUILayout.LabelField(label, EditorStyles.boldLabel);
EditorGUILayout.Separator();
}
private static void TinySeparator()
{
GUILayoutUtility.GetRect(0f, 0f);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2042b261749a0f445852e9bccb9fc16f
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Prefs/HierarchyPreferences.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aadfdb1af2564164c82e867ffc82322b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
using UnityEditor;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
public class EditorPrefsBoolean : EditorPrefsItem<bool>
{
private readonly float _labelWidth;
//---------------------------------------------------------------------
// Ctors
//---------------------------------------------------------------------
public EditorPrefsBoolean(string key, bool defaultValue, GUIContent label, float labelWidth)
: base(key, defaultValue, label)
{
_labelWidth = labelWidth;
}
//---------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------
public override bool Value
{
get
{
return EditorPrefs.GetBool(Key, DefaultValue);
}
set
{
if (Value == value) return;
EditorPrefs.SetBool(Key, value);
OnValueChanged(value);
}
}
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public override void Draw()
{
EditorGUIUtility.labelWidth = _labelWidth;
Value = EditorGUILayout.Toggle(Label, Value);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 58b12300e92a4024e80ebdcc971eb99a
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Prefs/Items/EditorPrefsBoolean.cs
uploadId: 716077

View File

@@ -0,0 +1,60 @@
using System;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
public abstract class EditorPrefsItem<T>
{
protected readonly string Key;
protected readonly GUIContent Label;
protected readonly T DefaultValue;
//---------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------
public abstract T Value { get; set; }
//---------------------------------------------------------------------
// Events
//---------------------------------------------------------------------
public event Action<T> Changed;
//---------------------------------------------------------------------
// Ctors
//---------------------------------------------------------------------
protected EditorPrefsItem(string key, T defaultValue, GUIContent label)
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException(nameof(key));
}
Key = key;
DefaultValue = defaultValue;
Label = label;
}
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public abstract void Draw();
public static implicit operator T(EditorPrefsItem<T> s)
{
return s.Value;
}
//---------------------------------------------------------------------
// Protected
//---------------------------------------------------------------------
protected void OnValueChanged(T value)
{
Changed?.Invoke(value);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f9fbb9f2704df024d81d73f8193af9e8
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Prefs/Items/EditorPrefsItem.cs
uploadId: 716077

View File

@@ -0,0 +1,42 @@
using System;
using UnityEditor;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
public class EditorPrefsModifierKey : EditorPrefsItem<EventModifiers> {
//---------------------------------------------------------------------
// Ctors
//---------------------------------------------------------------------
public EditorPrefsModifierKey(string key, EventModifiers defaultValue, GUIContent label)
: base(key, defaultValue, label) { }
//---------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------
public override EventModifiers Value {
get
{
var index = EditorPrefs.GetInt(Key, (int) DefaultValue);
return (Enum.IsDefined(typeof(EventModifiers), index)) ? (EventModifiers) index : DefaultValue;
}
set
{
if (Value == value) return;
EditorPrefs.SetInt(Key, (int) value);
OnValueChanged(value);
}
}
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public override void Draw() {
Value = (EventModifiers) EditorGUILayout.EnumPopup(Label, Value);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5499329b412119a45b04357956aeda19
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Prefs/Items/EditorPrefsModifierKey.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ca69afbdf78a7564cae7ca1a53c6fe08
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Chris Foulston
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 609221f9a89122145b14c121a191318e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/RList/LICENSE
uploadId: 716077

View File

@@ -0,0 +1,110 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Borodar.RainbowHierarchy.RList {
[Serializable]
public abstract class ReorderableArray<T> : ICloneable, IList<T>, ICollection<T>, IEnumerable<T> {
[SerializeField]
private List<T> array = new List<T>();
public ReorderableArray()
: this(0) {
}
public ReorderableArray(int length) {
array = new List<T>(length);
}
public T this[int index] {
get { return array[index]; }
set { array[index] = value; }
}
public int Length {
get { return array.Count; }
}
public bool IsReadOnly {
get { return false; }
}
public int Count {
get { return array.Count; }
}
public object Clone() {
return new List<T>(array);
}
public void CopyFrom(IEnumerable<T> value) {
array.Clear();
array.AddRange(value);
}
public bool Contains(T value) {
return array.Contains(value);
}
public int IndexOf(T value) {
return array.IndexOf(value);
}
public void Insert(int index, T item) {
array.Insert(index, item);
}
public void RemoveAt(int index) {
array.RemoveAt(index);
}
public void Add(T item) {
array.Add(item);
}
public void Clear() {
array.Clear();
}
public void CopyTo(T[] array, int arrayIndex) {
this.array.CopyTo(array, arrayIndex);
}
public bool Remove(T item) {
return array.Remove(item);
}
public T[] ToArray() {
return array.ToArray();
}
public IEnumerator<T> GetEnumerator() {
return array.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator() {
return array.GetEnumerator();
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ff2fb36905dd14a47916cba5057343f0
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/RList/ReorderableArray.cs
uploadId: 716077

View File

@@ -0,0 +1,53 @@
using System;
using UnityEngine;
namespace Borodar.RainbowHierarchy.RList {
public class ReorderableAttribute : PropertyAttribute {
public bool add;
public bool remove;
public bool draggable;
public bool singleLine;
public bool paginate;
public bool sortable;
public int pageSize;
public string elementNameProperty;
public string elementNameOverride;
public string elementIconPath;
public Type surrogateType;
public string surrogateProperty;
public ReorderableAttribute()
: this(null) {
}
public ReorderableAttribute(string elementNameProperty)
: this(true, true, true, elementNameProperty, null, null) {
}
public ReorderableAttribute(string elementNameProperty, string elementIconPath)
: this(true, true, true, elementNameProperty, null, elementIconPath) {
}
public ReorderableAttribute(string elementNameProperty, string elementNameOverride, string elementIconPath)
: this(true, true, true, elementNameProperty, elementNameOverride, elementIconPath) {
}
public ReorderableAttribute(bool add, bool remove, bool draggable, string elementNameProperty = null, string elementIconPath = null)
: this(add, remove, draggable, elementNameProperty, null, elementIconPath) {
}
public ReorderableAttribute(bool add, bool remove, bool draggable, string elementNameProperty = null, string elementNameOverride = null, string elementIconPath = null) {
this.add = add;
this.remove = remove;
this.draggable = draggable;
this.elementNameProperty = elementNameProperty;
this.elementNameOverride = elementNameOverride;
this.elementIconPath = elementIconPath;
sortable = true;
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a742bfa155a4d6f429285e9960422f18
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/RList/ReorderableAttribute.cs
uploadId: 716077

View File

@@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
namespace Borodar.RainbowHierarchy.RList {
[CustomPropertyDrawer(typeof(ReorderableAttribute))]
public class ReorderableDrawer : PropertyDrawer {
public const string ARRAY_PROPERTY_NAME = "array";
private static Dictionary<int, ReorderableList> lists = new Dictionary<int, ReorderableList>();
[Obsolete("CanCacheInspectorGUI has been deprecated and is no longer used.", false)]
public override bool CanCacheInspectorGUI(SerializedProperty property) {
return false;
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) {
ReorderableList list = GetList(property, attribute as ReorderableAttribute, ARRAY_PROPERTY_NAME);
return list != null ? list.GetHeight() : EditorGUIUtility.singleLineHeight;
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
ReorderableList list = GetList(property, attribute as ReorderableAttribute, ARRAY_PROPERTY_NAME);
if (list != null) {
list.DoList(EditorGUI.IndentedRect(position), label);
}
else {
GUI.Label(position, "Array must extend from ReorderableArray", EditorStyles.label);
}
}
public static int GetListId(SerializedProperty property) {
if (property != null) {
int h1 = property.serializedObject.targetObject.GetHashCode();
int h2 = property.propertyPath.GetHashCode();
return (((h1 << 5) + h1) ^ h2);
}
return 0;
}
public static ReorderableList GetList(SerializedProperty property, string arrayPropertyName) {
return GetList(property, null, GetListId(property), arrayPropertyName);
}
public static ReorderableList GetList(SerializedProperty property, ReorderableAttribute attrib, string arrayPropertyName) {
return GetList(property, attrib, GetListId(property), arrayPropertyName);
}
public static ReorderableList GetList(SerializedProperty property, int id, string arrayPropertyName) {
return GetList(property, null, id, arrayPropertyName);
}
public static ReorderableList GetList(SerializedProperty property, ReorderableAttribute attrib, int id, string arrayPropertyName) {
if (property == null) {
return null;
}
ReorderableList list = null;
SerializedProperty array = property.FindPropertyRelative(arrayPropertyName);
if (array != null && array.isArray) {
if (!lists.TryGetValue(id, out list)) {
if (attrib != null) {
Texture icon = !string.IsNullOrEmpty(attrib.elementIconPath) ? AssetDatabase.GetCachedIcon(attrib.elementIconPath) : null;
ReorderableList.ElementDisplayType displayType = attrib.singleLine ? ReorderableList.ElementDisplayType.SingleLine : ReorderableList.ElementDisplayType.Auto;
list = new ReorderableList(array, attrib.add, attrib.remove, attrib.draggable, displayType, attrib.elementNameProperty, attrib.elementNameOverride, icon);
list.paginate = attrib.paginate;
list.pageSize = attrib.pageSize;
list.sortable = attrib.sortable;
//handle surrogate if any
if (attrib.surrogateType != null) {
SurrogateCallback callback = new SurrogateCallback(attrib.surrogateProperty);
list.surrogate = new ReorderableList.Surrogate(attrib.surrogateType, callback.SetReference);
}
}
else {
list = new ReorderableList(array, true, true, true);
}
lists.Add(id, list);
}
else {
list.List = array;
}
}
return list;
}
private struct SurrogateCallback {
private string property;
internal SurrogateCallback(string property) {
this.property = property;
}
internal void SetReference(SerializedProperty element, Object objectReference, ReorderableList list) {
SerializedProperty prop = !string.IsNullOrEmpty(property) ? element.FindPropertyRelative(property) : null;
if (prop != null && prop.propertyType == SerializedPropertyType.ObjectReference) {
prop.objectReferenceValue = objectReference;
}
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7e6c549c0f86e7d4bb4d52b49fd1052c
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/RList/ReorderableDrawer.cs
uploadId: 716077

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bc6c2a114d6b2a646a7240a0b7517898
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/RList/ReorderableList.cs
uploadId: 716077

View File

@@ -0,0 +1,353 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using SiblingIndex = Borodar.RainbowHierarchy.HierarchyEditorUtility.SiblingIndex;
namespace Borodar.RainbowHierarchy
{
[InitializeOnLoad]
public static class RainbowHierarchyGUI
{
private const float DRAW_OFFSET = 28f;
private static readonly Color ROW_SHADING_COLOR = new Color(0f, 0f, 0f, 0.03f);
private static readonly List<GameObject> RECURSIVE_OBJECTS = new List<GameObject>();
private static bool _multiSelection;
//---------------------------------------------------------------------
// Ctor
//---------------------------------------------------------------------
static RainbowHierarchyGUI()
{
EditorApplication.hierarchyChanged += HierarchyWindowChanged;
EditorApplication.hierarchyWindowItemOnGUI += RainbowHierarchyItemOnGUI;
HierarchyRulesetV2.OnRulesetChangeCallback += OnRulesetChange;
}
//---------------------------------------------------------------------
// Delegates
//---------------------------------------------------------------------
private static void HierarchyWindowChanged()
{
HierarchyEditorUtility.UpdateSceneConfigVisibility(!HierarchyPreferences.HideConfig);
RECURSIVE_OBJECTS.Clear();
}
private static void OnRulesetChange()
{
RECURSIVE_OBJECTS.Clear();
}
private static void RainbowHierarchyItemOnGUI(int instanceId, Rect selectionRect)
{
var gameObject = (GameObject)EditorUtility.InstanceIDToObject(instanceId);
if (gameObject == null) return;
DrawRowShading(selectionRect);
DrawFoldouts(gameObject, selectionRect);
ReplaceHierarchyTextures(instanceId, gameObject, selectionRect);
DrawEditIcon(gameObject, selectionRect);
}
//---------------------------------------------------------------------
// GUI
//---------------------------------------------------------------------
private static void DrawRowShading(Rect selectionRect)
{
if (!HierarchyPreferences.DrawRowShading) return;
var isOdd = Mathf.FloorToInt(((selectionRect.y - 4) / 16) % 2) != 0;
if (isOdd) return;
var foldoutRect = new Rect(selectionRect);
foldoutRect.width += selectionRect.x + 16f;
foldoutRect.height += 1f;
foldoutRect.x = DRAW_OFFSET;
// Background
EditorGUI.DrawRect(foldoutRect, ROW_SHADING_COLOR);
// Top line
foldoutRect.height = 1f;
EditorGUI.DrawRect(foldoutRect, ROW_SHADING_COLOR);
// Bottom line
foldoutRect.y += 16f;
EditorGUI.DrawRect(foldoutRect, ROW_SHADING_COLOR);
}
private static void DrawFoldouts(GameObject gameObject, Rect selectionRect)
{
if (!HierarchyPreferences.ShowHierarchyTree || IsShowInSearch(selectionRect)) return;
const float textureWidth = 128f;
var fx = Mathf.Max(DRAW_OFFSET, selectionRect.x - textureWidth - 16f);
var fw = Mathf.Min(textureWidth, selectionRect.x - 16f - DRAW_OFFSET);
var foldoutRect = new Rect(selectionRect) {width = fw, x = fx};
var tw = foldoutRect.width / textureWidth;
var texCoords = new Rect(1 - tw,0,tw,1f);
GUI.DrawTextureWithTexCoords(foldoutRect, HierarchyEditorUtility.GetFoldoutLevelsIcon(), texCoords);
var transform = gameObject.transform;
if (transform.childCount > 0) return;
var index = GetSiblingIndex(transform);
foldoutRect.width = 16f;
foldoutRect.x = selectionRect.x - 16f;
GUI.DrawTexture(foldoutRect, HierarchyEditorUtility.GetFoldoutIcon(index));
}
private static void ReplaceHierarchyTextures(int instanceId, GameObject gameObject, Rect selectionRect)
{
if (EditorSceneManager.IsPreviewSceneObject(gameObject)) return;
var currentScene = gameObject.scene;
var ruleset = HierarchyRulesetV2.GetRulesetByScene(currentScene);
if (ruleset == null || ruleset.Rules.Count == 0) return;
var normalItem = ruleset.GetRule(gameObject);
var recursiveItem = GetRecursiveItemByObject(gameObject, ruleset);
if (normalItem != null)
{
UpdateRecursiveObjectsList(ruleset, normalItem, gameObject);
if (recursiveItem != null)
{
DrawItemWithBiggerPriority(instanceId, selectionRect, ruleset, normalItem, recursiveItem);
}
else
{
DrawNormalItem(instanceId, selectionRect, normalItem);
}
}
else if (recursiveItem != null)
{
DrawRecursiveItem(instanceId, selectionRect, recursiveItem);
}
}
private static void DrawEditIcon(GameObject gameObject, Rect selectionRect)
{
if (!HierarchyPreferences.IsEditModifierPressed(Event.current))
{
_multiSelection = false;
return;
}
if (EditorSceneManager.IsPreviewSceneObject(gameObject)) return;
var isMouseOver = selectionRect.Contains(Event.current.mousePosition);
var isSelected = IsSelected(gameObject);
_multiSelection = isSelected ? isMouseOver || _multiSelection : !isMouseOver && _multiSelection;
// if mouse is not over current object icon or selected group
if (!isMouseOver && (!isSelected || !_multiSelection)) return;
var editIcon = HierarchyEditorUtility.GetEditIcon();
DrawCustomIcon(editIcon, selectionRect);
if (GUI.Button(selectionRect, GUIContent.none, GUIStyle.none))
{
ShowPopupWindow(selectionRect, gameObject);
}
EditorApplication.RepaintHierarchyWindow();
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private static void DrawItemWithBiggerPriority(int instanceId, Rect selectionRect, HierarchyRulesetV2 conf, HierarchyRule normalRule, HierarchyRule recursiveRule)
{
if (recursiveRule.Priority > normalRule.Priority)
{
DrawRecursiveItem(instanceId, selectionRect, recursiveRule);
}
else if (recursiveRule.Priority == normalRule.Priority)
{
DrawItemWithGreaterOrdinal(instanceId, selectionRect, conf, normalRule, recursiveRule);
}
else
{
DrawNormalItem(instanceId, selectionRect, normalRule);
}
}
private static void DrawItemWithGreaterOrdinal(int instanceId, Rect selectionRect, HierarchyRulesetV2 conf, HierarchyRule normalRule, HierarchyRule recursiveRule)
{
if (recursiveRule.Ordinal > normalRule.Ordinal)
{
DrawRecursiveItem(instanceId, selectionRect, recursiveRule);
}
else
{
DrawNormalItem(instanceId, selectionRect, normalRule);
}
}
private static void DrawNormalItem(int instanceId, Rect selectionRect, HierarchyRule normalRule)
{
ReplaceIcon(instanceId, normalRule);
DrawCustomBackground(normalRule, selectionRect);
}
private static void DrawRecursiveItem(int instanceId, Rect selectionRect, HierarchyRule recursiveRule)
{
if (recursiveRule.IsIconRecursive) ReplaceIcon(instanceId, recursiveRule);
if (recursiveRule.IsBackgroundRecursive) DrawCustomBackground(recursiveRule, selectionRect);
}
private static void ReplaceIcon(int instanceId, HierarchyRule rule)
{
if (rule == null || !rule.HasIcon()) return;
var icon = rule.HasCustomIcon()
? rule.IconTexture
: HierarchyIconsStorage.GetIcon(rule.IconType);
HierarchyWindowAdapter.ApplyIconByInstanceId(instanceId, icon);
}
private static void DrawCustomIcon(Texture icon, Rect selectionRect)
{
var iconRect = new Rect(selectionRect) {width = 16f};
GUI.DrawTexture(iconRect, icon);
}
private static void DrawCustomBackground(HierarchyRule rule, Rect selectionRect)
{
if (rule == null || !rule.HasBackground()) return;
selectionRect.x += 17f;
var background = rule.HasCustomBackground()
? rule.BackgroundTexture
: HierarchyBackgroundsStorage.GetBackground(rule.BackgroundType);
GUI.DrawTexture(selectionRect, background);
}
private static void ShowPopupWindow(Rect selectionRect, GameObject currentObject)
{
var window = HierarchyPopupWindow.GetDraggableWindow();
var position = GUIUtility.GUIToScreenPoint(selectionRect.position + new Vector2(0, selectionRect.height + 2));
if (_multiSelection)
{
var gameObjects = Selection.gameObjects.ToList();
var index = gameObjects.IndexOf(currentObject);
window.ShowWithParams(position, gameObjects, index);
}
else
{
window.ShowWithParams(position, new List<GameObject> {currentObject}, 0);
}
}
private static HierarchyRule GetRecursiveItemByObject(GameObject gameObject, HierarchyRulesetV2 ruleset)
{
for (var i = RECURSIVE_OBJECTS.Count - 1; i >= 0; i--)
{
if (RECURSIVE_OBJECTS[i] == null)
{
RECURSIVE_OBJECTS.RemoveAt(i);
continue;
}
if (!gameObject.transform.IsChildOf(RECURSIVE_OBJECTS[i].transform))
{
continue;
}
var parentRule = ruleset.GetRule(RECURSIVE_OBJECTS[i]);
if (parentRule == null)
{
RECURSIVE_OBJECTS.RemoveAt(i);
continue;
}
if (parentRule.IsRecursive())
{
return parentRule;
}
}
return null;
}
[SuppressMessage("ReSharper", "InvertIf")]
private static void UpdateRecursiveObjectsList(HierarchyRulesetV2 conf, HierarchyRule currentRule, GameObject currentObject)
{
if (currentRule.IsRecursive())
{
if (!RECURSIVE_OBJECTS.Contains(currentObject))
{
for (var index = 0; index < RECURSIVE_OBJECTS.Count; index++)
{
var listObject = RECURSIVE_OBJECTS[index];
if (listObject == null) continue;
var listItem = conf.GetRule(listObject);
if (listItem == null) continue;
if (currentRule.Priority < listItem.Priority)
{
RECURSIVE_OBJECTS.Insert(index, currentObject);
return;
}
if (currentRule.Priority == listItem.Priority)
{
var currentOrdinal = conf.Rules.IndexOf(currentRule);
var listOrdinal = conf.Rules.IndexOf(listItem);
if (currentOrdinal < listOrdinal)
{
RECURSIVE_OBJECTS.Insert(index, currentObject);
return;
}
}
}
RECURSIVE_OBJECTS.Add(currentObject);
}
}
else
{
RECURSIVE_OBJECTS.Remove(currentObject);
}
}
private static bool IsSelected(GameObject gameObject)
{
return Selection.gameObjects.Contains(gameObject);
}
private static bool IsShowInSearch(Rect iconRect)
{
return iconRect.x == 16f;
}
[SuppressMessage("ReSharper", "ConvertIfStatementToReturnStatement")]
private static SiblingIndex GetSiblingIndex(Transform transform)
{
var parent = transform.parent;
var parentChildCount = (parent != null) ? parent.childCount : transform.gameObject.scene.rootCount;
var siblingIndex = transform.GetSiblingIndex();
if (siblingIndex == 0) return SiblingIndex.First;
if (siblingIndex == parentChildCount - 1) return SiblingIndex.Last;
return SiblingIndex.Middle;
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e1e9709c7ea6ee64bb8e4a6962b09dbd
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/RainbowHierarchyGUI.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bcc187ba40bab2e4abb458923e06c026
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,222 @@
using UnityEditor;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
[CustomPropertyDrawer(typeof(HierarchyRule))]
public class HierarchyRuleDrawer: PropertyDrawer
{
private const float PADDING = 8f;
private const float SPACING = 2f;
private const float LINE_HEIGHT = 18f;
private const float LABELS_WIDTH = 92f;
private const float ICON_WIDTH = 16f;
private const float PROPERTY_HEIGHT = 142f;
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var isHidden = property.FindPropertyRelative("IsHidden").boolValue;
if (isHidden) return;
var originalPosition = position;
var serializedItem = new SerializedItemWrapper(property);
var serializedObject = property.serializedObject;
DrawLabels(ref position, serializedItem);
DrawValues(ref position, originalPosition, serializedItem, serializedObject);
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
var isHidden = property.FindPropertyRelative("IsHidden").boolValue;
if (isHidden) return 0;
var iconType = property.FindPropertyRelative("IconType");
var backgroundType = property.FindPropertyRelative("BackgroundType");
var hasCustomIcon = (iconType.intValue == (int) HierarchyIcon.Custom);
var hasCustomBackground = (backgroundType.intValue == (int) HierarchyBackground.Custom);
var height = PROPERTY_HEIGHT;
if (hasCustomIcon) height += LINE_HEIGHT + SPACING;
if (hasCustomBackground) height += LINE_HEIGHT + SPACING;
return height;
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private static void DrawLabels(ref Rect position, SerializedItemWrapper item)
{
position.y += PADDING;
position.width = LABELS_WIDTH;
position.height = LINE_HEIGHT;
EditorGUI.PropertyField(position, item.ItemType, GUIContent.none);
position.y += LINE_HEIGHT + SPACING * 2f;
EditorGUI.LabelField(position, "Priority");
position.y += LINE_HEIGHT + SPACING * 3f;
EditorGUI.LabelField(position, "Icon");
position.y += LINE_HEIGHT + SPACING;
if (item.HasIcon)
{
position.width = ICON_WIDTH;
position.height = ICON_WIDTH;
var texture = (item.HasCustomIcon)
? (Texture2D) item.IconTexture.objectReferenceValue
: HierarchyIconsStorage.GetIcon(item.IconType.intValue);
if (texture != null) GUI.DrawTexture(position, texture);
position.width = LABELS_WIDTH;
position.height = LINE_HEIGHT;
}
position.y += (item.HasCustomIcon) ? 2f * LINE_HEIGHT + PADDING : LINE_HEIGHT + PADDING - SPACING;
EditorGUI.LabelField(position, "Background");
position.y += LINE_HEIGHT + SPACING;
if (item.HasBackground)
{
position.width = ICON_WIDTH * 3f;
position.height = ICON_WIDTH;
var texture = (item.HasCustomBackground)
? (Texture2D) item.Background.objectReferenceValue
: HierarchyBackgroundsStorage.GetBackground(item.BackgroundType.intValue);
if (texture != null) GUI.DrawTexture(position, texture);
}
}
private static void DrawValues(ref Rect position, Rect originalPosition, SerializedItemWrapper item, SerializedObject serializedObject)
{
EditorGUI.BeginChangeCheck();
position.x += LABELS_WIDTH + PADDING;
position.y = originalPosition.y + PADDING;
position.width = originalPosition.width - LABELS_WIDTH - PADDING;
var property = item.ItemType.intValue == 0 ? item.GameObject : item.Name;
EditorGUI.PropertyField(position, property, GUIContent.none);
position.y += LINE_HEIGHT + SPACING * 2f;
EditorGUI.PropertyField(position, item.Priority, GUIContent.none);
position.y += LINE_HEIGHT + SPACING * 3f;
DrawIconPopupMenu(position, item.Property, item.IconType.intValue);
if (item.HasCustomIcon)
{
position.y += LINE_HEIGHT + SPACING + 1f;
EditorGUI.PropertyField(position, item.IconTexture, GUIContent.none);
position.y -= SPACING;
}
position.y += LINE_HEIGHT + SPACING;
EditorGUI.PropertyField(position, item.IconRecursive, GUIContent.none);
position.x += ICON_WIDTH;
EditorGUI.LabelField(position, "Recursive");
position.x -= ICON_WIDTH;
position.y += LINE_HEIGHT + PADDING;
DrawBackgroundPopupMenu(position, item.Property, item.BackgroundType.intValue);
if (item.HasCustomBackground)
{
position.y += LINE_HEIGHT + SPACING + 1f;
EditorGUI.PropertyField(position, item.Background, GUIContent.none);
position.y -= SPACING;
}
position.y += LINE_HEIGHT + SPACING;
EditorGUI.PropertyField(position, item.BackgroundRecursive, GUIContent.none);
position.x += ICON_WIDTH;
EditorGUI.LabelField(position, "Recursive");
position.x -= ICON_WIDTH;
if (EditorGUI.EndChangeCheck()) serializedObject.ApplyModifiedProperties();
}
private static void DrawIconPopupMenu(Rect rect, SerializedProperty property, int iconType)
{
var menuName = ((HierarchyIcon) iconType).ToString();
if (GUI.Button(rect, new GUIContent(menuName), "MiniPopup"))
{
var screenPoint = GUIUtility.GUIToScreenPoint(rect.position);
var window = HierarchyIconsPopup.GetDraggableWindow();
window.ShowWithParams(screenPoint, property);
}
}
private static void DrawBackgroundPopupMenu(Rect rect, SerializedProperty property, int backgroundType)
{
var menuName = ((HierarchyBackground) backgroundType).ToString();
if (GUI.Button(rect, new GUIContent(menuName), "MiniPopup"))
{
var screenPoint = GUIUtility.GUIToScreenPoint(rect.position);
var window = HierarchyBackgroundsPopup.GetDraggableWindow();
window.ShowWithParams(screenPoint, property);
}
}
//---------------------------------------------------------------------
// Nested
//---------------------------------------------------------------------
private class SerializedItemWrapper
{
public readonly SerializedProperty Property;
public readonly SerializedProperty ItemType;
public readonly SerializedProperty Name;
public readonly SerializedProperty GameObject;
public readonly SerializedProperty Priority;
public readonly SerializedProperty IconType;
public readonly SerializedProperty IconTexture;
public readonly SerializedProperty IconRecursive;
public readonly SerializedProperty BackgroundType;
public readonly SerializedProperty Background;
public readonly SerializedProperty BackgroundRecursive;
public readonly bool HasIcon;
public readonly bool HasCustomIcon;
public readonly bool HasBackground;
public readonly bool HasCustomBackground;
public SerializedItemWrapper(SerializedProperty property)
{
Property = property;
ItemType = property.FindPropertyRelative("Type");
Name = property.FindPropertyRelative("Name");
GameObject = property.FindPropertyRelative("GameObject");
Priority = property.FindPropertyRelative("Priority");
IconType = property.FindPropertyRelative("IconType");
IconTexture = property.FindPropertyRelative("IconTexture");
IconRecursive = property.FindPropertyRelative("IsIconRecursive");
BackgroundType = property.FindPropertyRelative("BackgroundType");
Background = property.FindPropertyRelative("BackgroundTexture");
BackgroundRecursive = property.FindPropertyRelative("IsBackgroundRecursive");
HasIcon = (IconType.intValue != (int) HierarchyIcon.None);
HasCustomIcon = (IconType.intValue == (int) HierarchyIcon.Custom);
HasBackground = (BackgroundType.intValue != (int) HierarchyBackground.None);
HasCustomBackground = (BackgroundType.intValue == (int) HierarchyBackground.Custom);
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 760af7340c7200b489d74bd3240977bf
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Ruleset/HierarchyRuleDrawer.cs
uploadId: 716077

View File

@@ -0,0 +1,23 @@
using UnityEditor;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
[CustomEditor(typeof(HierarchyRuleset), true)]
public class HierarchyRulesetEditor : Editor
{
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox
(
"This ruleset created from the older Rainbow Hierarchy version. Do you want to update it now?",
MessageType.Warning
);
if (GUILayout.Button("Update Ruleset"))
{
HierarchyEditorProxy.UpdateOldRuleset?.Invoke(((HierarchyRuleset) target).gameObject);
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9164b5f0313f1bc4391c5f9ab0cca57d
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Ruleset/HierarchyRulesetEditor.cs
uploadId: 716077

View File

@@ -0,0 +1,394 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Borodar.RainbowHierarchy.RList;
using UnityEditor;
using UnityEngine;
using static Borodar.RainbowHierarchy.HierarchyRule;
using static UnityEngine.SendMessageOptions;
namespace Borodar.RainbowHierarchy
{
[CustomEditor(typeof(HierarchyRulesetV2), true)]
public class HierarchyRulesetEditorV2 : Editor
{
private const string SEARCH_RESULTS_TITLE = "Search Results";
private const string PROP_NAME_ITEMS = "Rules";
private const string NEGATIVE_LOOKAHEAD = "(?!.*)"; // Regex that matches nothing
private static readonly Dictionary<HierarchyRulesetV2, List<HierarchyRulesetEditorV2>> EDITORS_BY_CONF =
new Dictionary<HierarchyRulesetV2, List<HierarchyRulesetEditorV2>>();
private SerializedProperty _itemsProperty;
private ReorderableList _reorderableList;
private string _query = string.Empty;
private Enum _filter = Filter.All;
private bool _matchCase;
private bool _useRegex;
private string _warningMessage;
//---------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------
public bool ForceUpdate { get; set; }
public int SearchTab { get; set; }
public GameObject GameObject { get; set; }
//---------------------------------------------------------------------
// Messages
//---------------------------------------------------------------------
protected void OnEnable()
{
var ruleset = (HierarchyRulesetV2) target;
if (EDITORS_BY_CONF.TryGetValue(ruleset, out var editors))
{
editors.Add(this);
}
else
{
var list = new List<HierarchyRulesetEditorV2> {this};
EDITORS_BY_CONF.Add(ruleset, list);
}
_itemsProperty = serializedObject.FindProperty(PROP_NAME_ITEMS);
_reorderableList = new ReorderableList(_itemsProperty)
{
label = new GUIContent(string.Empty),
elementDisplayType = ReorderableList.ElementDisplayType.SingleLine,
headerHeight = 0f,
expandable = false,
paginate = true,
pageSize = 10,
};
_reorderableList.onChangedCallback += (list) => OnRulesetChange();
// ReSharper disable once DelegateSubtraction
Undo.undoRedoPerformed -= OnRulesetChange;
Undo.undoRedoPerformed += OnRulesetChange;
}
protected void OnDisable()
{
var ruleset = (HierarchyRulesetV2) target;
if (EDITORS_BY_CONF.TryGetValue(ruleset, out var editors))
{
editors.Remove(this);
if (editors.Count == 0) EDITORS_BY_CONF.Remove(ruleset);
}
ClearHiddenFlags();
// ReSharper disable once DelegateSubtraction
Undo.undoRedoPerformed -= OnRulesetChange;
}
public override void OnInspectorGUI()
{
GUILayout.Space(4f);
var searchTabBefore = SearchTab;
SearchTab = GUILayout.Toolbar(SearchTab, new [] {"Filter by object", "Filter by name"});
ForceUpdate |= SearchTab != searchTabBefore;
EditorGUILayout.BeginVertical("AvatarMappingBox");
{
GUILayout.Space(6f);
switch (SearchTab)
{
case 0: // Object
{
DrawSearchByFolderPanel(ForceUpdate);
break;
}
case 1: // Name
{
DrawSearchByKeyPanel(ForceUpdate);
break;
}
default:
throw new ArgumentOutOfRangeException(nameof(SearchTab), SearchTab, null);
}
if (!string.IsNullOrEmpty(_warningMessage))
{
EditorGUILayout.HelpBox(_warningMessage, MessageType.Warning);
}
GUILayout.Space(4f);
}
EditorGUILayout.EndVertical();
GUILayout.Space(2f);
serializedObject.Update();
DrawHierarchyList();
}
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static void ShowInspector(HierarchyRulesetV2 ruleset, GameObject currentObject = null)
{
Selection.activeObject = ruleset;
// Workaround with double delay to make sure all Inspectors already enabled
EditorApplication.delayCall += () => EditorApplication.delayCall += () =>
{
if (!EDITORS_BY_CONF.TryGetValue(ruleset, out var editors)) return;
foreach (var editor in editors)
{
editor.GameObject = currentObject;
editor.ForceUpdate = true;
editor.SearchTab = 0;
editor.Repaint();
}
};
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private void DrawSearchByFolderPanel(bool forceUpdate)
{
var assetBefore = GameObject;
GameObject = (GameObject) EditorGUILayout.ObjectField(GameObject, typeof(GameObject), true);
if (!forceUpdate && GameObject == assetBefore) return;
if (GameObject == null)
{
ClearHiddenFlags();
}
else
{
ApplyHiddenFlagsByAsset();
}
}
private void DrawSearchByKeyPanel(bool forceUpdate)
{
EditorGUILayout.BeginHorizontal();
var queryChanged = HierarchyEditorUtility.SearchField(ref _query, ref _filter, Filter.All);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
if (!Equals(_filter, Filter.All))
{
var rect = GUILayoutUtility.GetRect(GUIContent.none, "MiniLabel");
rect.x += 2f;
rect.y += 1f;
rect.width = 55f;
GUI.Label(rect, $"➔ {_filter}", "MiniLabel");
}
GUILayout.FlexibleSpace();
var matchCaseBefore = _matchCase;
_matchCase = EditorGUILayout.ToggleLeft("Match case", _matchCase, "MiniLabel", GUILayout.Width(83f));
var matchCaseChanged = _matchCase != matchCaseBefore;
var useRegexBefore = _useRegex;
_useRegex = EditorGUILayout.ToggleLeft("Regex", _useRegex, "MiniLabel", GUILayout.Width(58f));
var useRegexChanged = _useRegex != useRegexBefore;
EditorGUILayout.EndHorizontal();
if (!forceUpdate && !queryChanged && !matchCaseChanged && !useRegexChanged) return;
_warningMessage = string.Empty;
ApplyFilters();
}
private void ApplyFilters()
{
var isDefaultFilter = Equals(Filter.All, _filter);
if (string.IsNullOrEmpty(_query) && isDefaultFilter)
{
ClearHiddenFlags();
}
else
{
ApplyHiddenFlagsByKey();
}
}
private void ClearHiddenFlags()
{
if (_itemsProperty == null) return;
for (var i = 0; i < _itemsProperty.arraySize; i++)
{
var item = _itemsProperty.GetArrayElementAtIndex(i);
item.FindPropertyRelative("IsHidden").boolValue = false;
}
serializedObject.ApplyModifiedProperties();
_reorderableList.canAdd = true;
_reorderableList.headerHeight = 0f;
_reorderableList.label.text = string.Empty;
_reorderableList.paginate = true;
}
private void ApplyHiddenFlagsByAsset()
{
foreach (var rule in ((HierarchyRulesetV2) target).Rules)
{
var match = false;
switch (rule.Type)
{
case KeyType.Object:
match |= rule.GameObject == GameObject;
match |= rule.IsRecursive() && GameObject.transform.IsChildOf(rule.GameObject.transform);
break;
case KeyType.Name:
match |= rule.Name == GameObject.name;
if (rule.IsRecursive())
{
var parent = GameObject.transform.parent;
while (parent != null)
{
match |= rule.Name == parent.name;
if (match) break;
parent = parent.parent;
}
}
break;
default:
throw new ArgumentOutOfRangeException();
}
rule.IsHidden = !match;
}
_reorderableList.canAdd = false;
_reorderableList.headerHeight = 18f;
_reorderableList.label.text = SEARCH_RESULTS_TITLE;
_reorderableList.paginate = false;
}
private void ApplyHiddenFlagsByKey()
{
var regex = (_useRegex) ? MakeRegexFromQuery() : null;
for (var i = 0; i < _itemsProperty.arraySize; i++)
{
var item = _itemsProperty.GetArrayElementAtIndex(i);
var isHidden = item.FindPropertyRelative("IsHidden");
switch (_filter)
{
case Filter.All:
var isObject = KeyHasSameType(item, KeyType.Object);
isHidden.boolValue = !NameContainsQuery(item, regex, isObject);
break;
case Filter.Object:
isHidden.boolValue = !KeyHasSameType(item, KeyType.Object) || !NameContainsQuery(item, regex, true);
break;
case Filter.Name:
isHidden.boolValue = !KeyHasSameType(item, KeyType.Name) || !NameContainsQuery(item, regex, false);
break;
default:
throw new ArgumentOutOfRangeException(nameof(_filter), _filter, null);
}
}
_itemsProperty.serializedObject.ApplyModifiedProperties();
_reorderableList.canAdd = false;
_reorderableList.headerHeight = 18f;
_reorderableList.label = new GUIContent(SEARCH_RESULTS_TITLE);
_reorderableList.paginate = false;
}
private Regex MakeRegexFromQuery()
{
var options = _matchCase ? RegexOptions.None : RegexOptions.IgnoreCase;
try
{
return new Regex(_query, options);
}
catch (ArgumentException ex)
{
_warningMessage = ex.Message;
return new Regex(NEGATIVE_LOOKAHEAD);
}
}
private static bool KeyHasSameType(SerializedProperty item, KeyType keyType)
{
var propType = item.FindPropertyRelative("Type").enumValueIndex;
return propType == (int) keyType;
}
private bool NameContainsQuery(SerializedProperty item, Regex regex, bool isObject)
{
var key = KeyToString(item, isObject);
// Regex search
if (_useRegex)
{
var match = regex.Match(key);
return match.Success;
}
// Simple search
var comparison = _matchCase ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
return key.IndexOf(_query, comparison) >= 0;
}
private string KeyToString(SerializedProperty item, bool isObject)
{
if (isObject)
{
var reference = item.FindPropertyRelative("GameObject").objectReferenceValue;
return reference != null ? reference.name : string.Empty;
}
else
{
return item.FindPropertyRelative("Name").stringValue;
}
}
private void DrawHierarchyList()
{
EditorGUI.BeginChangeCheck();
_reorderableList.DoLayoutList();
// Track changes in reorderable list
if (EditorGUI.EndChangeCheck())
{
OnRulesetChange();
}
}
private void OnRulesetChange()
{
((HierarchyRulesetV2) target).SendMessage("OnRulesetChange", DontRequireReceiver);
serializedObject.ApplyModifiedProperties();
}
//---------------------------------------------------------------------
// Nested
//---------------------------------------------------------------------
private enum Filter
{
All, Name, Object
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 266803d19a0606046912a8e90cd4d473
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Ruleset/HierarchyRulesetEditorV2.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 14bb12a5a0bb93949baf55633fae3d8b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 34a68908649d9a3428ce44fa1b31b9a2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using StorageHelper = Borodar.RainbowHierarchy.TexturesStorageHelper<Borodar.RainbowHierarchy.HierarchyBackground>;
namespace Borodar.RainbowHierarchy
{
public static class HierarchyBackgroundsStorage
{
private static readonly Dictionary<HierarchyBackground, Texture2D> BACKGROUND_TEXTURES = new Dictionary<HierarchyBackground, Texture2D>();
private static readonly Dictionary<HierarchyBackground, Lazy<string>> BACKGROUND_STRINGS = new Dictionary<HierarchyBackground, Lazy<string>>()
{
{HierarchyBackground.ClrRed, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAqElEQVQ4EZWRgQ3DIAwEoZNklOy/QydpqjRPZevyhIhEAj7YfzZQ38uyllK+GNuhNT6DEXF5ttcx6av/Jec91b2oAVCaQ66snrMTQIMnMnbSBLBtahq43zQBTHzcgWgzpi6HHbA9dnOn8xU68sDlRU6vMAsJdsuPI3TkyLKVRZonAAo4xLzXvwFQlHRqOr1IXqICHqRxpPMSVZFVZ2AtP47gBsJG1bVff5VFJEHEsuQUAAAAAElFTkSuQmCC")},
{HierarchyBackground.ClrVermilion, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAApUlEQVQ4EZ1QiRGAMAhr3cJtHMD9F3AM34YzXqCnVr1DUkhCaZ7GfkgpbSWWEuuZZ8nADHDYM25XCvj2EtlQ+w+aRINWmYmUTIM4PZ5V4zANUFR3xU4gBwzJaiC9ZrjTIE78tUKzSO7nVtBbKBa+g+BcK6Dz9QbG5xtEcTxzdFWnAQlvWVczfGegxCdT94hPRPbiCu4RdWok0qDKdytUxLOgQ1DKB60fIWpsPsbCAAAAAElFTkSuQmCC")},
{HierarchyBackground.ClrOrange, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAsUlEQVQ4EZWQAQ7DIAwDYb/ob/axvXbP2FqGozpyQ0ArEiK49iW0vl/bs5Ry9P3tez/Pj5yodcPn3ke/ZKtmYteiXglok8BKRqYRALLSZ8BBJ8Bo0k5hIl+amE5AnEBDWscJ/B+oaVUPk3EChCI9A0WP/0SYlR6NGcyezQkQ0JDCsrBrBLhwo7CmBNg4N8Kw2pQEQNAn4J4tfZr5FaCBf2DmJyAGtJOCh5qA4cNEiI3KD5IJJZo84XQDAAAAAElFTkSuQmCC")},
{HierarchyBackground.ClrAmber, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAqklEQVQ4EZWRAQ6DMAwD2/1iv+HDe9WesQGrOzkyTisVpFCL2pdE1PfruZVS9lZHq6/Up+lRqed4NBOe+j/ifYa6iuQjAIFZSBHJQwBMSletANXwVAJWAhqmPgnghzsn1okJEEz7DWg+6WUCvxzkcxOugO4rEyi0NyTAu6/AuocAJd/SCvApRiD3TP+CGwnz1eIvpAsm7FRw17MV1KgMbQQdKyDglxqkTuAf96cnzA70DsIAAAAASUVORK5CYII=")},
{HierarchyBackground.ClrYellow, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAsElEQVQ4EY1TCRKDMAiE/sLf9P/f8BmtTYFIu4BkdAa5ls1KRt737UlEH7G32HF6jV9ELDbENDY764Y1/EMa+ozp8rspTxircwJL8vhFnhnZCRSLJBnoXIjR2kACB608ELPFSADNoKYhnHAkaIDLcruD5RQ0ww7wEwATwrzEoCAgm6Qc4jvIjZw3fP9rVGlZ3tVQwaCCO6cWjBNk5px3an5LVOY7Q4WoU1Cklsn5B48vAIEn/yp7a7UAAAAASUVORK5CYII=")},
{HierarchyBackground.ClrLime, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAqUlEQVQ4Ea2Qiw3CMAxEE7Zgmy7cqRgDSsmzuOgS1MpIteT4dz47ruvjvpRS3k1fTbevxX8eKDVht1sLkL1pDe/PRwTZ5hm3i4ANXOZYNc+HLwIAXpwnicAtmCqCCKzqZJYe7jRsQOBNmQ0g7jcgyDaBlQxfUPLM+pbg+gZz4YxEtdjYj6gCNkMYGBF4M37mHmD6DWjKTAXn0m9A0qdmyK79AmyZqT9bfgCtoyjL+TMqmQAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrChartreuse, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAArElEQVQ4EZWRgQ3DMAgE7W7RbbpYpu0YSeqCk4+ep64cS8jAw4GTuryfr1LKx2w328hW89Vc9xzq9ocFOA3OnzvVABCEOiaw1H0AQovRAtDFs5Pz7lcAmEz17h6HO5GzuwFAuXvuBECXiwMmAGF5pV3fwLEqxlGDiDcIowb1Kc2AJP5IpCEjQCo8YfrM6zd6g4qyQJcTGBtos8YGS729BgCZNhX2rRmQRkxg2hejsySZiTECtgAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrHarlequin, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAr0lEQVQ4EY1RWxLEIAjDvUSv0+89/F6oT0HTRqRdO0MFAiFo+v6mWUS2bHu2tdpCp/psqNGe7ZN/+A44L2dy2HETjLSLdFU3ged2o2roqxIIFPBgRMEKzAeBBgxGzWEOBAqyAvbDxpqkS3wrizEbwgpKWVlkeJ2eoIgfWUGHNK8QC/2ThYJhyY7vukSVzCTsu54mvFbwDU93wHkbihWUlsFmDAU8yHwQGBsVPrndkBNLLyVSzgXMlAAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrGreen, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmElEQVQ4EZWRCxKAIAhEtTN4oO7c8fqYkDQELpPNmAjLAzGXrawppauto62z72TvYFHs1S7tQF99tqk/5wjgb2Y2wjwLcJ0KgMia7oS9stawSwCmM3i04IoArhJCIgDSazDbGmDbG0G0huzpVwg7GFWMfNQBHGKUKLHPDPg+Egl2PQOWoSE6IYJqANIgPxcRAN3HTRhlav8N3vMf/ZzaXywAAAAASUVORK5CYII=")},
{HierarchyBackground.ClrEmerald, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAnUlEQVQ4EZ1RQQ6AIAwD3+FjPPltH6aClFgcyBaFZLCwtuvAz9u6OOfOFCHFcccuTuQM1FlDHqa0cUUmxtliohTwBlEtSQEVZBQ8BYa6Q5gCmK2dz2j8lCgAB39dZDwFIDnioPzCCBlNq0f8MsILo43wAqJdWtIp8moEjZSZ2kYHQ2SIUkBrYN3nplKgna9Hlk6BL78AsCz2yL27eAFBSiFE/wbSXQAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrSpringGreen, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAuElEQVQ4EY1QiRHDMAizu0W2yVqdt2PkcQFHOSHXbXNHwFgPuC6v51pKOSxOi/2KjbLXHMB4Ph7286/2dP/1jAvuRw0BBzSgpKZ2woQrBJjsBHZiAe43J0FASSoIkaEPAVZWMZA1D2+ggE9nNUorDON1hcRhjNcVK6gbAalUlJ1DwDxCje6TLfW1bCFwebAV10rCOUxmK/w7QXoDJs0mUExfATN9z8EdhLECK090gsu4qCEwIf1s1zfz0iebR6oUSwAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrAquamarine, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAm0lEQVQ4Ea2QgQ2AIAwEwS3cxnWdyzFUkEdKPgVJjZoUHmmvT/28rYtzLqQ4Upxl32mHlkCO3EGHKS34Ygqf1ctFANZiNOIvCoB/QluBXgAgM501wxmctQBwaC65smgNfnyCTuywbsfiAAWWIg2qM2D7Oml4ZgfDxM4lmtYZfHagG5iB/AQusg60DhEOrEXs9r8ZoDs/gbuwbnIuS1cjyK4dccAAAAAASUVORK5CYII=")},
{HierarchyBackground.ClrCyan, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAtUlEQVQ4EY2RixHEIAhE9bpIN+m/jZRx+RyQwDwxOpcZZHWXFWJdtm0tpZwSh8T+xBdZsYfyzik+P7Lod90p1hqoBVlX3GBU0Ja3O6253KCl+o6c50XWzauBqCj0Ys15hEqDIAUEZrXgzpgGHZmK89b0NBjdykJqDNOAwlE3+Txegc5qlPduzvNuBBfNcu4gXkEJksQ0ZAd6HiPYhso/sJnxJ45upVfWxAgUzfB0hFmhc+zA8A9ikycD6t24QAAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrSkyBlue, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAsElEQVQ4EY2Qiw3DMAhE7W7Rbbpwp+oYbZIa1EPPH5pEQjnguAPX+/P1KKXsLbYWH8S74VWI4/xbI+k7BNqfGOVSkThHApawSYyZGUpg7qwr3MxNJHDVkbzuhNGPTuyxbmJVG5BkmE5jr8slQGUjjHk39EuMc0hgRTirdSdYQtfsBNanDdg8c49+dgK3CfKwpdczAQ5l2DfOBC6fIwF/EFjFCX+UnCMBmyU3cChBnfALCzcmyTdoAdUAAAAASUVORK5CYII=")},
{HierarchyBackground.ClrAzure, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAs0lEQVQ4EaWRgRGDMAhFk27RbVys03aMVi2QEl+ISb2rdyjC5/E1+f54LimlVWKTeCNekp8FNdtNRHplid2y+U11flnuAC2y6aLZUxfuDriyPcI6BxRcAZrGHegwh0af02kIoIMjH6HKwkzAuZQ7D2zNHBCHf4zV+b9OwSh0wK3RUV0ZEwdonUOExZnmnYCm0b0QX5paaU5hvrV0idFK/Ynqn83OwLfAJa0DdtTaiIC6OfgAbicnnDm2y8cAAAAASUVORK5CYII=")},
{HierarchyBackground.ClrCerulean, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAr0lEQVQ4EY2SgRHCMAwDE7ZgGwZg/wUYA0qJfHXu42Jw79w6liLZTfr1/ri11rYR7xEvxHPk34Kc7TJIevqI3bLfL/H8Ud5dQEWCTvr33V2g4h7FbI8LVEeIIs0FBFRGYKfGpwDBk9NRoMkyghYEM4FoMk+hslmi5FnOETJX1tnBaQQSs5wdiDPvQQQyAXZgHB8hAnGdCS73ICUBYKfKl1Mou0Jw/gPVqA7OkkaT/gE58CRsKSA1HwAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrBlue, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAArElEQVQ4EZWQAQ6AIAhFtdt0i+5/ku5QaUDSPojL2lj4+TzQvK77llK6KArFCXFQHgV6ykKm6KuRGGkKyFEx0LyvKoAmmqHeGLAeSQHUkJGAOTajLkMUwKbpqUDMCEA6eEzqh7xvwC4sYo6EbsjfDRAmuQKALCmcux4jKIDFtrb8RlfwunlEQ5448JbvIzJ5eu0Gl230Ctzs12u+4U96FDB0fRTMFT68XVk2vgEQ1iRfQ76zdwAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrIndigo, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAq0lEQVQ4EY2S0Q2EMAxDWyZhlNvh9v9mCEAcDkr1GgoXpEKIHcdG1O+8fEopO8521jrr4HjfOft0knTV6/H3fkSGC9yASBy8a2l1AeEZF5FzUGCw5LUl152DTIzIaQ4sz+u+C2QEm2EEqrOmLvuqmwMCGuAmCrDfOSDAgVhzkdWMkBEhR3WLEDc9vdOBcdzBDXhSQF8z7T8wOwAzZRfB1BJT/AadgzibiWRiP5amKH4XBiZzAAAAAElFTkSuQmCC")},
{HierarchyBackground.ClrViolet, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAArklEQVQ4EZWSAQ7DIAhFdXfZPXq5nXWH2FonzJ88xSWsCQXh+0Db+rg/j1LK2e3q9h72grdYZnXVbM956y976tf99W6mFsAXie1BJ0Bir0s4qccCsGDKda0GnGA6ggTyFCq3800T7Iq7XJiMgEzXoCGAHUOnUWTe4koAi6HTADDvMQGZCVbNdImkU/grNv10BArTMB3BaSDwPpAOP9h0BAozE0xfYe24rgUn2OL2AUS9JrOiCXynAAAAAElFTkSuQmCC")},
{HierarchyBackground.ClrPurple, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAArElEQVQ4EY2Qiw3DMAhE7Y6UCbp0huoM+Tg+5ItOJqRYIoA5Hjh1XX7fUsrZbe92DL+JR6wGHe389ASndasW5T+mJwAJIDwRTO9NTwAatUjQX0+ATkfTnBPk7gmYn8CGN289BECYeYLTEIDVdD0nHKuoxmICoobRF7pKABQK0UlhNwoKeBVGRQKyE3VLMBsBKGQgTkMACkrXGJOeDjT3T8xu4EDcwBWCi3mzdgHb3ST1vqEGMwAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrMagenta, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAuElEQVQ4EZWSgRHDIAhFsSt1ge4/RBZpGwso6ZNorvUO/crnBXOW7b49ROStsWu8ejyxmo6wfORM7zedbBSN6qpNtp8NeixfA5ATs2I7y+ASgFzwK1AIIJ2acILNc1yBpitNsMOiA6ddVa5yAWBrK6+dn3wBYGtTY6dmH39iZZK61/rCDtwTHWh2qKGxAYb0FwbA+X6tss8NSUzuYLCvNuzMNTtgEb/Ec2rzHE+ZZJqyzuC/X2IGygdrCCcSvgMbtAAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrFuchsia, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAArklEQVQ4EZ2QARLDIAgEtS/Li/OrvqJJU4/MMSeUpFNnkBNhEftzWZfW2j7sPWwTew39zZiDmu0xNqx+Ot8PV7OIeZ2AOS0D4z3PRwVgwq2vANUIGjddAarO+gfQ0x8oXRMrGOL+B1p8VZDuOII9J93mgDaCLkfIpWckjcYXKBmp8UxgjOMPPKZ01SyG17jpATCPzUlBo5Ar5XAEJCidBbeeACX/CuMI1uSf7tb0A2xIJvWEOFUAAAAAAElFTkSuQmCC")},
{HierarchyBackground.ClrRose, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAuElEQVQ4EZWRAQ7CMAwDW37DL/gW7+UZMEYd5s5yGgkqZXNS55Jp/XG931pr24j3iJfEc2gP3KNG33YZCU4fsYf6ZqeexSTQ0wiAjgLEQJ06CvWDAJ/o+YoATyfAJ3q+AsCzE+CGaoNUrwDVBqleAdKkY0WthyZAL/xzNNcNQhOA5BeIeqDnX8AUpSNfneThBm5OxsOgG8TWBOgFvJ77gJkT4E3VBrORggA0aFO1gXqCQQCB/7xjyAdN/ienW2LnbwAAAABJRU5ErkJggg==")},
{HierarchyBackground.ClrCrimson, new Lazy<string>(()=> "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAs0lEQVQ4EYWS0Q3DIAxEIat0kf53/w26RZNQ2+iiM+6lkQzHYT8wSn8/Xs/W2mFxWuwUH9O/Ajles282+NfndI3jUlmseR2AnFaB6z7WQwGQ8HdWANUC+6EVQJ3Mb+A6vQHTOVHB3Lc3mKlcfFdQ9rY2S+M6ZbcafJBr2UItnU5pDY/IZE9d1wCufvoPmM4axT6zHxo38AXTWTOA/dAAOJvpXHSrARjp/HxVBSgtqETlRwtfnlAndOonlR0AAAAASUVORK5CYII=")},
};
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static Texture2D GetBackground(int type)
{
return GetBackground((HierarchyBackground) type);
}
public static Texture2D GetBackground(HierarchyBackground type)
{
return StorageHelper.GetTexture(type, FilterMode.Bilinear, BACKGROUND_STRINGS, BACKGROUND_TEXTURES);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cea73ccf4aaf8af41ab87f612277cae7
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Storage/Backgrounds/HierarchyBackgroundsStorage.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d7f15485a6928a241bd69f8e2b1e6db5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
namespace Borodar.RainbowHierarchy
{
public enum HierarchyEditorTexture
{
IcnEdit,
IcnFoldoutFirst,
IcnFoldoutMiddle,
IcnFoldoutLast,
IcnFoldoutLevels,
IcnFilter,
IcnDelete,
IcnSettings,
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3843cb555ef66604aaa10c6d7cfe587e
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Storage/EditorTextures/HierarchyEditorTexture.cs
uploadId: 716077

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using StorageHelper = Borodar.RainbowHierarchy.TexturesStorageHelper<Borodar.RainbowHierarchy.HierarchyEditorTexture>;
namespace Borodar.RainbowHierarchy
{
public static class HierarchyEditorTexturesStorage
{
private static readonly Dictionary<HierarchyEditorTexture, Texture2D> EDITOR_TEXTURES;
private static readonly Dictionary<HierarchyEditorTexture, Lazy<string>> EDITOR_STRINGS;
//---------------------------------------------------------------------
// Ctors
//---------------------------------------------------------------------
static HierarchyEditorTexturesStorage()
{
EDITOR_TEXTURES = new Dictionary<HierarchyEditorTexture, Texture2D>();
EDITOR_STRINGS = (EditorGUIUtility.isProSkin) ? GetDictPro() : GetDictFree();
}
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static Texture2D GetTexture(HierarchyEditorTexture type)
{
return StorageHelper.GetTexture(type, FilterMode.Bilinear, EDITOR_STRINGS, EDITOR_TEXTURES);
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private static Dictionary<HierarchyEditorTexture, Lazy<string>> GetDictPro()
{
return new Dictionary<HierarchyEditorTexture, Lazy<string>>
{
{HierarchyEditorTexture.IcnEdit, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAADOUlEQVRIDdVVXUiTYRR26XSub5tuy23uR13T5SrT0KgMKpOkIm/qIrooKugq7KIuJbqIrg0q6CYJiaKoINCwoqgwRftdmj9T0vk3Y27Ozelsaie+OHvf9/uqWXnhLsZzznnOOe97ft5PUl5enrCUvxVLGfxH7OWfICmeEslT5upOtXGyKJKnIklHLheHZv7sHleJzJowGR3SrEyJWrRhzPcbEFcCk3paGEJUKaSJJNAqZgssAQnBzTcFCeknXGOMKYG83hLQKiNCGltEoFYf6Mw3Bj0TssaPuu4RxeFt7nXmSaHnvo2enIzwzVfmXEOoonDMkDbTM8JV1RYu0FQJs2i7C8bO7HfRnEVINfW2Rx/0pANVImjd8bJ+0rxYfGznADMOiVarFaOcKOsvygmgyIBeD9fiUrs8nESSoOZmGSsvyqTzqclzbX1qtFI92Gr3oYEEgbD0UoOtqVuDylL7+Om9vSr5N9Qg2Jznu9K4GkXqBk1dGocpqFVSp4Omnb/jaCUOBc6D43K40K6Cr+SwgR76XH17LayheAIwPHXqlPKoPTOEjFaX+laTGUUEMGZ5hpBJE1uR+nf6C/fzg9NS5ACgmgxydF7yxJlBMj4PKUmRxIzpsVMXnWOuJEgA/tDDv/uJ+rE3SEpcgFUgEzhMIlvGExhTxYYxcCd9AVNN1qlmLh7q2JJHzZJRM90xqISKM55F2RNHdwyQp4aVLrH6335J/2WTr518b9HGmsZHhBAlNv+IPxUmB3PAmJ6tdMHUo4YHGsVsqd33oDUT9bF5AlVzj7qyeBRtCGDezx3shLnsGeVACcNj08fGDGk8eN0d2zLQUAluvMja7vCKrg9QIehv4vLR/VPSupcWHvP/VJPhC1X7PIs0LxZff5ZNNgDcqSaD3OfhNtl8UMrRCdm9FuPdZpMhPbJK7KEHcvugsqYhd8iXqk+LwBvXOay4SjwS/OHY5xq08N2Ax73drcKJq9rTC68/74D/D98Y8M2BQYAPDgyCN5iMBB5QJeJV3smUT0R0UHYNKxg3RglHcbpVwuhAE0kgjAVFiFMppMWVwO2VM60DkVwLYVzUiPQAbf8FxHWDf8m0/BN8B0f1DQMsgsBGAAAAAElFTkSuQmCC")},
{HierarchyEditorTexture.IcnFoldoutFirst, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAA8UlEQVR4Ae2ZQQrDMBADm9Kf+v9vaOnVh0BAgkx2cltihCyNffGx1npN/t6TN//fuwFIwPAEPALDAfAS/NyAgO/m4djm6ugdUI0XIC4BgJKqFiWgGi9AXAIAJVUtSkA1XoC4BABKqlqUgGq8AHEJAJRUtSgB1XgB4hIAKKlqUQKq8QLExxNwh3eBnZP9nWD/f3U+fWcYT4ABXOXpaevveAecntl0AR6BdKI0PQmgNZb2KwHpRGl6EkBrLO1XAtKJ0vQkgNZY2q8EpBOl6UkArbG0XwlIJ0rTkwBaY2m/EpBOlKYnAbTG0n4lIJ0oTW88AT8muwOwK+8yWQAAAABJRU5ErkJggg==")},
{HierarchyEditorTexture.IcnFoldoutMiddle, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAA8klEQVR4Ae2aMQ6EMADDAPHT/v8Nd2OlDgwo0Z1VM8GAiRLDxDnGOH58fJbnn8t19fKq0gFwCwCMVI2oAdV6AXANAIxUjagB1XoBcA0AjFSNqAHVegFwDQCMVI2oAdV6AXANAIxUjagB1XoBcA0AjFSNqAHVegFwDQCMVI2oAdV6AXANAIxUjXhX6e/g6/8C7yjzrsf/DXwFZlF7nm1vwD9+Ax7f2bSn2xtgAWmlaDwNoC2WzqsB6UZpPA2gLZbOqwHpRmk8DaAtls6rAelGaTwNoC2WzqsB6UZpPA2gLZbOqwHpRmk8DaAtls6rAelGabwvvrQDrtVOP8MAAAAASUVORK5CYII=")},
{HierarchyEditorTexture.IcnFoldoutLast, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAA70lEQVR4Ae2aMQ5AQAAEET+9/7+BUnKFQjKxmxsVhbHZHSr7GGP7+bim5+/TNXp5oPQCuAUUjIRG1AC03gK4BhSMhEbUALTeArgGFIyERtQAtN4CuAYUjIRG1AC03gK4BhSMhEbUALTeArgGFIyERtQAtN4CuAYUjIRG1AC03gK4BhSMhEY8Ufo3+Py/wDfKc9fr/wa+Ak9Ra54tb0DCN+D1HaW9XN4AC6AVS+drQPpCdD4NoBtO52tA+kJ0Pg2gG07na0D6QnQ+DaAbTudrQPpCdD4NoBtO52tA+kJ0Pg2gG07na0D6QnQ+DaAbTuffvsQDriqTua4AAAAASUVORK5CYII=")},
{HierarchyEditorTexture.IcnFoldoutLevels, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAETUlEQVR4Ae3dwa0aQRAEUK9FFE4D0nAUI0EapAFpOA1Iw3FYvtaBw/SpxPu3Fmqp+81fbWkvc6y1fvgjQIAAAQIEvkvg53eta1sCBAgQIEDgv4AA4P+AAAECBAh8oYAA8IWHbmUCBAgQIHAqIPgVM/6Nur08xwLvqNvL37HAn6jby2ss8Iy6vbzHAlnHz3XlIya+Rd1e5vOWz2P7fq9Y4BJ1e5nvu3wfjvbzBWDEp5kAAQIECHQKCACd52ZqAgQIECAwEhAARnyaCRAgQIBAp4AA0HlupiZAgAABAiMBAWDEp5kAAQIECHQKCACd52ZqAgQIECAwEhAARnyaCRAgQIBAp8DhLoDOgzM1AQIECBCYCPgCMNHTS4AAAQIESgUEgNKDMzYBAgQIEJgICAATPb0ECBAgQKBUQAAoPThjEyBAgACBiYAAMNHTS4AAAQIESgUEgNKDMz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NhZJeBV8DpNQfeBBeYIOgBfL8QfI8wFqqQt6FveJeCV1b1gyFwKUyBk2EQqPUwGdIuHNUcOQv8d/mTsL8E9oVlsBzSdACV38N+aUY56gx4BGzOsD2D+oldNs6UXG+SiyQgo/+maq+Opy9frJTRapzHQ+w2VqZhffOsAa324S3xTavO3fx8gAlur27F1XxtlwQkbmNl01BnAhz0t2UHiL+zqC0T4H5dVQJqO1/UOQO8+Ov8p6SqSGLiEOpOgG9+Fif2nl3he0HbqE39a2v5v4a38vEAeJT2DDEY8sh3Ee/CNNiSx6FVmzrPAa2Oaa/61X0L7NVgWums1yfgXw1CMvNagfwEAAAAAElFTkSuQmCC")},
};
}
private static Dictionary<HierarchyEditorTexture, Lazy<string>> GetDictFree()
{
return new Dictionary<HierarchyEditorTexture, Lazy<string>>
{
{HierarchyEditorTexture.IcnEdit, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAChElEQVRIDeVVzetpURR9Pz2Sz/JdGPEYCQMxMCJk6C9VZhiJkpFkJJRC+Q4hH8Vb75067Xvu9bq/Xr/B6xlo7bXX2vvec84+96NSqXz7yp/mK4v/qv3vN/iuZokej0e5XL7f71ys1WpLpZJOp+PMO6BqiY7HI62OWmh5OBzeFaW82gbUwzC6ykk5o9Dgcrksl0sqXa/XNGR4s9lQcrVawUgZhhX2oNlsoqLJZAoEAg6Ho9/vwyx3DofD/X4fiUR2u91oNDqdTna7vVgsCsoPYdDG43G73RZE6sNUKhUMBqleskTYum63S9OfxbALx0HSoNfrXa/Xd0VtNtuP3z+Ad5rb7YYiNCvZg9lsRnMc6/X6ZDLp9/s5M51OO52O4tOgSCKR4ErJG+RyOewqz3GQTqdpdfAIQXIBB9hnFOEhgKSB0WjM5/OhUIgqvF6vx+OhDMMgkaI81q9QKOD4UVLSAAmNRoPTSRVOp5OGFAspGGGnAmAxBvV6vQSRylDRKDZ4Pp8YBVpRcYyZQEjBCDv1AksaYBqr1SpGlIrm8/lisaAMwyCRojzmGfbz+UxJSYNarbbdbmma4VarhXNJeYQgKcMw7PV6nfKSOcDhGwwGNM0wznuj0cB84RSCQRXcP3IZY3w+H01JGkSj0clkgmmkCo5R9A91mQwjiSLcAiBZInyh4vE4TX8Ww46PHXVJGiCBu5CtA+YlFotlMhnhsFOzy+XKZrN4ZDZcUAozBLF4XYPCdwPHCWZeC9eOcLSQCofD9M7BN8psNhsMBu5iQHwDsBDR6mAULyiBdLvd8urwKjRgnem/xWKhIcOKpFymqoHVahW2DqHKBgp7IH+Kv2FUvcH/3eAn+b75RLaqSOAAAAAASUVORK5CYII=")},
{HierarchyEditorTexture.IcnFoldoutFirst, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAA8UlEQVR4Ae2ZQQrDMBADm9Kf+v9vaOnVh0BAgkx2cltihCyNffGx1npN/t6TN//fuwFIwPAEPALDAfAS/NyAgO/m4djm6ugdUI0XIC4BgJKqFiWgGi9AXAIAJVUtSkA1XoC4BABKqlqUgGq8AHEJAJRUtSgB1XgB4hIAKKlqUQKq8QLExxNwh3eBnZP9nWD/f3U+fWcYT4ABXOXpaevveAecntl0AR6BdKI0PQmgNZb2KwHpRGl6EkBrLO1XAtKJ0vQkgNZY2q8EpBOl6UkArbG0XwlIJ0rTkwBaY2m/EpBOlKYnAbTG0n4lIJ0oTW88AT8muwOwK+8yWQAAAABJRU5ErkJggg==")},
{HierarchyEditorTexture.IcnFoldoutMiddle, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAA8klEQVR4Ae2aMQ6EMADDAPHT/v8Nd2OlDgwo0Z1VM8GAiRLDxDnGOH58fJbnn8t19fKq0gFwCwCMVI2oAdV6AXANAIxUjagB1XoBcA0AjFSNqAHVegFwDQCMVI2oAdV6AXANAIxUjagB1XoBcA0AjFSNqAHVegFwDQCMVI2oAdV6AXANAIxUjXhX6e/g6/8C7yjzrsf/DXwFZlF7nm1vwD9+Ax7f2bSn2xtgAWmlaDwNoC2WzqsB6UZpPA2gLZbOqwHpRmk8DaAtls6rAelGaTwNoC2WzqsB6UZpPA2gLZbOqwHpRmk8DaAtls6rAelGabwvvrQDrtVOP8MAAAAASUVORK5CYII=")},
{HierarchyEditorTexture.IcnFoldoutLast, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAA70lEQVR4Ae2aMQ5AQAAEET+9/7+BUnKFQjKxmxsVhbHZHSr7GGP7+bim5+/TNXp5oPQCuAUUjIRG1AC03gK4BhSMhEbUALTeArgGFIyERtQAtN4CuAYUjIRG1AC03gK4BhSMhEbUALTeArgGFIyERtQAtN4CuAYUjIRG1AC03gK4BhSMhEY8Ufo3+Py/wDfKc9fr/wa+Ak9Ra54tb0DCN+D1HaW9XN4AC6AVS+drQPpCdD4NoBtO52tA+kJ0Pg2gG07na0D6QnQ+DaAbTudrQPpCdD4NoBtO52tA+kJ0Pg2gG07na0D6QnQ+DaAbTuffvsQDriqTua4AAAAASUVORK5CYII=")},
{HierarchyEditorTexture.IcnFoldoutLevels, new Lazy<string>(() => "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAETUlEQVR4Ae3dwa0aQRAEUK9FFE4D0nAUI0EapAFpOA1Iw3FYvtaBw/SpxPu3Fmqp+81fbWkvc6y1fvgjQIAAAQIEvkvg53eta1sCBAgQIEDgv4AA4P+AAAECBAh8oYAA8IWHbmUCBAgQIHAqIPgVM/6Nur08xwLvqNvL37HAn6jby2ss8Iy6vbzHAlnHz3XlIya+Rd1e5vOWz2P7fq9Y4BJ1e5nvu3wfjvbzBWDEp5kAAQIECHQKCACd52ZqAgQIECAwEhAARnyaCRAgQIBAp4AA0HlupiZAgAABAiMBAWDEp5kAAQIECHQKCACd52ZqAgQIECAwEhAARnyaCRAgQIBAp8DhLoDOgzM1AQIECBCYCPgCMNHTS4AAAQIESgUEgNKDMzYBAgQIEJgICAATPb0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XXVH8+8dTSUpARqsg2dgmxcpsp36nSk6ZVTbhm2lia/k58LaJMW0BGhrAt5OcOIfGmbBKPDM7eLp6Clb3L7cxmzDth6GDRASF73U80yWBHj3p8AXYFbFRfIDuBqGw72wuhPLxkDeF5mYBMVp6BPqVVBrZxK/fc64EpaDfTLx8g3cD5FTH9cNkuW/xGpGx/PjAugHy8BGk2Q/Kr+HgUlKGepM+DDYmKJ7KvW+uVIcKZluQPwovMs68OF/Xmb678tOe+epd2Jk53XRr28xTL2T6HzYSa52skyBXA7rlGtDsa6o0E8fYPRVibRLAoLbWKtZqTIBdtrh26o4jdoyAe7XZSWgsvNFlSPAO7/GjxaljCQGu1B1AtbT8uJg6+kVvhfUR2WSZxss0onNGN0DHqY8QwyALOK7iDdgKkTe4GQxzqNTdQLsi0N4Yp5Odadu1VOgO2Mp1FavT8C/Mq4X7qXMq7QAAAAASUVORK5CYII=")},
};
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 88f63074b66e1e941a7cd13738861295
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Storage/EditorTextures/HierarchyEditorTexturesStorage.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 19103cff5dce9484dab9f3b92422d61b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
namespace Borodar.RainbowHierarchy
{
public enum HierarchyIconCategory
{
All,
Colors,
General,
Assets,
Collab,
Console,
Animation,
AR,
Audio,
Effects,
Events,
Folders,
Layouts,
Light,
Meshes,
Miscellaneous,
Navigation,
Network,
Physics2D,
Physics,
Playables,
Rendering,
Tilemap,
UI,
Video
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 44fe96b23f3ba9c4d8267106947d7fc5
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Storage/Icons/HierarchyIconCategory.cs
uploadId: 716077

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 42f791d258491594d94c4d6affa566d8
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Storage/Icons/HierarchyIconsArchiveFree.cs
uploadId: 716077

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d5c1d777bb3e19a4c957a19f582dd2cc
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Storage/Icons/HierarchyIconsArchivePro.cs
uploadId: 716077

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using StorageHelper = Borodar.RainbowHierarchy.TexturesStorageHelper<Borodar.RainbowHierarchy.HierarchyIcon>;
namespace Borodar.RainbowHierarchy
{
public static class HierarchyIconsStorage
{
private static readonly Dictionary<HierarchyIcon, Texture2D> ICON_TEXTURES;
private static readonly Dictionary<HierarchyIcon, Lazy<string>> ICON_STRINGS;
//---------------------------------------------------------------------
// Ctors
//---------------------------------------------------------------------
static HierarchyIconsStorage()
{
ICON_TEXTURES = new Dictionary<HierarchyIcon, Texture2D>();
ICON_STRINGS = (EditorGUIUtility.isProSkin) ? HierarchyIconsArchivePro.GetDict()
: HierarchyIconsArchiveFree.GetDict();
}
public static Texture2D GetIcon(int type)
{
return GetIcon((HierarchyIcon) type);
}
public static Texture2D GetIcon(HierarchyIcon type)
{
return StorageHelper.GetTexture(type, FilterMode.Bilinear, ICON_STRINGS, ICON_TEXTURES);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 27d46ae4ed7c65f46a7b9c6226cafae8
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Storage/Icons/HierarchyIconsStorage.cs
uploadId: 716077

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
public static class TexturesStorageHelper<T>
{
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
[SuppressMessage("ReSharper", "InvertIf")]
public static Texture2D GetTexture(T type, FilterMode filterMode, Dictionary<T, Lazy<string>> strings, Dictionary<T, Texture2D> textures)
{
if (!textures.TryGetValue(type, out var texture))
{
if (strings.TryGetValue(type, out var lazyString))
{
texture = TextureFromString(lazyString.Value, filterMode);
}
else
{
texture = Texture2D.grayTexture;
RHLogger.LogWarning($"Cannot find texture with ID: {type}");
}
textures.Add(type, texture);
}
return texture;
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
[SuppressMessage("ReSharper", "UseObjectOrCollectionInitializer")]
private static Texture2D TextureFromString(string value, FilterMode filterMode)
{
var texture = new Texture2D(4, 4, TextureFormat.DXT5, false, false);
texture.filterMode = filterMode;
texture.wrapMode = TextureWrapMode.Clamp;
texture.hideFlags = HideFlags.HideAndDontSave;
texture.LoadImage(Convert.FromBase64String(value));
return texture;
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b4405d1be47948f4f915ce25dadbda0d
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Storage/TexturesStorageHelper.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0a6178494bd391a4bbae815c6ef0e14c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,75 @@
using System.Diagnostics.CodeAnalysis;
using UnityEditor;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
public abstract class CoreDraggablePopupWindow : EditorWindow
{
private Vector2 _offset;
//---------------------------------------------------------------------
// Static
//---------------------------------------------------------------------
/// <summary>
/// Returns the first DraggablePopupWindow of type T which is currently on the screen.
/// If there is none, creates and shows new window and returns the instance of it.
/// </summary>
[SuppressMessage("ReSharper", "PossibleNullReferenceException")]
protected static T GetDraggableWindow<T>() where T : CoreDraggablePopupWindow
{
var array = Resources.FindObjectsOfTypeAll(typeof(T)) as T[];
var t = (array.Length <= 0) ? null : array[0];
return t ? t : CreateInstance<T>();
}
//---------------------------------------------------------------------
// Messages
//---------------------------------------------------------------------
/// <summary>
/// Callback for drawing GUI controls for the popup window.
/// </summary>
[SuppressMessage("ReSharper", "InvertIf")]
protected virtual void OnGUI()
{
var e = Event.current;
// Close the window if ESC is pressed
if (e.type == EventType.KeyUp && e.keyCode == KeyCode.Escape) Close();
// calculate offset for the mouse cursor when start dragging
if (e.button == 0 && e.type == EventType.MouseDown)
{
_offset = position.position - GUIUtility.GUIToScreenPoint(e.mousePosition);
}
// drag window
if (e.button == 0 && e.type == EventType.MouseDrag && IsDragModifierPressed(e))
{
var mousePos = GUIUtility.GUIToScreenPoint(e.mousePosition);
position = new Rect(mousePos + _offset, position.size);
}
}
//---------------------------------------------------------------------
// Protected
//---------------------------------------------------------------------
/// <summary>
/// Show draggable editor window with popup-style framing.
/// </summary>
protected void Show<T>(Rect inPosition, bool focus = true) where T : CoreDraggablePopupWindow
{
minSize = inPosition.size;
position = inPosition;
ShowPopup();
if (focus) Focus();
}
protected abstract bool IsDragModifierPressed(Event e);
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: aa4a4fb896b20d149b676e21370adc8b
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Windows/CoreDraggablePopupWindow.cs
uploadId: 716077

View File

@@ -0,0 +1,150 @@
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
public class HierarchyBackgroundsPopup : HierarchySelectionPopup<HierarchyBackground>
{
private static readonly Vector2 WINDOW_SIZE = new Vector2(390f, 214f);
//---------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------
protected override Vector2 WindowSize => WINDOW_SIZE;
protected override int GridColumns => 4;
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static HierarchyBackgroundsPopup GetDraggableWindow()
{
return GetDraggableWindow<HierarchyBackgroundsPopup>();
}
//---------------------------------------------------------------------
// Protected
//---------------------------------------------------------------------
protected override void DrawButtons(Rect rect)
{
DrawCategoryButton(rect, "All");
rect.y += LINE_HEIGHT * 9f + SPACING * 6f;
DrawCustomButton(rect);
rect.y += LINE_HEIGHT + SPACING;
DrawNoneButton(rect);
}
protected override void DrawIcons(Rect rect)
{
GUILayout.BeginArea(rect);
ScrollPos = BeginScrollView(ScrollPos);
var predicate = GetCategoryPredicate();
var icons = Enum.GetValues(typeof(HierarchyBackground))
.Cast<HierarchyBackground>()
.Where(predicate)
.ToList();
GUILayout.BeginVertical();
DrawIconsGrid(icons);
GUILayout.EndVertical();
EditorGUILayout.EndScrollView();
GUILayout.EndArea();
}
protected override void DrawIconButton(HierarchyBackground backgroundType)
{
var rect = EditorGUILayout.GetControlRect(GUILayout.Width(66), GUILayout.Height(22));
if (GUI.Button(rect, GUIContent.none, "grey_border"))
{
AssignBackgroundByType(HierarchyRule, backgroundType);
}
var backgroundTex = HierarchyBackgroundsStorage.GetBackground(backgroundType);
DrawPreview(rect, backgroundTex);
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private void DrawCategoryButton(Rect rect, string text)
{
if (!GUI.Button(rect, text, "MiniToolbarButtonLeft")) return;
ApplyIconsCategory();
}
private void DrawCustomButton(Rect rect)
{
if (!GUI.Button(rect, "Custom", "minibutton")) return;
AssignBackgroundByType(HierarchyRule, HierarchyBackground.Custom);
}
private void DrawNoneButton(Rect rect)
{
if (!GUI.Button(rect, "None", "minibutton")) return;
ResetBackgroundToDefault(HierarchyRule);
}
private static Func<HierarchyBackground, bool> GetCategoryPredicate()
{
return icon => (int) icon >= 1000 && (int) icon < 50000;
}
private static void DrawPreview(Rect rect, Texture icon)
{
rect.x += 1f;
rect.y += 1f;
rect.width = PREVIEW_SIZE_LARGE;
rect.height = PREVIEW_SIZE_SMALL + 4f;
GUI.Label(rect, "Folder", "CenteredLabel");
GUI.DrawTexture(rect, icon);
}
private void ApplyIconsCategory()
{
ScrollPos = Vector2.zero;
}
private void AssignBackgroundByType(dynamic rule, HierarchyBackground type)
{
if (IsRuleSerialized)
{
rule.FindPropertyRelative("BackgroundType").intValue = (int) type;
rule.FindPropertyRelative("BackgroundTexture").objectReferenceValue = null;
ApplyPropertyChangesAndClose(rule);
}
else
{
rule.BackgroundType = type;
rule.BackgroundTexture = null;
CloseAndRepaintParent();
}
}
private void ResetBackgroundToDefault(dynamic rule)
{
if (IsRuleSerialized)
{
rule.FindPropertyRelative("BackgroundType").intValue = (int) HierarchyBackground.None;
rule.FindPropertyRelative("BackgroundTexture").objectReferenceValue = null;
rule.FindPropertyRelative("IsBackgroundRecursive").boolValue = false;
ApplyPropertyChangesAndClose(rule);
}
else
{
rule.BackgroundType = HierarchyBackground.None;
rule.BackgroundTexture = null;
rule.IsBackgroundRecursive = false;
CloseAndRepaintParent();
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ddb7dcc055c8d2b4295bdbd5843af4d6
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Windows/HierarchyBackgroundsPopup.cs
uploadId: 716077

View File

@@ -0,0 +1,250 @@
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
public class HierarchyIconsPopup : HierarchySelectionPopup<HierarchyIcon>
{
private static readonly Vector2 WINDOW_SIZE = new Vector2(325f, 214f);
private HierarchyIconCategory _category;
//---------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------
protected override Vector2 WindowSize => WINDOW_SIZE;
protected override int GridColumns => 6;
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static HierarchyIconsPopup GetDraggableWindow()
{
return GetDraggableWindow<HierarchyIconsPopup>();
}
//---------------------------------------------------------------------
// Protected
//---------------------------------------------------------------------
protected override void DrawButtons(Rect rect)
{
rect.height = WindowSize.y - 60f;
GUILayout.BeginArea(rect);
ScrollPos2 = BeginScrollView(ScrollPos2);
GUILayout.BeginVertical();
DrawCategoryButton("All", HierarchyIconCategory.All);
DrawCategoryButton("Colors", HierarchyIconCategory.Colors);
DrawCategoryButton("General", HierarchyIconCategory.General);
DrawCategoryButton("Animation", HierarchyIconCategory.Animation);
DrawCategoryButton("AR", HierarchyIconCategory.AR);
DrawCategoryButton("Assets", HierarchyIconCategory.Assets);
DrawCategoryButton("Audio", HierarchyIconCategory.Audio);
DrawCategoryButton("Collab", HierarchyIconCategory.Collab);
DrawCategoryButton("Console", HierarchyIconCategory.Console);
DrawCategoryButton("Effects", HierarchyIconCategory.Effects);
DrawCategoryButton("Events", HierarchyIconCategory.Events);
DrawCategoryButton("Folders", HierarchyIconCategory.Folders);
DrawCategoryButton("Layouts", HierarchyIconCategory.Layouts);
DrawCategoryButton("Light", HierarchyIconCategory.Light);
DrawCategoryButton("Meshes", HierarchyIconCategory.Meshes);
DrawCategoryButton("Misc", HierarchyIconCategory.Miscellaneous);
DrawCategoryButton("Navigation", HierarchyIconCategory.Navigation);
DrawCategoryButton("Network", HierarchyIconCategory.Network);
DrawCategoryButton("Physics2D", HierarchyIconCategory.Physics2D);
DrawCategoryButton("Physics", HierarchyIconCategory.Physics);
DrawCategoryButton("Playables", HierarchyIconCategory.Playables);
DrawCategoryButton("Rendering", HierarchyIconCategory.Rendering);
DrawCategoryButton("Tilemap", HierarchyIconCategory.Tilemap);
DrawCategoryButton("UI", HierarchyIconCategory.UI);
DrawCategoryButton("Video", HierarchyIconCategory.Video);
GUILayout.EndVertical();
EditorGUILayout.EndScrollView();
GUILayout.EndArea();
rect.y = WindowSize.y - LINE_HEIGHT * 2f - 5f;
rect.height = LINE_HEIGHT;
DrawCustomButton(rect);
rect.y += LINE_HEIGHT + SPACING;
DrawNoneButton(rect);
}
protected override void DrawIcons(Rect rect)
{
GUILayout.BeginArea(rect);
ScrollPos = BeginScrollView(ScrollPos);
var predicate = GetCategoryPredicate(_category);
var icons = Enum.GetValues(typeof(HierarchyIcon))
.Cast<HierarchyIcon>()
.Where(predicate)
.ToList();
GUILayout.BeginVertical();
DrawIconsGrid(icons);
GUILayout.EndVertical();
EditorGUILayout.EndScrollView();
GUILayout.EndArea();
}
protected override void DrawIconButton(HierarchyIcon iconType)
{
var rect = EditorGUILayout.GetControlRect(
GUILayout.Width(PREVIEW_SIZE_SMALL + PADDING * 4f),
GUILayout.Height(PREVIEW_SIZE_SMALL + PADDING * 4f));
if (GUI.Button(rect, GUIContent.none, "grey_border"))
{
AssignIconByType(HierarchyRule, iconType);
}
var iconTex = HierarchyIconsStorage.GetIcon(iconType);
DrawPreview(rect, iconTex);
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private void DrawCategoryButton(string text, HierarchyIconCategory category)
{
GUILayout.BeginHorizontal();
var isButtonPressed = GUILayout.Button(text, "MiniToolbarButtonLeft");
GUILayout.Space(2f);
GUILayout.EndHorizontal();
GUILayout.Space(2f);
if (!isButtonPressed) return;
ApplyIconsCategory(category);
}
private void DrawNoneButton(Rect rect)
{
if (!GUI.Button(rect, "None", "minibutton")) return;
ResetIconToDefault(HierarchyRule);
}
private void DrawCustomButton(Rect rect)
{
if (!GUI.Button(rect, "Custom", "minibutton")) return;
AssignIconByType(HierarchyRule, HierarchyIcon.Custom);
}
private static Func<HierarchyIcon, bool> GetCategoryPredicate(HierarchyIconCategory category)
{
switch (category)
{
case HierarchyIconCategory.All:
return icon => icon != HierarchyIcon.None && icon != HierarchyIcon.Custom;
case HierarchyIconCategory.Colors:
return icon => (int) icon >= 1000 && (int) icon < 50000;
case HierarchyIconCategory.General:
return icon => (int) icon >= 100000 && (int) icon < 117000;
case HierarchyIconCategory.Animation:
return icon => (int) icon >= 117000 && (int) icon < 120000;
case HierarchyIconCategory.AR:
return icon => (int) icon >= 120000 && (int) icon < 125000;
case HierarchyIconCategory.Assets:
return icon => (int) icon >= 125000 && (int) icon < 130000;
case HierarchyIconCategory.Audio:
return icon => (int) icon >= 130000 && (int) icon < 138500;
case HierarchyIconCategory.Collab:
return icon => (int) icon >= 138500 && (int) icon < 139100;
case HierarchyIconCategory.Console:
return icon => (int) icon >= 139100 && (int) icon < 139500;
case HierarchyIconCategory.Effects:
return icon => (int) icon >= 139500 && (int) icon < 150000;
case HierarchyIconCategory.Events:
return icon => (int) icon >= 150000 && (int) icon < 158000;
case HierarchyIconCategory.Folders:
return icon => (int) icon >= 158000 && (int) icon < 160000;
case HierarchyIconCategory.Layouts:
return icon => (int) icon >= 160000 && (int) icon < 169500;
case HierarchyIconCategory.Light:
return icon => (int) icon >= 169500 && (int) icon < 170000;
case HierarchyIconCategory.Meshes:
return icon => (int) icon >= 170000 && (int) icon < 180000;
case HierarchyIconCategory.Miscellaneous:
return icon => (int) icon >= 180000 && (int) icon < 200000;
case HierarchyIconCategory.Navigation:
return icon => (int) icon >= 200000 && (int) icon < 210000;
case HierarchyIconCategory.Network:
return icon => (int) icon >= 210000 && (int) icon < 230000;
case HierarchyIconCategory.Physics2D:
return icon => (int) icon >= 230000 && (int) icon < 260000;
case HierarchyIconCategory.Physics:
return icon => (int) icon >= 260000 && (int) icon < 280000;
case HierarchyIconCategory.Playables:
return icon => (int) icon >= 280000 && (int) icon < 290000;
case HierarchyIconCategory.Rendering:
return icon => (int) icon >= 290000 && (int) icon < 310000;
case HierarchyIconCategory.Tilemap:
return icon => (int) icon >= 310000 && (int) icon < 320000;
case HierarchyIconCategory.UI:
return icon => (int) icon >= 320000 && (int) icon < 340000;
case HierarchyIconCategory.Video:
return icon => (int) icon >= 340000 && (int) icon < 350000;
default:
throw new ArgumentOutOfRangeException();
}
}
private static void DrawPreview(Rect rect, Texture icon)
{
rect.x += PADDING * 2f;
rect.y += PADDING * 2f;
rect.width = rect.height = PREVIEW_SIZE_SMALL;
GUI.DrawTexture(rect, icon);
}
private void ApplyIconsCategory(HierarchyIconCategory category)
{
_category = category;
ScrollPos = Vector2.zero;
}
private void AssignIconByType(dynamic rule, HierarchyIcon type)
{
if (IsRuleSerialized)
{
rule.FindPropertyRelative("IconType").intValue = (int) type;
rule.FindPropertyRelative("IconTexture").objectReferenceValue = null;
ApplyPropertyChangesAndClose(rule);
}
else
{
rule.IconType = type;
rule.IconTexture = null;
CloseAndRepaintParent();
}
}
private void ResetIconToDefault(dynamic rule)
{
if (IsRuleSerialized)
{
rule.FindPropertyRelative("IconType").intValue = (int) HierarchyIcon.None;
rule.FindPropertyRelative("IconTexture").objectReferenceValue = null;
rule.FindPropertyRelative("IsIconRecursive").boolValue = false;
ApplyPropertyChangesAndClose(rule);
}
else
{
rule.IconType = HierarchyIcon.None;
rule.IconTexture = null;
rule.IsIconRecursive = false;
CloseAndRepaintParent();
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e76b1a25e9c44ea47b8d5197d04bdbdb
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Windows/HierarchyIconsPopup.cs
uploadId: 716077

View File

@@ -0,0 +1,377 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using static Borodar.RainbowHierarchy.ColorHelper;
using KeyType = Borodar.RainbowHierarchy.HierarchyRule.KeyType;
namespace Borodar.RainbowHierarchy
{
public class HierarchyPopupWindow : CoreDraggablePopupWindow
{
private const float PADDING = 8f;
private const float SPACING = 2f;
private const float LINE_HEIGHT = 18f;
private const float LABELS_WIDTH = 80f;
private const float BUTTON_WIDTH = 55f;
private const float ICON_WIDTH_SMALL = 16f;
private const float WINDOW_WIDTH = 300f;
private const float WINDOW_HEIGHT = 176f;
private static readonly Vector2 WINDOW_SIZE = new(WINDOW_WIDTH, WINDOW_HEIGHT);
private Rect _windowRect;
private Rect _backgroundRect;
private List<GameObject> _selectedObjects;
private GameObject _currentObject;
private HierarchyRulesetV2 _ruleset;
private HierarchyRule _currentRule;
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public static HierarchyPopupWindow GetDraggableWindow()
{
return GetDraggableWindow<HierarchyPopupWindow>();
}
public void ShowWithParams(Vector2 inPosition, List<GameObject> selectedObjects, int firstSelected)
{
_selectedObjects = selectedObjects;
var scene = selectedObjects[0].scene;
_ruleset = HierarchyRulesetV2.GetRulesetByScene(scene, true);
_currentObject = selectedObjects[firstSelected];
var rule = _ruleset.GetRule(_currentObject);
_currentRule = rule == null ?
new HierarchyRule(KeyType.Object, _currentObject, _currentObject.name) :
new HierarchyRule(rule);
_currentRule.GameObject = _currentObject;
// Resize
var customIconHeight = (_currentRule.HasCustomIcon()) ? LINE_HEIGHT : 0f;
var customBackgroundHeight = (_currentRule.HasCustomBackground()) ? LINE_HEIGHT : 0f;
var rect = new Rect(inPosition, WINDOW_SIZE)
{
height = WINDOW_HEIGHT + customIconHeight + customBackgroundHeight
};
_windowRect = new Rect(Vector2.zero, rect.size);
_backgroundRect = new Rect(Vector2.one, rect.size - new Vector2(2f, 2f));
Show<HierarchyPopupWindow>(rect);
}
//---------------------------------------------------------------------
// Messages
//---------------------------------------------------------------------
protected override void OnGUI()
{
if (_currentRule == null) { Close(); return; }
base.OnGUI();
ChangeWindowSize(_currentRule.HasCustomIcon(), _currentRule.HasCustomBackground());
var rect = _windowRect;
// Window Background
var borderColor = EditorGUIUtility.isProSkin ? POPUP_BORDER_CLR_PRO : POPUP_BORDER_CLR_FREE;
EditorGUI.DrawRect(_windowRect, borderColor);
var backgroundColor = EditorGUIUtility.isProSkin ? POPUP_BACKGROUND_CLR_PRO : POPUP_BACKGROUND_CLR_FREE;
EditorGUI.DrawRect(_backgroundRect, backgroundColor);
// Body
DrawTypeAndKey(ref rect);
DrawPriority(ref rect);
DrawIcon(ref rect);
DrawBackground(ref rect);
DrawButtons(ref rect);
DrawSeparators(ref rect);
}
//---------------------------------------------------------------------
// Protected
//---------------------------------------------------------------------
protected override bool IsDragModifierPressed(Event e)
{
return HierarchyPreferences.IsDragModifierPressed(e);
}
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private void DrawTypeAndKey(ref Rect rect)
{
rect.x += 0.5f * PADDING;
rect.y += PADDING;
rect.width = LABELS_WIDTH - PADDING;
rect.height = LINE_HEIGHT;
_currentRule.Type = (KeyType) EditorGUI.EnumPopup(rect, _currentRule.Type);
rect.x += LABELS_WIDTH;
rect.y = _windowRect.y + PADDING;
rect.width = _windowRect.width - LABELS_WIDTH - PADDING;
GUI.enabled = false;
if (_selectedObjects.Count == 1)
if (_currentRule.Type == KeyType.Object)
{
EditorGUI.ObjectField(rect, _currentObject, typeof(GameObject), true);
}
else
{
EditorGUI.TextField(rect, _currentObject.name);
}
else
{
EditorGUI.TextField(rect, GUIContent.none, _selectedObjects.Count + " selected");
}
GUI.enabled = true;
}
private void DrawPriority(ref Rect rect)
{
rect.x = 0.5f * PADDING;
rect.y += LINE_HEIGHT + 3f;
EditorGUI.LabelField(rect, "Priority");
rect.width = _windowRect.width - LABELS_WIDTH - PADDING;
rect.x += LABELS_WIDTH;
_currentRule.Priority = EditorGUI.IntField(rect, GUIContent.none, _currentRule.Priority);
}
private void DrawIcon(ref Rect rect)
{
rect.x = 0.5f * PADDING;
rect.y += LINE_HEIGHT + 1.5f * PADDING + 1f;
EditorGUI.LabelField(rect, "Icon");
rect.y += LINE_HEIGHT + SPACING;
rect.width = ICON_WIDTH_SMALL;
rect.height = ICON_WIDTH_SMALL;
if (_currentRule.HasIcon())
{
var texture = (_currentRule.HasCustomIcon())
? _currentRule.IconTexture
: HierarchyIconsStorage.GetIcon(_currentRule.IconType);
GUI.DrawTexture(rect, texture);
}
rect.x += LABELS_WIDTH;
rect.y -= LINE_HEIGHT + 1.5f * SPACING;
rect.width = _windowRect.width - LABELS_WIDTH - PADDING;
rect.height = LINE_HEIGHT;
DrawIconsPopup(rect, _currentRule);
// Custom Icon Field
if (_currentRule.HasCustomIcon())
{
rect.y += LINE_HEIGHT + 2f * SPACING;
_currentRule.IconTexture = (Texture2D) EditorGUI.ObjectField(rect, _currentRule.IconTexture, typeof(Texture2D), false);
}
rect.y += _currentRule.HasCustomIcon() ? LINE_HEIGHT + 0.2f * SPACING : LINE_HEIGHT + SPACING;
_currentRule.IsIconRecursive = EditorGUI.Toggle(rect, _currentRule.IsIconRecursive);
rect.x += ICON_WIDTH_SMALL;
EditorGUI.LabelField(rect, "Recursive");
}
private void DrawBackground(ref Rect rect)
{
rect.x = 0.5f * PADDING;
rect.y += LINE_HEIGHT + SPACING * 3;
EditorGUI.LabelField(rect, "Background");
rect.y += LINE_HEIGHT + SPACING;
rect.width = ICON_WIDTH_SMALL * 3f;
rect.height = ICON_WIDTH_SMALL;
if (_currentRule.HasBackground())
{
var texture = (_currentRule.HasCustomBackground())
? _currentRule.BackgroundTexture
: HierarchyBackgroundsStorage.GetBackground(_currentRule.BackgroundType);
GUI.DrawTexture(rect, texture);
}
rect.x += LABELS_WIDTH;
rect.y -= LINE_HEIGHT + 1.5f * SPACING;
rect.width = _windowRect.width - LABELS_WIDTH - PADDING;
rect.height = LINE_HEIGHT;
DrawBackgroundsPopup(rect, _currentRule);
// Custom Icon Field
if (_currentRule.HasCustomBackground())
{
rect.y += LINE_HEIGHT + 2f * SPACING;
_currentRule.BackgroundTexture =
(Texture2D) EditorGUI.ObjectField(rect, _currentRule.BackgroundTexture, typeof(Texture2D), false);
}
rect.y += _currentRule.HasCustomBackground() ? LINE_HEIGHT + 0.2f * SPACING : LINE_HEIGHT + SPACING;
_currentRule.IsBackgroundRecursive = EditorGUI.Toggle(rect, _currentRule.IsBackgroundRecursive);
rect.x += ICON_WIDTH_SMALL;
EditorGUI.LabelField(rect, "Recursive");
}
private void DrawButtons(ref Rect rect)
{
rect.x = PADDING;
rect.y = position.height - LINE_HEIGHT - 0.75f * PADDING;
rect.width = ICON_WIDTH_SMALL;
ButtonSettings(rect);
rect.x += ICON_WIDTH_SMALL + 0.75f * PADDING;
ButtonFilter(rect);
rect.x += ICON_WIDTH_SMALL + 0.75f * PADDING;
ButtonDefault(rect);
rect.x = WINDOW_WIDTH - 2f * (BUTTON_WIDTH + PADDING);
rect.width = BUTTON_WIDTH;
ButtonCancel(rect);
rect.x = WINDOW_WIDTH - BUTTON_WIDTH - PADDING;
ButtonApply(rect);
}
private void DrawSeparators(ref Rect rect)
{
var color1 = (EditorGUIUtility.isProSkin) ? SEPARATOR_CLR_1_PRO : SEPARATOR_CLR_1_FREE;
var color2 = (EditorGUIUtility.isProSkin) ? SEPARATOR_CLR_2_PRO : SEPARATOR_CLR_2_FREE;
// First separator
rect.x = 0.5f * PADDING;
rect.y = 2f * LINE_HEIGHT + 16f;
rect.width = WINDOW_WIDTH - PADDING;
rect.height = 1f;
EditorGUI.DrawRect(rect, color1);
rect.y += 1;
EditorGUI.DrawRect(rect, color2);
// Second separator
rect.y = position.height - LINE_HEIGHT - 11f;
EditorGUI.DrawRect(rect, color1);
rect.y += 1;
EditorGUI.DrawRect(rect, color2);
}
private void ButtonSettings(Rect rect)
{
var icon = HierarchyEditorUtility.GetSettingsButtonIcon();
if (!GUI.Button(rect, new GUIContent(icon, "All Rules"), GUIStyle.none)) return;
Selection.activeObject = _ruleset;
Close();
}
private void ButtonFilter(Rect rect)
{
var icon = HierarchyEditorUtility.GetFilterButtonIcon();
if (!GUI.Button(rect, new GUIContent(icon, "Object Rules"), GUIStyle.none)) return;
HierarchyRulesetEditorV2.ShowInspector(_ruleset, _currentObject);
Close();
}
private void ButtonDefault(Rect rect)
{
var icon = HierarchyEditorUtility.GetDeleteButtonIcon();
if (!GUI.Button(rect, new GUIContent(icon, "Revert to Default"), GUIStyle.none)) return;
_currentRule.Priority = 0;
_currentRule.IconType = HierarchyIcon.None;
_currentRule.IconTexture = null;
_currentRule.IsIconRecursive = false;
_currentRule.BackgroundType = HierarchyBackground.None;
_currentRule.BackgroundTexture = null;
_currentRule.IsBackgroundRecursive = false;
}
private void ButtonCancel(Rect rect)
{
if (!GUI.Button(rect, "Cancel")) return;
Close();
}
private void ButtonApply(Rect rect)
{
if (!GUI.Button(rect, "Apply")) return;
var currentScene = _currentObject.scene;
var ruleset = HierarchyRulesetV2.GetRulesetByScene(currentScene, true);
foreach (var selectedObject in _selectedObjects)
{
// objects can be selected across multiple scenes
if (currentScene != selectedObject.scene)
{
currentScene = selectedObject.scene;
ruleset = HierarchyRulesetV2.GetRulesetByScene(currentScene, true);
}
_currentRule.GameObject = _currentRule.Type == KeyType.Name ? null : selectedObject;
_currentRule.Name = _currentRule.Type == KeyType.Name ? selectedObject.name : null;
Undo.RecordObject(ruleset, "Rainbow Hierarchy Ruleset Changes");
ruleset.UpdateRule(selectedObject, _currentRule);
}
Close();
}
private void ChangeWindowSize(bool hasCustomIcon, bool hasCustomBackground)
{
var rect = position;
var customIconHeight = (hasCustomIcon) ? LINE_HEIGHT + 1f : 0f;
var customBackgroundHeight = (hasCustomBackground) ? LINE_HEIGHT + 1f : 0f;
var resizeHeight = WINDOW_HEIGHT + customIconHeight + customBackgroundHeight;
if (resizeHeight == rect.height) return;
rect.height = resizeHeight;
position = rect;
_windowRect.height = rect.height;
_backgroundRect.height = rect.height - 2f;
}
private void DrawIconsPopup(Rect rect, HierarchyRule rule)
{
var menuName = (_currentRule.HasCustomIcon()) ? "Custom" : _currentRule.IconType.ToString();
if (!GUI.Button(rect, new GUIContent(menuName), "MiniPopup")) return;
var window = HierarchyIconsPopup.GetDraggableWindow();
window.ShowWithParams(position.position + rect.position, rule, this);
}
private void DrawBackgroundsPopup(Rect rect, HierarchyRule rule)
{
var menuName = _currentRule.HasCustomBackground() ? "Custom" : _currentRule.BackgroundType.ToString();
if (!GUI.Button(rect, new GUIContent(menuName), "MiniPopup")) return;
var window = HierarchyBackgroundsPopup.GetDraggableWindow();
window.ShowWithParams(position.position + rect.position, rule, this);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 45b1cbaf79679e04ab0123ee46b27e60
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Windows/HierarchyPopupWindow.cs
uploadId: 716077

View File

@@ -0,0 +1,172 @@
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using static Borodar.RainbowHierarchy.ColorHelper;
namespace Borodar.RainbowHierarchy
{
public abstract class HierarchySelectionPopup<T> : CoreDraggablePopupWindow where T : System.Enum
{
protected const float PADDING = 4f;
protected const float SPACING = 1f;
protected const float LINE_HEIGHT = 18f;
protected const float LABELS_WIDTH = 90f;
protected const float PREVIEW_SIZE_SMALL = 16f;
protected const float PREVIEW_SIZE_LARGE = 64f;
protected Vector2 ScrollPos;
protected Vector2 ScrollPos2;
protected dynamic HierarchyRule;
protected bool IsRuleSerialized;
private EditorWindow _parent;
private Rect _windowRect;
private Rect _backgroundRect;
//---------------------------------------------------------------------
// Properties
//---------------------------------------------------------------------
protected abstract Vector2 WindowSize { get; }
protected abstract int GridColumns { get; }
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public void ShowWithParams(Vector2 inPosition, dynamic hierarchyRule, EditorWindow parent = null)
{
var rect = new Rect(inPosition, WindowSize);
_windowRect = new Rect(Vector2.zero, rect.size);
_backgroundRect = new Rect(Vector2.one, rect.size - new Vector2(2f, 2f));
HierarchyRule = hierarchyRule;
_parent = parent;
IsRuleSerialized = parent == null;
Show<HierarchyPopupWindow>(rect);
}
//---------------------------------------------------------------------
// Messages
//---------------------------------------------------------------------
protected override void OnGUI()
{
base.OnGUI();
if (focusedWindow != this) Close();
var rect = _windowRect;
DrawBackground();
rect.x = PADDING;
rect.y = PADDING;
rect.width = WindowSize.x - LABELS_WIDTH - 2f * PADDING;
rect.height = WindowSize.y - 2f * PADDING;
DrawIcons(rect);
rect.x += rect.width + 1f;
rect.width = 2f;
DrawSeparators(rect);
rect.x += rect.width + PADDING * 1.5f;
rect.y += 1f;
rect.width = LABELS_WIDTH - PADDING * 2.5f;
rect.height = LINE_HEIGHT;
DrawButtons(rect);
}
//---------------------------------------------------------------------
// Protected
//---------------------------------------------------------------------
protected void CloseAndRepaintParent()
{
_parent.Repaint();
Close();
}
protected void ApplyPropertyChangesAndClose(SerializedProperty projectItem)
{
var serializedObject = projectItem.serializedObject;
serializedObject.ApplyModifiedProperties();
HierarchyRulesetV2.OnRulesetChangeCallback();
Close();
}
protected static Vector2 BeginScrollView(Vector2 scrollPos)
{
return EditorGUILayout.BeginScrollView(scrollPos, false, true,
GUIStyle.none, GUI.skin.verticalScrollbar, GUI.skin.scrollView);
}
protected override bool IsDragModifierPressed(Event e)
{
return HierarchyPreferences.IsDragModifierPressed(e);
}
protected void DrawIconsGrid(IReadOnlyList<T> icons)
{
var count = icons.Count();
var rows = Mathf.Ceil((float) count / GridColumns);
for (var i = 0; i < rows; i++)
{
GUILayout.BeginHorizontal();
for (var j = 0; j < GridColumns; j++)
{
var id = i * GridColumns + j;
if (id >= count)
{
GUILayout.FlexibleSpace();
break;
}
DrawIconButton(icons[id]);
}
GUILayout.EndHorizontal();
}
}
protected abstract void DrawIconButton(T icon);
protected abstract void DrawButtons(Rect rect);
protected abstract void DrawIcons(Rect rect);
//---------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------
private void DrawBackground()
{
var isProSkin = EditorGUIUtility.isProSkin;
var borderColor = isProSkin ? POPUP_BORDER_CLR_PRO : POPUP_BORDER_CLR_FREE;
EditorGUI.DrawRect(_windowRect, borderColor);
var backgroundColor = isProSkin ? POPUP_BACKGROUND_CLR_PRO : POPUP_BACKGROUND_CLR_FREE;
EditorGUI.DrawRect(_backgroundRect, backgroundColor);
}
private void DrawSeparators(Rect rect)
{
var color1 = (EditorGUIUtility.isProSkin) ? SEPARATOR_CLR_1_PRO : SEPARATOR_CLR_1_FREE;
var color2 = (EditorGUIUtility.isProSkin) ? SEPARATOR_CLR_2_PRO : SEPARATOR_CLR_2_FREE;
rect.x += 0.5f * PADDING;
rect.y = 1f;
rect.width = 1f;
rect.height = WindowSize.y - 2f;
EditorGUI.DrawRect(rect, color1);
rect.x += 1f;
EditorGUI.DrawRect(rect, color2);
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bfd081adec187c342b1da7d0af61f011
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Editor/Windows/HierarchySelectionPopup.cs
uploadId: 716077

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a00a57ff27f69a34c8bd70497b86a2a3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
namespace Borodar.RainbowHierarchy
{
public enum HierarchyBackground
{
// General
None = 0,
Custom = 1,
// Colors
ClrRed = 1000,
ClrVermilion = 2000,
ClrOrange = 3000,
ClrAmber = 4000,
ClrYellow = 5000,
ClrLime = 6000,
ClrChartreuse = 7000,
ClrHarlequin = 8000,
ClrGreen = 9000,
ClrEmerald = 10000,
ClrSpringGreen = 11000,
ClrAquamarine = 12000,
ClrCyan = 13000,
ClrSkyBlue = 14000,
ClrAzure = 15000,
ClrCerulean = 16000,
ClrBlue = 17000,
ClrIndigo = 18000,
ClrViolet = 19000,
ClrPurple = 20000,
ClrMagenta = 21000,
ClrFuchsia = 22000,
ClrRose = 23000,
ClrCrimson = 24000,
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: d11d1da58916d414e836041c47f31879
timeCreated: 1445183351
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyBackground.cs
uploadId: 716077

View File

@@ -0,0 +1,10 @@
using System;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
public static class HierarchyEditorProxy
{
public static Action<GameObject> UpdateOldRuleset;
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0a990858cde84341b16a4435ab8068bb
timeCreated: 1650316756
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyEditorProxy.cs
uploadId: 716077

View File

@@ -0,0 +1,309 @@
namespace Borodar.RainbowHierarchy
{
public enum HierarchyIcon
{
// General
None = 0,
Custom = 1,
// Colors
Red = 1000,
Vermilion = 2000,
Orange = 3000,
Amber = 4000,
Yellow = 5000,
Lime = 6000,
Chartreuse = 7000,
Harlequin = 8000,
Green = 9000,
Emerald = 10000,
SpringGreen = 11000,
Aquamarine = 12000,
Cyan = 13000,
SkyBlue = 14000,
Azure = 15000,
Cerulean = 16000,
Blue = 17000,
Indigo = 18000,
Violet = 19000,
Purple = 20000,
Magenta = 21000,
Fuchsia = 22000,
Rose = 23000,
Crimson = 24000,
// General
EditorSettings = 103000,
Font = 104000,
Favorite = 104500,
GuiSkin = 105000,
Material = 106000,
PhysicMaterial = 107000,
Prefab = 108000,
SceneAsset = 109000,
ScriptableObject = 110000,
Sprite = 110050,
SpriteAtlas = 110100,
Texture2D = 110150,
Texture = 113000,
RenderTexture = 113050,
Transform = 114000,
// Animation
Animation = 117000,
AnimationClip = 117050,
AnimatorController = 117100,
AnimatorOverrideController = 117150,
AnimationState = 117200,
AnimationStateMachine = 117250,
AnimationStateTransition = 117300,
Animator = 117350,
AnyStateNode = 117400,
AvatarMask = 117450,
BlendTree = 117500,
// AR
WorldAnchor = 120000,
ArAnchor = 121000,
// Assets
DefaultAsset = 125000,
TextAsset = 125150,
TextScriptImporter = 125200,
CsScript = 125250,
ComputeShader = 125300,
JsScript = 125350,
RaytracingShader = 125400,
ShaderImporter = 125450,
StyleSheet = 125500,
VisualTreeAsset = 125550,
BooScript = 125600,
AssemblyDefinitionAsset = 125650,
MetaFile = 125700,
Shader = 125750,
ShaderVariant = 125800,
TerrainData = 125850,
// Audio
AudioChorusFilter = 130000,
AudioDistortionFilter = 131000,
AudioEchoFilter = 132000,
AudioHighPassFilter = 133000,
AudioListener = 134000,
AudioLowPassFilter = 135000,
AudioReverbFilter = 136000,
AudioReverbZone = 137000,
AudioSource = 138000,
AudioClip = 138020,
AudioMixerController = 138040,
AudioMixerGroup = 138060,
AudioMixerSnapshot = 138080,
AudioMixerView = 138100,
AudioSpatializer = 138120,
Microphone = 138140,
// Collab
CollabChanges = 138500,
CollabChangesConflict = 138550,
CollabChangesDeleted = 138600,
CollabConflict = 138650,
CollabCreate = 138700,
CollabDeleted = 138750,
CollabEdit = 138800,
CollabExclude = 138850,
CollabMoved = 138900,
// Console
ConsoleError = 139100,
ConsoleErrorGray = 139120,
ConsoleInfo = 139140,
ConsoleInfoGray = 139160,
ConsoleWarning = 139180,
ConsoleWarningGray = 139200,
ConsoleWindow = 139220,
// Effects
Halo = 139500,
LensFlare = 140000,
LineRenderer = 141000,
ParticleSystem = 142000,
Projector = 143000,
TrailRenderer = 144000,
VisualEffect = 145000,
VisualEffectAsset = 145100,
VisualEffectBlock = 145200,
VisualEffectOperator = 145300,
Flare = 145350,
// Events
EventSystem = 150000,
EventTrigger = 151000,
GraphicRaycaster = 152000,
Physics2DRaycaster = 153000,
PhysicsRaycaster = 154000,
StandaloneInputModule = 155000,
TouchInputModule = 156000,
HoloLensInputModule = 156100,
// Folders
Folder = 158000,
FolderEmpty = 158050,
FolderFavorite = 158100,
FolderOpened = 158150,
// Layout
AspectRatioFitter = 160000,
Canvas = 161000,
CanvasGroup = 162000,
CanvasScaler = 163000,
ContentSizeFitter = 164000,
GridLayoutGroup = 165000,
HorizontalLayoutGroup = 166000,
LayoutElement = 167000,
RectTransform = 168000,
RectTransformBlueprint = 168500,
VerticalLayoutGroup = 169000,
// Light
Light = 169500,
AreaLight = 169510,
DirectionalLight = 169520,
Spotlight = 169530,
LightProbes = 169540,
LightProbeGroup = 169550,
LightProbeProxyVolume = 169560,
LightingDataAsset = 169570,
LightingSettings = 169580,
LightmapParameters = 169590,
// Meshes
Mesh = 170000,
MeshFilter = 171000,
MeshRenderer = 172000,
SkinnedMeshRenderer = 173000,
TextMesh = 174000,
// Miscellaneous
AimConstraint = 180000,
ArticulationBody = 182500,
BillboardRenderer = 183000,
Grid = 184000,
LookAtConstraint = 185000,
ParentConstraint = 186000,
ParticleSystemForceField = 186500,
PositionConstraint = 187000,
RotationConstraint = 189000,
ScaleConstraint = 190000,
SpriteMask = 191000,
SpriteShapeRenderer = 192000,
Terrain = 193000,
WindZone = 194000,
// Navigation
NavMeshAgent = 200000,
NavMeshObstacle = 201000,
OffMeshLink = 202000,
NavMeshData = 202100,
// Network
NetworkAnimator = 210000,
NetworkDiscovery = 211000,
NetworkIdentity = 212000,
NetworkLobbyManager = 213000,
NetworkManager = 214000,
NetworkManagerHUD = 215000,
NetworkMigrationManager = 216000,
NetworkProximityChecker = 217000,
NetworkStartPosition = 218000,
NetworkTransform = 219000,
NetworkTransformChild = 220000,
NetworkTransformVisualizer = 221000,
// Physics 2D
AreaEffector2D = 230000,
BoxCollider2D = 231000,
BuoyancyEffector2D = 232000,
CapsuleCollider2D = 233000,
CircleCollider2D = 234000,
CompositeCollider2D = 235000,
ConstantForce2D = 236000,
DistanceJoint2D = 237000,
EdgeCollider2D = 238000,
FixedJoint2D = 239000,
FrictionJoint2D = 240000,
HingeJoint2D = 241000,
PlatformEffector2D = 242000,
PointEffector2D = 243000,
PolygonCollider2D = 244000,
RelativeJoint2D = 245000,
Rigidbody2D = 246000,
SliderJoint2D = 247000,
SpringJoint2D = 248000,
SurfaceEffector2D = 249000,
TargetJoint2D = 250000,
WheelJoint2D = 251000,
// Physics
BoxCollider = 260000,
CapsuleCollider = 261000,
CharacterController = 262000,
CharacterJoint = 263000,
Cloth = 264000,
ConfigurableJoint = 265000,
ConstantForce = 266000,
FixedJoint = 267000,
HingeJoint = 268000,
MeshCollider = 269000,
Rigidbody = 270000,
SphereCollider = 271000,
SpringJoint = 272000,
TerrainCollider = 273000,
WheelCollider = 274000,
// Playables
PlayableDirector = 280000,
// Rendering
Camera = 290000,
CanvasRenderer = 291000,
FlareLayer = 292000,
LODGroup = 296000,
OcclusionArea = 297000,
OcclusionPortal = 298000,
ReflectionProbe = 299000,
Skybox = 300000,
Cubemap = 300500,
SortingGroup = 301000,
SpriteRenderer = 302000,
StreamingController = 303000,
// Tilemap
Tilemap = 310000,
TilemapCollider2D = 311000,
TilemapRenderer = 312000,
Tile = 312100,
// UI
Button = 320000,
Dropdown = 321000,
Image = 322000,
InputField = 323000,
Mask = 324000,
RawImage = 325000,
RectMask2D = 325500,
Scrollbar = 326000,
ScrollRect = 327000,
Selectable = 328000,
Slider = 329000,
Text = 330000,
Toggle = 331000,
ToggleGroup = 332000,
Outline = 333000,
PositionAsUV1 = 334000,
Shadow = 335000,
// Video
VideoClipOld = 340000,
VideoPlayer = 341000,
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 7286c04579fc2814e8dcdc6535ff594b
timeCreated: 1445183351
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyIcon.cs
uploadId: 716077

View File

@@ -0,0 +1,117 @@
using System;
using UnityEngine;
namespace Borodar.RainbowHierarchy
{
[Serializable]
public class HierarchyRule
{
public KeyType Type;
public string Name;
public GameObject GameObject;
public int Ordinal;
public int Priority;
public HierarchyIcon IconType;
public Texture2D IconTexture;
public bool IsIconRecursive;
public HierarchyBackground BackgroundType;
public Texture2D BackgroundTexture;
public bool IsBackgroundRecursive;
public bool IsHidden;
//---------------------------------------------------------------------
// Ctors
//---------------------------------------------------------------------
public HierarchyRule(KeyType type, GameObject gameObject, string name)
{
Type = type;
GameObject = gameObject;
Name = name;
}
public HierarchyRule(HierarchyRule value)
{
Type = value.Type;
Name = value.Name;
GameObject = value.GameObject;
Ordinal = value.Ordinal;
Priority = value.Priority;
IconType = value.IconType;
IconTexture = value.IconTexture;
IsIconRecursive = value.IsIconRecursive;
BackgroundType = value.BackgroundType;
BackgroundTexture = value.BackgroundTexture;
IsBackgroundRecursive = value.IsBackgroundRecursive;
}
//---------------------------------------------------------------------
// Public
//---------------------------------------------------------------------
public void CopyFrom(HierarchyRule target)
{
Type = target.Type;
Name = target.Name;
GameObject = target.GameObject;
Ordinal = target.Ordinal;
Priority = target.Priority;
IconType = target.IconType;
IconTexture = target.IconTexture;
IsIconRecursive = target.IsIconRecursive;
BackgroundType = target.BackgroundType;
BackgroundTexture = target.BackgroundTexture;
IsBackgroundRecursive = target.IsBackgroundRecursive;
}
public bool HasIcon()
{
return IconType != HierarchyIcon.None && (!HasCustomIcon() || IconTexture != null);
}
public bool HasCustomIcon()
{
return IconType == HierarchyIcon.Custom;
}
public bool HasBackground()
{
return BackgroundType != HierarchyBackground.None && (!HasCustomBackground() || BackgroundTexture != null);
}
public bool HasCustomBackground()
{
return BackgroundType == HierarchyBackground.Custom;
}
public bool HasAtLeastOneTexture()
{
return HasIcon() || HasBackground();
}
public bool IsRecursive()
{
return IsIconRecursive || IsBackgroundRecursive;
}
//---------------------------------------------------------------------
// Nested
//---------------------------------------------------------------------
public enum KeyType
{
Object,
Name
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 490b15219bc2e7a449e56c680dbc28f1
timeCreated: 1445183351
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 106670
packageName: Rainbow Hierarchy 2
packageVersion: 2.6.2
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyRule.cs
uploadId: 716077

View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
namespace Borodar.RainbowHierarchy
{
[ExecuteInEditMode]
[HelpURL(AssetInfo.HELP_URL)]
public class HierarchyRuleset : MonoBehaviour
{
public const int VERSION = 1;
[FormerlySerializedAs("HierarchyItems")]
public List<HierarchyRule> Rules = new List<HierarchyRule>();
//---------------------------------------------------------------------
// Messages
//---------------------------------------------------------------------
private void Awake()
{
HierarchyEditorProxy.UpdateOldRuleset?.Invoke(gameObject);
}
}
}

Some files were not shown because too many files have changed in this diff Show More