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

GLTFLoader: Add before/afterRoot hookpoints #21207

Merged
merged 1 commit into from
Feb 9, 2021

Conversation

takahirox
Copy link
Collaborator

@takahirox takahirox commented Feb 5, 2021

Related PR: #20789

Description

This PR adds invokeAll before/afterRoot hookpoints.

beforeRoot() hook is called before starting the entre glTF but after for parsing glTF binary to JSON. The main use case would be for hacking glTF definition. (I remember some devs requested it.) And handlers for extensions under the root may need it.

afterRoot(result) hook is called after generating all Three.js objects. The main use case would be handling extensions under the root and/or apply some changes to the generated Three.js objects. My material variants extension handler plugin needs this hook point.

Copy link
Collaborator

@donmccurdy donmccurdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks!

@mrdoob mrdoob merged commit 4d547af into mrdoob:dev Feb 9, 2021
@mrdoob
Copy link
Owner

mrdoob commented Feb 9, 2021

Thanks!

@takahirox takahirox deleted the GLTFLoaderAddHooks branch February 9, 2021 21:36
@0b5vr 0b5vr mentioned this pull request Feb 10, 2021
22 tasks
0b5vr pushed a commit to 0b5vr/three-ts-types that referenced this pull request Feb 10, 2021
joshuaellis pushed a commit to three-types/three-ts-types that referenced this pull request Feb 11, 2021
* feature (GLTFLoader): Add beforeRoot and afterRoot to GLTFLoaderPlugin
See: mrdoob/three.js#21207

* fix (GLTFLoader): add missing methods of GLTFParser

* test: add gltfloader-plugin.ts
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.

3 participants