Difference between revisions of "Generating texture lists"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Amorilia
(improved formatting and removed explicit references to my name as that is not relevant for the tutorial)
imported>Darkness X
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Modeling_and_Texturing_Tutorials]]
[[Category:Texturing_Tutorials]]
[[Category:Tutorials]]
[[Category:Tutorials]]
Created by [[User:Razorwing|Razorwing]] from [http://www.silgrad.com/ Silgrad Tower]
{{Tools|req0=[http://www.python.org/download/ Python 2.6]|req1=[http://sourceforge.net/projects/pyffi/files/ PyFFI]|opt0=[http://notepad-plus.sourceforge.net/ Notepad ++]}}


==Introduction==
==Introduction==
Line 44: Line 46:
Put together, the command in my case is:  
Put together, the command in my case is:  


  python scripts\niftexdump.py "C:\Program Files\Oblivion\Data\meshes\ST\book" > "C:\logs\book.txt
  python scripts\niftexdump.py "C:\Program Files\Oblivion\Data\meshes\ST\book" > "C:\logs\book.txt"


The script will execute, which you can tell by the cursor blinking on the row underneath. You'll know when the operation is finished by DOS giving you a new command prompt.
The script will execute, which you can tell by the cursor blinking on the row underneath. You'll know when the operation is finished by DOS giving you a new command prompt.

Latest revision as of 07:42, 16 April 2010

Created by Razorwing from Silgrad Tower

Tools used in this tutorial

Required

Optional


Introduction[edit | edit source]

Niftexdump is a Python script that batch-processes nif files to generate a report of the files' material settings. Its primary application is to give modellers an overview of a large number of models, perhaps because they want an index over Oblivion's files or perhaps because their mod uses a lot of new models. The reports generated by the script makes it very easy to for instance find out which models use a particular texture. This is an important concern for the Silgrad Tower mod, mentioned in the examples below, since the mod uses around 4000 models and changing a texture's filename without researching which models uses it can cause a lot of problems.


Have you forgotten if you actually used a texture on your models you added to your texture folder? Do you want to change the filename and/or folder path of a texture but are worried that will cause 'pinkness' in unexpected places? Do you want to make sure that for instance all your ambient light settings are pure white? All of those problems and more can be solved by using the niftexdump script.


Requirements[edit | edit source]

First you need to install Python. After that you need to install PyFFI. For more information about installing those, see the Nif Optimization wiki article.

Running the Script[edit | edit source]

Choose "Run" on Windows' Start Menu, type cmd in the textbox and press the OK button to launch DOS. Browse to Python's installation folder by typing cd followed by the local path. The default local path is C:\Python25, so if you installed to that then the command would be

cd C:\Python25

Lastly hit the return key to execute the command. Next, enter the following command:

python scripts\niftexdump.py "<local path to mesh folder>" > "<local path+filename of log file>"

and hit return. If you use local paths or filenames with blankspaces in them—you most likely will—then you need to encase them in citation marks, otherwise DOS will interpret them as separate arguments and will not understand the command. You can always use citation marks for paths if you want, it's just that not using them only works as long as there are no blankspaces.

For example, let's say you want to get information about the models located in a folder called "book" which is a subfolder of "ST" in the root meshes folder. In that case the local path to mesh folder is

C:\Program Files\Oblivion\Data\meshes\ST\book

It might differ depending on your harddrive setup and where you chose to install Oblivion, but you get the jist of it. A good way of getting the local path if you're unsure is through the folder's adress bar (which you might have to enable through Windows' folder options dialogue).

Note that you can enter the command as

python scripts\niftexdump.py "C:\Program Files\Oblivion\Data\meshes\ST\book"

but that will mean the information gets printed to the DOS window, which isn't very useful. Instead you'll probably want to print the information to a text document. To do that, write the command you have so far and add a blankspace then a > sign and then another blankspace and then write the local path and filename of the text document you want to create. For example, suppose you have a directory

c:\logs

where you save your logs. It doesn't matter where you save the logs, the only things to keep in mind is to add quotation marks if there are blankspaces in the path and/or filename and also to add the file extension. In the above case the log would be "C:\logs\book.txt".

Put together, the command in my case is:

python scripts\niftexdump.py "C:\Program Files\Oblivion\Data\meshes\ST\book" > "C:\logs\book.txt"

The script will execute, which you can tell by the cursor blinking on the row underneath. You'll know when the operation is finished by DOS giving you a new command prompt.


TIP. If you press the up arrow on your keyboard's arrow pad, the last executed DOS command will get reprinted. You can save a lot of time by tweaking a copied command than by writing it over and over again.


The DOS Commands A generated log A collection of generated logs


Inspecting the Log File[edit | edit source]

There are thousands of models to keep track of in the Silgrad Tower mod and exporting all of them to a single text file isn't a practical solution. It's more convenient to do it folder by folder, for three reasons: It's easier to find information that way, it's faster to update the info for a folder you've worked in, and also because in rare cases the script may stop when it comes across a nif it doesn't understand (you should report such cases on the bug tracker).

Sometimes one wants to run searches through all the logs, and if you have a great deal of them then you can save some time by using programs that can run batch searches like that. There are a number of commercial programs that can find text strings in multiple documents, but if you don't have any then an excellent freeware alternative is "Notepad ++". It's very easy to get started too, just open it up and choose "Search > Find in files...". Browse to the folder you saved the logs to by clicking the "..." button to the right of the Directory textbox. Enter a texture name or other textstring in the "Find what:" textbox, and away you go. You'll get a list of which logs the search occurs in. Open the logs manually and do a search for the textstring, then scroll up to find out what nif it belongs to.

Searching logs in Notepad++