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.
70 lines
2.3 KiB
70 lines
2.3 KiB
5 years ago
|
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||
|
//
|
||
|
// Purpose:
|
||
|
//
|
||
|
// $NoKeywords: $
|
||
|
//
|
||
|
//=============================================================================//
|
||
|
|
||
|
#include "dme_controls/AttributeAssetPickerPanel.h"
|
||
|
#include "dme_controls/AttributeTextEntry.h"
|
||
|
#include "matsys_controls/AssetPicker.h"
|
||
|
#include "matsys_controls/VtfPicker.h"
|
||
|
#include "matsys_controls/VMTPicker.h"
|
||
|
#include "tier1/KeyValues.h"
|
||
|
|
||
|
|
||
|
using namespace vgui;
|
||
|
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// Assets
|
||
|
//-----------------------------------------------------------------------------
|
||
|
IMPLEMENT_ATTRIBUTE_ASSET_PICKER( CAttributeBspPickerPanel, "Select .BSP file", "BSP Files", "bsp", "maps", "bspName" );
|
||
|
IMPLEMENT_ATTRIBUTE_ASSET_PREVIEW_PICKER( CAttributeVmtPickerPanel, CVMTPickerFrame, "Select .VMT file" );
|
||
|
IMPLEMENT_ATTRIBUTE_ASSET_PREVIEW_PICKER( CAttributeVtfPickerPanel, CVTFPickerFrame, "Select .VTF file" );
|
||
|
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// Constructor
|
||
|
//-----------------------------------------------------------------------------
|
||
|
CAttributeAssetPickerPanel::CAttributeAssetPickerPanel( vgui::Panel *parent, const AttributeWidgetInfo_t &info ) :
|
||
|
BaseClass( parent, info )
|
||
|
{
|
||
|
}
|
||
|
|
||
|
CAttributeAssetPickerPanel::~CAttributeAssetPickerPanel()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// Called when it's time to show the BSP picker
|
||
|
//-----------------------------------------------------------------------------
|
||
|
void CAttributeAssetPickerPanel::ShowPickerDialog()
|
||
|
{
|
||
|
CBaseAssetPickerFrame *pAssetPickerDialog = CreateAssetPickerFrame( );
|
||
|
pAssetPickerDialog->AddActionSignalTarget( this );
|
||
|
pAssetPickerDialog->DoModal( );
|
||
|
}
|
||
|
|
||
|
|
||
|
//-----------------------------------------------------------------------------
|
||
|
// Called by the asset picker dialog if a asset was selected
|
||
|
//-----------------------------------------------------------------------------
|
||
|
void CAttributeAssetPickerPanel::OnAssetSelected( KeyValues *pKeyValues )
|
||
|
{
|
||
|
// Get the asset name back
|
||
|
const char *pAssetName = pKeyValues->GetString( "asset", NULL );
|
||
|
if ( !pAssetName || !pAssetName[ 0 ] )
|
||
|
return;
|
||
|
|
||
|
// Apply to text panel
|
||
|
m_pData->SetText( pAssetName );
|
||
|
SetDirty(true);
|
||
|
if ( IsAutoApply() )
|
||
|
{
|
||
|
Apply();
|
||
|
}
|
||
|
}
|