|
Carlos Lopez |
a09598 |
/* === S Y N F I G ========================================================= */
|
|
Carlos Lopez |
a09598 |
/*! \file tool/main.cpp
|
|
Carlos Lopez |
a09598 |
** \brief SYNFIG Tool
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** $Id$
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** \legal
|
|
Carlos Lopez |
a09598 |
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
|
|
Carlos Lopez |
a09598 |
** Copyright (c) 2007, 2008 Chris Moore
|
|
Diego Barrios Romero |
088628 |
** Copyright (c) 2009-2015 Diego Barrios Romero
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** This package is free software; you can redistribute it and/or
|
|
Carlos Lopez |
a09598 |
** modify it under the terms of the GNU General Public License as
|
|
Carlos Lopez |
a09598 |
** published by the Free Software Foundation; either version 2 of
|
|
Carlos Lopez |
a09598 |
** the License, or (at your option) any later version.
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** This package is distributed in the hope that it will be useful,
|
|
Carlos Lopez |
a09598 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Carlos Lopez |
a09598 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Carlos Lopez |
a09598 |
** General Public License for more details.
|
|
Carlos Lopez |
a09598 |
** \endlegal
|
|
Carlos Lopez |
a09598 |
*/
|
|
Carlos Lopez |
a09598 |
/* ========================================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === H E A D E R S ======================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#ifdef USING_PCH
|
|
Carlos Lopez |
a09598 |
# include "pch.h"
|
|
Carlos Lopez |
a09598 |
#else
|
|
Carlos Lopez |
a09598 |
#ifdef HAVE_CONFIG_H
|
|
Carlos Lopez |
a09598 |
# include <config.h></config.h>
|
|
Carlos Lopez |
a09598 |
#endif
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#include <iostream></iostream>
|
|
Diego Barrios Romero |
c7ce8b |
#include <string></string>
|
|
Carlos Lopez |
a09598 |
#include <list></list>
|
|
Carlos Lopez |
a09598 |
|
|
|
cc8279 |
//#include <boost options_description.hpp="" program_options=""></boost>
|
|
|
cc8279 |
//#include <boost parsers.hpp="" program_options=""></boost>
|
|
|
cc8279 |
//#include <boost program_options="" variables_map.hpp=""></boost>
|
|
Diego Barrios Romero |
fd3b0f |
#include <boost tokenizer.hpp=""></boost>
|
|
Diego Barrios Romero |
fd3b0f |
#include <boost token_functions.hpp=""></boost>
|
|
|
3e2a84 |
//#include <boost format.hpp=""></boost>
|
|
Diego Barrios Romero |
fd3b0f |
|
|
|
873d31 |
#include <glibmm.h></glibmm.h>
|
|
|
873d31 |
|
|
bw |
94d8a6 |
#include <synfig localization.h=""></synfig>
|
|
bw |
94d8a6 |
#include <synfig general.h=""></synfig>
|
|
bw |
94d8a6 |
|
|
Carlos Lopez |
a09598 |
#include <synfig module.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig importer.h=""></synfig>
|
|
Carlos Lopez |
b9c525 |
#include <synfig cairoimporter.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig layer.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig canvas.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig target.h=""></synfig>
|
|
Diego Barrios Romero |
6202fa |
#include <synfig targetparam.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig string.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig paramdesc.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <synfig main.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
#include <autorevision.h></autorevision.h>
|
|
Diego Barrios Romero |
978ba8 |
#include "definitions.h"
|
|
Diego Barrios Romero |
978ba8 |
#include "progress.h"
|
|
Diego Barrios Romero |
978ba8 |
#include "job.h"
|
|
Diego Barrios Romero |
d406bf |
#include "synfigtoolexception.h"
|
|
Diego Barrios Romero |
ffa0f8 |
#include "optionsprocessor.h"
|
|
Diego Barrios Romero |
53159b |
#include "joblistprocessor.h"
|
|
Diego Barrios Romero |
dd46b5 |
#include "printing_functions.h"
|
|
Diego Barrios Romero |
fd3b0f |
|
|
|
cc8279 |
//#include "named_type.h"
|
|
Carlos Lopez |
a09598 |
#endif
|
|
Carlos Lopez |
a09598 |
|
|
|
cc8279 |
//namespace po=boost::program_options;
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
f8991f |
std::string _appendAlphaToFilename(std::string input_filename)
|
|
Diego Barrios Romero |
f8991f |
{
|
|
|
509b0d |
|
|
|
509b0d |
std::size_t found = input_filename.rfind(".");
|
|
|
509b0d |
if (found == std::string::npos) return input_filename + "-alpha"; // extension not found, just add to the end
|
|
|
509b0d |
|
|
|
509b0d |
return input_filename.substr(0, found) + "-alpha" + input_filename.substr(found);
|
|
|
509b0d |
|
|
|
509b0d |
/*bfs::path filename(input_filename);
|
|
Diego Barrios Romero |
f8991f |
bfs::path alpha_filename(filename.stem().string() + "-alpha" +
|
|
Diego Barrios Romero |
f8991f |
filename.extension().string());
|
|
|
509b0d |
return bfs::path(filename.parent_path() / alpha_filename).string();*/
|
|
Diego Barrios Romero |
f8991f |
}
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
c7ce8b |
int main(int argc, char* argv[])
|
|
Carlos Lopez |
a09598 |
{
|
|
Carlos Lopez |
a09598 |
setlocale(LC_ALL, "");
|
|
|
395610 |
Glib::init(); // need to use Gio functions before app is started
|
|
Diego Barrios Romero |
c7ce8b |
|
|
Diego Barrios Romero |
0b9c51 |
SynfigToolGeneralOptions::create_singleton_instance(argv[0]);
|
|
Diego Barrios Romero |
0b9c51 |
|
|
|
509b0d |
std::string binary_path =
|
|
Diego Barrios Romero |
0b9c51 |
SynfigToolGeneralOptions::instance()->get_binary_path();
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#ifdef ENABLE_NLS
|
|
|
891c49 |
/*bst::filesystem::path locale_path =
|
|
|
509b0d |
binary_path.parent_path().parent_path();*/
|
|
|
509b0d |
std::string locale_path = get_absolute_path(binary_path + "../../share/locale");
|
|
|
509b0d |
//locale_path = locale_path/"share"/"locale";
|
|
|
509b0d |
//bindtextdomain("synfig", Glib::locale_from_utf8(locale_path.string()).c_str() );
|
|
|
509b0d |
bindtextdomain("synfig", Glib::locale_from_utf8(locale_path).c_str() );
|
|
Carlos Lopez |
a09598 |
bind_textdomain_codeset("synfig", "UTF-8");
|
|
Carlos Lopez |
a09598 |
textdomain("synfig");
|
|
Carlos Lopez |
a09598 |
#endif
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
if(!SYNFIG_CHECK_VERSION())
|
|
Carlos Lopez |
a09598 |
{
|
|
Diego Barrios Romero |
0b9c51 |
std::cerr << _("FATAL: Synfig Version Mismatch") << std::endl;
|
|
Carlos Lopez |
a09598 |
return SYNFIGTOOL_BADVERSION;
|
|
Carlos Lopez |
a09598 |
}
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
0b9c51 |
try
|
|
Diego Barrios Romero |
0b9c51 |
{
|
|
Diego Barrios Romero |
0b9c51 |
if(argc == 1)
|
|
Diego Barrios Romero |
0b9c51 |
{
|
|
Diego Barrios Romero |
71669d |
throw (SynfigToolException(SYNFIGTOOL_MISSINGARGUMENT));
|
|
Diego Barrios Romero |
0b9c51 |
}
|
|
Diego Barrios Romero |
71669d |
|
|
Carlos Lopez |
a09598 |
|
|
|
891c49 |
/* named_type<std::string>* target_arg_desc = new named_type<std::string>("module");</std::string></std::string>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* width_arg_desc = new named_type<int>("NUM");</int></int>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* height_arg_desc = new named_type<int>("NUM");</int></int>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* span_arg_desc = new named_type<int>("NUM");</int></int>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* antialias_arg_desc = new named_type<int>("1..30");</int></int>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* quality_arg_desc = new named_type<int>("0..10");</int></int>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* threads_arg_desc = new named_type<int>("NUM");</int></int>
|
|
Diego Barrios Romero |
9e9a73 |
named_type<int>* verbosity_arg_desc = new named_type<int>("NUM");</int></int>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* canvas_arg_desc = new named_type<std::string>("canvas-id");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* output_file_arg_desc = new named_type<std::string>("filename");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* input_file_arg_desc = new named_type<std::string>("filename");</std::string></std::string>
|
|
Diego Barrios Romero |
a3d879 |
named_type<float>* fps_arg_desc = new named_type<float>("NUM");</float></float>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* time_arg_desc = new named_type<std::string>("seconds");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* begin_time_arg_desc = new named_type<std::string>("seconds");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* start_time_arg_desc = new named_type<std::string>("seconds");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* end_time_arg_desc = new named_type<std::string>("seconds");</std::string></std::string>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* dpi_arg_desc = new named_type<int>("NUM");</int></int>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* dpi_x_arg_desc = new named_type<int>("NUM");</int></int>
|
|
Diego Barrios Romero |
3dc329 |
named_type<int>* dpi_y_arg_desc = new named_type<int>("NUM");</int></int>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* append_filename_arg_desc = new named_type<std::string>("filename");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* sequence_separator_arg_desc = new named_type<std::string>("string");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* canvas_info_fields_arg_desc = new named_type<std::string>("fields");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* layer_info_field_arg_desc = new named_type<std::string>("layer-name");</std::string></std::string>
|
|
Diego Barrios Romero |
b8710c |
named_type<std::string>* video_codec_arg_desc = new named_type<std::string>("codec");</std::string></std::string>
|
|
Diego Barrios Romero |
848b46 |
named_type<int>* video_bitrate_arg_desc = new named_type<int>("bitrate");</int></int>
|
|
Diego Barrios Romero |
3dc329 |
|
|
Diego Barrios Romero |
3dc329 |
po::options_description po_settings(_("Settings"));
|
|
Diego Barrios Romero |
3dc329 |
po_settings.add_options()
|
|
Diego Barrios Romero |
bbc871 |
("target,t", target_arg_desc, _("Specify output target (Default: PNG)"))
|
|
Diego Barrios Romero |
bbc871 |
("width,w", width_arg_desc, _("Set the image width in pixels (Use zero for file default)"))
|
|
Diego Barrios Romero |
bbc871 |
("height,h", height_arg_desc, _("Set the image height in pixels (Use zero for file default)"))
|
|
Diego Barrios Romero |
3dc329 |
("span,s", span_arg_desc, _("Set the diagonal size of image window (Span)"))
|
|
Diego Barrios Romero |
3dc329 |
("antialias,a", antialias_arg_desc, _("Set antialias amount for parametric renderer."))
|
|
|
3e2a84 |
("quality,Q", quality_arg_desc->default_value(DEFAULT_QUALITY), etl::strprintf(_("Specify image quality for accelerated renderer (Default: %d)"), DEFAULT_QUALITY).c_str())
|
|
Diego Barrios Romero |
69ac67 |
("gamma,g", gamma_arg_desc, _("Gamma"))
|
|
Diego Barrios Romero |
bbc871 |
("threads,T", threads_arg_desc, _("Enable multithreaded renderer using the specified number of threads"))
|
|
Diego Barrios Romero |
bbc871 |
("input-file,i", input_file_arg_desc, _("Specify input filename"))
|
|
Diego Barrios Romero |
3dc329 |
("output-file,o", output_file_arg_desc, _("Specify output filename"))
|
|
Diego Barrios Romero |
bbc871 |
("sequence-separator", sequence_separator_arg_desc, _("Output file sequence separator string (Use double quotes if you want to use spaces)"))
|
|
Diego Barrios Romero |
bbc871 |
("canvas,c", canvas_arg_desc, _("Render the canvas with the given id instead of the root."))
|
|
Diego Barrios Romero |
3dc329 |
("fps", fps_arg_desc, _("Set the frame rate"))
|
|
Diego Barrios Romero |
3dc329 |
("time", time_arg_desc, _("Render a single frame at <seconds>"))</seconds>
|
|
Diego Barrios Romero |
3dc329 |
("begin-time", begin_time_arg_desc, _("Set the starting time"))
|
|
Diego Barrios Romero |
3dc329 |
("start-time", start_time_arg_desc, _("Set the starting time"))
|
|
Diego Barrios Romero |
3dc329 |
("end-time", end_time_arg_desc, _("Set the ending time"))
|
|
Diego Barrios Romero |
bbc871 |
("dpi", dpi_arg_desc, _("Set the physical resolution (Dots-per-inch)"))
|
|
Diego Barrios Romero |
bbc871 |
("dpi-x", dpi_x_arg_desc, _("Set the physical X resolution (Dots-per-inch)"))
|
|
Diego Barrios Romero |
bbc871 |
("dpi-y", dpi_y_arg_desc, _("Set the physical Y resolution (Dots-per-inch)"))
|
|
Diego Barrios Romero |
fd3b0f |
;
|
|
Diego Barrios Romero |
fd3b0f |
|
|
Diego Barrios Romero |
3dc329 |
po::options_description po_switchopts(_("Switch options"));
|
|
Diego Barrios Romero |
3dc329 |
po_switchopts.add_options()
|
|
Diego Barrios Romero |
9e9a73 |
("verbose,v", verbosity_arg_desc, _("Output verbosity level"))
|
|
Diego Barrios Romero |
fd3b0f |
("quiet,q", _("Quiet mode (No progress/time-remaining display)"))
|
|
Diego Barrios Romero |
fd3b0f |
("benchmarks,b", _("Print benchmarks"))
|
|
|
4010f4 |
("extract-alpha,x", _("Extract alpha"))
|
|
Diego Barrios Romero |
fd3b0f |
;
|
|
Diego Barrios Romero |
fd3b0f |
|
|
Diego Barrios Romero |
3dc329 |
po::options_description po_misc(_("Misc options"));
|
|
Diego Barrios Romero |
3dc329 |
po_misc.add_options()
|
|
Diego Barrios Romero |
3dc329 |
("append", append_filename_arg_desc, _("Append layers in <filename> to composition"))</filename>
|
|
Diego Barrios Romero |
3dc329 |
("canvas-info", canvas_info_fields_arg_desc, _("Print out specified details of the root canvas"))
|
|
Diego Barrios Romero |
bbc871 |
("canvases", _("Print out the list of exported canvases in the composition"))
|
|
Diego Barrios Romero |
fd3b0f |
;
|
|
Diego Barrios Romero |
fd3b0f |
|
|
Diego Barrios Romero |
848b46 |
po::options_description po_ffmpeg(_("FFMPEG target options"));
|
|
Diego Barrios Romero |
848b46 |
po_ffmpeg.add_options()
|
|
Diego Barrios Romero |
848b46 |
("video-codec", video_codec_arg_desc, _("Set the codec for the video. See --ffmpeg-video-codecs"))
|
|
Diego Barrios Romero |
848b46 |
("video-bitrate", video_bitrate_arg_desc, _("Set the bitrate for the output video"))
|
|
Diego Barrios Romero |
848b46 |
;
|
|
Diego Barrios Romero |
848b46 |
|
|
Diego Barrios Romero |
bbc871 |
po::options_description po_info(_("Synfig info options"));
|
|
Diego Barrios Romero |
3dc329 |
po_info.add_options()
|
|
Diego Barrios Romero |
848b46 |
("help", _("Produce this help message"))
|
|
Diego Barrios Romero |
fd3b0f |
("importers", _("Print out the list of available importers"))
|
|
Diego Barrios Romero |
fd3b0f |
("info", _("Print out misc build information"))
|
|
Diego Barrios Romero |
fd3b0f |
("layers", _("Print out the list of available layers"))
|
|
Diego Barrios Romero |
3dc329 |
("layer-info", layer_info_field_arg_desc, _("Print out layer's description, parameter info, etc."))
|
|
Diego Barrios Romero |
fd3b0f |
("license", _("Print out license information"))
|
|
Diego Barrios Romero |
fd3b0f |
("modules", _("Print out the list of loaded modules"))
|
|
Diego Barrios Romero |
fd3b0f |
("targets", _("Print out the list of available targets"))
|
|
Diego Barrios Romero |
011adb |
("target-video-codecs", _("Print out the list of available video codecs when encoding through FFMPEG"))
|
|
Diego Barrios Romero |
fd3b0f |
("valuenodes", _("Print out the list of available ValueNodes"))
|
|
Diego Barrios Romero |
fd3b0f |
("version", _("Print out version information"))
|
|
Diego Barrios Romero |
fd3b0f |
;
|
|
Diego Barrios Romero |
fd3b0f |
|
|
Diego Barrios Romero |
bbc871 |
po::options_description po_hidden("");
|
|
Diego Barrios Romero |
bbc871 |
po_hidden.add_options()
|
|
Diego Barrios Romero |
bbc871 |
("list-canvases", _("Print out the list of exported canvases in the composition"))
|
|
Diego Barrios Romero |
bbc871 |
;
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
dbdbbf |
#ifdef _DEBUG
|
|
Diego Barrios Romero |
3dc329 |
po::options_description po_debug(_("Synfig debug flags"));
|
|
Diego Barrios Romero |
3dc329 |
po_debug.add_options()
|
|
Diego Barrios Romero |
dbdbbf |
("guid-test", _("Test GUID generation"))
|
|
Diego Barrios Romero |
dbdbbf |
("signal-test", _("Test signal implementation"))
|
|
Diego Barrios Romero |
dbdbbf |
;
|
|
Diego Barrios Romero |
dbdbbf |
#endif
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
72281d |
// The first positional option will be treated as the input file
|
|
Diego Barrios Romero |
72281d |
po::positional_options_description po_positional;
|
|
Diego Barrios Romero |
72281d |
po_positional.add("input-file", 1);
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
fd3b0f |
// Declare an options description instance which will include
|
|
Diego Barrios Romero |
fd3b0f |
// all the options
|
|
Diego Barrios Romero |
3dc329 |
po::options_description po_all("");
|
|
Diego Barrios Romero |
bbc871 |
po_all.add(po_settings).add(po_switchopts).add(po_misc).add(po_info).add(po_ffmpeg).add(po_hidden);
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
dbdbbf |
#ifdef _DEBUG
|
|
Diego Barrios Romero |
3dc329 |
po_all.add(po_debug);
|
|
Diego Barrios Romero |
dbdbbf |
#endif
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
fd3b0f |
// Declare an options description instance which will be shown
|
|
Diego Barrios Romero |
fd3b0f |
// to the user
|
|
Diego Barrios Romero |
3dc329 |
po::options_description po_visible("");
|
|
Diego Barrios Romero |
bbc871 |
po_visible.add(po_settings).add(po_switchopts).add(po_misc).add(po_ffmpeg);
|
|
Diego Barrios Romero |
ee0cc7 |
|
|
Diego Barrios Romero |
bbc871 |
#ifdef _DEBUG
|
|
Diego Barrios Romero |
bbc871 |
po_visible.add(po_debug);
|
|
Diego Barrios Romero |
bbc871 |
#endif
|
|
Diego Barrios Romero |
ee0cc7 |
|
|
Diego Barrios Romero |
bbc871 |
po_visible.add(po_info);
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
fd3b0f |
po::variables_map vm;
|
|
frijol |
c4229d |
try{
|
|
frijol |
c4229d |
po::store(po::command_line_parser(argc, argv).options(po_all).
|
|
frijol |
c4229d |
positional(po_positional).run(), vm);
|
|
|
4a958f |
}catch(std::exception& e)
|
|
frijol |
c4229d |
{
|
|
frijol |
c4229d |
std::cout << std::endl << e.what() << std::endl;
|
|
frijol |
c4229d |
std::cout << _("Try 'synfig --help' for more information") << std::endl;
|
|
frijol |
c4229d |
return SYNFIGTOOL_UNKNOWNARGUMENT;
|
|
|
891c49 |
}*/
|
|
Carlos Lopez |
a09598 |
|
|
|
891c49 |
//OptionsProcessor op(vm, po_visible);
|
|
|
891c49 |
SynfigCommandLineParser parser;
|
|
|
891c49 |
parser.parse(argc, argv);
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
fd3b0f |
// Switch options ---------------------------------------------
|
|
|
891c49 |
parser.process_settings_options();
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
dbdbbf |
#ifdef _DEBUG
|
|
Diego Barrios Romero |
dbdbbf |
// DEBUG options ----------------------------------------------
|
|
|
891c49 |
parser.process_debug_options();
|
|
Diego Barrios Romero |
dbdbbf |
#endif
|
|
Carlos Lopez |
a09598 |
|
|
bth |
9b207d |
// Trivial info options -----------------------------------------------
|
|
bth |
9b207d |
parser.process_trivial_info_options();
|
|
bth |
9b207d |
|
|
Diego Barrios Romero |
b13b63 |
// Synfig Main initialization needs to be after verbose and
|
|
Diego Barrios Romero |
b13b63 |
// before any other where it's used
|
|
|
509b0d |
Progress p(binary_path.c_str());
|
|
|
509b0d |
//synfig::Main synfig_main(binary_path.parent_path().string(), &p);
|
|
|
28c737 |
synfig::Main synfig_main(get_absolute_path(binary_path + "/.."), &p);
|
|
Carlos Lopez |
a09598 |
|
|
bth |
9b207d |
// Info options -----------------------------------------------
|
|
bth |
9b207d |
parser.process_info_options();
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
0b9c51 |
std::list<job> job_list;</job>
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
53159b |
// Processing --------------------------------------------------
|
|
Diego Barrios Romero |
71669d |
Job job;
|
|
|
891c49 |
job = parser.extract_job();
|
|
|
891c49 |
job.desc = job.canvas->rend_desc() = parser.extract_renddesc(job.canvas->rend_desc());
|
|
Carlos Lopez |
a09598 |
|
|
|
4010f4 |
if (job.extract_alpha) {
|
|
Diego Barrios Romero |
b8710c |
job.alpha_mode = synfig::TARGET_ALPHA_MODE_REDUCE;
|
|
|
4010f4 |
job_list.push_front(job);
|
|
Diego Barrios Romero |
b8710c |
job.alpha_mode = synfig::TARGET_ALPHA_MODE_EXTRACT;
|
|
Diego Barrios Romero |
f8991f |
job.outfilename = _appendAlphaToFilename(job.outfilename);
|
|
|
4010f4 |
job_list.push_front(job);
|
|
|
4010f4 |
} else {
|
|
|
4010f4 |
job_list.push_front(job);
|
|
|
4010f4 |
}
|
|
Carlos Lopez |
a09598 |
|
|
|
891c49 |
process_job_list(job_list, parser.extract_targetparam());
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
fd3b0f |
return SYNFIGTOOL_OK;
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
fd3b0f |
}
|
|
Diego Barrios Romero |
d406bf |
catch (SynfigToolException& e) {
|
|
Diego Barrios Romero |
d406bf |
exit_code code = e.get_exit_code();
|
|
Diego Barrios Romero |
d406bf |
if (code != SYNFIGTOOL_HELP && code != SYNFIGTOOL_OK)
|
|
Diego Barrios Romero |
0b9c51 |
std::cerr << e.get_message().c_str() << std::endl;
|
|
Diego Barrios Romero |
71669d |
if (code == SYNFIGTOOL_MISSINGARGUMENT)
|
|
Diego Barrios Romero |
71669d |
print_usage();
|
|
Carlos Lopez |
a09598 |
|
|
Diego Barrios Romero |
d406bf |
return code;
|
|
Diego Barrios Romero |
d406bf |
}
|
|
Diego Barrios Romero |
fd3b0f |
catch(std::exception& e) {
|
|
Diego Barrios Romero |
0b9c51 |
std::cout << e.what() << std::endl;
|
|
Diego Barrios Romero |
fd3b0f |
}
|
|
Carlos Lopez |
a09598 |
}
|