-
Notifications
You must be signed in to change notification settings - Fork 796
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7966 from Unity-Technologies/internal/master
Internal/master
- Loading branch information
Showing
1,438 changed files
with
466,278 additions
and
52,916 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
Packages/com.unity.render-pipelines.core/Editor/AssetDatabaseHelper.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,34 @@ | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace UnityEditor.Rendering | ||
{ | ||
/// <summary> Set of helpers for AssetDatabase operations. </summary> | ||
public static class AssetDatabaseHelper | ||
{ | ||
/// <summary> | ||
/// Finds all assets of type T in the project. | ||
/// </summary> | ||
/// <param name="extension">Asset type extension i.e ".mat" for materials</param> | ||
/// <typeparam name="T">The type of material you are looking for</typeparam> | ||
/// <returns></returns> | ||
public static IEnumerable<T> FindAssets<T>(string extension = null) | ||
{ | ||
string typeName = typeof(T).ToString(); | ||
int i = typeName.LastIndexOf('.'); | ||
if (i != -1) | ||
{ | ||
typeName = typeName.Substring(i+1, typeName.Length - i-1); | ||
} | ||
|
||
string query = !string.IsNullOrEmpty(extension) ? $"t:{typeName} glob:\"**/*{extension}\"" : $"t:{typeName}"; | ||
|
||
foreach (var guid in AssetDatabase.FindAssets(query)) | ||
{ | ||
var asset = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(guid)); | ||
if (asset is T castAsset) | ||
yield return castAsset; | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Packages/com.unity.render-pipelines.core/Editor/AssetDatabaseHelper.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
3 changes: 3 additions & 0 deletions
3
Packages/com.unity.render-pipelines.core/Editor/GPUDriven.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
Packages/com.unity.render-pipelines.core/Editor/GPUDriven/GPUResidentDrawerEditorUtils.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,33 @@ | ||
using System.IO; | ||
using UnityEngine; | ||
using UnityEngine.Rendering; | ||
|
||
namespace UnityEditor.Rendering | ||
{ | ||
internal class GPUResidentDrawerEditorUtils | ||
{ | ||
class DoCreateNewAssetGPUResidentDrawerResources : ProjectWindowCallback.EndNameEditAction | ||
{ | ||
public override void Action(int instanceId, string pathName, string resourceFile) | ||
{ | ||
var newAsset = CreateInstance<GPUResidentDrawerResources>(); | ||
newAsset.name = Path.GetFileName(pathName); | ||
|
||
ResourceReloader.ReloadAllNullIn(newAsset, "Packages/com.unity.render-pipelines.core/"); | ||
|
||
AssetDatabase.CreateAsset(newAsset, pathName); | ||
ProjectWindowUtil.ShowCreatedAsset(newAsset); | ||
} | ||
} | ||
|
||
// Hide: User aren't suppose to have to create it. | ||
//[MenuItem("Assets/Create/Rendering/GPU Resident Drawer Resources", priority = CoreUtils.Sections.section7 + CoreUtils.Priorities.assetsCreateRenderingMenuPriority + 2)] | ||
static void CreateGPUResidentDrawerResources() | ||
{ | ||
var icon = EditorGUIUtility.FindTexture("ScriptableObject Icon"); | ||
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, | ||
ScriptableObject.CreateInstance<DoCreateNewAssetGPUResidentDrawerResources>(), | ||
"New GPUResidentDrawerResources.asset", icon, null); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ges/com.unity.render-pipelines.core/Editor/GPUDriven/GPUResidentDrawerEditorUtils.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
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.