protected override OdinMenuTree BuildMenuTree() { var setting = GetOrCreateSetting(); OdinMenuTree tree = new OdinMenuTree(supportsMultiSelect: true) { { "Setting", setting }, }; var paths = setting.AssetPaths; for (int i = 0; i < paths.Count; i++) { if (paths[i].AssetPath != string.Empty) { tree.AddAssetAtPath(paths[i].Name, paths[i].AssetPath); } if (paths[i].FolderPath != string.Empty) { tree.AddAllAssetsAtPath(paths[i].Name, paths[i].FolderPath, typeof(ScriptableObject), true); } } tree.EnumerateTree().AddIcons <IGetIcon>(x => x.GetIcon()); tree.DefaultMenuStyle.IconSize = 34f; tree.DefaultMenuStyle.IconPadding = 0f; tree.DefaultMenuStyle.SetIconOffset(-5f); tree.DefaultMenuStyle.SetOffset(5f); tree.Config.DrawSearchToolbar = true; return(tree); }
private SomeData someData = new SomeData(); // Take a look at SomeData to see how serialization works in Editor Windows. protected override OdinMenuTree BuildMenuTree() { OdinMenuTree tree = new OdinMenuTree(supportsMultiSelect: true) { { "Home", this, EditorIcons.House }, // draws the someDataField in this case. { "Odin Settings", null, EditorIcons.SettingsCog }, { "Odin Settings/Color Palettes", ColorPaletteManager.Instance, EditorIcons.EyeDropper }, { "Odin Settings/AOT Generation", AOTGenerationConfig.Instance, EditorIcons.SmartPhone }, { "Camera current", Camera.current }, { "Some Class", this.someData } }; tree.AddAllAssetsAtPath("More Odin Settings", SirenixAssetPaths.OdinEditorConfigsPath, typeof(ScriptableObject), true) .AddThumbnailIcons(); tree.AddAssetAtPath("Odin Getting Started", SirenixAssetPaths.SirenixPluginPath + "Getting Started With Odin.asset"); tree.MenuItems.Insert(2, new OdinMenuItem(tree, "Menu Style", tree.DefaultMenuStyle)); tree.Add("Menu/Items/Are/Created/As/Needed", new GUIContent()); tree.Add("Menu/Items/Are/Created", new GUIContent("And can be overridden")); // As you can see, Odin provides a few ways to quickly add editors / objects to your menu tree. // The API also gives you full control over the selection, etc.. // Make sure to check out the API Documentation for OdinMenuEditorWindow, OdinMenuTree and OdinMenuItem for more information on what you can do! return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(); tree.Selection.SupportsMultiSelect = false; tree.Add("Settings", GeneralDrawerConfig.Instance); tree.Add("Utilities", new TextureUtilityEditor()); tree.Add("Utilities/MyStruct", new MyStruct()); tree.AddAllAssetsAtPath("Odin Settings", "", typeof(ScriptableObject), true, true); return(tree); var tree2 = new OdinMenuTree(); tree2.DefaultMenuStyle = OdinMenuStyle.TreeViewStyle; tree2.Add("Menu Style", tree2.DefaultMenuStyle); var allAssets = AssetDatabase.GetAllAssetPaths() .Where(x => x.StartsWith("Assets/")) .OrderBy(x => x); foreach (var path in allAssets) { tree2.AddAssetAtPath(path.Substring("Assets/".Length), path); } tree2.EnumerateTree().AddThumbnailIcons(); return(tree2); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(false); tree.DefaultMenuStyle.SetHeight(50); tree.DefaultMenuStyle.SetIconSize(40); tree.Config.DrawSearchToolbar = true; tree.AddAssetAtPath("UnitTypes", GV.UnitSoPath + GV.UnitTypesAsset, typeof(UnitTypes)).AddIcon(EditorIcons.Globe); tree.Add("Player", null, EditorIcons.Flag); tree.Add("Player/PlayerUnits", null, TextureManager.Instance.GetFirstLike("Man_1_nobg")); tree.AddAllAssetsAtPath("Player/PlayerUnits", GV.UnitSoPath, typeof(PlayerUnitData), true, true); tree.EnumerateTree().AddIcons <PlayerUnitData>(x => x.icon); tree.AddAssetAtPath("Player/Inventory", GV.InventorySoPath + GV.EditorInventoryAsset).AddIcon(TextureManager.Instance.GetFirstLike("bag")); tree.Add("EnemyUnits", null, EditorIcons.Crosshair); tree.AddAllAssetsAtPath("EnemyUnits", GV.UnitSoPath, typeof(EnemyUnitData), true, true); tree.EnumerateTree().AddIcons <EnemyUnitData>(x => x.icon); tree.Add("Abilities", null, EditorIcons.GridImageTextList); tree.AddAllAssetsAtPath("Abilities", GV.AbilitiesSoPath, typeof(Ability), true).ForEach(AddDragHandles); tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); tree.EnumerateTree().AddIcons <Ability>(x => x.icon); tree.Add("Items", null, EditorIcons.ShoppingBasket); tree.Add("Items/Weapons", null, TextureManager.Instance.GetFirstLike("sword_nobg")); tree.AddAllAssetsAtPath("Items/Weapons", GV.ItemsSoPath, typeof(Weapon), true).ForEach(AddDragHandles); tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); tree.EnumerateTree().AddIcons <Item>(x => x.icon); tree.Add("Items/Armor", null, TextureManager.Instance.GetFirstLike("armor")); tree.AddAllAssetsAtPath("Items/Armor", GV.ItemsSoPath, typeof(Armor), true).ForEach(AddDragHandles); tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); tree.EnumerateTree().AddIcons <Item>(x => x.icon); tree.Add("Items/Consumables", null, TextureManager.Instance.GetFirstLike("potion_nobg")); tree.AddAllAssetsAtPath("Items/Consumables", GV.ItemsSoPath, typeof(Consumable), true).ForEach(AddDragHandles); tree.EnumerateTree().Where(x => x.Value as Item).ForEach(AddDragHandles); tree.EnumerateTree().AddIcons <Item>(x => x.icon); return(tree); }
protected override OdinMenuTree BuildMenuTree() { OdinMenuTree tree = new OdinMenuTree(supportsMultiSelect: true) { }; tree.AddAssetAtPath("Build", "Configs/Editor/Build/Build.asset"); tree.AddAllAssetsAtPath("", "", typeof(BuildSteps_Config), includeSubDirectories: true, flattenSubDirectories: true) .AddThumbnailIcons(); return(tree); }
protected override void BuildSelectionTree(OdinMenuTree tree) { tree.Config.DrawSearchToolbar = true; tree.Selection.SupportsMultiSelect = false; AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => typeof(CLASS).IsAssignableFrom(p)) .SelectMany(t => AssetDatabase.FindAssets("t:" + t.Name)) .Select(assetGUID => AssetDatabase.GUIDToAssetPath(assetGUID)) .ForEach((string p_path) => { tree.AddAssetAtPath(p_path, p_path); }); }
protected override OdinMenuTree BuildMenuTree() { _dbList.Clear(); var tree = new OdinMenuTree(true); tree.DefaultMenuStyle.IconSize = 28.00f; tree.Config.DrawSearchToolbar = true; var ids = AssetDatabase.FindAssets("t:ScriptableDatabase"); for (int i = 0; i < ids.Length; i++) { var obj = AssetDatabase.LoadAssetAtPath <ScriptableDatabase>(AssetDatabase.GUIDToAssetPath(ids[i])); if (obj != null) { _dbList.Add(obj); } } RefreshDbs(); for (int i = 0; i < _dbList.Count; i++) { var db = _dbList[i]; var dbTable = db.GetEditorWindow(); if (dbTable != null) { tree.Add(db.name, dbTable); } else { tree.AddObjectAtPath(db.name, db, false); } var dbObjs = db.AllObjects; if (dbObjs == null) { continue; } foreach (var dbObj in dbObjs) { if (dbObj == null) { continue; } tree.AddAssetAtPath(db.name + "/" + dbObj.name, AssetDatabase.GetAssetPath(dbObj)); } } tree.EnumerateTree().AddIcons <ICustomPreview>(m => m.GetPreviewTexture()); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); tree.DefaultMenuStyle = CaomaoGUIStyle.DefaultMenuStyle; tree.Config.DrawSearchToolbar = true; tree.AddObjectAtPath("本地化操作", this.operatorIns); tree.AddAllAssetsAtPath("本地化ScriptableObject文件", this.operatorIns.SBFolderPath, true, false); tree.AddAllAssetsAtPath("本地化Excel文件", this.operatorIns.ExcelFolderPath, true, false); tree.AddAssetAtPath("脚本常量模板", this.operatorIns.TemplateFilePath); tree.EnumerateTree().AddThumbnailIcons(); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(); tree.DefaultMenuStyle = OdinMenuStyle.TreeViewStyle; tree.Add("Menu Style", tree.DefaultMenuStyle); var allAssets = AssetDatabase.GetAllAssetPaths() .Where(x => x.StartsWith("Assets/")) .OrderBy(x => x); foreach (var path in allAssets) { tree.AddAssetAtPath(path.Substring("Assets/".Length), path); } tree.EnumerateTree().AddThumbnailIcons(); return(tree); }