How to check Textures paths?


#1

Hi, I’m writing a tool to check if all our texture paths are ok, but I can’t find an exact solution. Is there any way to check if the texture paths are “local”, and therefore be read in a different PC as long as the project is properly set up ?

I’m using :
cmds.getAttr(’%s.fileTextureName’ % texture)

to get the Texture path but it always give me the Full Path of the texture. So if it’s in the designer’s PC, even if the project isn’t properly setup, it will give you a valid path.

I’m working around it by getting the workspace (project path) and check if it is included in the Texture Full Path. It kinda works, but it’s not really precise if the designer has project folders inside other projects.

How do you check your File Paths ?


#2

Perhaps this will help, you can use this or you can analyze the code I suppose to see how he did it.

https://www.highend3d.com/maya/script/ftm-for-maya-2017-2018-for-maya


#3

Thanks for your answer.

I haven’t read all the code (because I hate mel), but basically that tool checks if the texture file is valid and fix it according to the path you specify. Cool tool, but it’s a tool to fix, not to check.

What I want to know is if this scene data will be able to be opened without broken links in a different computer (my client’s computer).

For that, my guess is that the best way would be to get the local path of the texture the way it’s displayed in the UI (ex : sourceimages\texture.tga ) and check if it exists inside the project folder, but I can’t seem a way to get this info. Not yet at least.

Instead, when I get it through the attribute fileTextureName, I get the Full Path (ex: D:\project\sourceimages\texture.tga). And in this case, even if the project isn’t properly set, the path will still be valid in the designer’s PC because it exists, but the link will break in a different PC.

My solution, for now, is to check if the current Project path is included in the Texture Full Path, and hope that the designers won’t be setting the project in a parent folder.

Thanks again