X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Ftool%2Fmain.cpp;h=701bd67b5a82459255c3f726ba8c46b69b7c5da9;hb=1ba01d62f55407997aca33ed89d171ea7e5979d1;hp=c0f2313866d6ad03a8319ce3bad320544ee29bf2;hpb=cf22834e4230b95b8228edffc705240af0895979;p=synfig.git diff --git a/synfig-core/trunk/src/tool/main.cpp b/synfig-core/trunk/src/tool/main.cpp index c0f2313..701bd67 100644 --- a/synfig-core/trunk/src/tool/main.cpp +++ b/synfig-core/trunk/src/tool/main.cpp @@ -259,6 +259,18 @@ struct Job int quality; bool sifout; bool list_canvases; + + bool canvas_info, canvas_info_all, canvas_info_time_start, canvas_info_time_end, canvas_info_frame_rate, + canvas_info_frame_start, canvas_info_frame_end, canvas_info_w, canvas_info_h, canvas_info_image_aspect, + canvas_info_pw, canvas_info_ph, canvas_info_pixel_aspect, canvas_info_tl, canvas_info_br, + canvas_info_physical_w, canvas_info_physical_h, canvas_info_x_res, canvas_info_y_res, canvas_info_span, + canvas_info_interlaced, canvas_info_antialias, canvas_info_clamp, canvas_info_flags, canvas_info_focus, + canvas_info_bg_color, canvas_info_metadata; + + Job() + { + canvas_info = canvas_info_all = canvas_info_time_start = canvas_info_time_end = canvas_info_frame_rate = canvas_info_frame_start = canvas_info_frame_end = canvas_info_w = canvas_info_h = canvas_info_image_aspect = canvas_info_pw = canvas_info_ph = canvas_info_pixel_aspect = canvas_info_tl = canvas_info_br = canvas_info_physical_w = canvas_info_physical_h = canvas_info_x_res = canvas_info_y_res = canvas_info_span = canvas_info_interlaced = canvas_info_antialias = canvas_info_clamp = canvas_info_flags = canvas_info_focus = canvas_info_bg_color = canvas_info_metadata = false; + }; }; typedef list arg_list_t; @@ -336,6 +348,7 @@ void display_help(int amount) Argument("--dpi-y","",_("Set the physical Y resolution (dots-per-inch)")); Argument("--list-canvases",NULL,_("List the exported canvases in the composition")); + Argument("--canvas-info","",_("Print out specified details of the root canvas")); Argument("--append","",_("Append layers in to composition")); Argument("--layer-info","",_("Print out layer's description, parameter info, etc.")); @@ -387,7 +400,7 @@ int process_global_flags(arg_list_t &arg_list) if(*iter == "--info") { cout<children()); @@ -855,6 +935,182 @@ void list_child_canvases(string prefix, Canvas::Handle canvas) } } +void list_canvas_info(Job job) +{ + Canvas::Handle canvas(job.canvas); + const RendDesc &rend_desc(canvas->rend_desc()); + + if (job.canvas_info_all || job.canvas_info_time_start) + { + cout << endl << "# " << _("Start Time") << endl; + cout << "time_start" << "=" << rend_desc.get_time_start().get_string().c_str() << endl; + } + + if (job.canvas_info_all || job.canvas_info_time_end) + { + cout << endl << "# " << _("End Time") << endl; + cout << "time_end" << "=" << rend_desc.get_time_end().get_string().c_str() << endl; + } + + if (job.canvas_info_all || job.canvas_info_frame_rate) + { + cout << endl << "# " << _("Frame Rate") << endl; + cout << "frame_rate" << "=" << rend_desc.get_frame_rate() << endl; + } + + if (job.canvas_info_all || job.canvas_info_frame_start) + { + cout << endl << "# " << _("Start Frame") << endl; + cout << "frame_start" << "=" << rend_desc.get_frame_start() << endl; + } + + if (job.canvas_info_all || job.canvas_info_frame_end) + { + cout << endl << "# " << _("End Frame") << endl; + cout << "frame_end" << "=" << rend_desc.get_frame_end() << endl; + } + + if (job.canvas_info_all) + cout << endl; + + if (job.canvas_info_all || job.canvas_info_w) + { + cout << endl << "# " << _("Width") << endl; + cout << "w" << "=" << rend_desc.get_w() << endl; + } + + if (job.canvas_info_all || job.canvas_info_h) + { + cout << endl << "# " << _("Height") << endl; + cout << "h" << "=" << rend_desc.get_h() << endl; + } + + if (job.canvas_info_all || job.canvas_info_image_aspect) + { + cout << endl << "# " << _("Image Aspect Ratio") << endl; + cout << "image_aspect" << "=" << rend_desc.get_image_aspect() << endl; + } + + if (job.canvas_info_all) + cout << endl; + + if (job.canvas_info_all || job.canvas_info_pw) + { + cout << endl << "# " << _("Pixel Width") << endl; + cout << "pw" << "=" << rend_desc.get_pw() << endl; + } + + if (job.canvas_info_all || job.canvas_info_ph) + { + cout << endl << "# " << _("Pixel Height") << endl; + cout << "ph" << "=" << rend_desc.get_ph() << endl; + } + + if (job.canvas_info_all || job.canvas_info_pixel_aspect) + { + cout << endl << "# " << _("Pixel Aspect Ratio") << endl; + cout << "pixel_aspect" << "=" << rend_desc.get_pixel_aspect() << endl; + } + + if (job.canvas_info_all) + cout << endl; + + if (job.canvas_info_all || job.canvas_info_tl) + { + cout << endl << "# " << _("Top Left") << endl; + cout << "tl" << "=" << rend_desc.get_tl()[0] + << " " << rend_desc.get_tl()[1] << endl; + } + + if (job.canvas_info_all || job.canvas_info_br) + { + cout << endl << "# " << _("Bottom Right") << endl; + cout << "br" << "=" << rend_desc.get_br()[0] + << " " << rend_desc.get_br()[1] << endl; + } + + if (job.canvas_info_all || job.canvas_info_physical_w) + { + cout << endl << "# " << _("Physical Width") << endl; + cout << "physical_w" << "=" << rend_desc.get_physical_w() << endl; + } + + if (job.canvas_info_all || job.canvas_info_physical_h) + { + cout << endl << "# " << _("Physical Height") << endl; + cout << "physical_h" << "=" << rend_desc.get_physical_h() << endl; + } + + if (job.canvas_info_all || job.canvas_info_x_res) + { + cout << endl << "# " << _("X Resolution") << endl; + cout << "x_res" << "=" << rend_desc.get_x_res() << endl; + } + + if (job.canvas_info_all || job.canvas_info_y_res) + { + cout << endl << "# " << _("Y Resolution") << endl; + cout << "y_res" << "=" << rend_desc.get_y_res() << endl; + } + + if (job.canvas_info_all || job.canvas_info_span) + { + cout << endl << "# " << _("Diagonal Image Span") << endl; + cout << "span" << "=" << rend_desc.get_span() << endl; + } + + if (job.canvas_info_all) + cout << endl; + + if (job.canvas_info_all || job.canvas_info_interlaced) + { + cout << endl << "# " << _("Interlaced") << endl; + cout << "interlaced" << "=" << rend_desc.get_interlaced() << endl; + } + + if (job.canvas_info_all || job.canvas_info_antialias) + { + cout << endl << "# " << _("Antialias") << endl; + cout << "antialias" << "=" << rend_desc.get_antialias() << endl; + } + + if (job.canvas_info_all || job.canvas_info_clamp) + { + cout << endl << "# " << _("Clamp") << endl; + cout << "clamp" << "=" << rend_desc.get_clamp() << endl; + } + + if (job.canvas_info_all || job.canvas_info_flags) + { + cout << endl << "# " << _("Flags") << endl; + cout << "flags" << "=" << rend_desc.get_flags() << endl; + } + + if (job.canvas_info_all || job.canvas_info_focus) + { + cout << endl << "# " << _("Focus") << endl; + cout << "focus" << "=" << rend_desc.get_focus()[0] + << " " << rend_desc.get_focus()[1] << endl; + } + + if (job.canvas_info_all || job.canvas_info_bg_color) + { + cout << endl << "# " << _("Background Color") << endl; + cout << "bg_color" << "=" << rend_desc.get_bg_color().get_string().c_str() << endl; + } + + if (job.canvas_info_all) + cout << endl; + + if (job.canvas_info_all || job.canvas_info_metadata) + { + std::list keys(canvas->get_meta_data_keys()); + cout << endl << "# " << _("Metadata") << endl; + for (std::list::iterator iter = keys.begin(); iter != keys.end(); iter++) + cout << *iter << "=" << canvas->get_meta_data(*iter) << endl; + } +} + /* === M E T H O D S ======================================================= */ /* === E N T R Y P O I N T ================================================= */ @@ -918,11 +1174,19 @@ int main(int argc, char *argv[]) return ret; // Open the composition - job_list.front().root=open_canvas(job_list.front().filename); + String errors, warnings; + try + { + job_list.front().root=open_canvas(job_list.front().filename, errors, warnings); + } + catch(runtime_error x) + { + job_list.front().root = 0; + } if(!job_list.front().root) { - cerr<<_("Unable to open ")<set_time(0); string canvasid; @@ -940,7 +1206,8 @@ int main(int argc, char *argv[]) { try { - job_list.front().canvas=job_list.front().root->find_canvas(canvasid); + String warnings; + job_list.front().canvas=job_list.front().root->find_canvas(canvasid, warnings); } catch(Exception::IDNotFound) { @@ -976,9 +1243,13 @@ int main(int argc, char *argv[]) extract_append(imageargs,composite_file); if(!composite_file.empty()) { - Canvas::Handle composite(open_canvas(composite_file)); + String errors, warnings; + Canvas::Handle composite(open_canvas(composite_file, errors, warnings)); if(!composite) + { + cerr<<_("Unable to append '")<rbegin();iter!=composite->rend();++iter) { @@ -1134,6 +1405,11 @@ int main(int argc, char *argv[]) list_child_canvases(job_list.front().filename + "#", job_list.front().canvas); cerr << endl; } + else if (job_list.front().canvas_info) + { + list_canvas_info(job_list.front()); + cerr << endl; + } else { VERBOSE_OUT(1)<<_("Rendering...")<