FrameCounter/FrameCounter.cpp
#include "FrameCounter.h"
MB_PLUGIN(
"FrameCounter",
"Sample plugin counts frames",
"Autodesk",
"http://www.mudbox3d.com", FrameCounter::Initializer );
CounterNode* FrameCounter::s_pCounter = NULL;
void FrameCounter::Initializer()
{
}
void FrameCounter::StartCounting()
{
if ( s_pCounter == NULL )
{
s_pCounter = new CounterNode;
}
}
void FrameCounter::StopCounting()
{
if ( s_pCounter != NULL )
{
delete s_pCounter;
s_pCounter = NULL;
}
}
CounterNode::CounterNode()
: m_iNumberOfFrames(0)
, m_eEachFrame(this)
{
m_eEachFrame.Connect(
Kernel()->ViewPort()->FrameEvent );
}
void CounterNode::OnEvent( const EventGate &cEvent )
{
if ( cEvent == m_eEachFrame )
{
m_iNumberOfFrames++;
}
}