I have got the following code for listing the texture files being used in my Maya file. When I run the code I get a list of texture files with their paths. But I just need a list of filenames and I'm trying to extract them but not getting the list as I expect.
import maya.cmds as cmds
# Gets all 'file' nodes in maya
fileList = cmds.ls(type='file')
texture_filename_list = []
# For each file node..
for f in fileList:
# Get the name of the image attached to it
texture_filename = cmds.getAttr(f + '.fileTextureName')
texture_filename_list.append(texture_filename)
print texture_filename_list
The output is [u'D:/IRASProject/RVK/SAFAA/Shared/sourceimages/chars/amir/4k/safaa_amir_clean_body_dif.jpg', u'D:/IRASProject/RVK/SAFAA/Shared/sourceimages/chars/amir/4k/safaa_amir_body_nrlMap.tif', etc]
Now from this list I need to extract the filenames only so I add the code as,
for path in texture_filename_list :
path.split('/')
path_list.append(path)
print path_list
When I execute then I get the same list for path_list. What could be the problem?