Need some basic help on how to transform mesh verts.

I’m trying to create a script that will randomize loose parts within a mesh, so location, rotation, and scale of any loose parts will be randomized by an amount based on user input.

I’m just starting and would like to know if anyone has any input on how I might do this before I start racking my own brain ;). A couple questions I have right off the bat are as follows.

  1. Is there any built in way to iterate through loose parts within a mesh? If not does anyone have an idea of how to best do this?

  2. How would I apply a transform like changing location or scale to any given loose part within a mesh once I know it’s vertices.

This post is related to another proposing a randomization modifier for loose parts in objects. I first want to see if I can write a script that does everything proposed before trying to tackle a modifier.
http://blenderartists.org/forum/showthread.php?t=192163

thanks for any help!

cheers,
Cole

for 1. I don’t know of any direct way. The fastest may be to assign every loose part to another vertexgroup and access them from there. for a quick first test.

  1. have a look at the mathutils module. if you have the verts you want to transform you can just multiply them with a matrix and they get their new scale rotation, translation. http://www.blender.org/documentation/250PythonDoc/mathutils.html#mathutils.Matrix i think.