-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# =============== # | ||
# Unity generated # | ||
# =============== # | ||
Temp/ | ||
Obj/ | ||
UnityGenerated/ | ||
Library/ | ||
|
||
# ===================================== # | ||
# Visual Studio / MonoDevelop generated # | ||
# ===================================== # | ||
ExportedObj/ | ||
*.svd | ||
*.userprefs | ||
*.csproj | ||
*.pidb | ||
*.suo | ||
*.sln | ||
*.user | ||
*.unityproj | ||
*.booproj | ||
|
||
# ============ # | ||
# OS generated # | ||
# ============ # | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
Icon? | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# ============ # | ||
# for others # | ||
# ============ # | ||
|
||
*.log #log files, for some plugins | ||
*.pyc #python bytecode cache, for some plugins. | ||
sysinfo.txt #Unity3D Generated File On Crash Reports |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
///----------------------------------- | ||
/// AssetBookmarker | ||
/// @ 2016 RNGTM(https://github.com/rngtm) | ||
///----------------------------------- | ||
namespace AssetBookmarker | ||
{ | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
/// <summary> | ||
/// Bookmarkのデータ | ||
/// </summary> | ||
public class BookmarkData : ScriptableObject | ||
{ | ||
[SerializeField] | ||
private List<Object> assets; | ||
|
||
/// <summary> | ||
/// ブックマークとして登録しているアセット | ||
/// </summary> | ||
public List<Object> Assets { get { return this.assets; } } | ||
|
||
/// <summary> | ||
/// アセットをブックマークへ登録 | ||
/// </summary> | ||
public void Register(Object asset) | ||
{ | ||
this.assets.Add(asset); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
///----------------------------------- | ||
/// AssetBookmarker | ||
/// @ 2016 RNGTM(https://github.com/rngtm) | ||
///----------------------------------- | ||
namespace AssetBookmarker | ||
{ | ||
using System.Linq; | ||
using System.IO; | ||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
public class BookmarkUtility : MonoBehaviour | ||
{ | ||
/// <summary> | ||
/// Bookmarkデータファイル名 | ||
/// </summary> | ||
private static readonly string DataName = "BookmarkData.asset"; | ||
|
||
/// <summary> | ||
/// Bookmarkデータのロード | ||
/// </summary> | ||
public static BookmarkData LoadData() | ||
{ | ||
var monoScript = Resources.FindObjectsOfTypeAll<MonoScript>().FirstOrDefault(m => m.GetClass() == typeof(BookmarkUtility)); | ||
var path = AssetDatabase.GetAssetPath(monoScript); | ||
var dirPath = Path.GetDirectoryName(path); | ||
var dataPath = dirPath + Path.DirectorySeparatorChar + DataName; | ||
|
||
return (BookmarkData)AssetDatabase.LoadAssetAtPath(dataPath, typeof(BookmarkData)); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
///----------------------------------- | ||
/// AssetBookmarker | ||
/// @ 2016 RNGTM(https://github.com/rngtm) | ||
///----------------------------------- | ||
namespace AssetBookmarker | ||
{ | ||
using UnityEngine; | ||
using UnityEditor; | ||
using UnityEditorInternal; | ||
|
||
/// <summary> | ||
/// ブックマークの管理を行うウィンドウ | ||
/// </summary> | ||
public class BookmarkWindow : EditorWindow | ||
{ | ||
/// <summary> | ||
/// MenuItemのPriority | ||
/// </summary> | ||
private const int Priority = 10001; | ||
|
||
/// <summary> | ||
/// Bookmarkデータ | ||
/// </summary> | ||
private static BookmarkData _data; | ||
|
||
/// <summary> | ||
/// Bookmark表示用のReorderableList | ||
/// </summary> | ||
private ReorderableList list; | ||
|
||
/// <summary> | ||
/// ウィンドウを開く | ||
/// </summary> | ||
[MenuItem("Tools/AssetBookmarker")] | ||
static void Open() | ||
{ | ||
GetWindow<BookmarkWindow>(); | ||
} | ||
|
||
/// <summary> | ||
/// ウィンドウの描画処理 | ||
/// </summary> | ||
void OnGUI() | ||
{ | ||
if (_data == null) | ||
{ | ||
_data = BookmarkUtility.LoadData(); | ||
} | ||
|
||
if (this.list == null) | ||
{ | ||
this.CreateList(); | ||
} | ||
|
||
EditorGUILayout.LabelField("ブックマークしたアセット一覧を表示します"); | ||
|
||
this.list.DoLayoutList(); | ||
} | ||
|
||
/// <summary> | ||
/// エディタ上で選択しているアセットをBookmarkへ登録 | ||
/// </summary> | ||
[MenuItem("Assets/Add to bookmark list", false, Priority)] | ||
static void RegisterSelection() | ||
{ | ||
if (_data == null) | ||
{ | ||
_data = BookmarkUtility.LoadData(); | ||
} | ||
|
||
_data.Assets.AddRange(Selection.objects); | ||
EditorUtility.SetDirty(_data); | ||
|
||
var window = Resources.FindObjectsOfTypeAll<BookmarkWindow>(); | ||
if (window == null || window.Length == 0) | ||
{ | ||
Open(); | ||
} | ||
else | ||
{ | ||
window[0].Repaint(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// RegisterSelectionのValidateメソッド | ||
/// </summary> | ||
[MenuItem("Assets/Add to bookmark list", true, Priority)] | ||
static bool ValidateRegisterSelection() | ||
{ | ||
return Selection.activeObject != null; | ||
} | ||
|
||
/// <summary> | ||
/// ReorderableListを作成する | ||
/// </summary> | ||
void CreateList() | ||
{ | ||
this.list = new ReorderableList(_data.Assets, typeof(Object)); | ||
|
||
this.list.drawHeaderCallback = (rect) => | ||
{ | ||
EditorGUI.LabelField(rect, "Bookmarks"); | ||
}; | ||
|
||
// 要素の描画 | ||
this.list.drawElementCallback = (rect, index, isActive, isFocused) => | ||
{ | ||
rect.y += 1; | ||
rect.height -= 4; | ||
|
||
var labelRect = new Rect(rect); | ||
labelRect.width = 17f; | ||
|
||
var objectRect = new Rect(rect); | ||
objectRect.width -= labelRect.width; | ||
objectRect.x += labelRect.width; | ||
|
||
EditorGUI.LabelField(labelRect, index.ToString()); | ||
|
||
EditorGUI.BeginChangeCheck(); | ||
var asset = (Object)list.list[index]; | ||
asset = EditorGUI.ObjectField(objectRect, asset, typeof(Object), false); | ||
if (EditorGUI.EndChangeCheck()) | ||
{ | ||
Debug.Log("Changed"); | ||
list.list[index] = asset; | ||
EditorUtility.SetDirty(_data); | ||
} | ||
}; | ||
|
||
// フッター描画 | ||
this.list.drawFooterCallback = (rect) => | ||
{ | ||
if (this.list.count == 0) | ||
{ | ||
rect.position -= new Vector2(0f, this.list.elementHeight + this.list.headerHeight + 3f); | ||
} | ||
else | ||
{ | ||
rect.position -= new Vector2(0f, this.list.elementHeight * this.list.count + this.list.headerHeight + 3f); | ||
} | ||
ReorderableList.defaultBehaviours.DrawFooter(rect, list); | ||
}; | ||
|
||
this.list.onChangedCallback += (index) => | ||
{ | ||
EditorUtility.SetDirty(_data); | ||
}; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
m_EditorVersion: 5.5.0b7 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Unity-AssetBookmarker | ||
============ | ||
**AssetBookmarker** is a tool to bookmark Unity assets. | ||
|
||
Usage | ||
------- | ||
1) Right-click the asset which you want to bookmark. | ||
![](./Demo/1.png) | ||
|
||
<br> | ||
|
||
2) Select "Add to bookmark list" in context menu. | ||
![](./Demo/2.png) | ||
|
||
<br> | ||
|
||
That's it! | ||
![](./Demo/3.png) | ||
|
||
|
||
License | ||
------- | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 RNGTM (https://github.com/rngtm) | ||
|
||
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. |