OpenNaja / cobra-tools

A suite of GUI tools for extracting and modifying OVL and OVS archives, as well as editing the associated in-house file formats. Also includes a model plugin for Blender. For downloads, guides, and FAQs visit:
https://opennaja.github.io/cobra-tools/
GNU General Public License v3.0
98 stars 28 forks source link

Codegen - Python 3.11 changes str(enum) behavior #274

Closed rinrobi closed 1 year ago

rinrobi commented 1 year ago

Describe the bug

Extracting a tex file with python 3.11 messed up the compression type Instead of "compression_type="DdsType.BC1_UNORM_SRGB"", it becomes "compression_type="79", and is unable to be injected

To Reproduce Steps to reproduce the behavior:

  1. Have python 3.11
  2. Extract a tex file
  3. Open the file and read the compression type

Expected behavior compression_type="DdsType.BC1_UNORM_SRGB"

3.11 Screenshot (104)

3.10.7 Screenshot (105)

HENDRIX-ZT2 commented 1 year ago

https://docs.python.org/3.12/whatsnew/3.11.html#enum

Changed IntEnum, IntFlag and StrEnum to now inherit from ReprEnum, so their str() output now matches format() (both str(AnIntEnum.ONE) and format(AnIntEnum.ONE) return '1', whereas before str(AnIntEnum.ONE) returned 'AnIntEnum.ONE'.

HENDRIX-ZT2 commented 1 year ago

Solution is probably using repr() instead of str()

HENDRIX-ZT2 commented 1 year ago

Repr adds < >, gotta override or use custom implementation

rinrobi commented 1 year ago

fix didn't work? or was there another error

harlequinzeg0 commented 1 year ago

reverted commit on master