Torque3D Documentation / _generateds / VSlowMoTrack.cpp

VSlowMoTrack.cpp

Engine/source/Verve/Extension/Director/VSlowMoTrack.cpp

More...

Detailed Description

Public Functions

IMPLEMENT_CONOBJECT(VSlowMoTrack )

 1
 2//-----------------------------------------------------------------------------
 3// Verve
 4// Copyright (C) 2014 - Violent Tulip
 5//
 6// Permission is hereby granted, free of charge, to any person obtaining a copy
 7// of this software and associated documentation files (the "Software"), to
 8// deal in the Software without restriction, including without limitation the
 9// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10// sell copies of the Software, and to permit persons to whom the Software is
11// furnished to do so, subject to the following conditions:
12//
13// The above copyright notice and this permission notice shall be included in
14// all copies or substantial portions of the Software.
15//
16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22// IN THE SOFTWARE.
23//-----------------------------------------------------------------------------
24#include "Verve/Extension/Director/VSlowMoTrack.h"
25
26//-----------------------------------------------------------------------------
27IMPLEMENT_CONOBJECT( VSlowMoTrack );
28//-----------------------------------------------------------------------------
29
30VSlowMoTrack::VSlowMoTrack( void )
31{
32    setLabel( "SlowMoTrack" );
33}
34
35//-----------------------------------------------------------------------------
36//
37// Controller Methods.
38//
39//-----------------------------------------------------------------------------
40
41//-----------------------------------------------------------------------------
42// 
43// VSlowMoTrack::onControllerEvent( pEvent );
44// 
45// ...
46// 
47// For a full list of possible events, see the 'eControllerEventType'
48// declaration in VController.h.
49// 
50//-----------------------------------------------------------------------------
51bool VSlowMoTrack::onControllerEvent( VController::eControllerEventType pEvent )
52{
53    if ( !Parent::onControllerEvent( pEvent ) )
54    {
55        // Skip.
56        return false;
57    }
58
59    // Enabled?
60    if ( !isEnabled() )
61    {
62        // Continue Processing Events.
63        return true;
64    }
65
66    switch ( pEvent )
67    {
68        case VController::k_EventStop :
69            {
70
71                // Reset Time Scale.
72                getController()->setTimeScale( ( isControllerPlayingForward() ) ? 1.f : -1.f );
73
74            } break;
75    }
76
77    return true;
78}
79
80//-----------------------------------------------------------------------------
81// 
82// VSlowMoTrack::onControllerReset( pTime, pForward );
83// 
84// ...
85// 
86//-----------------------------------------------------------------------------
87void VSlowMoTrack::onControllerReset( const S32 &pTime, const bool &pForward )
88{
89    // Parent Reset.
90    Parent::onControllerReset( pTime, pForward );
91
92    // Reset Time Scale.
93    getController()->setTimeScale( ( pForward ) ? 1.f : -1.f );
94}
95