class FlameChannelParser::FramecurveWriters::Base

Writes out a framecurve setup

Public Class Methods

extension() click to toggle source

Should return the desired extension for the exported file

# File lib/framecurve_writers/base.rb, line 26
def self.extension
  '.timewarp'
end
inherited(by) click to toggle source
# File lib/framecurve_writers/base.rb, line 15
def self.inherited(by)
  @@writers ||= []
  @@writers.push(by)
end
with_each_writer() click to toggle source

Yields each defined writer class to the block

# File lib/framecurve_writers/base.rb, line 21
def self.with_each_writer
  @@writers.each(&Proc.new)
end

Public Instance Methods

run_export(io) { |w| ... } click to toggle source

Run the exporter writing the result to the passed IO. Will yield a KeyWriter to the caller for writing frames (call key(at, value) on it)

# File lib/framecurve_writers/base.rb, line 32
def run_export(io)
  w = KeyWriter.new
  yield(w)
  w.keys.each do | at, value |
    io.puts("%d %.5f" % [at, value])
  end
end
run_export_from_framecurve(io, curve) click to toggle source

Run the exporter writing the result to it, and pulling framecurve frames from the passed Curve object

# File lib/framecurve_writers/base.rb, line 42
def run_export_from_framecurve(io, curve)
  run_export(io) do | writer |
    curve.to_materialized_curve.each_tuple do | t |
      writer.key(t.at, t.value)
    end
  end
end