Skip to content

Commit 07731cd

Browse files
author
Clement Champetier
committed
ProcessGraph: call begin/endSequence foreach plugin only one time
* OFX doc of beginSequenceRender: "This action is passed to an image effect before it renders a range of frames." * OFX doc of endSequenceRender: "This action is passed to an image effect after is has rendered a range of frames." * The range is not necessarily continuous, so tuttle should not call beginSequence and endSequence on plugins for each continuous range of frames.
1 parent 8b61675 commit 07731cd

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

libraries/tuttle/src/tuttle/host/graph/ProcessGraph.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -607,14 +607,24 @@ bool ProcessGraph::process( memory::IMemoryCache& outCache )
607607

608608
TUTTLE_LOG_INFO( "[Process render] start" );
609609

610-
//--- RENDER
611-
// at each frame
612-
BOOST_FOREACH( const TimeRange& timeRange, timeRanges )
610+
// Begin range of frames
611+
TimeRange globalTimeRange( timeRanges.back() );
612+
BOOST_FOREACH( const TimeRange& range, timeRanges )
613613
{
614-
TUTTLE_LOG_TRACE( "[Process render] timeRange: [" << timeRange._begin << ", " << timeRange._end << ", " << timeRange._step << "]" );
614+
if( globalTimeRange._begin > range._begin )
615+
globalTimeRange._begin = range._begin;
616+
if( globalTimeRange._end < range._end )
617+
globalTimeRange._end = range._end;
618+
}
619+
TUTTLE_LOG_TRACE( "[Process render] begin timeRange: [" << globalTimeRange._begin << ", " << globalTimeRange._end << "]" );
620+
beginSequence( globalTimeRange );
615621

616-
beginSequence( timeRange );
622+
// RENDER (at each frame)
623+
BOOST_FOREACH( const TimeRange& timeRange, timeRanges )
624+
{
625+
TUTTLE_LOG_TRACE( "[Process render] process timeRange: [" << timeRange._begin << ", " << timeRange._end << ", " << timeRange._step << "]" );
617626

627+
// If someone had asked to abort the process
618628
if( _options.getAbort() )
619629
{
620630
TUTTLE_LOG_ERROR( "[Process render] PROCESS ABORTED before first frame." );
@@ -715,10 +725,11 @@ bool ProcessGraph::process( memory::IMemoryCache& outCache )
715725
}
716726
_options.endFrameHandle();
717727
}
718-
719-
endSequence();
720728
}
721729

730+
// End range of frames
731+
endSequence();
732+
722733
#ifdef TUTTLE_EXPORT_WITH_TIMER
723734
TUTTLE_LOG_INFO( "[all process timer] " << boost::timer::format(all_process_timer.elapsed()) );
724735
#endif

0 commit comments

Comments
 (0)