Skip to content

Instantly share code, notes, and snippets.

@SEVEZ
Created August 29, 2015 11:26
Show Gist options
  • Save SEVEZ/d8bd872afdc47cbc09f6 to your computer and use it in GitHub Desktop.
Save SEVEZ/d8bd872afdc47cbc09f6 to your computer and use it in GitHub Desktop.
Check if object is referenced
selection = cmds.ls(sl = True)
for model in selection:
refcheck = cmds.referenceQuery(model, inr = True)
if (refcheck == 1):
reftodel = cmds.referenceQuery(model, f = True)
cmds.file(reftodel, rr = True)
cmds.file(newfile, r=True)
else:
cmds.delete(model)
cmds.file(newfile, i=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment