Notifications
Clear all

[Closed] Run script on multiple files automatically

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.

11 Replies
 JHN
1 Reply
(@halgfx)
Joined: 10 months ago

Posts: 0

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

 JHN

Thank Paul

Cheers,
-Johan

Hey

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).

 JHN

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

Cheers,
-Johan

Abandoning the boat huh?

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

Autoclicker FTW!

Thank you for your help.

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

3 Replies
(@denist)
Joined: 10 months ago

Posts: 0

do you mean the getMAXFileAssetMetadata or I missed something?

(@gravey)
Joined: 10 months ago

Posts: 0

yes my bad that’s what I meant

(@denist)
Joined: 10 months ago

Posts: 0

gooooood to know… i’m still in shape.

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.