-
-
Notifications
You must be signed in to change notification settings - Fork 36k
GLTFLoader: Fix lights list iterator. #14515
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This isn't new in this PR but I think the following would be better
because
lightDef.name
can be empty strings''
.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.
BTW any special reasons why you wanna name light as
light_num
iflightDef.name
isn't defined? I think user may want the empty strings name (default in Three.js) in that case.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.
See KhronosGroup/glTF-Validator#93 — I'm increasingly thinking we should ensure that all nodes have unique names, even if it means changing user-specified names. Duplicate names are a common source of animation bugs. Because empty strings are practically guaranteed to be non-unique, I don't think we should be trying to preserve those.
Uh oh!
There was an error while loading. Please reload this page.
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.
I'm one of the users who don't want loader to pollute the names as default (even if it's an empty strings name). And currently glTF spec allows non-unique name.
But I can understand non-unique name can sometimes cause problems so wondering if I can first add a method to
SceneUtils
or somewhere which ensures non-unique name in a scene and ask users to explicitly call. We can move it into the loader later if glTF spec becomes to recommend or request unique name.Let's make a thread and discuss unique-name handling in Three.js there when necessary. And I want glTF spec to update or add a node about unique name first.
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 validator thread (KhronosGroup/glTF-Validator#93) goes into some detail on this — there are many tools that expect or require uniquely named objects, even though the glTF spec does not. Currently renaming seems to be the recommended way to handle this. But I would be OK with consolidating the renaming logic into one place rather than having one-offs like this, whether that's within GLTFLoader somewhere or in a Utils class.
Technically we don't need globally unique names — just unique within the asset, so that an AnimationMixer has references to nodes that are both (a) unique and (b) portable if animations are loaded from a different file than the mesh.
Uh oh!
There was an error while loading. Please reload this page.
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.
I think first glTF spec should discuss and add a note or update the spec, it'd be a lack of consideration for asset runs anywhere. And if glTF spec requests unique name, the situation would be much simpler.
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.
You may want to comment on the thread, then. The current consensus is that the spec will not require unique names.
Uh oh!
There was an error while loading. Please reload this page.
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.
I won't because I don't request unique-name in the spec. Rather than that, I wanna first think how to resolve animation issue with non-unique name without name pollution in Three.js.