Exporting parent + each child to separate files

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2012
Exporting parent + each child to separate files

Is there a way to do this? For example, if I have a parent curve called MAN. MAN has 3 child groups, head, hand, foot. I want to select the parent, MAN, and have the script exports into 3 files.

MAN + head
MAN + hand
MAN + foot

head, hand and foot are still child of MAN.
 
  04 April 2012
you mean like this

import maya.cmds as mc

currentPath = mc.file(q=1,sn=1)
if len(currentPath) == 0:
    mc.error('Save current scene first.')
selection = mc.ls(sl=1)
if len(selection) == 0:
    mc.error('Nothing Selected')
for sel in selection:
    children = mc.listRelatives(sel,c=1,f=1)
    if len(children) == 0:
        mc.error('%s has no exportable children'%sel)
    print "\nExporting %s's children -", children
    for child in children:
        mc.select(child)
        mc.file('%s_%s-%s'%('.'.join(currentPath.split('.')[:-1]),selection[0],child.split('|')[-1]),es=1,type='mayaAscii')
__________________
ldunham.blogspot.com
 
  04 April 2012
The select(child) would mean that the parent isn't exported tho?

The easy way out I guess is to do loops to unparent > export > reparent them. :O But I'd like to know if there's a better way.
 
  04 April 2012
yes it would.

I didnt know you wanted to export JUST the child.

Then the only way would be to unparent/re-parent..
__________________
ldunham.blogspot.com
 
  04 April 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:58 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.