3
$\begingroup$

When I instance 2 objects, one having a modifier that refers to the other, if I make the instances real, the modifiers don't refer to their respective object. I tried every approach I could think of: - particle instance of a collection - duplivert of a collection - duplivert of 2 parented objects

None of them got it to work.

Is there any way around this?

Here's a simple example file:

Steps:

  • edit the lattice and see how it deforms the Suzanne
  • make the instances real on the emitter plane
  • remove the particle system
  • from there, how to make it so each lattice deforms each Suzanne ?

Maybe my approach is wrong but if so, what's the alternative?

$\endgroup$
2
$\begingroup$

With a script.

If make the particle system only have a one frame lifetime then all will be created on frame 1

enter image description here

After pressing Convert (make real) will notice that Lattice.001 is with Suzanne.001, Lattice.002 is with Suzanne.002, ... we can use that.

Also give each lattice its own data so editing one doesn't affect all.

Here is a script select the plane and run script

import bpy
context = bpy.context
scene = context.scene


ob = context.object # the plane
# make dupes real
bpy.ops.object.duplicates_make_real()
# remove the ps
ob.modifiers.remove(ob.modifiers[0])


lattices = sorted(l.name for l in scene.objects if l.type == 'LATTICE'
        and l.name.startswith("Lattice")
        and l.name[-3:].isnumeric())

suzannes = sorted(s.name for s in scene.objects if s.type == 'MESH'
        and s.name.startswith("Suzanne")
        and s.name[-3:].isnumeric())

for ln, sn in zip(lattices, suzannes):
    suzanne = scene.objects.get(sn)
    lattice = scene.objects.get(ln)
    # give each lattice its own data
    lattice.data = lattice.data.copy()
    # set modifier to lattice 
    suzanne.modifiers[0].object = lattice

Note: Don't have any other objects other than originals starting with "Suzanne" or "Lattice" in the scene.

Worth noting could extend this to look for collection instances in the particle system settings and get the object names from the collection objects.

|improve this answer|||||
$\endgroup$
  • 1
    $\begingroup$ Works great, thanks! Though it's surprising that we have to script this. Looks to me like this assignment should happen by default. I don't see a reason why not so I guess I can make a feature request. $\endgroup$ – ChameleonScales Dec 23 '19 at 15:53
  • $\begingroup$ Same issue came up in a question re duplicating objects. With driver targets from memory... or maybe that's where I saw the issue first.. anyhoo. It may have been explained there. $\endgroup$ – batFINGER Dec 23 '19 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.