bin/tracksperanto in tracksperanto-1.0.6 vs bin/tracksperanto in tracksperanto-1.1.0

- old
+ new

@@ -3,23 +3,24 @@ # # Translate a 2D track file from a single format to many others # # == Usage # -# tracksperanto -f shakescript /Films/Blockbuster/Shots/001/script.shk -w 1920 -h 1080 +# tracksperanto -f ShakeScript /Films/Blockbuster/Shots/001/script.shk -w 1920 -h 1080 # # == Author # Julik <me@julik.nl> require File.dirname(__FILE__) + '/../lib/tracksperanto' -require File.dirname(__FILE__) + '/../lib/pipeline' require 'optparse' # Sane defaults reader_klass = Tracksperanto::Import::ShakeScript width = 1920 height = 1080 +reformat_w = nil +reformat_h = nil scale_x = 1.0 scale_y = 1.0 slip = 0 golden_tracks = false @@ -44,10 +45,17 @@ p.on(" -ys", "--yscale Y_SCALING_FACTOR", Float, "Scale the result in Y by this factor (1.0 is the default)") {|sy| scale_y = sy } p.on(" -s", "--slip FRAMES", Integer, "Slip the result by this number of frames, positive is 'later'") {|sy| slip = sy } p.on(" -g", "--golden", "Reset the residuals of all trackers to 0 (ignore correlation)") {|g_flag| golden_tracks = g_flag } + p.on(" -rx", "--reformat-x NEW_PIX_WIDTH", Integer, "Reformat the comp to this width and scale all tracks to it") {|rw| + reformat_w = rw + } + p.on(" -ry", "--reformat-y NEW_PIX_HEIGHT", Integer, "Reformat the comp to this height and scale all tracks to it") {|rh| + reformat_h = rh + } + end begin parser.parse! rescue OptionParser::MissingArgument => e @@ -62,15 +70,15 @@ puts parser exit(-1) end pipe = Tracksperanto::Pipeline::Base.new -pipe.progress_block = lambda{|percent, msg| puts("#{msg}..#{percent.to_i}% complete") } +pipe.progress_block = lambda{|percent, msg| puts("#{msg}..#{percent.to_i}%") } -pipe.run(input_file, width, height, reader_klass) do | scaler, slipper, golden | +pipe.run(input_file, width, height, reader_klass) do | scaler, slipper, golden, reformat | slipper.slip = slip scaler.x_factor = scale_x scaler.y_factor = scale_y golden.enabled = golden_tracks -end - -puts "Converted #{pipe.converted_points} trackers" + reformat.width = reformat_w if reformat_w + reformat.width = reformat_h if reformat_h +end \ No newline at end of file