I’ve been trying to improve a little script of mine and add some features to it,
one of which would require iterating over all the loose parts of a mesh (without splitting it of course).
I can’t seem to find any built in property or method that returns the list of loose mesh islands.
Did I miss something or is will I really have to find some hacky way around this?
You want the “Loose” option. As you notice, this actually splits the object into several objects. But once you’re done modifying it, you can rejoin them using:
If you really can’t split the object (e.g. if you need consistent vertex indices that might get mixed up during the split) it’s still not too hard.
Pseudo-code:
Switch to edit mode
Add all vertices to "unprocessed" list.
While (unprocessed verts remain):
Deselect all vertices
Select any one unprocessed vert
Call built-in API function [select_linked](http://www.blender.org/documentation/blender_python_api_2_66a_release/bpy.ops.curve.html?highlight=select_linked#bpy.ops.curve.select_linked)
Remove all selected verts from unprocessed list
Do whatever you need to do with this loose part
Thanks supergra!
I like your idea. It preferable to splitting and joining back the mesh I think (sounds like it could mess things up regardless of the vert indices)