X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fbatchrender.C;h=6238d6d6808386c2aaf3edd04c2b488b363e4cb5;hp=6f1129f0afcee60f51c86c9c45ae89d7327b0845;hb=ddfda6a8cc59bda4dc734973c1c5fecaa31ea487;hpb=721a106de35567bcab14a0e92718767189acf176 diff --git a/cinelerra-5.1/cinelerra/batchrender.C b/cinelerra-5.1/cinelerra/batchrender.C index 6f1129f0..6238d6d6 100644 --- a/cinelerra-5.1/cinelerra/batchrender.C +++ b/cinelerra-5.1/cinelerra/batchrender.C @@ -60,6 +60,8 @@ #include "dvdcreate.h" #include "bdcreate.h" +#include + int BatchRenderThread::column_widths[] = { 42, 42, 42, 222, 222, 150 }; const char *BatchRenderThread::column_titles[] = { N_("Enabled"), N_("Labeled"), N_("Farmed"), N_("Output"), N_("EDL"), N_("Elapsed") @@ -121,6 +123,8 @@ BatchRenderJob *BatchRenderJob::copy() void BatchRenderJob::load(FileXML *file) { int result = 0; + char job_title[BCSTRLEN]; + strcpy(job_title, file->tag.title); enabled = file->tag.get_property("ENABLED", enabled); farmed = file->tag.get_property("FARMED", farmed); @@ -138,7 +142,7 @@ void BatchRenderJob::load(FileXML *file) // coding maintenance. The defaults must now be stuffed into the XML for // unique storage. BC_Hash defaults; - defaults.load_string(file->read_text()); + defaults.load_string(file->read_text(job_title)); asset->load_defaults(&defaults, "", 0, 1, 0, 0, 0); } @@ -179,7 +183,9 @@ char *BatchRenderJob::create_script(EDL *edl, ArrayList *idxbls) int BatchRenderJob::get_strategy() { - return Render::get_strategy(farmed, labeled); + int range = File::is_image_render(asset->format) ? + RANGE_1FRAME : RANGE_SELECTION; + return Render::get_strategy(farmed, labeled, range); } @@ -193,7 +199,7 @@ BatchRenderThread::BatchRenderThread(MWindow *mwindow) default_job = 0; boot_defaults = 0; preferences = 0; - warn = 1; + warn = 0; render = 0; batch_path[0] = 0; do_farmed = 0; @@ -264,7 +270,10 @@ void BatchRenderThread::load_jobs(char *path, Preferences *preferences) while( !result ) { if( !(result = file.read_tag()) ) { if( file.tag.title_is("JOBS") ) { + if (mwindow && mwindow->preferences->unsafe_gui) warn = file.tag.get_property("WARN", 1); + if (mwindow && !mwindow->preferences->unsafe_gui) + warn = 0; } else if( file.tag.title_is("JOB") ) { BatchRenderJob *job = new BatchRenderJob(preferences, 0,0); @@ -289,6 +298,7 @@ void BatchRenderThread::save_jobs(char *path) { FileXML file; file.tag.set_title("JOBS"); + if (mwindow && mwindow->preferences->unsafe_gui) file.tag.set_property("WARN", warn); file.append_tag(); file.append_newline(); @@ -316,7 +326,7 @@ void BatchRenderThread::load_defaults(BC_Hash *defaults) for( int i = 0; i < BATCHRENDER_COLUMNS; i++ ) { char string[BCTEXTLEN]; sprintf(string, "BATCHRENDER_COLUMN%d", i); - list_width[i] = defaults->get(string, column_widths[i]); + list_width[i] = defaults->get(string, xS(column_widths[i])); } } @@ -383,6 +393,9 @@ void BatchRenderThread::update_selected_edl() FileXML xml_file; char *path = get_current_edl(); EDL *edl = mwindow->edl; + // result = 1 if user cancelled operation + int result = ConfirmSave::test_file(mwindow, path); + if (!result) { edl->save_xml(&xml_file, path); xml_file.terminate_string(); if( xml_file.write_to_file(path) ) { @@ -390,6 +403,7 @@ void BatchRenderThread::update_selected_edl() sprintf(msg, _("Unable to save: %s"), path); MainError::show_error(msg); } + } } BatchRenderJob* BatchRenderThread::get_current_job() @@ -513,7 +527,7 @@ int BatchRenderThread::test_edl_files() if( !ret && mwindow ) ret = test_errmsg(no_rendering, _("%d job EDLs no audio or video in render asset format\n"), 0); if( !ret && mwindow ) - ret = test_errmsg(no_labels, _("%d job EDLs render file per label and no labels\n"), 0); + ret = test_errmsg(no_labels, _("%d job EDLs Create new file at labels checked, but no labels\n"), 0); if( ret ) is_rendering = 0; return ret; @@ -724,7 +738,7 @@ void BatchRenderThread::trap_hook(FILE *fp, void *vp) BatchRenderGUI::BatchRenderGUI(MWindow *mwindow, BatchRenderThread *thread, int x, int y, int w, int h) : BC_Window(_(PROGRAM_NAME ": Batch Render"), - x, y, w, h, 730, 400, 1, 0, 1) + x, y, w, h, xS(730), yS(400), 1, 0, 1) { this->mwindow = mwindow; this->thread = thread; @@ -743,21 +757,23 @@ BatchRenderGUI::~BatchRenderGUI() void BatchRenderGUI::create_objects() { + int xs10 = xS(10), xs30 = xS(30), xs40 = xS(40); + int ys5 = yS(5), ys10 = yS(10), ys15 = yS(15); lock_window("BatchRenderGUI::create_objects"); mwindow->theme->get_batchrender_sizes(this, get_w(), get_h()); create_list(0); int x = mwindow->theme->batchrender_x1; - int y = 5; - int x1 = x, x2 = get_w()/2 + 30; // mwindow->theme->batchrender_x2; - int y1 = 5, y2 = 5; + int y = ys5; + int x1 = x, x2 = get_w()/2 + xs30; // mwindow->theme->batchrender_x2; + int y1 = ys5, y2 = ys5; // output file add_subwindow(output_path_title = new BC_Title(x1, y1, _("Output path:"))); y1 += output_path_title->get_h() + mwindow->theme->widget_border; format_tools = new BatchFormat(mwindow, this, thread->get_current_asset()); - format_tools->set_w(x2 - 40); + format_tools->set_w(x2 - xs40); BatchRenderJob *current_job = thread->get_current_job(); format_tools->create_objects(x1, y1, 1, 1, 1, 1, 0, 1, 0, 0, thread->do_labeled ? ¤t_job->labeled : 0, 0); @@ -767,7 +783,7 @@ void BatchRenderGUI::create_objects() use_renderfarm = new BatchRenderUseFarm(thread, x1, y1, ¤t_job->farmed); add_subwindow(use_renderfarm); - y1 += use_renderfarm->get_h() + 10; + y1 += use_renderfarm->get_h() + ys10; if( thread->do_farmed < 0 ) use_renderfarm->disable(); } @@ -778,7 +794,7 @@ void BatchRenderGUI::create_objects() x = x2; y = y2; add_subwindow(edl_path_text = new BatchRenderEDLPath( thread, - x, y, get_w()-x - 40, thread->get_current_edl())); + x, y, get_w()-x - xs40, thread->get_current_edl())); x = x2 + edl_path_text->get_w(); add_subwindow(edl_path_browse = new BrowseButton( mwindow->theme, this, edl_path_text, x, y, thread->get_current_edl(), @@ -786,8 +802,10 @@ void BatchRenderGUI::create_objects() y2 = y + edl_path_browse->get_h() + mwindow->theme->widget_border; x = x2; y = y2; + if (mwindow->preferences->unsafe_gui) { add_subwindow(update_selected_edl = new BatchRenderUpdateEDL(thread, x, y)); y += update_selected_edl->get_h() + mwindow->theme->widget_border; + } add_subwindow(use_current_edl = new BatchRenderCurrentEDL(thread, x, y)); y += use_current_edl->get_h() + mwindow->theme->widget_border; if( !mwindow->edl || !mwindow->edl->path[0] ) use_current_edl->disable(); @@ -799,8 +817,10 @@ void BatchRenderGUI::create_objects() x += savelist_batch->get_w() + mwindow->theme->widget_border; add_subwindow(loadlist_batch = new BatchRenderLoadList(thread, x, y)); y += loadlist_batch->get_h() + mwindow->theme->widget_border; + if (mwindow->preferences->unsafe_gui) { add_subwindow(warning = new BatchRenderWarning(thread, x2, y)); y2 = y + warning->get_h() + mwindow->theme->widget_border; + } if( y2 > y1 ) y1 = y2; x = mwindow->theme->batchrender_x1, y = y1; @@ -809,15 +829,17 @@ void BatchRenderGUI::create_objects() add_subwindow(batch_path = new BC_Title(x1, y, thread->batch_path, MEDIUMFONT)); y += list_title->get_h() + mwindow->theme->widget_border; y1 = get_h(); - y1 -= 15 + BC_GenericButton::calculate_h() + mwindow->theme->widget_border; + y1 -= ys15 + BC_GenericButton::calculate_h() + mwindow->theme->widget_border; add_subwindow(batch_list = new BatchRenderList(thread, x, y, - get_w() - x - 10, y1 - y)); + get_w() - x - xs10, y1 - y)); y += batch_list->get_h() + mwindow->theme->widget_border; add_subwindow(start_button = new BatchRenderStart(thread, x, y)); - x = get_w() / 2 - BC_GenericButton::calculate_w(this, _("Stop")) / 2; + x = get_w() / 3 - BC_GenericButton::calculate_w(this, _("Stop")) / 3; add_subwindow(stop_button = new BatchRenderStop(thread, x, y)); - x = get_w() - BC_GenericButton::calculate_w(this, _("Close")) - 10; + x = get_w() / 1.5 - BC_GenericButton::calculate_w(this, _("?")) / 1.5; + add_subwindow(help_button = new BatchRenderHelp(thread, x, y)); + x = get_w() - BC_GenericButton::calculate_w(this, _("Close")) - xs10; add_subwindow(cancel_button = new BatchRenderCancel(thread, x, y)); show_window(1); @@ -829,6 +851,7 @@ void BatchRenderGUI::button_disable() new_batch->disable(); delete_batch->disable(); use_current_edl->disable(); + if (mwindow->preferences->unsafe_gui) update_selected_edl->disable(); } @@ -838,19 +861,22 @@ void BatchRenderGUI::button_enable() delete_batch->enable(); if( mwindow->edl && mwindow->edl->path[0] ) use_current_edl->enable(); + if (mwindow->preferences->unsafe_gui) update_selected_edl->enable(); } int BatchRenderGUI::resize_event(int w, int h) { + int xs10 = xS(10), xs40 = xS(40); + int ys5 = yS(5), ys15 = yS(15); mwindow->session->batchrender_w = w; mwindow->session->batchrender_h = h; mwindow->theme->get_batchrender_sizes(this, w, h); int x = mwindow->theme->batchrender_x1; - int y = 5; - int x1 = x, x2 = get_w()/2 + 10; // mwindow->theme->batchrender_x2; - int y1 = 5, y2 = 5; + int y = ys5; + int x1 = x, x2 = get_w()/2 + xs10; // mwindow->theme->batchrender_x2; + int y1 = ys5, y2 = ys5; // output file output_path_title->reposition_window(x1, y1); @@ -862,14 +888,16 @@ int BatchRenderGUI::resize_event(int w, int h) x = x2, y = y2; edl_path_title->reposition_window(x, y); y += edl_path_title->get_h() + mwindow->theme->widget_border; - edl_path_text->reposition_window(x, y, w - x - 40); + edl_path_text->reposition_window(x, y, w - x - xs40); x += edl_path_text->get_w(); edl_path_browse->reposition_window(x, y); y2 = y + edl_path_browse->get_h() + mwindow->theme->widget_border; x = x2; y = y2; + if (mwindow->preferences->unsafe_gui) { update_selected_edl->reposition_window(x, y); y += update_selected_edl->get_h() + mwindow->theme->widget_border; + } use_current_edl->reposition_window(x, y); y += use_current_edl->get_h() + mwindow->theme->widget_border; new_batch->reposition_window(x, y); @@ -881,23 +909,26 @@ int BatchRenderGUI::resize_event(int w, int h) x += savelist_batch->get_w() + mwindow->theme->widget_border; loadlist_batch->reposition_window(x, y); y += loadlist_batch->get_h() + mwindow->theme->widget_border; + if (mwindow->preferences->unsafe_gui) { warning->reposition_window(x2, y); - - y1 = 15 + BC_GenericButton::calculate_h() + mwindow->theme->widget_border; + } + y1 = ys15 + BC_GenericButton::calculate_h() + mwindow->theme->widget_border; y2 = get_h() - y1 - batch_list->get_h(); y2 -= list_title->get_h() + mwindow->theme->widget_border; x = mwindow->theme->batchrender_x1; y = y2; list_title->reposition_window(x, y); y += list_title->get_h() + mwindow->theme->widget_border; - batch_list->reposition_window(x, y, w - x - 10, h - y - y1); + batch_list->reposition_window(x, y, w - x - xs10, h - y - y1); y += batch_list->get_h() + mwindow->theme->widget_border; start_button->reposition_window(x, y); - x = w / 2 - stop_button->get_w() / 2; + x = w / 3 - stop_button->get_w() / 3; stop_button->reposition_window(x, y); - x = w - cancel_button->get_w() - 10; + x = w - cancel_button->get_w() - xs10; cancel_button->reposition_window(x, y); + x = w / 1.5 - help_button->get_w() / 1.5; + help_button->reposition_window(x, y); return 1; } @@ -1036,6 +1067,7 @@ BatchRenderNew::BatchRenderNew(BatchRenderThread *thread, : BC_GenericButton(x, y, _("New")) { this->thread = thread; + set_tooltip(_("Create a new batch")); } int BatchRenderNew::handle_event() @@ -1048,6 +1080,7 @@ BatchRenderDelete::BatchRenderDelete(BatchRenderThread *thread, int x, int y) : BC_GenericButton(x, y, _("Delete")) { this->thread = thread; + set_tooltip(_("Delete loaded (highlighted) batch")); } int BatchRenderDelete::handle_event() @@ -1103,7 +1136,8 @@ void BatchRenderSaveList::run() char default_path[BCTEXTLEN]; sprintf(default_path, "~"); thread->mwindow->defaults->get("DEFAULT_BATCHLOADPATH", default_path); - BC_FileBox filewindow(100, 100, default_path, _("Save Batch Render List"), + BC_FileBox filewindow(xS(100), yS(100), default_path, + _("Save Batch Render List"), _("Enter a Batch Render filename to save as:"), 0, 0, 0, 0); gui = &filewindow; @@ -1181,7 +1215,7 @@ void BatchRenderLoadList::run() char default_path[BCTEXTLEN]; sprintf(default_path, "~"); thread->mwindow->defaults->get("DEFAULT_BATCHLOADPATH", default_path); - BC_FileBox filewindow(100, 100, default_path, _("Load Batch Render List"), + BC_FileBox filewindow(xS(100), yS(100), default_path, _("Load Batch Render List"), _("Enter a Batch Render filename to load from:"), 0, 0, 0, 0); gui = &filewindow; @@ -1191,6 +1225,7 @@ void BatchRenderLoadList::run() int result2 = filewindow.run_window(); if( !result2 ) { + thread->gui->lock_window("BatchRenderLoadList::run"); strcpy(thread->batch_path, filewindow.get_submitted_path()); thread->gui->batch_path->update(thread->batch_path); thread->mwindow->defaults->update("DEFAULT_BATCHLOADPATH", thread->batch_path); @@ -1198,6 +1233,7 @@ void BatchRenderLoadList::run() thread->gui->create_list(1); thread->current_job = 0; thread->gui->change_job(); + thread->gui->unlock_window(); } startup_lock->lock("BatchRenderLoadList::run"); @@ -1217,6 +1253,7 @@ BatchRenderCurrentEDL::BatchRenderCurrentEDL(BatchRenderThread *thread, : BC_GenericButton(x, y, _("Use Current EDL")) { this->thread = thread; + set_tooltip(_("Replaces highlighted batch job with session currently on timeline. File on disk NOT changed!")); } int BatchRenderCurrentEDL::handle_event() @@ -1231,6 +1268,7 @@ BatchRenderUpdateEDL::BatchRenderUpdateEDL(BatchRenderThread *thread, : BC_GenericButton(x, y, _("Save to EDL Path")) { this->thread = thread; + set_tooltip(_("WARNING - saves to loaded (highlighted) EDL, *overwrites* highlighted project!")); } int BatchRenderUpdateEDL::handle_event() @@ -1332,6 +1370,7 @@ BatchRenderStart::BatchRenderStart(BatchRenderThread *thread, int x, int y) : BC_GenericButton(x, y, _("Start")) { this->thread = thread; + set_tooltip(_("Start batch rendering")); } int BatchRenderStart::handle_event() @@ -1344,6 +1383,7 @@ BatchRenderStop::BatchRenderStop(BatchRenderThread *thread, int x, int y) : BC_GenericButton(x, y, _("Stop")) { this->thread = thread; + set_tooltip(_("Stops currently active batch rendering")); } int BatchRenderStop::handle_event() @@ -1359,6 +1399,7 @@ BatchRenderWarning::BatchRenderWarning(BatchRenderThread *thread, int x, int y) : BC_CheckBox(x, y, thread->warn, _("warn if jobs/session mismatched")) { this->thread = thread; + set_tooltip(_("Prevents rendering if loaded session and batch job(s) differ")); } int BatchRenderWarning::handle_event() @@ -1371,6 +1412,7 @@ BatchRenderCancel::BatchRenderCancel(BatchRenderThread *thread, int x, int y) : BC_GenericButton(x, y, _("Close")) { this->thread = thread; + set_tooltip(_("Closes this window")); } int BatchRenderCancel::handle_event() @@ -1394,6 +1436,20 @@ int BatchRenderCancel::keypress_event() return 0; } +//new help button +BatchRenderHelp::BatchRenderHelp(BatchRenderThread *thread, int x, int y) + : BC_GenericButton(x, y, _("?")) +{ + this->thread = thread; + set_tooltip(_("Open quick start guide")); +} + +int BatchRenderHelp::handle_event() +{ + system("$CIN_BROWSER file://$CIN_DAT/doc/help_br_index.html"); + return 0; +} + BatchRenderUseFarm::BatchRenderUseFarm(BatchRenderThread *thread, int x, int y, int *output) : BC_CheckBox(x, y, *output, _("Use render farm")) {