Last active
August 29, 2015 13:57
-
-
Save fredrikaverpil/9761879 to your computer and use it in GitHub Desktop.
Find any VrayEnvironmentPreviewTm nodes and remove them #maya
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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