Sha256: 9699e8a1e4e254bfbd32d098471c38512b178e6934d96473d68bb0a4c0983002

Contents?: true

Size: 1.5 KB

Versions: 10

Compression:

Stored size: 1.5 KB

Contents

# -*- encoding : utf-8 -*-
require "forwardable"

# The base middleware class works just like a Tracksperanto::Export::Base, but it only wraps another exporting object and does not get registered on it's own
# as an export format. Middleware can be used to massage the tracks being exported in various interesting ways - like moving the coordinates, clipping the keyframes,
# scaling the whole export or even reversing the trackers to go backwards
class Tracksperanto::Middleware::Base
  include Tracksperanto::Casts
  include Tracksperanto::BlockInit
  include Tracksperanto::ConstName
  include Tracksperanto::SimpleExport
  include Tracksperanto::Parameters
  
  extend Forwardable
  def_delegators :@exporter, :start_export, :start_tracker_segment, :end_tracker_segment, :export_point, :end_export
  
  # Used to automatically register your middleware in Tracksperanto.middlewares
  # Normally you wouldn't need to override this
  def self.inherited(by)
    Tracksperanto.middlewares.push(by)
    super
  end
  
  # Returns the human name of the action that the middleware will perform. The action is
  # the in infinitive form, like "Remove all the invalid keyframes", "Crop the image" and so on
  def self.action_description
    "Base middleware class"
  end
  
  # Constructor accepts the exporter that will be wrapped, followed by the optional options hash
  # and the optional block that yields self
  def initialize(*exporter_and_args_for_block_init)
    @exporter = exporter_and_args_for_block_init.shift
    super
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tracksperanto-2.12.0 lib/middleware/base.rb
tracksperanto-2.11.3 lib/middleware/base.rb
tracksperanto-2.11.2 lib/middleware/base.rb
tracksperanto-2.11.1 lib/middleware/base.rb
tracksperanto-2.11.0 lib/middleware/base.rb
tracksperanto-2.10.0 lib/middleware/base.rb
tracksperanto-2.9.9 lib/middleware/base.rb
tracksperanto-2.9.8 lib/middleware/base.rb
tracksperanto-2.9.7 lib/middleware/base.rb
tracksperanto-2.9.6 lib/middleware/base.rb