Last active
July 14, 2017 09:44
-
-
Save fereria/bd3129389a1ebb7254750306cda87be4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
default = ['TurtleDefaultBakeLayer','defaultLightSet','defaultObjectSet','initialParticleSE','initialShadingGroup'] | |
set_list = [x for x in pm.ls(type="objectSet") if x.name() not in default] | |
cmd_list = [] | |
for set in set_list: | |
if set.isReferenced() is True: | |
continue | |
object = set.elements() | |
if len(object) != 0: | |
cmd_list.append("select -r " + " ".join([x.name() for x in object]) + ";") | |
cmd_list.append('sets -name "{0}";'.format(set.name())) | |
cmd_list.append("select -cl;") | |
save_file = pm.fileDialog(m=1,dm="*.mel") | |
if save_file is not None: | |
with open(save_file,'w') as f: | |
f.write("\n".join(cmd_list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment