void mdlviewer_prevsequence( StudioModel &tempmodel )
{
	int iSeq = tempmodel.GetSequence( );
	if (iSeq == tempmodel.SetSequence( iSeq - 1 ))
	{
		tempmodel.SetSequence( 0 );
	}

  printf("Seq: %d\n",tempmodel.GetSequence( ));
}
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;
}
void mdlviewer_init( char *modelname, StudioModel &tempmodel )
{
	// make a bogus texture
	// R_InitTexture( );

	tempmodel.Init( modelname );
	tempmodel.SetSequence( 0 );

	tempmodel.SetController( 0, 0.0 );
	tempmodel.SetController( 1, 0.0 );
	tempmodel.SetController( 2, 0.0 );
	tempmodel.SetController( 3, 0.0 );
	tempmodel.SetMouth( 0 );
}