Skip to content

Instantly share code, notes, and snippets.

@topfunky
Created April 16, 2011 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topfunky/922752 to your computer and use it in GitHub Desktop.
Save topfunky/922752 to your computer and use it in GitHub Desktop.
Render After Effects sketches
AFTER_EFFECTS_EXPORT_DIRECTORY = "film/after_effects"
rule ".mov" => proc {|task_name|
task_name.sub(/\.mov/,
'.aep').sub(AFTER_EFFECTS_EXPORT_DIRECTORY,
'artwork/after_effects') } do |t|
if !t.name.match("Adobe After Effects Auto-Save")
puts "Rendering #{t.source} to #{t.name}"
output_template = "Animation"
if (t.source =~ /-t-/)
output_template = "Lossless with Alpha (Straight)"
end
mkdir_p File.dirname(File.expand_path(t.name))
if File.exist?(File.expand_path(t.name))
rm File.expand_path(t.name)
end
command = ["'/Applications/Adobe After Effects CS5/aerender'",
# "-reuse", # Launch one instance of AE, or use existing. Faster.
%(-project "#{File.expand_path(t.source)}"),
%(-comp "Comp 1"),
%(-RStemplate "Best Settings - Full Comp"), # Render template
%(-OMtemplate "#{output_template}"), # Output template
"-mp", # Use multicore
"-v ERRORS",
"-close DO_NOT_SAVE_CHANGES",
"-sound ON",
%(-output "#{File.expand_path(t.name)}")]
system(command.join(' '))
rm_rf t.source + " Logs"
end
end
rule ".mov" => proc {|task_name|
task_name.sub(/\.mov/,
'.aep').sub(AFTER_EFFECTS_EXPORT_DIRECTORY,
'artwork-ii/after_effects') } do |t|
if !t.name.match("Adobe After Effects Auto-Save")
puts "Rendering #{t.source} to #{t.name}"
output_template = "Lossless"
if (t.source =~ /-t-/)
output_template = "Lossless with Alpha (Straight)"
end
mkdir_p File.dirname(File.expand_path(t.name))
command = ["'/Applications/Adobe After Effects CS4/aerender'",
"-reuse", # Launch one instance of AE, or use existing. Faster.
%(-project "#{File.expand_path(t.source)}"),
%(-comp "Comp 1"),
%(-RStemplate "Best Settings"), # Render template
%(-OMtemplate "#{output_template}"), # Output template
"-mp", # Use multicore
"-v ERRORS",
"-close DO_NOT_SAVE_CHANGES",
"-sound ON",
%(-output "#{File.expand_path(t.name)}")]
system(command.join(' '))
rm_rf t.source + " Logs"
end
end
task :create_output_directory do
mkdir_p AFTER_EFFECTS_EXPORT_DIRECTORY
end
MOV_FILES = Dir['artwork/after_effects/**/[0-9]*.aep'].map {|t| t.sub(/artwork\/after_effects/, AFTER_EFFECTS_EXPORT_DIRECTORY).sub(/\.aep/, '.mov')}
desc "Render After Effects files"
task :render => [:create_output_directory, MOV_FILES].flatten
task :default => :render
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment