Home Technical Talk

Maya: Keeping object name when combining

pr1970
polycounter lvl 7
Offline / Send Message
pr1970 polycounter lvl 7
Hi All

Anyone know if its possible to combine poly objects in Maya (2013) but keep the original objects naming, instead of replacing it with a new one. For example and objected called "table1" combined with "legs1" becomes "Polysurface937434343".
Any way of keeping it to say "table1" for example.

Thanks

Replies

  • Denny
    Options
    Offline / Send Message
    Denny polycounter lvl 14
    You can do it with a script like this one. To give it a spin, select all meshes in order and run the script. The first object will be the name for the final combined mesh.
    int $keepHistory = false;
    
    string $selection[] = `ls -sl -l -tr`;
    string $shortNames[] = `ls -sl -sn -tr`;
    string $parents[] = `listRelatives -p -f $selection[0]`;
    string $newObjects[] = `polyUnite -ch $keepHistory -n $shortNames[0] $selection`;
    
    // Parent groups tend to be removed on delete history if they become empty.
    // Make sure parent object still exists before reparenting.
    if (`objExists $parents[0]`)
       parent $newObjects $parents[0];
    
  • pr1970
    Options
    Offline / Send Message
    pr1970 polycounter lvl 7
    Thank you Denny. Works a treat. :-)
  • Denny
    Options
    Offline / Send Message
    Denny polycounter lvl 14
    You're welcome! May all your scenes become less cluttered from now on. :)
  • Axcel
    Options
    Offline / Send Message
    Axcel polycounter lvl 14
    Doesn't exactly work for me in any different way of what i already have.  Maybe my expectations are different.

    Can we modify script so in case of combining legs with table (selecting table as last/first) newly created mesh will be:

    having name and pivot from last/first selected mesh
    not taken away from group in outliner

    Thanks guys!
  • TTools
    Options
    Offline / Send Message
    TTools polycounter lvl 4
    Take a look at this tool. I think it will do exactly what you're looking for and then some.   Keeps the object name, pivot, translation, rotation, and hierarchy.

     Also comes with like 50 other tools.
    AttachMaster
    https://youtu.be/O2mK7I1Errw

    http://www.thomashamiltonart.com/TTools.html

  • MrMerr
    Options
    Offline / Send Message
    Denny said:
    You can do it with a script like this one. To give it a spin, select all meshes in order and run the script. The first object will be the name for the final combined mesh.
    int $keepHistory = false;
    
    string $selection[] = `ls -sl -l -tr`;
    string $shortNames[] = `ls -sl -sn -tr`;
    string $parents[] = `listRelatives -p -f $selection[0]`;
    string $newObjects[] = `polyUnite -ch $keepHistory -n $shortNames[0] $selection`;
    
    // Parent groups tend to be removed on delete history if they become empty.
    // Make sure parent object still exists before reparenting.
    if (`objExists $parents[0]`)
       parent $newObjects $parents[0];
    
    Thank you! Maya 2024, works almost perfectly, it just adds "1" in the end when i combine object "foot" and my boots for modular character (after combine maya named this object  "foot1" )
Sign In or Register to comment.