4
$\begingroup$

I can manually:

  • select a vertex in edit mode
  • snap the 3D cursor to it
  • make an empty there in object mode
  • keep the empty selected, select the mesh, enter into edit mode
  • press Ctrl+P to create a vertex parent for the empty

Now the empty follows the vertex, even if it has some cloth physics applied or something else. The basic procedure. Very handy.

BUT, How to select multiple vertices in edit mode and press a button and:

  • have empties created for each selected vertice's location and
  • respectively each vertex to be the parent of its empty?

enter image description here

( This might help, investigating: https://blender.stackexchange.com/a/209262/8282 )

$\endgroup$

1 Answer 1

6
$\begingroup$

Yep, the post link in the end of the question and one other solved most of my problems (I edited the scripts to suit my needs):

import bpy
from bpy import context

ob = context.object
coll = context.collection

mode = bpy.context.active_object.mode
# we need to switch from Edit mode to Object mode so the selection gets updated
bpy.ops.object.mode_set(mode='OBJECT')
selectedVerts = [v for v in bpy.context.active_object.data.vertices if v.select]
for v in selectedVerts:
    mt = bpy.data.objects.new(
        f"Vert{v.index}",
        None,
        )
    mt.empty_display_type = 'SPHERE'
    mt.empty_display_size = 0.05
    mt.parent = ob
    mt.parent_type = 'VERTEX'
    mt.parent_vertices = [v.index] * 3
    coll.objects.link(mt)
# back to whatever mode we were in
bpy.ops.object.mode_set(mode=mode)
$\endgroup$

You must log in to answer this question.

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