Fix Combine Same Materials on 2.80 and older and related issues + Faulty UV fix optimisation #482
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.
This is patch for a few issues with the Combine Same Materials part of Fix Model:
bpy.ops.object.material_slot_remove_unused
does not exist on those versions.self.combined_tex
) before iterating the mesh objects has been replaced with producing the dictionary while iterating, this is why the material hash generation has been moved to its own function that takes a material argument instead of one function that generates material hashes for all the materials of all the meshes and stores them inself.combined_tex
.' .001'
would have already been modified due to it ending in'.001'
.Since it was in the middle of other code I was modifying, I also optimised the part of Fix Model that fixes faulty uv coordinates and added plus and minus infinity to the values it considers faulty. It was also resetting the count of fixed uv coordinates with each mesh iterated, so I've fixed that too. It is included as a separate commit because it's not really related to any of the other changes.
I have tested on Blender 2.80, 2.90.1, 2.93.9 and 3.2.0. The development branch does not load on 2.79 so I could not test it there.
When testing against 2.80 I included the change from #481