convert multiple instances to object

convert multiple instances to object

Anonymous
Not applicable
18,901 Views
14 Replies
Message 1 of 15

convert multiple instances to object

Anonymous
Not applicable

I have a scene composed of multiple instances that make up a complete object (say repeating sections of a train carriage or seats) after finishing the modelling I now have the complete object which I need without any instance on it. 

 

if I select all the objects and do modify-> convert instance to object, various parts of this actually disappear, 

if I duplicate them the same thing happen, same thing if I export to obj.

the only way is to export to fbx but that destroys the materials.

 

is there an actual way to retain and convert all instances of a geometry as a separate object without tedious manual processing? maybe some script? 

thanks in advance for any pointers.

0 Likes
Accepted solutions (1)
18,902 Views
14 Replies
Replies (14)
Message 2 of 15

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

Have you tried going to Mesh->Combine?

 

This will combine everything into one object and whenever you need to separate them again you can do Mesh->Seperate.

 

Please let me know if this helps or if you need any more assistance!

 

 

0 Likes
Message 3 of 15

Anonymous
Not applicable

thanks Sean,

combine has the same effect as the others unfortuantely, one or more of the copies disappears

0 Likes
Message 4 of 15

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

Hmm ok.

 

When you get a chance, can you please zip and attach the scene file here or via dropbox/google drive or another file sharing program so I can take a look at it?

 

 

Message 5 of 15

Anonymous
Not applicable

@sean.heasley that's a bit tricky but here's some quick steps to reproduce: it seems to happen with instanced groups

 

so

create a cube and group it,

duplicate special (instance) the group a couple of times,

select all and try combine or any other method.

 

on my end they just vanish except one

 

0 Likes
Message 6 of 15

darioOrtisi
Collaborator
Collaborator

Have you deleted all Histroy and/or deletd all constraint after deleted histroy?. This happened to me.

0 Likes
Message 7 of 15

Anonymous
Not applicable

@darioOrtisi seems to happen both with or without history

0 Likes
Message 8 of 15

mspeer
Consultant
Consultant
Accepted solution

Hi!

If you group the objects and instance the whole group not only the mesh/shape will be instanced, but the direct transform node too (with the identical UUID) making it impossible to distinguish between those objects.

 

There is currently no workaround or solution i can offer.

 

Please report this problem (bug?) to Autodesk.
Help -> Speak Back -> Report a Problem

Message 9 of 15

sean.heasley
Alumni
Alumni

Hi @Anonymous

 

Thanks for the repro steps!

 

Like @mspeer said, this looks like an issue with Maya and I've logged it with our dev team so they can work on a fix for a the future.

 

 

Message 10 of 15

Anonymous
Not applicable

thanks  a lot  @mspeer and @sean.heasley for logging in the issue, fingers crossed it'll get sorted soon enough.

 

in the mean time I happened on a workaround with this code, credit goes to lesterbanks 

its fairly slow on large scenes and I'm losing shaders on some pieces so would be nice to have an actual solution implemented by autodesk.

 

# Python code
import maya.cmds as mc
import maya.OpenMaya as om

def getInstances():
    instances = []
    iterDag = om.MItDag(om.MItDag.kBreadthFirst)
    while not iterDag.isDone():
        instanced = om.MItDag.isInstanced(iterDag)
        if instanced:
            instances.append(iterDag.fullPathName())
        iterDag.next()
    return instances

def uninstance():
    instances = getInstances()
    while len(instances):
        parent = mc.listRelatives(instances[0], parent=True)[0]
        mc.duplicate(parent, renameChildren=True)
        mc.delete(parent)
        instances = getInstances()

uninstance()

 

Message 11 of 15

camrynCG68D
Community Visitor
Community Visitor

The way I've gotten around this is by exporting as an FBX and reimporting into the scene. This works with Maya LT as well as regular Maya -- in the full version there should be an option in the export settings under Geometry to Preserve Instances. 
I need them as OBJs to import into another software that doesn't accept FBX, and so this work around helped me. 

Message 12 of 15

sdouvilleAATP5
Community Visitor
Community Visitor

That code is gold. Thank you

0 Likes
Message 13 of 15

Gillaria
Explorer
Explorer
I just want to say that the problem has not yet been solved, despite the fact that 5 years have passed.
Yeah, Autodesk is famous for solving problems in its products.

Many thanks to @Anonymous, the script works well.
Message 14 of 15

sktvete
Explorer
Explorer

Almost 6 now, @Sean Heasley

0 Likes
Message 15 of 15

jonathan.beviere
Community Visitor
Community Visitor

Select all the instances

In Modeling Menu Bar :

Modify > Convert > Instance to Object

0 Likes