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 153 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 145 def add_new_layer(clip) layer_letter = ('a'..'z').to_a[@graphs.length] 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 161 def initialize_chains # puts "LayerTransition.initialize_chains #{@input}" super @layers = [] c1 = {} c2 = {} @layer_chains = [c1, c2] if _present(@input[:from][:filters]) c1[:filters] = ChainModule.new(@input[:from], @job_input, @input) end if _present(@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
inputs()
click to toggle source
# File lib/graphs/layers.rb, line 183 def inputs graph_inputs = [] @graphs.each { |graph| graph_inputs += graph.inputs } graph_inputs end
layer_command(scope)
click to toggle source
# File lib/graphs/layers.rb, line 189 def layer_command(scope) layer_scope(scope) layer_letters = ('a'..'z').to_a.cycle 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_letters.next}_#{Type::TRANSITION}" cmd = graph.graph_command(scope[:mm_output], dont_set_input_index: true) layer_chain = @layer_chains[i] cmd += ',' unless cmd.end_with?(':v]') 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 += ',' unless cmd.end_with?(':v]') 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 i.zero? merge_cmds << cmd end cmds << backcolor_cmd cmds += merge_cmds cmds.join(';') end