Difference between revisions of "Nif Optimization"

76 bytes removed ,  14:49, 14 January 2008
improved formatting, some minor updates
imported>Amorilia
(updated info about optimizer script)
imported>Amorilia
(improved formatting, some minor updates)
Line 34: Line 34:
To get the script to work you need Python and PyFFI. Python is an open source programming language, while PyFFI is an interface between Python and nif files.
To get the script to work you need Python and PyFFI. Python is an open source programming language, while PyFFI is an interface between Python and nif files.


# Install [http://www.python.org/download/ Python 2.5] (in this article it will be assume that you use the default installation path, C:\Python25).
*Install [http://www.python.org/download/ Python 2.5] (in this article it will be assume that you use the default installation path, C:\Python25).
# Install [http://sourceforge.net/project/platformdownload.php?group_id=199269&sel_platform=3089 PyFFI].
*Install [http://sourceforge.net/project/platformdownload.php?group_id=199269&sel_platform=3089 PyFFI].


==Using the Optimizer from the Windows Explorer==
==Using the Script from the Windows Explorer==


For simple usage you can use it directly from the Windows explorer.
For simple usage you can use it directly from the Windows explorer.


#Right click on the nif you wish to optimize.
*Right click on the nif you wish to optimize.
#Select "Optimize with PyFFI".
*Select "Optimize with PyFFI".
#A DOS window will open, asking for confirmation. Type the letter Y and hit enter.
*A DOS window will open, asking for confirmation. Type the letter Y and hit enter.
#You will get to see the results of the optimization.
*You will get to see the results of the optimization.
#Test your optimized nif file with nifskope and in the game to make sure that nothing has been lost. If the script makes a visual change to your nif file, report it on the [http://niftools.sourceforge.net/forum/ niftools forum].
*Test your optimized nif file with nifskope and in the game to make sure that nothing has been lost. If the script makes a visual change to your nif file, report it on the [http://niftools.sourceforge.net/forum/ niftools forum].


==Using the Optimizer from the Command Prompt==
==Using the Script from the Command Prompt==


To use the more advanced features of the nif optimizer, such as batch processing of many nifs with a single command, and excluding particular block types from optimization, you need to use the script through the command prompt. If you are uncomfortable using the command prompt, then do not worry, all the steps are explained.
To use the more advanced features of the nif optimizer, such as batch processing of many nifs with a single command, and excluding particular block types from optimization, you need to use the script through the command prompt. If you are uncomfortable using the command prompt, then do not worry, all the steps are explained.


===Running nifoptimize.py in the Windows shell===
===Running the Script===
 
# Create a folder called "nifoptimize" on your C: drive (the name is not crucial, you can choose whichever folder name you like).
# Make a full backup of all nifs you plan to optimize before proceeding. If the script runs into a bug then it may corrupt your nif and thereby destroy it.
# Copy the nifs you want to optimize to "C:\nifoptimize".
# Open the start menu in Windows and select Run ([http://s11.photobucket.com/albums/a177/SilgradTower/AmoriliasScript/RunOnStartMenu.jpg img]). In the popup, write cmd and hit enter ([http://s11.photobucket.com/albums/a177/SilgradTower/AmoriliasScript/cmd.jpg img]). Now a Windows shell with command prompt will appear. Write


*Create a folder called "nifoptimize" on your C: drive (the name is not crucial, you can choose whichever folder name you like).
*Make a full backup of all nifs you plan to optimize before proceeding. If the script runs into a bug then it may corrupt your nif and thereby destroy it.
*Copy the nifs you want to optimize to "C:\nifoptimize".
*Open the start menu in Windows and select Run ([http://s11.photobucket.com/albums/a177/SilgradTower/AmoriliasScript/RunOnStartMenu.jpg img]). In the popup, write cmd and hit enter ([http://s11.photobucket.com/albums/a177/SilgradTower/AmoriliasScript/cmd.jpg img]). Now a Windows shell with command prompt will appear. [[Image:PythonScriptInDos.jpg|thumb| This is what the DOS window should look like if using the default commands.]]
*Type
  cd C:\Python25
  cd C:\Python25
followed by enter, to tell the Windows shell to go to your Python install folder. If you did not install Python in the default location then just replace the folder with your Python install folder. If you are unsure about where Python is installed, open the start menu then go to "Programs > Python 2.5", right-click any of the shortcuts and choose properties. Open the Shortcut tab, where the Python path is displayed in the "Target:" textbox. Write that url in your DOS window in the same format as the example.
*Next, type
  python.exe Scripts\nifoptimize.py C:\nifoptimize
  python.exe Scripts\nifoptimize.py C:\nifoptimize
 
followed by enter, to run the nifoptimize.py script, which will process all nif files in the folder C:\nifoptimize.
and hit enter.
*If everything works like it should, you should get a warning and a confirmation prompt. Write the letter Y and hit return. Now the program will work it's way through all the nifs in the folder.
 
*If the script comes across a nif it doesn't understand it will display an error, but it should continue working. The problematic nif should be left untouched, but be sure to check with NifSkope, just to avoid any risk of using a corrupted nif.
[[Image:PythonScriptInDos.jpg|thumb| This is what the DOS window should look like if using the default commands.]]
*Don't forget to doublecheck that all nifs work afterwards. If it opens in Nifskope and looks alright then it is probably not corrupted.
 
===Notes===
 
* The first line tells the Windows shell to go to your Python install folder. If you did not install Python in the default location then just replace the folder with your Python install folder. If you are unsure about where Python is installed, open the start menu then go to "Programs > Python 2.5", right-click any of the shortcuts and choose properties. Open the Shortcut tab, where the Python path is displayed in the "Target:" textbox. Write that url in your DOS window in the same format as the example.
* The second line makes Python run the nifoptimize.py script, which will process all nif files in the folder C:\nifoptimize.
 
If everything works like it should, you should get a warning and a confirmation prompt. Write the letter Y and hit return. Now the program will work it's way through all the nifs in the folder.
 
If the script comes across a nif it doesn't understand it will display an error, but it should continue working. The problematic nif should be left untouched, but be sure to check with NifSkope, just to avoid any risk of using a corrupted nif.
 
 
Don't forget to doublecheck that all nifs work afterwards. If it opens in Nifskope and look alright then I'd say it's a safe bet it's not corrupted.


===Command Line Options===
===Command Line Options===
Anonymous user