pub fn calc_mem_tlen(member: &DnaStrMember, type_found: u16) -> u16
Expand description

Each Blender C struct can have member entries and this function calculates a size for each of these entries.

e.g.

$ ./target/release/blend_info -n Camera blend/factory_v279.blend
Camera 248
struct Camera { // SDNAnr = 25
  ID id; // 120
  AnimData *adt; // 8
  char type; // 1
  char dtx; // 1
  short flag; // 2
  float passepartalpha; // 4
  float clipsta; // 4
  float clipend; // 4
  float lens; // 4
  float ortho_scale; // 4
  float drawsize; // 4
  float sensor_x; // 4
  float sensor_y; // 4
  float shiftx; // 4
  float shifty; // 4
  float YF_dofdist; // 4
  Ipo *ipo; // 8
  Object *dof_ob; // 8
  GPUDOFSettings gpu_dof; // 24
  char sensor_fit; // 1
  char pad[7]; // 7
  CameraStereoSettings stereo; // 24
}; // 248

Simple members, like “char”, “short”, or “float” consist e.g. of one, two, or 4 bytes, whereas ID is a C struct itself (and the number of bytes might change over time between Blender versions). Pointers to a C struct start with an “*” in it’s name (e.g. “*ipo”), and always have the same length. independent of the length of the C struct they are pointing to. Arrays (like “pad[7]”) multiply the length of the array (in this case 7) by the number of bytes used for the type (in this case one byte for a “char”).