mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 01:39:36 +00:00
1
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// VMT.VPC
|
||||
//
|
||||
// Project Script
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
$Macro SRCDIR "..\.."
|
||||
$Macro OUTBINDIR "$SRCDIR\..\game\bin\tools"
|
||||
|
||||
$Include "$SRCDIR\vpc_scripts\source_dll_base.vpc"
|
||||
|
||||
$Configuration
|
||||
{
|
||||
$Compiler
|
||||
{
|
||||
$AdditionalIncludeDirectories "$BASE,../common"
|
||||
}
|
||||
|
||||
$Linker
|
||||
{
|
||||
$AdditionalDependencies "$BASE Psapi.lib"
|
||||
}
|
||||
}
|
||||
|
||||
$Project "Vmt"
|
||||
{
|
||||
$Folder "Source Files"
|
||||
{
|
||||
$File "$SRCDIR\public\interpolatortypes.cpp"
|
||||
$File "$SRCDIR\public\movieobjects\movieobjects.cpp"
|
||||
$File "$SRCDIR\public\registry.cpp"
|
||||
$File "$SRCDIR\public\vgui_controls\vgui_controls.cpp"
|
||||
$File "vmtdoc.cpp"
|
||||
$File "vmttool.cpp"
|
||||
}
|
||||
|
||||
$Folder "Header Files"
|
||||
{
|
||||
$File "$SRCDIR\public\interpolatortypes.h"
|
||||
$File "vmtdoc.h"
|
||||
$File "vmttool.h"
|
||||
}
|
||||
|
||||
$Folder "Link Libraries"
|
||||
{
|
||||
$Lib datamodel
|
||||
$Lib dmxloader
|
||||
$Lib dme_controls
|
||||
$Lib dmserializers
|
||||
$Lib mathlib
|
||||
$Lib matsys_controls
|
||||
$Lib movieobjects
|
||||
$Lib sfmobjects
|
||||
$Lib tier2
|
||||
$Lib tier3
|
||||
$Lib toolutils
|
||||
$Lib vgui_controls
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,133 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef VMTDOC_H
|
||||
#define VMTDOC_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include "dme_controls/inotifyui.h"
|
||||
#include "datamodel/dmehandle.h"
|
||||
#include "materialsystem/MaterialSystemUtil.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
class IVMTDocCallback;
|
||||
class IShader;
|
||||
enum ShaderParamType_t;
|
||||
class IMaterial;
|
||||
class IShader;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Contains all editable state
|
||||
//-----------------------------------------------------------------------------
|
||||
class CVMTDoc : public IDmNotify
|
||||
{
|
||||
public:
|
||||
CVMTDoc( IVMTDocCallback *pCallback );
|
||||
~CVMTDoc();
|
||||
|
||||
// Inherited from INotifyUI
|
||||
virtual void NotifyDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
|
||||
|
||||
// Sets/Gets the file name
|
||||
const char *GetFileName();
|
||||
void SetFileName( const char *pFileName );
|
||||
|
||||
// Dirty bits (has it changed since the last time it was saved?)
|
||||
void SetDirty( bool bDirty );
|
||||
bool IsDirty() const;
|
||||
|
||||
// Creates a new act busy list
|
||||
void CreateNew();
|
||||
|
||||
// Saves/loads from file
|
||||
bool LoadFromFile( const char *pFileName );
|
||||
bool SaveToFile( );
|
||||
|
||||
// Returns the root object
|
||||
CDmElement *GetRootObject();
|
||||
|
||||
// Called when data changes (see INotifyUI for flags)
|
||||
void OnDataChanged( const char *pReason, int nNotifySource, int nNotifyFlags );
|
||||
|
||||
// Sets the shader in the material
|
||||
void SetShader( const char *pShaderName );
|
||||
|
||||
// Gets the preview material
|
||||
IMaterial *GetPreviewMaterial();
|
||||
|
||||
// Sets shader parameters to the default for that shader
|
||||
void SetParamsToDefault();
|
||||
|
||||
private:
|
||||
// Creates the root element
|
||||
bool CreateRootElement();
|
||||
|
||||
// Add attribute for shader parameter
|
||||
CDmAttribute* AddAttributeForShaderParameter( CDmElement *pMaterial, const char *pParamName, ShaderParamType_t paramType );
|
||||
|
||||
// Add a single shader parameter if it doesn't exist
|
||||
void AddNewShaderParam( CDmElement *pMaterial, const char *pParamName, ShaderParamType_t paramType, const char *pValue );
|
||||
|
||||
// Add all shader parameters that don't currently exist
|
||||
void AddNewShaderParams( CDmElement *pMaterial, IShader *pShader );
|
||||
|
||||
// Is this attribute a shader parameter?
|
||||
bool IsShaderParam( CDmAttribute* pAttribute );
|
||||
|
||||
// Remove all shader parameters that don't exist in the new shader
|
||||
void RemoveUnusedShaderParams( CDmElement *pMaterial, IShader *pShader, IShader *pOldShader );
|
||||
|
||||
// Remove all shader parameters
|
||||
void RemoveAllShaderParams( CDmElement *pMaterial );
|
||||
|
||||
// Finds a shader
|
||||
IShader *FindShader( const char *pShaderName );
|
||||
|
||||
// Updates the preview material
|
||||
void UpdatePreviewMaterial();
|
||||
|
||||
// Copies VMT parameters into the root
|
||||
void CopyParamsFromVMT( CDmElement *pVMT );
|
||||
|
||||
// A couple methods to set param values from strings (OLD METHOD!)
|
||||
bool SetVMatrixParamValue( CDmAttribute *pAttribute, const char *pValue );
|
||||
bool SetVector2DParamValue( CDmAttribute *pAttribute, const char *pValue );
|
||||
bool SetVector3DParamValue( CDmAttribute *pAttribute, const char *pValue );
|
||||
bool SetVector4DParamValue( CDmAttribute *pAttribute, const char *pValue );
|
||||
bool SetColorParamValue( CDmAttribute *pAttribute, const char *pValue );
|
||||
|
||||
// Sets an attribute value from the shader param default
|
||||
void SetAttributeValueFromDefault( CDmElement *pMaterial, CDmAttribute *pAttribute, const char *pValue );
|
||||
|
||||
// Hooks the preview to an existing material, if there is one
|
||||
void SetupPreviewMaterial( );
|
||||
|
||||
// Prior to saving to disk, extract all shader parameters which == the default
|
||||
CDmElement* ExtractDefaultParameters( );
|
||||
|
||||
IVMTDocCallback *m_pCallback;
|
||||
CMaterialReference m_pScratchMaterial;
|
||||
CMaterialReference m_pPreviewMaterial;
|
||||
CDmeHandle< CDmElement > m_hRoot;
|
||||
CUtlString m_CurrentShader;
|
||||
IShader *m_pCurrentIShader;
|
||||
char m_pFileName[512];
|
||||
bool m_bDirty;
|
||||
};
|
||||
|
||||
|
||||
#endif // VMTDOC_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,50 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: VMT tool; main UI smarts class
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef VMTTOOL_H
|
||||
#define VMTTOOL_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
class CDmeEditorTypeDictionary;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Singleton interfaces
|
||||
//-----------------------------------------------------------------------------
|
||||
extern CDmeEditorTypeDictionary *g_pEditorTypeDict;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Allows the doc to call back into the VMT editor tool
|
||||
//-----------------------------------------------------------------------------
|
||||
class IVMTDocCallback
|
||||
{
|
||||
public:
|
||||
// Called by the doc when the data changes
|
||||
virtual void OnDocChanged( const char *pReason, int nNotifySource, int nNotifyFlags ) = 0;
|
||||
|
||||
// Update the editor dict based on the current material parameters
|
||||
virtual void AddShaderParameter( const char *pParam, const char *pWidget, const char *pTextType ) = 0;
|
||||
|
||||
// Update the editor dict based on the current material parameters
|
||||
virtual void RemoveShaderParameter( const char *pParam ) = 0;
|
||||
|
||||
// Adds flags, tool parameters
|
||||
virtual void AddFlagParameter( const char *pParam ) = 0;
|
||||
virtual void AddToolParameter( const char *pParam, const char *pWidget = NULL, const char *pTextType = NULL ) = 0;
|
||||
virtual void RemoveAllFlagParameters() = 0;
|
||||
virtual void RemoveAllToolParameters() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // VMTTOOL_H
|
||||
Reference in New Issue
Block a user