Class: Blender3d::PointerType
- Inherits:
-
Object
- Object
- Blender3d::PointerType
- Defined in:
- lib/blender-3d/types.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type) ⇒ PointerType
constructor
A new instance of PointerType.
- #inspect ⇒ Object
- #read(reader) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type) ⇒ PointerType
Returns a new instance of PointerType.
45 46 47 |
# File 'lib/blender-3d/types.rb', line 45 def initialize(type) @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
43 44 45 |
# File 'lib/blender-3d/types.rb', line 43 def type @type end |
Instance Method Details
#inspect ⇒ Object
53 54 55 |
# File 'lib/blender-3d/types.rb', line 53 def inspect "#{@type.inspect}*" end |
#read(reader) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/blender-3d/types.rb', line 57 def read(reader) pointer = Pointer.new(reader.read_pointer) model = reader.model block = model.pointers[pointer] if block && block.data.is_a?(String) && !block.type if block.count == 1 size = if @type.is_a?(PointerType) model.header.pointer_size else model.dna_block.data.types.find { |type, _| type == @type.name }.last end if block.size > size && block.size % size == 0 block.type = ArrayType.new(@type, block.size / size) else block.type = @type end else block.type = @type end block.parse_data(reader.model) end pointer end |
#to_s ⇒ Object
49 50 51 |
# File 'lib/blender-3d/types.rb', line 49 def to_s "Pointer(#@type)" end |