Skip to content

Conversation

@einarf
Copy link
Member

@einarf einarf commented Jun 14, 2018

Add an option allowing the parser to auto create missing materials. This supports missing mtl files and references to material names that doesn't exist

einarf added 4 commits June 14, 2018 21:04
Add an option allowing the parser to auto create missing materials. This supports missing mtl files and references to material names that doesn't exist
if self.create_materials:
self.material = Material(name=name, is_default=True)
self.wavefront.materials[name] = self.material
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another way to do this:

if not self.create_materials: raise PywavefrontException self.material = Material... 

This is totally stylistic preference. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a bit cleaner I think. Fixing.

@greenmoss
Copy link
Collaborator

Thanks for the PR @einarf . Please have a look at the comment and let me know what you think. If you have a strong preference to leave it as is, let me know and I can merge as is.

@einarf
Copy link
Member Author

einarf commented Jun 16, 2018

Think this should be ready now.

@greenmoss greenmoss merged commit bb0d5e6 into pywavefront:master Jun 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants