Robust texture pathing

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  04 April 2014
Robust texture pathing

Max seems horrible at using relative texture paths.

our max files are moving to new work spaces as we sort out our P4 workflow and texture refs are being lost.

our asset directories look like

../source_art/characters/myGuy/textures/myguy_diffuse.tif ...ect

but when the path to ../source_art changes (i.e., a new workspace is created in P4) max looses track of all the textures.

It's a headache I've faced before and not found a robust solution for.
google yields a variety of responses, mostly one-file-at-a-time band aid solutions.
I'd like something bulletproof , reliable, and script-able.

I am thinking of dropping the mesh vs texture folder arrangement and just keeping the textures in the maxfilepath folder so Max can see them.
but I have noticed that when you do this, the mxs reference (obj.material.diffuseMap.filename) still points to the old location.
Thus is important because I need a reliable reference to the source textures file locations.
  04 April 2014
try relink bitmap from colin seener.
  04 April 2014
nice tool, even scriptable, but I need to know how to do it myself.

where can I find the mxs equivalent of the buttons in the bitmap / photometric path editor ?

Last edited by Mambo4 : 04 April 2014 at 05:53 PM.
  04 April 2014
My searches yielded a bewildering array of ways to mangle and obfuscate max texture file paths.

I settled on asset Tracker's AtsOps Interface to manage my texture paths, because this seemed to give direct access to the filepath values that cause the "missing File" prompt. Everything else was more of a band aid that didn't cure the cause.

	newDir replaces the "mesh" maxfilepath with "texture"
	so "C:/project/art/characters/myCharacter/mesh/ " becomes "C:/project/art/characters/myCharacter/textures/"
        if not found in /textures/ then the global /art/ directory is searched.
        this covers  expected locations of the textures in anyone's local workspace

fn repathBitmaps newDir:(substitutestring maxfilepath "mesh" "texture") =
	local arr=#()
	ATSOps.GetFilesByFileSystemStatus #Missing &arr--gather missing filpaths into the array arr
	if arr.count>0 then(
		format " repathMissingBitmaps to: %\n" newDir
		--use maxfilepath to find the local path to /art/ 
		slices=filterstring maxfilepath "\\"
		str = ""
		index=finditem slices "art"
		for i = 1 to index do
		for asset in arr do
			format "\t\tmissing:%\n" asset
			AtsOps.selectFiles #(asset)
			local filenameOfAsset = (DotNetClass "System.IO.Path").GetFileName asset
			local di = DotNetObject "System.IO.DirectoryInfo" newDir --look in ../textures/
			local files = di.GetFiles filenameOfAsset (DotNetClass "System.IO.SearchOption").AllDirectories
			if files[1] !=undefined then (
				--if found , replace the path in the Asset Tracker
				local newFileName = files[1].directoryName
				AtsOps.SetPathOnSelection newFileName
				format "\t\tFOUND:%\n" newFileName
				--not in ../textures/ so look globally in .../art/
				di = DotNetObject "System.IO.DirectoryInfo" artPath
				artfiles = di.GetFiles filenameOfAsset (DotNetClass "System.IO.SearchOption").AllDirectories
				for each in artfiles do
				if artfiles[1] !=undefined then (
					newFileName = artfiles[1].directoryName
					AtsOps.SetPathOnSelection newFileName
					format "\t\tFOUND:%\n" newFileName 	
					format "\t\tNOT FOUND:%\n"asset	

reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 11:15 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.