class MovieMasher::GraphMash

a mash represented as a graph

Public Class Methods

new(job, mash_input, render_range = nil, label_name = 'layer') click to toggle source
Calls superclass method MovieMasher::Graph.new
# File lib/graph.rb, line 238
def initialize(job, mash_input, render_range = nil, label_name = 'layer')
  @label_name = label_name
  super(job, mash_input, render_range)
  @layers = []
  @layers << LayerColor.new(duration, mash_input[:mash][:backcolor])
end

Public Instance Methods

add_new_layer(input) click to toggle source
# File lib/graph.rb, line 210
def add_new_layer(input)
  layer = create_layer(input)
  @layers << layer
  layer
end
graph_command(output, dont_set_input_index = false) click to toggle source
# File lib/graph.rb, line 215
def graph_command(output, dont_set_input_index = false) # LayerTransition
  FilterSourceRaw.input_index = 0 unless dont_set_input_index
  @job_output = output
  graph_cmds = []
  layer_length = @layers.length
  layer_length.times do |i|
    layer = @layers[i]
    cmd = layer.layer_command(graph_scope)
    cmd += layer.trim_command(@render_range)
    cmd += "[#{@label_name}#{i}]" if 1 < layer_length
    graph_cmds << cmd
  end
  if 1 < layer_length
    (1..layer_length - 1).each do |i|
      layer = @layers[i]
      cmd = layer.merger_command(graph_scope, @label_name, i)
      cmd += "[#{@label_name}ed#{i}]" if i + 1 < layer_length
      graph_cmds << cmd
    end
  end
  cmd = graph_cmds.join ';'
  cmd
end
inputs() click to toggle source
# File lib/graph.rb, line 244
def inputs
  layer_inputs = []
  @layers.each { |layer| layer_inputs += layer.inputs }
  layer_inputs
end