Last active
April 16, 2018 21:32
-
-
Save marvolo3d/fed1edbbca680cbc9c1712324f5427e3 to your computer and use it in GitHub Desktop.
touch all textures in maya scene
This file contains 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 pymel.core as pm | |
import subprocess | |
import os | |
import glob | |
import re | |
filesList = [] | |
for fileNode in pm.ls(typ='file'): | |
filePath = fileNode.fileTextureName.get() | |
if fileNode.uvTilingMode.get() == 3 and '/pub/' not in filePath: # if using UDIM and not a /pub/ texture | |
tokenResult = re.search(r"(.*[.])(\d{4})([.].*)", filePath) | |
splitPath = list(tokenResult.groups()) | |
splitPath[1] = '*' | |
for x in glob.glob(''.join(splitPath)): | |
filesList.append(x) | |
for textureFile in set(filesList): | |
if not os.path.exists(textureFile): | |
pm.displayWarning('File {} does not exist'.format(textureFile)) | |
else: | |
# subprocess.call(['touch', textureFile]) | |
pm.displayInfo('Touched {}'.format(textureFile)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment