You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.2 KiB
74 lines
2.2 KiB
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
|
|
//
|
|
// Purpose:
|
|
//
|
|
//=============================================================================
|
|
|
|
#include "filesystem.h"
|
|
#include "matsys_controls/vtfpicker.h"
|
|
#include "matsys_controls/vtfpreviewpanel.h"
|
|
#include "vgui_controls/Splitter.h"
|
|
|
|
// NOTE: This has to be the last file included!
|
|
#include "tier0/memdbgon.h"
|
|
|
|
|
|
using namespace vgui;
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//
|
|
// Asset Picker with no preview
|
|
//
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Constructor
|
|
//-----------------------------------------------------------------------------
|
|
CVTFPicker::CVTFPicker( vgui::Panel *pParent ) :
|
|
BaseClass( pParent, "VTF Files", "vtf", "materials", "vtfName" )
|
|
{
|
|
// Horizontal splitter for preview
|
|
m_pPreviewSplitter = new Splitter( this, "PreviewSplitter", SPLITTER_MODE_VERTICAL, 1 );
|
|
vgui::Panel *pSplitterLeftSide = m_pPreviewSplitter->GetChild( 0 );
|
|
vgui::Panel *pSplitterRightSide = m_pPreviewSplitter->GetChild( 1 );
|
|
|
|
// VTF preview
|
|
m_pVTFPreview = new CVTFPreviewPanel( pSplitterRightSide, "VTFPreview" );
|
|
|
|
// Standard browser controls
|
|
CreateStandardControls( pSplitterLeftSide );
|
|
|
|
LoadControlSettingsAndUserConfig( "resource/vtfpicker.res" );
|
|
}
|
|
|
|
CVTFPicker::~CVTFPicker()
|
|
{
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Derived classes have this called when the previewed asset changes
|
|
//-----------------------------------------------------------------------------
|
|
void CVTFPicker::OnSelectedAssetPicked( const char *pAssetName )
|
|
{
|
|
m_pVTFPreview->SetVTF( pAssetName );
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//
|
|
// Purpose: Modal picker frame
|
|
//
|
|
//-----------------------------------------------------------------------------
|
|
CVTFPickerFrame::CVTFPickerFrame( vgui::Panel *pParent, const char *pTitle ) :
|
|
BaseClass( pParent )
|
|
{
|
|
SetAssetPicker( new CVTFPicker( this ) );
|
|
LoadControlSettingsAndUserConfig( "resource/vtfpickerframe.res" );
|
|
SetTitle( pTitle, false );
|
|
}
|
|
|
|
|
|
|