PDA

View Full Version : How to easily convert all paths to UNC??



lardbros
04-27-2012, 07:23 AM
Hey there everyone,

I'm trying to set up some render nodes using backburner, and have got a mapped drive working with 3dsmax, but for some reason when sending LightWave jobs to Backburner (using a script from Zarno on here), it only works with a UNC path. This isn't too much of an issue as I'm the only one using LW here, but it's a bit of a pain having to go through all the save paths, and content directories, in BOTH modeller and Layout... it's a bit tedious.

I had a quick search on here for any scripts, but haven't found anything... just wondering if anyone else has developed or used one that would do this for everything at a click of a button?

Many thanks in advance!!! :)

Tim

Lewis
04-27-2012, 07:56 AM
Package Scene

nickdigital
04-27-2012, 09:42 AM
If you submit your shots to Backburner via a script you could write the path into your script.

lardbros
04-27-2012, 10:49 AM
Thanks for the suggestions...

What I'm kind of looking for is more of a tickbox in LW to say, "always use unc paths". 3dsmax has this and it makes out life very easy... The package scene might do this, but I don't need to move the files or make new folders etc. Hmmm, not sure about editing the script... It could work if I knew what I was doing! :D

nickdigital
04-27-2012, 11:02 AM
What type of script is it? Inside there's probably info on what your folder structure is. In theory you could edit that info so instead of using your mapped drives it uses UNC.

lardbros
04-27-2012, 11:13 AM
It's an LScript, that in turn loads the backburner job .exe with a load of commands, which then in turn creates a small batch file to run the jobs. :)

It might be lscript based, but not sure...

you can get it here:

http://www.ardevi.si/scripts-and-apps/

nickdigital
04-27-2012, 11:22 AM
Inside of the lscript is:


ContentDir = getdir(CONTENTDIR);

getDir is getting whatever your Content directory is when you're working...which is your mapped drive.

You'll want to pass your UNC path to the variable ContentDir so when you submit your jobs the UNC path is written...not your mapped drive.

Lewis
04-27-2012, 11:23 AM
Thanks for the suggestions...

What I'm kind of looking for is more of a tickbox in LW to say, "always use unc paths". 3dsmax has this and it makes out life very easy... The package scene might do this, but I don't need to move the files or make new folders etc. Hmmm, not sure about editing the script... It could work if I knew what I was doing! :D

You don't have to move files at all, just run package scene to desired location temporary and then just use *.LWS file which will then have all corrected links to be relative instead absolute.

lardbros
04-27-2012, 11:28 AM
You don't have to move files at all, just run package scene to desired location temporary and then just use *.LWS file which will then have all corrected links to be relative instead absolute.

I know... but it's just typical LW workaround central! It shouldn't be this difficult. I tend to render stuff in around 10-20 different passes, and this step just adds to the mess.

Wish we'd never begun to work with mapped drives at all... it's a royal pain in the backside.

lardbros
04-27-2012, 11:32 AM
Inside of the lscript is:


ContentDir = getdir(CONTENTDIR);

getDir is getting whatever your Content directory is when you're working...which is your mapped drive.

You'll want to pass your UNC path to the variable ContentDir so when you submit your jobs the UNC path is written...not your mapped drive.

Thanks Nick... but how would I do this? Not a scripter at all, sorry! :) Do you mean just change my content directory within LW to the UNC path?

There are loads of areas that the UNC has to be designated... so, all images, all your models within modeller, the content directory, etc, etc... it would be nice if there was a script that ran through the scene, changed all references to everything to UNC, and that was it. I realise Lewis' idea would technically do this, but I can't be doing with messing around with files and the package scene. Don't want to come across as nitpicky and ungrateful, sorry... just that 3dsmax has quite a few ways to sort this out in a button click or two!!

nickdigital
04-27-2012, 11:41 AM
Thanks Nick... but how would I do this? Not a scripter at all, sorry! :) Do you mean just change my content directory within LW to the UNC path?


I assume you want to still work with a mapped drive on the workstations? You could use UNC paths though, we do. This is what I envision your setup being based on your request.

Workstation uses a mapped drive for Content directory.
Render nodes use UNC paths.


I only looked through the script quickly but it looks to do something similar to my Rush script. It just collects the necessary information to build a command line that your render controller understands.

In the script it's using the lscript command to get the content directory based on your workstation setup. Which would be fine if both you and the render nodes were both using mapped drives or UNC. But since you're mixing that you need to change the code in the lscript to not automatically detect what the content directory is based on your workstation config.

So you either hardcode the unc path with something like, where "myserver" is your network share:


ContentDir = ''//myserver/";

You could get even fancier by getting the ContentDir = getdir(CONTENTDIR); and doing string manipulation to convert your mapped drive to the UNC path.

You should test out your changes on a copy of the lcript. I use the info() command to see what my code is doing.

This help?

lardbros
04-27-2012, 12:09 PM
It all makes complete sense.... A shame I don't know lscript :) I'll have a go and see what happens. It may be better for everyone if I try and ask Jure (the original coder) to try and manipulate the script a little :)

Definitely up for having a go.

Using unc paths is what I personally do... Just the rest of the team aren't so understanding of the difference, and have always used a mapped drive. I'll also post a feature request... Would be ideal to have a tickbox that says "always use unc paths" luke 3ds max.

dwburman
04-27-2012, 11:29 PM
For the .lws, it's fairly easy to open it in a in a text editor (notepad on the PC or TextEdit on the Mac) and perform a find and replace. (Find "G:\Myfolder" Replace with "\\MyServer\Myfolder")

For the models, it's not so easy.

Are your assets spread across different folders? If all your files are in the content directory, the filepaths should be relative and setting the content directory to UNC path should would fix the problem. Though there are some things that like to reference absolute paths.