// PlugTest.h : main header file for the PLUGTEST DLL
//

#if !defined(OPT_KEYFRAME)
#define OPT_KEYFRAME

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif


#include "AnimationSuite.h"


struct ThreadData 
{

	int stop;
	int abort;
	int done;
	float percent_complete;
	INode*	theNode;
	float	transThreshold;
	float	rotThreshold;
	TimeValue step;
	int totalChildren;
	int childrenCounted;

	char current_operation[200];

	ThreadData()
	{
		stop = 0;
		abort = 0;
		percent_complete = 0;
		step = 0;
		transThreshold = 0;
		rotThreshold = 0;
		theNode = NULL;
		done = 0;
		totalChildren = 0;
		childrenCounted = 0;
	}

};

class OptKeyReduceStatus:
	public KeyReduceStatus
{
public:
	
	OptKeyReduceStatus()
	{
		
	}

	void Init(int total)
	{
		
	}

	int Progress(int p){return KEYREDUCE_CONTINUE;};
};

extern CCriticalSection g_threadLock;
extern ThreadData g_threadInfo;


/////////////////////////////////////////////////////////////////////////////
// PlugPanel, manage the Plugins' display panel
class OptimizeKeyframePanel : public UtilityObj {
	protected:
		IUtil*			m_iu;
		HWND			m_hPanel;

	public:
		Interface*		m_ip;

        // Constructor & Destructor
        OptimizeKeyframePanel() {};
        virtual ~OptimizeKeyframePanel() {};

		// Overides of the UtilityObj class
		void BeginEditParams(Interface* ip, IUtil* iu);
		void EndEditParams(Interface* ip, IUtil* iu);
		void DeleteThis()						{}
		void Init(HWND hWnd);
		void Destroy(HWND hWnd);

		//Specific Methods
		void Optimize();
		void OptimizeAnimation(INode *copy_node, int &current_node, int total_nodes, JointEditDialog *dialog);


};

/////////////////////////////////////////////////////////////////////////////
// 3DS Max Standard Select-by-name Dialog Box Callback Class
class TestHitByNameDlgCallback : public HitByNameDlgCallback
{
	public:
		virtual TCHAR* dialogTitle()		{ return _T("Select a Node to get information from");}
		virtual TCHAR* buttonText()			{ return _T("Select");}
		virtual BOOL useFilter()			{return FALSE;}
		virtual BOOL useProc()				{ return TRUE;}
		virtual void proc(INodeTab &nodeTab){NodeTab = nodeTab;}
		virtual BOOL singleSelect()			{return TRUE;}

	public:
		INodeTab	NodeTab;
};


/////////////////////////////////////////////////////////////////////////////

#endif
