BabylonJS / Exporters

Exporters for Babylon.js and gltf file formats
Other
597 stars 307 forks source link

Maya: Allow to disable exporting of custom user attributes from maya nodes #1076

Open BigRoy opened 1 year ago

BigRoy commented 1 year ago

Issue

The exporter currently always includes custom user attributes on nodes as extras.{attribute} on each node. In some cases you might want to exclude certain extra attributes from export instead of needing to remove these from your scenes prior to that.

Solution

Add an extra parameters which would allow to disable the writing of extras.

Extra nice would be to be able to include only certain extra attributes (or even maya native attributes) like a attribute parameter which would e.g. be a string like "myAttribute otherAttribute primaryVisibility" to include only those attributes as extras if it matches that name.

Or potentially allow more complex expressions for the attributes (like Houdini groups) "* ^myAttribute" to include all (*) and then exclude (^) the myAttribute named attribute. Or match custom_* to match all attributes that start with custom_ like custom_myAttribute or custom_exportData.

Additional Info

The export logic for Custom Attributes is done through BabylonExporter.CustomAttributes.cs

We would need to expose an extra parameter for the exporter and filter the custom attributes around here using e.g. this.exportParameters.exportCustomAttributes and implement a filtering like described above.

bghgary commented 1 year ago

Would you be willing to make a contribution?

BigRoy commented 1 year ago

It's not necessarily my forte (nor do I have plenty of time on the side) - so I had hoped that by potentially pointing to the relevant code areas someone familiar with the code base would be able to do it easily.

Anyway, if I do find myself with spare time I'd be happy to take a look into this. But in practice having spare time rarely works out.

Do you happen to know a simple pattern matching that's artist-friendly but trivial for C# to filter the list against? I really like Houdini's way for grouping but not sure how to best translate that to C#. For what it's worth, allowing a list of regex filter strings would also be fine.