Last active
August 2, 2023 05:50
-
-
Save patwooky/cbc27e107748ff9f19c062b28844d097 to your computer and use it in GitHub Desktop.
Select all transform nodes that have no shape nodes under them
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
# Find Empty Groups V001_01 | |
# Select all transform nodes that have no shape nodes under them | |
if not 'pm' in dir(): | |
import pymel.core as pm | |
print ('imported pymel') | |
else: | |
print('pymel exists') | |
def getEmptyTransforms(sel=[]): | |
returnList = [] | |
if not sel: | |
sel = pm.ls(type='transform') | |
print(f'sel is {sel}') | |
for thisXform in sel: | |
if not (pm.listRelatives(thisXform, ad=True, type='shape')): | |
returnList.append(thisXform) | |
print(f'{len(returnList)} empty transforms found') | |
print(f'{returnList}') | |
return returnList | |
emptyXforms = getEmptyTransforms(pm.ls(sl=True)) | |
pm.select(emptyXforms, replace=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment