Fix Combine Same Materials on 2.80 and older and related issues + Faulty UV fix optimisation#482
Open
Mysteryem wants to merge 2 commits intoabsolute-quantum:developmentfrom
Open
Conversation
…t_remove_unused does not exist Fix running combine_materials on all meshes for every mesh Fix add_principled_shader making duplicate mmd materials be considered non-duplicate Replace EDIT mode selection and assignment of materials with OBJECT mode foreach_get/set for performance Add material hashes for 2.80+ materials that don't use nodes Fix ordering and remove unnecessary setting of active_material_index in common.clean_material_names Fix multiple cases of code not checking if a material_slot is empty
Optimise fixing faulty UV coordinates using foreach_get/set and numpy Fix resetting fixed_uv_coords count for each iterated mesh
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_unuseddoes 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