Skip to content

Commit

Permalink
Make "Keep original header" a toggleable option
Browse files Browse the repository at this point in the history
  • Loading branch information
RenolY2 committed Aug 30, 2019
1 parent 236c342 commit 540fdbf
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions j3dview.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import logging
import os.path
import configparser

import numpy
from OpenGL.GL import *
Expand Down Expand Up @@ -138,17 +139,30 @@ def __init__(self,textures,index,new_value):
new = self.new_value
old = self.old_value

new.wrap_s = old.wrap_s
new.wrap_t = old.wrap_t
new.minification_filter = old.minification_filter
new.magnification_filter = old.magnification_filter

new.minimum_lod = old.minimum_lod
new.maximum_lod = old.maximum_lod
new.lod_bias = old.lod_bias
new.unknown0 = old.unknown0
new.unknown1 = old.unknown1
new.unknown2 = old.unknown2
config = configparser.ConfigParser()
try:
config.read("options.ini")
keeporiginalheader = config["Textures"].getboolean("keeporiginalheader")
except KeyError:
config["Textures"] = {"keeporiginalheader": "True"}
with open("options.ini", "w") as f:
f.write("")
config.write(f)

keeporiginalheader = True

if keeporiginalheader:
new.wrap_s = old.wrap_s
new.wrap_t = old.wrap_t
new.minification_filter = old.minification_filter
new.magnification_filter = old.magnification_filter

new.minimum_lod = old.minimum_lod
new.maximum_lod = old.maximum_lod
new.lod_bias = old.lod_bias
new.unknown0 = old.unknown0
new.unknown1 = old.unknown1
new.unknown2 = old.unknown2

def redo(self):
self.textures[self.index] = self.new_value
Expand Down

0 comments on commit 540fdbf

Please sign in to comment.