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

Changes to get_size, xml interface and validate_instance argument order and more #258

Closed Candoran2 closed 2 years ago

Candoran2 commented 2 years ago

Changes:

  1. Fixed regex-based class call construction.
  2. Changed order of arguments and the way to pass them for to_xml, from_xml, get_size and validate_instance.
  3. Updated codegen readme.
  4. Added get_size and validate_instance methods to classes in the base format that didn't have them.

Detailed changes:

  1. Simple fix where I forgot to use parentheses to indicate a function call.
  2. The to/from_xml functions, get_size and validate_instance all got the arg and template (and arr1 and arr2) parameters passed as part of a tuple. This is in contrast with most other functions, where each is passed as a separate parameter. The order of get_size was also changed to put instance before context. This means that the order of some arguments is generally standardized as follows:

    instance, stream, context, arg, template, shape, dtype

    Note: this says nothing about which arguments a function should take, whether there are other arguments before, after or indeed in between them (although arg, template, shape and dtype should be grouped together when present to allow easy expansion of the field arguments returned by _get_filtered_attribute_list).

  3. The codegen readme was updated to reflect these changes.
  4. This means that every class in the base format now implements every interface denoted in the readme, which should make it easy for other formats to implement them as well should it be desired.