03-18-2010, 11:59 AM
Does anyone know a way to update 1 or 2 textures in each of 62 nifs into 3 new pairs of textures without going into each one individually in nifscope to perform 186 individual edits and gradually losing your mind..!
I'm trying to do a bulk retex on the architecture/stonewalls set for three different landscape regions. I found Texture Replacer but can't seem to make it work: it just breaks the NIFs.
Ideally, I'd like it if NifSkope had a "batch" mode, but it doesn't seem to. Has anyone come across a suitable tool?
Update:
OK, I had to put my programmer head on for this one, which is unfortunate: because its a rather mouldy old turnip now used as a candleholder in the shed.
My tool of choice, I think, is going to be niftoaster. This is a Python script supplied with the PyFFI toolset. The main reason I'm going with this is that it's current. PyFFI is actively in development on sourceforge.
However, the documentation appears to have been written exclusively by programmers and is therefore fundamentally incomprehensible to ordinary mortals. I was just about able to make enough sense of it to get it to run.
To run niftoaster, you need to have PyFFI installed, and for that you need Python 2.6. Once those are installed, and if you've selected all the defaults, then you should have the following file:
c:\Python26\Scripts\niftoaster.py
.. lots of other files and folders too, of course, but that's niftoaster.
It's a command line tool. Check all's well by opening a cmd.exe and running these commands:
C:
cd C:\Python26
python Scripts\niftoaster.py --help
you should get the output:
Usage: niftoaster.py [options] <spell1> <spell2> ... <file>|<folder>
Apply the spells <spell1>, <spell2>, and so on, on <file>, or recursively on
<folder>.
Options:
.... and lots more info.
"Spells" are programs that niftoaster will run on the files. You can get a full list with the command
python Scripts\niftoaster.py --spells
The one I'm interested in is modify_substitutetexturepath. I tried the built in help:
python Scripts\niftoaster.py --help-spell modify_substitutetexturepath
pyffi.toaster:INFO:Runs a regex replacement on texture paths.
Well, after that not-so-helpful start, I did work it out. To run niftoaster for my retex, I created a batch file in my project working folder called retex.bat containing the following:
:eek: What's all that then?
The actual syntax here is,
python Scripts\niftoaster.py -a [regular expression (regex) replacement string] [spellname] [filepath]
"-a" prefixes an argument that will be passed to all the "spells"
niftoaster has a whole heap of "spells" that can be run on all the files found in [filepath]
the one I'm interested in is modify_substitutetexturepath
so for me the real fight was finding out what a regex replacement string was and how to write one to go in [regular expression (regex) replacement string]
What we've basically got in there is:
/change this/to this
all the backslashes are just doubled-up because Python likes it that way.
I suspect this is all very case sensitive.
When you run the batch file, which you can from Windows explorer if you like, it pops up a dosbox and prompts:
This script will modify your files, in particular if something goes wrong it
may destroy them. Make a backup of your files before running this script.
Are you sure that you want to proceed? [n/y]
If you didn't make a backup before this then now would be a good time!
Say "Y" and it'll churn through all the files making the change.
You can get much fancier with regular expressions, replacing just exactly those parts you need, but this is enough for me for tonight.
As intimated earlier, there's other stuff you can do with niftoaster - there's a guide to using it for Nif Optimisation on CS Wiki by Razorwing.
Hope that helps someone....
I'm trying to do a bulk retex on the architecture/stonewalls set for three different landscape regions. I found Texture Replacer but can't seem to make it work: it just breaks the NIFs.
Ideally, I'd like it if NifSkope had a "batch" mode, but it doesn't seem to. Has anyone come across a suitable tool?
Update:
OK, I had to put my programmer head on for this one, which is unfortunate: because its a rather mouldy old turnip now used as a candleholder in the shed.
My tool of choice, I think, is going to be niftoaster. This is a Python script supplied with the PyFFI toolset. The main reason I'm going with this is that it's current. PyFFI is actively in development on sourceforge.
However, the documentation appears to have been written exclusively by programmers and is therefore fundamentally incomprehensible to ordinary mortals. I was just about able to make enough sense of it to get it to run.
To run niftoaster, you need to have PyFFI installed, and for that you need Python 2.6. Once those are installed, and if you've selected all the defaults, then you should have the following file:
c:\Python26\Scripts\niftoaster.py
.. lots of other files and folders too, of course, but that's niftoaster.
It's a command line tool. Check all's well by opening a cmd.exe and running these commands:
C:
cd C:\Python26
python Scripts\niftoaster.py --help
you should get the output:
Usage: niftoaster.py [options] <spell1> <spell2> ... <file>|<folder>
Apply the spells <spell1>, <spell2>, and so on, on <file>, or recursively on
<folder>.
Options:
.... and lots more info.
"Spells" are programs that niftoaster will run on the files. You can get a full list with the command
python Scripts\niftoaster.py --spells
The one I'm interested in is modify_substitutetexturepath. I tried the built in help:
python Scripts\niftoaster.py --help-spell modify_substitutetexturepath
pyffi.toaster:INFO:Runs a regex replacement on texture paths.
Well, after that not-so-helpful start, I did work it out. To run niftoaster for my retex, I created a batch file in my project working folder called retex.bat containing the following:
Code:
c:
cd c:\python26
python Scripts\niftoaster.py -a /architecture\\stonewall\\Stonewall01.dds/Elsweyr\\architecture\\stonewall\\EwMdStoneWallDesert01.dds modify_substitutetexturepath "C:\\Program Files\\Bethesda Softworks\\Oblivion\\Data\\Meshes\\Elsweyr\\Architecture\\stonewall\\desert\\mod\\"
pause
The actual syntax here is,
python Scripts\niftoaster.py -a [regular expression (regex) replacement string] [spellname] [filepath]
"-a" prefixes an argument that will be passed to all the "spells"
niftoaster has a whole heap of "spells" that can be run on all the files found in [filepath]
the one I'm interested in is modify_substitutetexturepath
so for me the real fight was finding out what a regex replacement string was and how to write one to go in [regular expression (regex) replacement string]
What we've basically got in there is:
/change this/to this
all the backslashes are just doubled-up because Python likes it that way.
I suspect this is all very case sensitive.
When you run the batch file, which you can from Windows explorer if you like, it pops up a dosbox and prompts:
This script will modify your files, in particular if something goes wrong it
may destroy them. Make a backup of your files before running this script.
Are you sure that you want to proceed? [n/y]
If you didn't make a backup before this then now would be a good time!
Say "Y" and it'll churn through all the files making the change.
You can get much fancier with regular expressions, replacing just exactly those parts you need, but this is enough for me for tonight.
As intimated earlier, there's other stuff you can do with niftoaster - there's a guide to using it for Nif Optimisation on CS Wiki by Razorwing.
Hope that helps someone....