本文整理汇总了C++中CChoreoEvent::SetEndTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CChoreoEvent::SetEndTime方法的具体用法?C++ CChoreoEvent::SetEndTime怎么用?C++ CChoreoEvent::SetEndTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChoreoEvent
的用法示例。
在下文中一共展示了CChoreoEvent::SetEndTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: redraw
//-----------------------------------------------------------------------------
// Purpose: FIXME: This should either be embedded or we should draw the caption
// here
//-----------------------------------------------------------------------------
void CChoreoEventWidget::redraw( CChoreoWidgetDrawHelper& drawHelper )
{
if ( !getVisible() )
return;
CChoreoEvent *event = GetEvent();
if ( !event )
return;
int deflateborder = 1;
int fontsize = 9;
HDC dc = drawHelper.GrabDC();
RECT rcClient = getBounds();
RECT rcDC;
drawHelper.GetClientRect( rcDC );
RECT dummy;
if ( !IntersectRect( &dummy, &rcDC, &rcClient ) )
return;
bool ramponly = m_pView->IsRampOnly();
if ( IsSelected() && !ramponly )
{
InflateRect( &rcClient, 3, 1 );
//rcClient.bottom -= 1;
rcClient.right += 1;
RECT rcFrame = rcClient;
RECT rcBorder = rcClient;
rcFrame.bottom = rcFrame.top + 17;
rcBorder.bottom = rcFrame.top + 17;
COLORREF clrSelection = RGB( 0, 63, 63 );
COLORREF clrBorder = RGB( 100, 200, 255 );
HBRUSH brBorder = CreateSolidBrush( clrBorder );
HBRUSH brSelected = CreateHatchBrush( HS_FDIAGONAL, clrSelection );
for ( int i = 0; i < 2; i++ )
{
FrameRect( dc, &rcFrame, brSelected );
InflateRect( &rcFrame, -1, -1 );
}
FrameRect( dc, &rcBorder, brBorder );
FrameRect( dc, &rcFrame, brBorder );
DeleteObject( brSelected );
DeleteObject( brBorder );
rcClient.right -= 1;
//rcClient.bottom += 1;
InflateRect( &rcClient, -3, -1 );
}
RECT rcEvent;
rcEvent = rcClient;
InflateRect( &rcEvent, 0, -deflateborder );
rcEvent.bottom = rcEvent.top + 10;
if ( event->GetType() == CChoreoEvent::SPEAK && m_pWaveFile && !event->HasEndTime() )
{
event->SetEndTime( event->GetStartTime() + m_pWaveFile->GetRunningLength() );
rcEvent.right = ( int )( m_pWaveFile->GetRunningLength() * m_pView->GetPixelsPerSecond() );
}
if ( event->HasEndTime() )
{
rcEvent.right = rcEvent.left + m_nDurationRightEdge;
RECT rcEventLine = rcEvent;
OffsetRect( &rcEventLine, 0, 1 );
if ( event->GetType() == CChoreoEvent::SPEAK )
{
if ( m_pWaveFile )
{
HBRUSH brEvent = CreateSolidBrush( COLOR_CHOREO_EVENT );
HBRUSH brBackground = CreateSolidBrush( COLOR_CHOREO_DARKBACKGROUND );
if ( !ramponly )
{
FillRect( dc, &rcEventLine, brBackground );
}
// Only draw wav form here if selected
if ( IsSelected() )
{
sound->RenderWavToDC( dc, rcEventLine, IsSelected() ? COLOR_CHOREO_EVENT_SELECTED : COLOR_CHOREO_EVENT, 0.0, m_pWaveFile->GetRunningLength(), m_pWaveFile );
}
//FrameRect( dc, &rcEventLine, brEvent );
drawHelper.DrawColoredLine( COLOR_CHOREO_EVENT, PS_SOLID, 3,
//.........这里部分代码省略.........
示例2: ReconcileGestureTimes
void CChoreoChannel::ReconcileGestureTimes()
{
// Sort gesture events within channel by starting time
CUtlRBTree< CChoreoEvent * > sortedGestures( 0, 0, ChoreEventStartTimeLessFunc );
int i;
// Sort items
int c = GetNumEvents();
for ( i = 0; i < c; i++ )
{
CChoreoEvent *e = GetEvent( i );
Assert( e );
if ( e->GetType() != CChoreoEvent::GESTURE )
continue;
sortedGestures.Insert( e );
}
// Now walk list of gestures
if ( !sortedGestures.Count() )
return;
CChoreoEvent *previous = NULL;
for ( i = sortedGestures.FirstInorder(); i != sortedGestures.InvalidIndex(); i = sortedGestures.NextInorder( i ) )
{
CChoreoEvent *event = sortedGestures[ i ];
if ( !previous )
{
// event->SetStartTime( 0.0f );
}
else if ( previous->GetSyncToFollowingGesture() )
{
// TODO: ask the sequence for what tags to match
CEventAbsoluteTag *pEntryTag = event->FindEntryTag( CChoreoEvent::PLAYBACK );
CEventAbsoluteTag *pExitTag = previous->FindExitTag( CChoreoEvent::PLAYBACK );
if (pEntryTag && pExitTag)
{
float entryTime = pEntryTag->GetAbsoluteTime( );
// get current decay rate of previous gesture
float duration = previous->GetDuration();
float decayTime = (1.0 - pExitTag->GetPercentage()) * duration;
// adjust the previous gestures end time to current apex + existing decay rate
previous->RescaleGestureTimes( previous->GetStartTime(), entryTime + decayTime, true );
previous->SetEndTime( entryTime + decayTime );
// set the previous gestures end tag to the current apex
pExitTag->SetAbsoluteTime( entryTime );
event->PreventTagOverlap( );
previous->PreventTagOverlap( );
}
// BUG: Tracker 3298: ywb 1/31/04
// I think this fixes the issue with abutting past NULL gestures on paste:
// Here's the bug report:
// -------------------------
// When copying and pasteing posture and gesture clips in face poser the beginings of the clips stretch
// to the begining of the scene even if there is a null gesture in place at the begining.
// -------------------------
/*
else if ( pEntryTag && !Q_stricmp( previous->GetName(), "NULL" ) )
{
// If the previous was a null event, then do a bit of fixup
event->SetStartTime( previous->GetEndTime() );
event->PreventTagOverlap( );
}
*/
// The previous event decays from it's end dispaly end time to the current event's display start time
// The next event starts just after the display end time of the previous event
}
previous = event;
}
if ( previous )
{
CChoreoScene *scene = previous->GetScene();
if ( scene )
{
// HACK: Could probably do better by allowing user to drag the blue "end time" bar
//float finish = scene->FindStopTime();
//previous->RescaleGestureTimes( previous->GetStartTime(), finish );
//previous->SetEndTime( finish );
}
}
/*
c = 0;
for ( i = sortedGestures.FirstInorder(); i != sortedGestures.InvalidIndex(); i = sortedGestures.NextInorder( i ) )
{
CChoreoEvent *event = sortedGestures[ i ];
Msg( "event %i start %f disp %f dispend %f end %f\n",
c + 1,
//.........这里部分代码省略.........