poly-hammer / BlenderTools

Blender addons that improve the game development workflow between Blender and Unreal.
https://poly-hammer.github.io/BlenderTools/
MIT License
234 stars 15 forks source link

SendToUE - Exporting hair can fail due to spurious validation error when checking for enabled plugins #62

Closed dannymcgee closed 3 months ago

dannymcgee commented 3 months ago

Sorry this doesn't follow the typical template of repro steps, etc. The repro is a bit niche and tedious to describe, and I've already done the work of tracking down the root cause, so hopefully this is okay.

In the UnrealRemoteCalls class (in dependencies/unreal.py), the get_enabled_plugins() method uses a flawed procedure that will never return a complete list of actually enabled plugins for a given project. Currently it reads and parses the .uproject file as JSON, and simply maps the Plugins array to its entry Names, filtering for entries where Enabled is true. This will always be an inexhaustive list for a couple of reasons:

This is problematic because get_enabled_plugins() is used by the ValidationManager, which will fail with an error if you try to export a hair system while the "Groom" plugin is not found to be enabled. I ran into this issue while using a third-party plugin that depends on the "Groom" plugin, so while the plugin is enabled in my project, Send to Unreal fails to see that it's enabled and fails with a confusing error message.

A "correct" (but very slow) implementation, even discounting default-enabled plugins, would need to find the .uplugin manifest for each enabled plugin listed in the .uproject manifest, and recursively check those manifests' Plugins arrays (while maintaining a list of already checked plugins to avoid potential infinite recursion issues). I wouldn't recommend actually trying to do that, because it would be quite slow and error-prone. Instead, I would recommend either removing the validate_required_unreal_plugins() check completely, or downgrading it to a warning so that the export is allowed to proceed from Blender (and presumably fail at a later stage, during import on the Unreal side, if the plugin is actually not enabled).

JoshQuake commented 3 months ago

Fascinating. Thanks for the report!

jack-yao91 commented 3 months ago

Maybe this could be exposed as an option to turn off in the validations panel?

JoshQuake commented 3 months ago

Yep I like that idea.