class Assimp::PropertyStore

Public Class Methods

config_setter(*args) click to toggle source
# 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
new() click to toggle source
Calls superclass method
# File lib/assimp/import.rb, line 81
def initialize
  super(Assimp::aiCreatePropertyStore)
end
release(ptr) click to toggle source
# File lib/assimp/import.rb, line 85
def self.release(ptr)
  Assimp::aiReleasePropertyStore(ptr)
end