Manual export of vertex weights without exporting skeleton data #58
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.
Unless I'm misunderstanding something about the exporter, the only way you can export vertex weights is by also exporting the skeleton. This makes it difficult to create modular assets such as clothing, backpacks, or other soft worn articles, since it would require a lot more legwork on the application's part to de-duplicate the rig and associate the items with whatever pose buffer is used to store the wearer's rig state.
This modification to the export script adds an additional checkbox "Vertex weights" which allows for explicit control over whether or not vertex weights are exported. When exporting a rig this should always be checked, but it can also be checked when exporting a rigged object that will later be slaved to the skeleton in the final application, without exporting the actual rig data. This is similar to exporting one IQM file containing multiple meshes which reference the same rig, but much more modular as it allows the resulting assets to exist in separate files without duplicate data. The exported vertex bone IDs will be the same as usual, only that the bones they reference don't exist within that same file. When the mesh is loaded by the application it will be up to the application to make sure that the object is associated with the correct armature object/pose buffer, rather than creating a new one.
This is just a suggestion, I'm not sure if this change is consistent with the IQM file spec or purpose of the format. If this seems like a reasonable idea, before it gets merged it might make sense to add a warning or error to ensure "Vertex weights" is checked when exporting the rig, since exporting a rigged object without vertex weights doesn't make much sense.