Python script for removing NITextureEffects from nif files

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
Post Reply
devnull
Posts: 4
Joined: 25 Sep 2017, 03:23

Python script for removing NITextureEffects from nif files

Post by devnull » 25 Sep 2017, 04:02

Hey all,

I'm new here, so I'm not really sure if this is the right place to post this.

After reading the guide on converting Apel's various things here,
I decided to try to make an automated script to do this. It uses python 3 and pyffi

I've uploaded it as a gist for now here.

Any feedback is welcome as I have no prior experience with editing these files, I merely tried to mirror what the guide said to do manually.

User avatar
lysol
Posts: 726
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: Python script for removing NITextureEffects from nif files

Post by lysol » 25 Sep 2017, 11:58

Hi there and welcome to the forums!

I'm sure the thread fits this forum category.

Anyway, I'm at work right now, but I will try to have a look later today or later this week. If it works as it should, then you're my hero. Thanks for trying this out! :)
Normal mapped texture replacers, exclusive for OpenMW:
My Nexus page

User avatar
kuyondo
Posts: 120
Joined: 29 Mar 2016, 17:45

Re: Python script for removing NITextureEffects from nif files

Post by kuyondo » 25 Sep 2017, 12:01

this is amazing. Many people will find this useful.

devnull
Posts: 4
Joined: 25 Sep 2017, 03:23

Re: Python script for removing NITextureEffects from nif files

Post by devnull » 25 Sep 2017, 17:51

Excellent. Let me know if you have any questions about using it. I didn't exactly document it very well, and I only tested it on Linux, so I'm not 100% sure if Windows style paths would have any impact on it's functionality.

I'm also more than happy to take requests on any similar scripts / tools that might help with modding. I'm working on another tool right now to help better manage/ organize my data files directories.

jonimacarroni
Posts: 14
Joined: 26 Sep 2017, 23:43

Re: Python script for removing NITextureEffects from nif files

Post by jonimacarroni » 27 Sep 2017, 21:06

First of all, thank you very much for the work.

Now, I've tried running the script in spyder, and after installing pyffi I get the following error:
runfile('C:/GOG Games/MW mods/Data folders/fix_nif.py', wdir='C:/GOG Games/MW mods/Data folders')
usage: fix_nif.py [-h] [--dryrun] [--regex REGEX] dir
fix_nif.py: error: the following arguments are required: dir
An exception has occurred, use %tb to see the full traceback.

SystemExit: 2

C:\Users\Me\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2870: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
I'm running it in the directory where I have all the mods installed for openmw, each in its separate folder, of course. Do I need to run it inside each folder separately? Because I've tried it and it doesn't seem to work, I get the same error.
I've only used python for numerical/scientific computing, so I don't really understand argparse, but the error message seems to indicate that there's a directory argument that has not been specified, no?

devnull
Posts: 4
Joined: 25 Sep 2017, 03:23

Re: Python script for removing NITextureEffects from nif files

Post by devnull » 27 Sep 2017, 21:26

It looks like you're missing the dir argument, I believe you need to add an args parameter to runfile:

Code: Select all

runfile('C:/GOG Games/MW mods/Data folders/fix_nif.py', args='.', wdir='C:/GOG Games/MW mods/Data folders')

jonimacarroni
Posts: 14
Joined: 26 Sep 2017, 23:43

Re: Python script for removing NITextureEffects from nif files

Post by jonimacarroni » 27 Sep 2017, 21:34

I tried using both your exact command and also using args='C:/GOG Games/MW mods/Data folders', but I get a different error (same in both cases):
runfile('C:/GOG Games/MW mods/Data folders/fix_nif.py', args='C:/GOG Games/MW mods/Data folders', wdir='C:/GOG Games/MW mods/Data folders')
Traceback (most recent call last):

File "<ipython-input-3-ee979f07e8f4>", line 1, in <module>
runfile('C:/GOG Games/MW mods/Data folders/fix_nif.py', args='C:/GOG Games/MW mods/Data folders', wdir='C:/GOG Games/MW mods/Data folders')

File "C:\Users\Eu\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 688, in runfile
execfile(filename, namespace)

File "C:\Users\Eu\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 100, in execfile
with open(filename, 'rb') as f:

FileNotFoundError: [Errno 2] No such file or directory: 'C:/GOG Games/MW mods/Data folders/fix_nif.py'
This is strange, since this is the exact file I am running that is not being recognized.

EDIT: I think it would just be easier for me to recreate how you are using your own script. Can you explain how you are using it?
EDIT2: Ignore this, I got it to work.

devnull
Posts: 4
Joined: 25 Sep 2017, 03:23

Re: Python script for removing NITextureEffects from nif files

Post by devnull » 27 Sep 2017, 21:53

Hmm I'm not really familiar with IPython so I'm not sure if that's an exception that's coming from the script and that's just how it's presented.
It seems odd that it would throw a file not found exception if it ran the script in the first place in your previous post.

I'll try testing on windows tonight... perhaps there is an issue with windows style paths too, I just did some reading in the python docs, I'm not convinced that the writes will work on windows, but you should see some output if it's doing anything.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest