Run script on multiple files automatically


#1

Hello there.
I have a bunch of 3d models and I’ve decided to organize them in folders by category, the problem (as always) are the maps, at first I though a unified ‘maps’ folder would be better but I’ve ended up deciding to just keep the maps on the same folder as the models.
The problem now is that I need them to be ready for distributed rendering, for scenes I’ve made a script that converts the paths of the resources to absolute network ones, it worked well with some exceptions that I had to fix manually, I don’t know if there’s an easier way to do network rendering because so far it’s been a royal pain in the butt… Anyway, I’ve made a little script that is like:


   	unc = "\\\ALAN-PC"
   
   	for m in (getClassInstances bitmapTexture) do (
   		x = sysInfo.currentdir + "\\" + (filenameFromPath m.fileName)
   		m.fileName = unc + (substring x 3 -1)
   		)
   

It successfully ‘strips’ any paths for the maps and link them according to its absolute location on the network. It worked like a charm for some objects I’ve tested.

Now, the problem is, I have a bucketful of objects and I’d like to run this little script on every of them, according to my estimations, it would take a week to do it manually (open all files one-by-one and run the script).

So, is there a way to automatically do that? Maybe a batch script or something…

Thank you in advance.

EDIT: Oh, I forgot to mention that all this problems with network rendering is using Vray DR, it seems backburner is better but there’s no way to get it working (on previous max versions it used to crash during the rendering (i’ve even changed my router to make sure it wasn’t it)) now in this 2013 version it simply refuses to launch on the slaves.


#2

http://www.penproductions.ca/scripts/batchItMax/batchItMax.htm

Saved me on several occasions,

-Johan


#3

Wow! That tool seems exactly what I need.
I’ll try it asap and report back the results. Thank you!


#4

Thank Paul :wink:

Cheers,
-Johan


#5

Hey :slight_smile:

Ok, the script really works correctly (provided you know how to install it properly because the paths are different in newer max versions, and of course, windows 7 won’t allow it to write its log files on the default folders, so that’s another thing to check, overall it works good) but the problem now is that some of the models display a warning (the file was created with other version) and some ask me if I want to use the updated Vraysky model, and the batch just stops until I click the buttons. They’re both V-ray warnings so maybe there’s a way to disable them, or in the worst case an auto-clicker could resolve the problem.

This script really is a life-saver :D. Thank you very much! (I wonder why Google never finds stuff like this though).


#6

If Vray has the quiet:true interface implemented then you might be able to force the quiet mode on opening of the files.

http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=files/GUID-A1FFEDE0-9B92-4CD5-8127-76AA393D5143.htm,topicNumber=d30e671533

But you’re on your own on this one :wink:

Cheers,
-Johan


#7

Abandoning the boat huh? :slight_smile:

I’ve managed to solve the issue in a simpler way:

Autoclicker FTW!

Thank you for your help.


#8

rather than opening each file and using getclassinstances bitmaptexture you can use the getMaxFileObjectMetaData function to get texture, xref and other external links (like vrayproxy) paths. then modify the filenames to be relative to the max file and use setMaxFileObjectMetaData to commit your changes. this will do everything you want to without ever having to open any max files so will be much faster


#9

Hello. Thank you for your reply.
I don’t think relative paths works with Vray DR though, unless I’m doing something wrong… I’ve tried to render a file and the other nodes won’t find the textures.


#10

do you mean the getMAXFileAssetMetadata or I missed something?


#11

yes my bad that’s what I meant


#12

gooooood to know… i’m still in shape.


#13

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.