godot-asset-library icon indicating copy to clipboard operation
godot-asset-library copied to clipboard

No reliable Way to find Assets made with C#

Open jcommander opened this issue 1 year ago • 7 comments

Typing "C#" into the Search Box just displays all kinds of Assets, maybe the # gets filtered out of the search or its just too short. Maybe the Project's Github Statistic for used programming language could be pulled and those containing C# could get flagged so a Filter could also be added for it.

This would be useful for C# Users that want to find reference Code/Projects and would like to keep their Projects in C# entirely.

jcommander avatar Oct 30 '22 16:10 jcommander

Related to https://github.com/godotengine/godot-asset-library/issues/250.

The asset library rewrite features a tag system, but there's no ETA for deploying it.

Calinou avatar Oct 30 '22 20:10 Calinou

Great, I hope it's making progress.

But besides this, I've noticed the '#' does get escaped out of the search filter (just like dots, semicolons etc.) So if you search for "C#" (or even "C################" for that matter), you will still only get results for "C".

Would it be possible to ignore the Character '#' without security impediments or maybe just allow the Search Term "C#" so you can find it when it's put in the Title?

jcommander avatar Nov 01 '22 07:11 jcommander

Would it be possible to ignore the Character '#' without security impediments or maybe just allow the Search Term "C#" so you can find it when it's put in the Title?

The code is here:

https://github.com/godotengine/asset-library/blob/342e663d7902bbafcce71998567606ebc5fda662/src/routes/asset.php#L47-L49

It might be possible but it's not trivial. I don't have plans to work on it personally, so feel free to look into it.

Calinou avatar Nov 01 '22 15:11 Calinou

Since the rewrite project has been discontinued, are there any plans for the AssetLib to enable filtering by language? I'd love to use as many C# tools as I can since it's easier to develop with a somewhat unified codebase.

LauraWebdev avatar Oct 24 '23 12:10 LauraWebdev

Since the rewrite project has been discontinued, are there any plans for the AssetLib to enable filtering by language? I'd love to use as many C# tools as I can since it's easier to develop with a somewhat unified codebase.

This is the same issue as adding tags to the asset library. It requires adding a tags system, which implies a database migration and changes to the editor frontend to be able to filter by tag instead of using categories.

Converting old categories to tags is easy, but doing all the work around tagging is nontrivial. Old assets will also be missing tags (other than the legacy category tag) unless their author edits the asset in question.

Calinou avatar Oct 24 '23 23:10 Calinou

The code is here:

https://github.com/godotengine/asset-library/blob/342e663d7902bbafcce71998567606ebc5fda662/src/routes/asset.php#L47-L49

It might be possible but it's not trivial. I don't have plans to work on it personally, so feel free to look into it.

Okay, so after looking into it again, the line of code seems to miss it's purpose to me. Looking at its git blame, #251 mentions it's to trim whitespaces. Not only does preg_replace('/[[:punct:]]+/', cut way more, testing it doesn't even trim whitespaces properly for me. Shouldn't trim() be used here? Running

$testStr = "  C# Script   ";
echo '%'.preg_replace('/[[:punct:]]+/', '%', $testStr).'%';
echo '%'.trim($testStr).'%';

returns

% C% Script %
%C# Script%

PHP Playground

jcommander avatar Oct 25 '23 15:10 jcommander

Shouldn't trim() be used here?

Both are used, as the output of trim() is passed to preg_replace(). I don't know why preg_replace() was originally used here though (there is nothing about it in git blame).

Calinou avatar Oct 25 '23 18:10 Calinou