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 278
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 248
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

LayerTransition

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