Skip to content
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

Export guard / layer mask fix #708

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dbb789
Copy link

@dbb789 dbb789 commented Mar 6, 2024

This PR has two relatively simple changes;

IGLTFSceneExportGuard - this interface allows a MonoBehaviour on a GameObject to mark a portion of the transform hierarchy as unexportable, which allows us to easily indicate that portions of a scene are for business logic only and not visible objects, without having to create new layers and/or adjust tags. I've also included GLTFSceneExportGuard which is an empty MonoBehaviour purely for convenience when using this feature within the editor.

On line 970, there's a check for _exportLayerMask >= 0. I assume this was written with the assumption that an empty layer mask would be nonsensical and the exporter should just default to all layers. However, if layer 31 is enabled, this sets the sign bit on the underlying int, which will make the layer mask negative, and it'll therefore fail this check. I've switched this to _exportLayerMask != 0.

Both of these changes have been tested by us internally. Please take a look - thanks!

@CLAassistant
Copy link

CLAassistant commented Mar 6, 2024

CLA assistant check
All committers have signed the CLA.

@hybridherbst
Copy link
Collaborator

Hey, and thanks for the PR!

There are multiple ways already to exclude objects from export (via enabled state if wanted, via layers, via export callbacks).
I'm not sure if adding another core mechanism is the right approach here – but the same functionality can totally be achieved with a simple export plugin which would be an excellent small sample to ship with the package.

@pfcDorn can you take a look at making such an example export plugin and putting them into the Samples~ folder so it can be installed from PackMan? And also at the second half of this PR regarding the incorrect LayerMask check? Thanks!

@dbb789
Copy link
Author

dbb789 commented Mar 6, 2024

We've been playing around with import/export plugins but couldn't see an obvious and/or approved way to selectively chop nodes out based on our own criteria. If there's a way to do that then please do let us know as that would be perfect - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants