Maniphest T54127

Port blendfile parsing code from BAM to BAT?
Closed, ResolvedDESIGN

Assigned To
Sybren A. Stüvel (sybren)
Authored By
Sybren A. Stüvel (sybren)
Feb 22 2018, 11:15 AM
Tags
None
Subscribers
Francesco Siddi (fsiddi)
Sybren A. Stüvel (sybren)

Description

The Blendfile parsing code in BAM's blendfile.py works mostly fine, and should be ported to BAT.

  • Break into a few separate files.
  • Convert module-like classes to actual modules.
  • Instead of passing the BlendFileHeader object around all the time, which is then used to find the endianness index, which is then used to find the correct struct to parse data, for each field that needs to be read, take a more object-oriented approach and construct an object once that then just points to the correct struct.
  • Use pathlib.Path for concrete paths of files to access.
  • In general, use a more Pythonic approach.

One thing to note is that there currently seems to be a bug in write_string(), which truncates the string to the field length before encoding to UTF-8, rather than truncating the encoded bytes. Furthermore, it should avoid truncating in the middle of a character and producing invalid UTF-8.

Related Objects

StatusSubtypeAssignedTask
ResolvedDESIGNSybren A. Stüvel (sybren)
ResolvedDESIGNSybren A. Stüvel (sybren)

Event Timeline

Sybren A. Stüvel (sybren) lowered the priority of this task from 90 to Normal.Feb 22 2018, 11:15 AM
Sybren A. Stüvel (sybren) created this task.
Sybren A. Stüvel (sybren) changed the task status from Unknown Status to Resolved.Feb 26 2018, 4:35 PM

The blendfile parsing, and writing string properties, is all ported from BAM as of commit 127f357e49acc4c144d9c49c10f875ac91fc942e.