Adding proper GUI / code for custom model support (gui reimplementation from mcyoung) #128
Adding proper GUI / code for custom model support (gui reimplementation from mcyoung) #128Teotia444 wants to merge 13 commits intoSuperDude88:mainfrom
Conversation
| int fileCount = std::count_if( | ||
| begin(std::filesystem::directory_iterator(Utility::get_models_dir())), | ||
| end(std::filesystem::directory_iterator(Utility::get_models_dir())), | ||
| [](auto& entry) { return entry.is_directory(); } | ||
| ); |
There was a problem hiding this comment.
std::vector<fspath> models;
for (auto& dirent : std::filesystem::directory_iterator(Utility::get_models_dir())) {
if (dirent.is_directory()) models.push(dirent.path());
}
std::sort(models.begin(), models.end()); // readdir order isn't deterministic| Utility::platformLog("Applying custom model " + modelName + "..."); | ||
|
|
||
| auto model = Utility::get_models_dir() / modelName; | ||
| if (modelName == "random") { |
There was a problem hiding this comment.
Perhaps this should not overload the value of modelName, since people will get confused if they name a model random...
There was a problem hiding this comment.
I've replaced "random" with "?" as it is a forbidden character in Windows, which is already less likely to cause issues. I agree tho, modelName should probably not be overloaded and i should just add a new attribute, i'm lazy tho :)
There was a problem hiding this comment.
Just tossing ideas out since I haven't really dug through the old code/new code in a while -- but I think logically an empty string would make sense for a random model, basically equivalent to "no specific one provided"
That assumes an empty name isn't used as an error/validity condition anywhere, but honestly the error handling in my original custom model class is already bad so I'll need to rework that part of the system at some point regardless
cleaner code for model fetcher and fixed potential issue with overloading modelName
This PR is a re-implementation of a re-implementation from McYoung that contains code for a custom model subpage.
(from mcy's pr) The PR contains :
This PR still doesn't contain the desktop code, but i'll probably open another one containing just that.
Very quick video showing how the added tabs look :
https://github.com/user-attachments/assets/473a9408-056b-4dca-a6b9-efd0b420c6e3
(can provide more if needed)