-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
306 additions
and
27 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
Assets/AssetBookmarker/Core/Editor/GenericDataGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
///----------------------------------------- | ||
/// AssetBookmarker | ||
/// @ 2016 RNGTM(https://github.com/rngtm) | ||
///----------------------------------------- | ||
namespace AssetBookmarker | ||
{ | ||
using System.IO; | ||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
/// <summary> | ||
/// ファイルの作成を行うクラス | ||
/// </summary> | ||
public static class GenericDataGenerator | ||
{ | ||
public static T CreateData<T>(string rootFolderName, string saveFolderRelativePath, string dataName) where T : ScriptableObject | ||
{ | ||
var guid = AssetDatabase.FindAssets(rootFolderName)[0]; | ||
var rootDirectory = AssetDatabase.GUIDToAssetPath(guid); | ||
var directory = Path.Combine(rootDirectory, saveFolderRelativePath); | ||
if (string.IsNullOrEmpty(rootDirectory)) | ||
{ | ||
directory = "Assets"; | ||
} | ||
|
||
var name = dataName + ".asset"; | ||
var path = Path.Combine(directory, name); | ||
var instance = ScriptableObject.CreateInstance<T>(); | ||
ProjectWindowUtil.CreateAsset(instance, path); | ||
|
||
return instance; | ||
} | ||
|
||
public static T CreateDataImmediately<T>(string rootFolderName, string saveFolderRelativePath, string dataName) where T : ScriptableObject | ||
{ | ||
var guid = AssetDatabase.FindAssets(rootFolderName)[0]; | ||
var rootDirectory = AssetDatabase.GUIDToAssetPath(guid); | ||
var directory = Path.Combine(rootDirectory, saveFolderRelativePath); | ||
if (string.IsNullOrEmpty(rootDirectory)) | ||
{ | ||
directory = "Assets"; | ||
} | ||
|
||
var name = dataName + ".asset"; | ||
var path = Path.Combine(directory, name); | ||
var instance = ScriptableObject.CreateInstance<T>(); | ||
AssetDatabase.CreateAsset(instance, path); | ||
Debug.Log("Create: " + path, instance); | ||
|
||
return instance; | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Assets/AssetBookmarker/Core/Editor/GenericDataGenerator.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Assets/AssetBookmarker/Project/Editor/Model/ExportConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
///----------------------------------------- | ||
/// AssetBookmarker | ||
/// @ 2016 RNGTM(https://github.com/rngtm) | ||
///----------------------------------------- | ||
namespace AssetBookmarker.Project | ||
{ | ||
/// <summary> | ||
/// Export設定 | ||
/// </summary> | ||
public static class ExportConfig | ||
{ | ||
/// <summary> | ||
/// AssetBookmarkerのルートフォルダ名 | ||
/// </summary> | ||
public const string RootFolderName = "AssetBookmarker"; | ||
|
||
/// <summary> | ||
/// Bookmarkデータの保存先の相対パス | ||
/// </summary> | ||
public const string SaveFolderRelativePath = "Project/Data"; | ||
|
||
/// <summary> | ||
/// 新規Bookmarkデータのデフォルトの名前 | ||
/// </summary> | ||
public const string DefaultNewTodoName = "NewBookmarkData"; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Assets/AssetBookmarker/Project/Editor/Model/ExportConfig.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.