edit: the fix is further down
(I have an ugly hack to do this manually with IDLE.
the interesting part would be the next post)
problem: OBJ import loses set membership list. (for vertex groups)
assign the set membership of verts (maya) to blender vertex groups.
-take a piece of MEL code that selects a set of vertices and convert it to a piece of blender python that can be run from the text editor in Blender, so the resultant selected verts can be assigned to a vertex group - optionally, automate the assignment to vertex group(s).
OBJ vertex numbering begins at 1.
maya and blender both begin at 0.
Here’s what you get in maya when you select a set, then when you drag select the membership :
select -r -ne L_elbowSet ; // this is the set
select -r rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx rabbit.vtx ;
- a utility to take the above list of verts and put it in a form blender will be able to use to select the verts. Preferably reads a file and saves to a new file, and runs from IDLE.
- a script to run from inside blender to select a list of verts (so I can manually create a vertex group and assign the selection to it)
optional script to create the vertex group based on the set name; add the selected verts to the group.
in blender, I need:
? will the verts be same numbered ? // we can hope.
to work the mesh … (find how it is refered in blender)
probably have to be in edit mode
create vertex groups for the mesh
name ‘L_elbowSet’ // could be set1, etc… for all I care. They will get renamed again before I am done.
add each vert to the selection // the important part
assign the selection to the vertex group
what would be the script to select a vert based on it’s index?
add (or append) a vert to a selection?
need clever name for script v1.0
extract list of values from MEL data, save to file
replace = Blender.Mesh.AssignModes.REPLACE
mesh = rabbit.getData(mesh=True)
read the data and put it into a list
vertList =  # list of integers
mesh.assignVertsToGroup(‘renameMe’, vertList, 1.0, replace)