int IFaceposerModels::LoadModel( char const *filename )
{
	int idx = FindModelByFilename( filename );
	if ( idx == -1 && Count() < MAX_FP_MODELS )
	{
		StudioModel *model = new StudioModel();

		StudioModel *save = g_pStudioModel;
		g_pStudioModel = model;
		if ( !model->LoadModel( filename ) )
		{
			delete model;
			g_pStudioModel = save;
			return 0; // ?? ERROR
		}
		g_pStudioModel = save;

		SetupModelFlexcontrollerLinks( model );

		CFacePoserModel newEntry( filename, model );
		
		idx = m_Models.AddToTail( newEntry );

		g_MDLViewer->InitModelTab();
		
		g_MDLViewer->SetActiveModelTab( idx );

		g_pControlPanel->CenterOnFace();
	}
	return idx;
}
int IFaceposerModels::LoadModel( char const *filename )
{
	MDLCACHE_CRITICAL_SECTION_( g_pMDLCache );

	int idx = FindModelByFilename( filename );
	if ( idx == -1 && Count() < MAX_FP_MODELS )
	{
		StudioModel *model = new StudioModel();

		StudioModel *save = g_pStudioModel;
		g_pStudioModel = model;
		if ( !model->LoadModel( filename ) )
		{
			delete model;
			g_pStudioModel = save;
			return 0; // ?? ERROR
		}
		g_pStudioModel = save;

		model->SetSequence( model->LookupSequence( "idle_subtle" ) );
		int idx = model->GetSequence();
		model->SetSequence( idx );

		SetupModelFlexcontrollerLinks( model );

		if (!LoadViewerSettings( filename, model ))
		{
			InitViewerSettings( "faceposer" );
		}
		model->ClearOverlaysSequences();


		CFacePoserModel *newEntry = new CFacePoserModel( filename, model );
		
		idx = m_Models.AddToTail( newEntry );

		g_MDLViewer->InitModelTab();
		
		g_MDLViewer->SetActiveModelTab( idx );

		//g_pControlPanel->CenterOnFace();
	}
	return idx;
}