Skip to content

Express material names in the 3DOM scene graph#1063

Merged
cdata merged 2 commits intomasterfrom
expose-names-of-elements
Mar 4, 2020
Merged

Express material names in the 3DOM scene graph#1063
cdata merged 2 commits intomasterfrom
expose-names-of-elements

Conversation

@cdata
Copy link
Contributor

@cdata cdata commented Feb 28, 2020

Fixes #1062

@cdata cdata mentioned this pull request Mar 3, 2020
@cdata cdata requested a review from elalish March 3, 2020 19:44
elalish
elalish previously approved these changes Mar 3, 2020
Copy link
Contributor

@elalish elalish 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, just a couple small questions.

const port = await this[$workerInitializes];
const {port1, port2} = new MessageChannel();

console.log(modelGraft?.model.toJSON());
Copy link
Contributor

Choose a reason for hiding this comment

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

Sure you want to keep this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, will fix

const messageEvent = await messageEventArrives;
console.log(messageEvent.data);

expect(messageEvent.data).to.be.equal(material.name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the astronaut have a material name, or are we just checking that empty string equals empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has a name, I checked... Astronaut_mat, I think

Copy link
Contributor

Choose a reason for hiding this comment

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

SG; you could add a check that the name is not empty here in the test as documentation.

// Material names can be safely referenced directly from the Three.js
// object.
// @see: https://github.com/mrdoob/three.js/blob/790811db742ea9d7c54fe28f83865d7576f14134/examples/js/loaders/GLTFLoader.js#L2162
return (relatedObject as Material).name;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@cdata cdata merged commit ae70902 into master Mar 4, 2020
@cdata cdata added this to the v0.10.0 milestone Apr 15, 2020
@elalish elalish deleted the expose-names-of-elements branch September 15, 2020 23:07
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.

3DOM material names are not being expressed

2 participants