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

Further changes to codegen #252

Closed Candoran2 closed 2 years ago

Candoran2 commented 2 years ago

Additional/changed functionality:

  1. Added debug messages for reading and writing, and warning for validation, on enum for non-enum members.
  2. Added append and extend functions to Array.
  3. The versions.py for every format now also contains custom objects representing every <version> tag in the xml. They are all contained in the versions list and store all the same information as the tag (this is used in the blender niftools addon).
  4. get_padding and get_padding_size were moved from modules/formats/shared.py to the PadAlign class' file from the base format.
  5. Added the _attribute_list variable to every struct class. This gives static information about all the fields in the class (as opposed to _get_filtered_attribute_list). It returns field_name, field_type, field_args, (optional, default), conds, where dynamic values are replaced with None. conds is None if there are no conditions, True otherwise. This class variable can be used for speedup (the nif generated library uses it to speed up get_refs by a large amount). It is also used by the new additions to the StructMetaClass.
  6. StructMetaClass was updated to use the _attribute_list class variable to dynamically generate __len__, __iter__, __getitem__ and from_value functions for a class when appropriate. This means simple structs like Vectors, Colors etc should need less custom code to function as expected (e.g. conversion of Array of these structs to numpy arrays is now very simple).
  7. Boolean notation is now allowed in field default values (as long as the field type has boolean="true").
  8. Any default value not convertible to either a number or a boolean is now presumed to be a string (although I think strings should have a notation, but that's nif.xml format discussion).