CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 04-16-2013, 05:58 AM   #1
Hamburger
Expert
portfolio
Where is it?
Architectural Viz
Australia
 
Join Date: Sep 2004
Posts: 2,082
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-16-2013, 09:08 AM   #2
i11uzion
Guest
 
Posts: n/a
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-16-2013, 09:53 AM   #3
Hamburger
Expert
portfolio
Where is it?
Architectural Viz
Australia
 
Join Date: Sep 2004
Posts: 2,082
Perfect, many thanks. Boy that solution looks so simple - really have to jump on the bandwagon I think.
 
Old 04-16-2013, 09:53 AM   #4
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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 09:06 PM.


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