ProwlEngine / Prowl

An Open Source C# 3D Game Engine under MIT license, inspired by Unity and featuring a complete editor and built on Silk.NET
MIT License
413 stars 33 forks source link

[Editor] AssetsWindow.Ping(Guid) - Asset Pinging #71

Closed michaelsakharov closed 10 months ago

michaelsakharov commented 11 months ago

Ping an asset to show the user were it is in the AssetsWindow and AssetBrowser

10xJosh commented 11 months ago

I can do this one, was there a specific way you wanted this implemented?

michaelsakharov commented 11 months ago

I can do this one, was there a specific way you wanted this implemented?

Thinking about it more I think it makes sense to be inside AssetDatabase in the Editor, so like:

public static event Action<string>? PingAsset;
AssetDatabase.Ping(Guid) => Ping(GuidToPath(Guid));
AssetDatabase.Ping(RelativeAssetPath) => PingAsset?.Invoke(RelativeAssetPath);

So both AssetsWindow and AssetBrowser can hook onto the PingAsset event. Then find the RelativeAssetPath in the project and select it and its parent directory.

This part isn't required but would be nice, to show a yellow bright highlight around file/folder in both the AssetsWindow and AssetBrowser, there's a Utility function to do that, GuiHelper.ItemRect()

The idea is we can make it so that when you click on an Asset in the inspector, it will ping it for you to quickly find it.

10xJosh commented 11 months ago

Alrighty I'll get started on this soon!

10xJosh commented 10 months ago

Yo.. my bad man I don't think I can do this one. I've been trying to wrap my head around the ImGui stuff for a while now and I'm not comfortable enough to propose any real change to implement this feature. Very sorry!

michaelsakharov commented 10 months ago

All good, Thanks for letting me know

michaelsakharov commented 10 months ago

Added https://gyazo.com/67b42cf80dc3b4e1bdbd5d3af28bc090.mp4