Class: Assimp::PropertyStore

Inherits:
FFI::ManagedStruct
  • Object
show all
Defined in:
lib/assimp/import.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePropertyStore

Returns a new instance of PropertyStore.



81
82
83
# File 'lib/assimp/import.rb', line 81

def initialize
  super(Assimp::aiCreatePropertyStore)
end

Class Method Details

.config_setter(*args) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/assimp/import.rb', line 89

def self.config_setter(*args)
  args.each { |name, type|
    prop = name.upcase.to_s
    meth_name = name.to_s.downcase + "="
    if type == :bool
      define_method(meth_name) do |bool|
        raise "Invalid bool value #{bool.inspect}" unless bool == Assimp::TRUE || bool == Assimp::FALSE
        Assimp::aiSetImportPropertyInteger(self, prop, bool)
        bool
      end
    elsif type == :int
      define_method(meth_name) do |val|
        Assimp::aiSetImportPropertyInteger(self, prop, val)
        val
      end
    elsif type == :float
      define_method(meth_name) do |val|
        Assimp::aiSetImportPropertyFloat(self, prop, val)
        val
      end
    elsif type == :matrix4x4
      define_method(meth_name) do |mat|
        Assimp::aiSetImportPropertyMatrix(self, prop, mat)
        mat
      end
    elsif type == :string
      define_method(meth_name) do |str|
        s = String::new
        s.data = str
        Assimp::aiSetImportPropertyString(self, prop, s)
        str
      end
    elsif type == :string_array
      define_method(meth_name) do |args|
        str = args.collect { |a| a =~ /\s/ ? "\'"+a+"\'" : a }.join(" ")
        s = String::new
        s.data = str
        Assimp::aiSetImportPropertyString(self, prop, s)
        args
      end
    end
  }
end

.release(ptr) ⇒ Object



85
86
87
# File 'lib/assimp/import.rb', line 85

def self.release(ptr)
  Assimp::aiReleasePropertyStore(ptr)
end