Commit: 229c0580e2915b2dc349069ee7094d322408641f Author: Paul Golter Date: Thu Jul 1 12:21:31 2021 +0200 Branches: master https://developer.blender.org/rB229c0580e2915b2dc349069ee7094d322408641f
Fix: Export subtitles timecode relative to scene start frame, ignore muted strips This patch writes the timecode in the .srt file relative to the start frame of the scene. If the timecode is global but scene does not start at frame 0 the subtitles don't match if they get loaded in an external video player. Muted strips will be ignored. Don't allow negative timecodes in .srt. Reviewed By: Richard Antalik Differential Revision: http://developer.blender.org/D11762 =================================================================== M source/blender/editors/space_sequencer/sequencer_edit.c =================================================================== diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 25009532dd0..48b8a1b87a3 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2984,8 +2984,10 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + /* Only text strips that are not muted and don't end with negative frame. */ SEQ_ALL_BEGIN (ed, seq) { - if (seq->type == SEQ_TYPE_TEXT) { + if ((seq->type == SEQ_TYPE_TEXT) && ((seq->flag & SEQ_MUTE) == 0) && + (seq->enddisp > scene->r.sfra)) { BLI_addtail(&text_seq, MEM_dupallocN(seq)); } } @@ -3006,16 +3008,17 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) char timecode_str_start[32]; char timecode_str_end[32]; + /* Write timecode relative to start frame of scene. Don't allow negative timecodes. */ BLI_timecode_string_from_time(timecode_str_start, sizeof(timecode_str_start), -2, - FRA2TIME(seq->startdisp), + FRA2TIME(max_ii(seq->startdisp - scene->r.sfra, 0)), FPS, USER_TIMECODE_SUBRIP); BLI_timecode_string_from_time(timecode_str_end, sizeof(timecode_str_end), -2, - FRA2TIME(seq->enddisp), + FRA2TIME(seq->enddisp - scene->r.sfra), FPS, USER_TIMECODE_SUBRIP); _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
