Skip to content

Instantly share code, notes, and snippets.

@coxevan
Created November 12, 2018 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coxevan/6ca81425df1a2445c5ed3a0a716bbd7a to your computer and use it in GitHub Desktop.
Save coxevan/6ca81425df1a2445c5ed3a0a716bbd7a to your computer and use it in GitHub Desktop.
import pymel.core as pm
def delete_keys_on_sel():
selected = pm.selected()
if not selected:
return False
nodes_to_delete = []
for obj in selected:
attrs = pm.listAttr(obj, k=True)
for attr in attrs:
input_list = getattr(obj, attr).inputs()
valid_anim_curve = [node for node in input_list if isinstance(node, pm.nt.AnimCurve)]
if not valid_anim_curve:
continue
nodes_to_delete.append(valid_anim_curve)
pm.delete(nodes_to_delete)
return True
delete_keys_on_sel()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment