您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
31 行
1.4 KiB
31 行
1.4 KiB
using System;
|
|
using System.IO;
|
|
using UnityEngine;
|
|
using UnityEngine.Experimental.Rendering;
|
|
using UnityEngine.Experimental.Rendering.LightweightPipeline;
|
|
|
|
namespace UnityEditor.Experimental.Rendering.LightweightPipeline
|
|
{
|
|
public sealed partial class DiffusionProfileSettingsEditor
|
|
{
|
|
class DoCreateNewAsset<TAssetType> : ProjectWindowCallback.EndNameEditAction where TAssetType : ScriptableObject
|
|
{
|
|
public override void Action(int instanceId, string pathName, string resourceFile)
|
|
{
|
|
var newAsset = CreateInstance<TAssetType>();
|
|
newAsset.name = Path.GetFileName(pathName);
|
|
AssetDatabase.CreateAsset(newAsset, pathName);
|
|
ProjectWindowUtil.ShowCreatedAsset(newAsset);
|
|
}
|
|
}
|
|
|
|
class DoCreateNewAssetDiffusionProfileSettings : DoCreateNewAsset<DiffusionProfileSettings> {}
|
|
|
|
[MenuItem("Assets/Create/Rendering/Diffusion profile Settings (LW)", priority = CoreUtils.assetCreateMenuPriority2)]
|
|
static void MenuCreateDiffusionProfile()
|
|
{
|
|
var icon = EditorGUIUtility.FindTexture("ScriptableObject Icon");
|
|
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<DoCreateNewAssetDiffusionProfileSettings>(), "New Diffusion Profile Settings.asset", icon, null);
|
|
}
|
|
}
|
|
}
|