2
$\begingroup$

I have multiple mesh objects I'd like to combine into a single object. However, I'd also like to retain the name of these objects as vertex groups, and assign those objects to those vertex groups. Does blender feature a way of automatically doing this when joining objects? Or even one-click generate a vertex group for a singular object from its object name?

$\endgroup$

1 Answer 1

4
$\begingroup$

Give object A a vertex group named A. In edit mode, select all vertices and assign them to that group.

Same thing for object B with a group named B.

Then join A and B like normal. The vertex groups are preserved.


Script to do this automatically. Select the objects you want to join, make sure you're in Object mode, then run it from the text editor.

import bpy
assert bpy.context.mode == 'OBJECT'
for ob in bpy.context.selected_objects:
    if ob.type != 'MESH': continue
    vg = ob.vertex_groups.new(name=ob.name)
    vg.add(list(range(len(ob.data.vertices))), 1.0, 'REPLACE')
bpy.ops.object.join()
$\endgroup$
2
  • $\begingroup$ This is exactly what I’m wanting to do in the question, but for 20-30+ objects it’s unreasonable effort for an easily automatable task. Isn’t there an addon or special function that does this? $\endgroup$ Commented Apr 18, 2021 at 16:22
  • $\begingroup$ I added a script that will do it for you. $\endgroup$
    – scurest
    Commented Apr 18, 2021 at 18:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .