Skip to content

Instantly share code, notes, and snippets.

@rondreas
Created December 7, 2018 11:55
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 rondreas/d6582bcbc6e4a2b0299860162690557f to your computer and use it in GitHub Desktop.
Save rondreas/d6582bcbc6e4a2b0299860162690557f to your computer and use it in GitHub Desktop.
Count the number of scriptCtx in scene, checking only default named ones.
"""
Count the number of scriptCtx in scene, checking only default named ones.
"""
import pymel.core as pm
def countScriptCtx():
count = 0
mel_command = 'scriptCtx -ex "scriptCtx{}"'
n = 1
exist = True
while exist:
exist = pm.mel.eval(mel_command.format(n))
count += 1
n += 1
return count
c = countScriptCtx()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment