Skip to content

Instantly share code, notes, and snippets.

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 fredrikaverpil/9761879 to your computer and use it in GitHub Desktop.
Save fredrikaverpil/9761879 to your computer and use it in GitHub Desktop.
Find any VrayEnvironmentPreviewTm nodes and remove them #maya
import maya.cmds as cmds
def removeVrayEnvironmentPreviewTm():
# Are there any vrayEnvironmentPreviewTm nodes?
try:
cmds.select('vrayEnvironmentPreviewTm*', r=True)
nodesFound = cmds.ls( selection=True )
textMessage = 'Nodes found:\n\n'
for node in nodesFound:
textMessage += node + '\n'
textMessage += '\nAre you sure you want to delete them?'
response = cmds.confirmDialog( title='Confirm', message=textMessage, button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
except:
response = cmds.confirmDialog( title='Oh wait', message='No vrayEnvironmentPreviewTm nodes found.', button=['Doh'], defaultButton='Doh', dismissString='Doh' )
# Delete the nodes selected
if (response == 'Yes'):
try:
cmds.delete()
except:
response = cmds.confirmDialog( title='Confirm', message='Unable to delete the nodes... (reason unknown) - ask Freddddddooo!', button=['Ok'], defaultButton='Ok', dismissString='Ok' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment