Duplicate Object without children

963 views
Skip to first unread message

Will Sharkey

unread,
Oct 15, 2014, 11:05:58 AM10/15/14
to maya...@googlegroups.com
I was just looking into duplicating an object without its hierarchy. It seems I have to instance the shape of the object, then duplicate the instance. Then if I delete the instance, I get the object without hierarchy.

Is this really the workflow? There must be an easier way!

cheers

Ryan O'Phelan

unread,
Oct 15, 2014, 1:25:26 PM10/15/14
to maya...@googlegroups.com

This is not exactly the answer you were hoping for,  but we don't allow children under geometry here,  and I think there are some good workflow reasons for that.  We just use group/transforms.

R

--
You received this message because you are subscribed to the Google Groups "maya_he3d" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maya_he3d+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yaleh paxton-harding

unread,
Oct 15, 2014, 2:09:25 PM10/15/14
to maya...@googlegroups.com
A bit of a hack, you could make an arbitrary mesh (ie cube), then connect the outmesh attr from the shape node of the object you want to copy to the inmesh of the new arbitrary poly mesh. Then disconnect it. Could write a little scripty for that one and any pivot issues? Or maybe there's a more straight forward method.

Yaleh.

Yaleh paxton-harding

unread,
Oct 15, 2014, 2:10:24 PM10/15/14
to maya...@googlegroups.com
Assuming of course we are dealing with meshes..

Yaleh paxton-harding

unread,
Oct 15, 2014, 2:11:29 PM10/15/14
to maya...@googlegroups.com
I agree not a good idea to parent objects under objects. Stick to parenting to transforms/ groups..

On Wed, Oct 15, 2014 at 1:25 PM, Ryan O'Phelan <desig...@gmail.com> wrote:

Will Sharkey

unread,
Oct 15, 2014, 2:29:33 PM10/15/14
to maya...@googlegroups.com
Hi, so I'm not parenting objects under geo. Its a small task I do all the time in Softimage, duplicate any object without its children and I was just wondering where the option was in Maya.

Lets say I have a bunch of ctrl_Curves as children:
ctrl_Curve1
  -ctrl_Curve2
     -ctrl_Curve3
       - ctrl_Curve etc

If i want to duplicate ctrl_Curve1, I hit control + d and I get ctrl_Curve1 + children. Then I gotta delete the children.
What if ctrl_Curve1 had 1000 children, if I duplicate ctrl_Curve1 then the children are also duplicated, then I got to delete them all, seems unnecessary. 

I know I could export the ctrl_Curve and reimport it but I thought there might be a checkbox named 'ignore children' somewhere :)

Stephen

unread,
Oct 15, 2014, 5:17:36 PM10/15/14
to maya...@googlegroups.com
This is one of those fundamental xsi vs maya hierarchy things.   
 I think it's such a non issue that the majority of people just duplicate. Arrow down arrow over and delete 
  It's actually very rare that I will duplicate an object from a hierarchy. If it's in the hierarchy I want the whole thing. 

  You can arrow down to get the shape node.  Duplicate that.  And then reparent it to a transform if you want to go thru the trouble.   Easy enough to script that.   But with xsi dieing off and more people moving from xsi to maya. I would expect some feature creep to happen. 

-=s 




Will Sharkey

unread,
Oct 15, 2014, 5:47:03 PM10/15/14
to maya...@googlegroups.com
Yeah, its really a non issue, I was just curious :)

Cheers Stephen. 

--
You received this message because you are subscribed to a topic in the Google Groups "maya_he3d" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/maya_he3d/aopNtPWHgj8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to maya_he3d+...@googlegroups.com.

Stephen

unread,
Oct 15, 2014, 7:58:56 PM10/15/14
to maya...@googlegroups.com
I would definitely add it to the small annoying things.   
  It's scriptable but would be nice I have in native maya 

-=s 




Ryan O'Phelan

unread,
Oct 15, 2014, 8:55:19 PM10/15/14
to maya...@googlegroups.com

Sorry I was assuming geometry.  That xsi function would be great in maya.

Morgan Loomis

unread,
Nov 19, 2014, 4:11:33 AM11/19/14
to maya...@googlegroups.com
This is possible command line, I just looked but can't see an obvious way to do it through the menus, but if you're scripting it's the -parentOnly flag of the duplicate command. However this also means no shapes, so if you select some geo and run duplicate -parentOnly you end up with just a transform.

Roy Nieterau

unread,
Nov 22, 2014, 4:19:18 AM11/22/14
to maya...@googlegroups.com, morgan...@gmail.com
And otherwise this should do the trick:

I added some extensive comments just to explain why I'm doing some of the things in there. Useful if you are still learning I suppose. Note that as I work on pipelines at our studio many things (even small things) is performance critical, therefore I've the tendency to write a bit more complicated code with the idea of making something that is more modular, harder to break and faster to process. ;)

import maya.cmds as mc

def duplicateWithoutChildren(nodes, keepShapes=True):

   
if not nodes:
       
return []

    duplicates
= []
   
for obj in nodes:
        dup
= mc.duplicate(obj, rc=True)[0] # sometimes maya is buggy without renameChildren==true
       
       
# Note: The *shapes* argument can only be set to True to filter
       
# to only children shapes, yet it can't be set to False to False
       
# to return only non-shapes.
       
# Therefore we need to filter out all shapes ourselves (see below)
        children
= mc.listRelatives(dup, fullPath=True)
                                   
       
if children:
           
if keepShapes:
               
# Don't care about preserving order, but do care about removing
               
# in a fast way where one *could* possibly have many shapes.
               
# It's more likely a premature optimization, but `set` should
               
# perform much better on the cases with many many children.
               
# Note: We're forcing full path names (fullPath==True and long==True) in
               
# `listRelatives` and `ls` because we're filtering based on string names.
               
# This avoids any hierarchy/unique name issues. Where speed isn't critical
               
# but you would rather code faster give a go with Pymel.
                children
= list(set(children) - set(mc.ls(children, shapes=True, long=True)))
           
if children:
                mc
.delete(children)
        duplicates
.append(dup)
   
   
if duplicates:
        mc
.select(duplicates, r=1) # select newly created nodes

   
return duplicates

if __name__ == "__main__":
    sel
= mc.ls(sl=1)
    duplicateWithoutChildren
(sel)

Reply all
Reply to author
Forward
0 new messages