diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /tools/commedit/dmecommentarynodeentity.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'tools/commedit/dmecommentarynodeentity.h')
| -rw-r--r-- | tools/commedit/dmecommentarynodeentity.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/tools/commedit/dmecommentarynodeentity.h b/tools/commedit/dmecommentarynodeentity.h new file mode 100644 index 0000000..00c7aac --- /dev/null +++ b/tools/commedit/dmecommentarynodeentity.h @@ -0,0 +1,100 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Represents an entity in a VMF +// +//============================================================================= + +#ifndef DMEVMFENTITY_H +#define DMEVMFENTITY_H +#ifdef _WIN32 +#pragma once +#endif + +#include "toolutils/dmemdlrenderable.h" +#include "datamodel/dmelement.h" +#include "toolframework/itoolentity.h" +#include "materialsystem/MaterialSystemUtil.h" + + +//----------------------------------------------------------------------------- +// Represents an editable entity; draws its helpers +//----------------------------------------------------------------------------- +class CDmeCommentaryNodeEntity : public CDmeMdlRenderable<CDmElement> +{ + DEFINE_ELEMENT( CDmeCommentaryNodeEntity, CDmeMdlRenderable<CDmElement> ); + +public: + // Inherited from CDmElement + virtual void OnAttributeChanged( CDmAttribute *pAttribute ); + +public: + // Inherited from DmeRenderable + virtual const Vector &GetRenderOrigin( void ); + virtual const QAngle &GetRenderAngles( void ); + virtual int DrawModel( int flags ); + virtual void GetRenderBounds( Vector& mins, Vector& maxs ); + virtual bool IsTransparent( void ); + +public: + int GetEntityId() const; + + const char *GetClassName() const; + const char *GetTargetName() const; + + bool IsPlaceholder() const; + + // Entity Key iteration + CDmAttribute *FirstEntityKey(); + CDmAttribute *NextEntityKey( CDmAttribute *pEntityKey ); + + // Attach/detach from an engine entity with the same editor index + void AttachToEngineEntity( HTOOLHANDLE hToolHandle ); + + void SetRenderOrigin( const Vector &vecOrigin ); + void SetRenderAngles( const QAngle &angles ); + + void MarkDirty( bool bDirty = true ); + +private: + bool IsEntityKey( CDmAttribute *pEntityKey ); + + // Draws the helper for the entity + void DrawSprite( IMaterial *pMaterial ); + + CDmaVar<Vector> m_vecLocalOrigin; + CDmaVar<Vector> m_vecLocalAngles; + + CDmaString m_ClassName; + CDmaString m_TargetName; + CDmaVar<bool> m_bIsPlaceholder; + + bool m_bInfoTarget; + bool m_bIsDirty; + + // The entity it's connected to in the engine + HTOOLHANDLE m_hEngineEntity; + + CMaterialReference m_SelectedInfoTarget; + CMaterialReference m_InfoTargetSprite; +}; + + +//----------------------------------------------------------------------------- +// Inline methods +//----------------------------------------------------------------------------- +inline const char *CDmeCommentaryNodeEntity::GetClassName() const +{ + return m_ClassName; +} + +inline const char *CDmeCommentaryNodeEntity::GetTargetName() const +{ + return m_TargetName; +} + +inline bool CDmeCommentaryNodeEntity::IsPlaceholder() const +{ + return m_bIsPlaceholder; +} + +#endif // DMEVMFENTITY_H |