Skip to content

Instantly share code, notes, and snippets.

@mikebourbeauart
Last active March 27, 2020 20:10
Show Gist options
  • Save mikebourbeauart/5bad6f89481849728717e24f4dfbedc6 to your computer and use it in GitHub Desktop.
Save mikebourbeauart/5bad6f89481849728717e24f4dfbedc6 to your computer and use it in GitHub Desktop.
Selects geometry transforms under current selection
"""Selects geometry transforms under a current selection"""
import maya.cmds as mc
# Get all mesh shapes under parent group
sel_shapes = mc.ls(selection=True, dagObjects=1, type='mesh')
# Get parent transforms from shapes (supports duplicate names, remove "path" if you want to raise an error on dup names)
geo_transforms = mc.listRelatives(sel_shapes, parent=True, path=True)
# Select geometry transforms
mc.select(geo_transforms, r=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment