Need plans for a nuclear bomb! (MEL explode all groups)

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
Old 04 April 2013   #1
Need plans for a nuclear bomb! (MEL explode all groups)

Hi,

I'm trying to "explode" all groups in Maya.

ie a recursive ungroup - or a funnier way to look at it as per subject, nuclear bombing / explode all groups.

I've currently got this far:

Code:
string $group[] = `select -hi`; string $transforms[] = `ls -sl -tr`; //print $transforms; optional, just feedback select $transforms[0]; float $howMany = `size($transforms)` - 1; print $howMany; for ($i=0; $i<$howMany; $i++) { ungroup; }


But this fails after it goes through a second round. Anyone know anything better?
 
Old 04 April 2013   #2
It's pymel, but it might do the trick, if it doesn't have to be mel?

Code:
import pymel.core as pm [shape.getParent().setParent(world=1) for shape in pm.ls(sl=1, shapes=1, dag=1)]
 
Old 04 April 2013   #3
Perfect, many thanks. Boy that solution looks so simple - really have to jump on the bandwagon I think.
 
Old 04 April 2013   #4
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.
 
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 06:48 PM.


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