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

Small additions to codegen and one fix. #280

Closed Candoran2 closed 1 year ago

Candoran2 commented 1 year ago

Changes:

  1. Enums and Bitfields can now also use custom class code, with the same syntax as Structs (everything after # START_CLASS is copied).
  2. Because from_value on a class indicates a class doesn't use context, and objects created with from_value don't have context, context is no longer taken into account with validation on classes that have from_value.
  3. Exception in validate_instance that are not the AssertionError were difficult to diagnose, because they didn't log the field or type - now every exception logs them.
  4. Added warning for reset_field when the field in question either doesn't exist on the struct or is not active to prevent silent failures that are difficult to track down, but still allow it to pass if that's the intended behaviour. Reset_field, if successful, also returns the value of the field.
  5. Fixed Array.from_value function that wasn't working properly due to array mismatch.