Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- context = bpy.context
- scene = context.scene
- curve_ob = context.object
- obs = [o for o in context.selected_objects if o is not curve_ob]
- res = 10
- cyclic = False
- new_obs = []
- o = 0 if cyclic else 1
- pts = res - 1
- for i in range(pts + o):
- s = obs[i % len(obs)].copy()
- s.location = (0, 0, 0)
- fp = s.constraints.new(type='FOLLOW_PATH')
- fp.target = curve_ob
- fp.use_fixed_location = True
- sc = s.constraints[0]
- sc.offset_factor = i / pts
- scene.collection.objects.link(s)
- new_obs.append(s)
- # remove constraints
- scene.update()
- for s in new_obs:
- sc = s.constraints[0]
- s.location = s.matrix_world.translation
- s.constraints.remove(sc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement