-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added filtering by asset type in the AssetBrowser #20025
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some padding around the checkboxes:
Perhaps we need a better way to create this kind of dropdowns as they are used in several places and as far as remember setting them up them is a bit of a pain.
And on another note - what do we gain from listing unknown types? The asset browser won't be able to display them anyway, right?
Added spacing in map editor dropdowns, added missing file extension to AssetBrowser in mod manifests and added a filter to not show engine files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change to fix 1. is squashed into the relevant commit, but here it is standalone: --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs
// Don't show unknown files in the engine dir - it is full of code and git and IDE files.
// But do show supported types that are inside just in case.
+ // Also don't show "files" without extensions because those may be folders.
var fileExtension = Path.GetExtension(file.Key.ToLowerInvariant());
- if (package.Name == Platform.EngineDir && !allowedExtensions.Contains(fileExtension))
+ if (string.IsNullOrWhiteSpace(fileExtension) || (package.Name == Platform.EngineDir && !allowedExtensions.Contains(fileExtension)))
continue;
AddAsset(assetList, file.Key, package, template); The change to fix 2. got its own commit. |
Re #20025 (comment): Why do we have to check if there is an extension to determine if it is a folder, and can't use something like |
Yes, we're talking about "entries" inside packages, so we can't really check and we resort to guessing. Also rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Don't show unknown files in the engine dir - it is full of code and git and IDE files. | ||
// But do show supported types that are inside just in case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like this, as it is hidden and not visible to the outside at all. Besides, when you select unknown
, aren't you exactly asking for this? A much better fix would be making the list with packages also one where you can tick/untick packages and maybe have the engine dir unticked by default? (Fwiw, several of the files in the engine dir will already be filtered by the "no extension" rule.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when you select unknown, aren't you exactly asking for this?
Yes, but I was previously asked to hide engine files so I added this 🤷♂️
I agree it would be good, but not in this PR (although that doesn't mean I'm volunteering to do it later either, sorry). I could add a blacklist, but what do we put in there - extensions? Packages? File names? Honestly I would like to wrap this (supposedly simple) feature up because the more I stare at the Rebased and fixed the minor nit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM. This PR is fixing tiny things all over the codebase which are completely unrelated to this PR and be better served in separate PR's. It just unnecessarily makes it harder to merge this
These are all file extensions used by the respective mods ingame, so they should be visible in the asset browser as well.
223052d
to
2895457
Compare
Rebased, dropping 4 of the 7 commits as they were merged in #20235. |
Closes #3493.