Thalassicus Posted December 14, 2009 Share Posted December 14, 2009 Is there any way to give NifSkope batch commands to run on a set of nifs? Either in a GUI or at the command line... I'm somewhat familiar with batch scripting in several environments and programming languages, if NifSkope accepts some form of command line instructions. In particular, I have several hundred meshes I'd like to change the bhkRigidBody layer to static and motion system to fixed. Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 14, 2009 Share Posted December 14, 2009 Not that I know of, although if your computer can handle it, you could always set nifscope as the default program to open a .nif file, open up 4-5 instances of nifscope at once, make changes to all, save and close all, open more, rinse repeat. if you have the discipline, you can probably knock out a hundred meshes or so in an hour. If you can space it out over a longer period of time, like a week, you could be surprised at how quickly you can work through them just by taking a few at a time while you're waiting for anything to happen (uploading files, downloading files, loading web pages, listening to music, killing time, sitting idle trying to think of what else you can do to put off homework). Link to comment Share on other sites More sharing options...
Thalassicus Posted December 14, 2009 Author Share Posted December 14, 2009 Looking into it some, I discovered the Niflib API, made by the developers of NifSkope. It seems a c++ program could could be written to process groups of nifs. What I have written so far is copied below. It compiles fine, but for some reason, I haven't been able to use ReadNifTree to recognize any Oblivion nifs. (apple01.nif is an Oblivion clutter object in the folder of the project.) (removed since I figured out the problem) I added some code to see what the problem was, and for the apple01.nif file, it's reported that the file is an unsupported version. (GetNifVersion returns 4294967294, which doesn't seem right.) I've followed all the guidelines for the api, but I seem to be overlooking something, and am sort of at a loss now what to do. Edit: After much trial and error, carefully re-reading documentation, and use of visual studio's intellisense, add watch and other things to figure out the class structures, I got some of it working. Much of the functionality had changed since the documentation for the api was written, but intellisense provided accurate information on each class's member data, allowing me to work my way down to the bhkRigidBody information without wading through dozens of source files. I successfully ran a program that automatically changed the data elements necessary to convert from physics-enabled to static in a test apple01.nif file. Now I'm just going to try setting it up to do groups of files en mass. It turns out the problem I was having was I had compiled the Release version of Niflib, but was trying to use it in debug mode for my program. After recompiling the library in Debug mode, I was able to use 'add watch' to figure out the structure of the data and how to access the bhkRigidBody information. Link to comment Share on other sites More sharing options...
AlphaxTES Posted December 15, 2009 Share Posted December 15, 2009 NifSkope doesn't have a command-line interface; its main job is analysing and editing individual files. Once inside a file, specific batch processing is possible via the Spells system in the context menus. PyFFI is the preferred interface for low-level interaction with NIFs (eg. batch processing an entire directory tree); several (useful) example spells are available. Amorilia or PacificMorrowind should be able to give you some guidance using PyFFI, on the NifTools forums. NifLib is probably not the most obvious choice for the task ;) PS. Be careful of using the word "convert" when dealing with NIFs; it brings up painful memories of people trying to convert files between different games... :rolleyes: Link to comment Share on other sites More sharing options...
Thalassicus Posted December 16, 2009 Author Share Posted December 16, 2009 I was hoping to use NifLib since c++ is the language more familiar to me, but I learned some rudimentary basics of python when doing scripting for civ 4. It looks like I'm going to have to go down that route anyways... niflib unfortunately doesn't recognize a few elements of oblivion's nifs, (writing them incorrectly when the tree is saved) and I haven't found a way to write specific data elements instead of a tree as a whole, to work around that problem. The term "spell" had thrown me off somewhat; I'd skipped over those sections, thinking they had to do with animated special effects. I'll look into PyFFI some, thank you. Link to comment Share on other sites More sharing options...
Thalassicus Posted December 17, 2009 Author Share Posted December 17, 2009 For anyone interested in similar tasks, I finally found a solution. 1) Install Python 2.62) Install PyFFI3) Create a folder to hold meshes you want to convert4) In that folder, create a shortcut such as the one below: Name:Convert to static Target:C:\Python26\python.exe "C:\Python26\Scripts\niftoaster.py" modify_collisiontype --prefix="static" -a static "C:\meshes" Start In:C:\Python26 Change both of the "C:\Python26\" to the path on your computer of wherever you installed Python 2.6. Change "C:\meshes" to wherever you created the folder to hold NIFs you want to convert. 6) Copy any folder(s) of nifs you want into this conversion folder.7) Run the shortcut you created. It'll change all nifs to the collision type you desire, and add the prefix in front of the new files. If you need any more help, you can ask here. Using this I was able to convert all ingredients in the game to statics, plus about fifty downloaded nifs, add them to the Construction Set, and test them ingame in under an hour. Link to comment Share on other sites More sharing options...
Recommended Posts