-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Add support for resource conversion plugins in filesystem dock #65585
Add support for resource conversion plugins in filesystem dock #65585
Conversation
74d4782
to
069075c
Compare
Decided to revisit this and add the remaining things I wanted to add because, to be frank, the current workflow for converting standard materials to shader materials is kind of atrocious. It now gives you warning when you attempt to convert files from the filesystem dock, and although there are currently no instances where multiple conversion types are avaliable, it will now collapse the conversion choices into a submenu if more than one is present in the future. I'm not happy about the fact that I had to add a new (and fairly reduntant) function to the API. I would have much rathered change 'handles' to a string type rather than a resource type, but I realize that doing so would break the API and subsequently break GDExtensions. As such, another function is added to ResourceConverterPlugins to check handling by type name rather than resource, meaning the resources won't have to be loaded when simply right-clicking on them |
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.
Dedicated icon syntax
817864a
to
c4ffc5d
Compare
Okay thanks, implemented changes recommend by @AThousandShips |
79a2c86
to
3ed43aa
Compare
Okay, updated now |
I think You can use this trick to achieve the same functionality with a low cost: Ref<Resource> temp = ClassDB::instantiate(p_type);
for (int i = 0; i < resource_conversion_plugins.size(); i++) {
if (resource_conversion_plugins[i].is_valid() && resource_conversion_plugins[i]->handles(temp)) {
ret.push_back(resource_conversion_plugins[i]);
}
} Instantiating an empty resource is much cheaper than loading it. |
6e7a60f
to
2dacbba
Compare
f04247f
to
96a41a9
Compare
Okay @KoBeWi and @AThousandShips, I think that should address most of the issues raised. One I'm not sure about is @KoBeWi's point about setting conversion dialog text in the constructor. |
96a41a9
to
9f3e20c
Compare
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 feature works correctly. I left some more style comments, but the code is good enough to be fixed in a follow-up.
9f3e20c
to
f44bce2
Compare
Updated again! @KoBeWi I wasn't sure if that was what you meant by an 'early return', but can you confirm that the change I made was what you were suggesting? |
Yes. You could also do |
Thanks! |
Based on a past discussion for a long overdue UX feature. Makes ResourceConversionPlugins avaliable to the filesystem dock, including allowing multiple files to be batch converted in one go and updating the usage of said resources in active scenes. Keeping in draft for a bit longer since I want to look at revising some of the API naming around detecting viable conversion plugins based purely on class name to avoid having to load the resource beforehand, and possibly look into introducing a warning dialogue explaining how conversion of types is a one-way operation.
That being said, I think the majority of the implementation is fine.