class Blender3d::FileBlock::Reader

Public Class Methods

new(reader, file_block = FileBlock.new) click to toggle source
# File lib/blender-3d/file_block.rb, line 42
def initialize(reader, file_block = FileBlock.new)
  @reader, @file_block = reader, file_block
end

Public Instance Methods

read() click to toggle source
# File lib/blender-3d/file_block.rb, line 46
def read
  @file_block.code = @reader.read(4).gsub(/\0.*$/, '')
  @file_block.size = @reader.read_uint32
  @file_block.pointer = Pointer.new(@reader.read_pointer)
  @file_block.type_index = @reader.read_uint32
  @file_block.count = @reader.read_uint32
  @file_block.data = @reader.read(@file_block.size)
  read_dna if @file_block.code == 'DNA1'
  @file_block
end

Private Instance Methods

read_dna() click to toggle source
# File lib/blender-3d/file_block.rb, line 57
        def read_dna
  file = StringIO.new(@file_block.data)
  @reader = @reader.model.create_reader(file)
  @file_block.data = DnaBlock.new(@reader)
end