class MovieMasher::LayerTransition

a transition layer

Public Class Methods

new(job, input, job_input) click to toggle source
Calls superclass method MovieMasher::Layer.new
# File lib/graphs/layers.rb, line 132
def initialize(job, input, job_input)
  @job = job
  raise('no job') unless @job
  super(input, job_input)
  @graphs = []
end

Public Instance Methods

add_new_layer(clip) click to toggle source
# File lib/graphs/layers.rb, line 124
def add_new_layer(clip)
  layer_letter = 'a'
  @graphs.length.times { layer_letter.next! }
  layer_label = "#{layer_letter}_#{Type::TRANSITION}"
  graph = GraphMash.new(@job, @job_input, @input[:range], layer_label)
  graph.add_new_layer(clip)
  @graphs << graph
end
initialize_chains() click to toggle source
Calls superclass method MovieMasher::Layer#initialize_chains
# File lib/graphs/layers.rb, line 175
def initialize_chains
  # puts "LayerTransition.initialize_chains #{@input}"
  super
  @layers = []
  c1 = {}
  c2 = {}
  @layer_chains = [c1, c2]
  if __is_and_not_empty(@input[:from][:filters])
    c1[:filters] = ChainModule.new(@input[:from], @job_input, @input)
  end
  if __is_and_not_empty(@input[:to][:filters])
    c2[:filters] = ChainModule.new(@input[:to], @job_input, @input)
  end
  c1[:merger] = ChainModule.new(@input[:from][:merger], @job_input, @input)
  c2[:merger] = ChainModule.new(@input[:to][:merger], @job_input, @input)
  c1[:scaler] = ChainModule.new(@input[:from][:scaler], @job_input, @input)
  c2[:scaler] = ChainModule.new(@input[:to][:scaler], @job_input, @input)
  mash_source = @job_input[:mash]
  mash_color = mash_source[:backcolor]
  @color_layer = LayerColor.new(@input[:range].length_seconds, mash_color)
end
layer_command(scope) click to toggle source
# File lib/graphs/layers.rb, line 138
def layer_command(scope)
  layer_scope(scope)
  layer_letter = 'a'
  cmds = []
  merge_cmds = []
  last_label = '[transback]'
  backcolor_cmd = @color_layer.layer_command(scope)
  backcolor_cmd += last_label
  @graphs.length.times do |i|
    graph = @graphs[i]
    layer_label = "#{layer_letter}_#{Type::TRANSITION}"
    cmd = graph.graph_command(scope[:mm_output])
    layer_chain = @layer_chains[i]
    cmd += ','
    cmd += layer_chain[:scaler].chain_command(scope)
    if layer_chain[:filters]
      chain_cmd = layer_chain[:filters].chain_command(scope)
      unless chain_cmd.to_s.empty?
        cmd += ','
        cmd += chain_cmd
      end
    end
    cur_label = "[#{layer_label}]"
    cmd += cur_label
    cmds << cmd
    cmd = last_label
    cmd += cur_label
    cmd += @layer_chains[i][:merger].chain_command(scope)
    last_label = "[#{layer_label}ed]"
    cmd += last_label if 0 == i
    merge_cmds << cmd
    layer_letter.next!
  end
  cmds << backcolor_cmd
  cmds += merge_cmds
  cmds.join(';')
end