Class EntityHelper
Namespace: ValveResourceFormat.Renderer.Editor.Helpers
Assembly: Renderer.dll
One of the things an entity is drawn with in the editor, such as its model, its icon or the light it casts. An entity gets a helper for each one its class declares.
public abstract class EntityHelperInheritance
object ← EntityHelper
Derived
BakeResourceHelper, IconHelper, ModelHelper
Constructors
EntityHelper(IHelperOwner, HelperDeclaration)
Initializes a helper of an entity.
protected EntityHelper(IHelperOwner owner, HelperDeclaration declaration)Parameters
owner IHelperOwner
The entity the helper belongs to.
declaration HelperDeclaration
The helper as the class of the entity declares it.
Properties
Declaration
Gets the helper as the class of the entity declares it.
public HelperDeclaration Declaration { get; }Property Value
HiddenInGameObjectsOnly
Gets whether the helper is hidden while the editor shows only what the game shows, unless its entity is selected.
public virtual bool HiddenInGameObjectsOnly { get; }Property Value
bool
IsStandIn
Gets whether the helper stands in for its entity in the editor. The game draws the entities of a compiled map, so only these helpers are drawn in their place.
public virtual bool IsStandIn { get; }Property Value
bool
IsToolShape
Gets whether the helper only draws shapes of the editor, which the game does not show. An entity of a compiled map is drawn with these too.
public virtual bool IsToolShape { get; }Property Value
bool
IsVisual
Gets whether the helper makes the entity visible, which most helpers do. An entity without such a helper is drawn as a box.
public virtual bool IsVisual { get; }Property Value
bool
NeedsShowHelpers
Gets whether the helper is only drawn while helpers are shown, which they are by default.
public virtual bool NeedsShowHelpers { get; }Property Value
bool
ObjectBounds
Gets the world bounds the helper adds to the bounds of its entity, or null if it adds none. The selection box is made from these. Most helpers add none, since a sphere or a line around an entity does not make the entity larger. An entity whose helpers add none is boxed at its origin.
public virtual AABB? ObjectBounds { get; }Property Value
AABB?
Owner
Gets the entity the helper belongs to.
public IHelperOwner Owner { get; }Property Value
RequiresSelection
Gets whether nothing of the helper is drawn while its entity is not selected.
public virtual bool RequiresSelection { get; }Property Value
bool
VisibilityLayers
Gets the visibility layers of the nodes the helper adds to the scene, besides those of its entity. They stand in for the options of the editor: the helpers layer for a helper only drawn while helpers are shown, the editor-only entities layer for one hidden while only what the game shows is drawn, and none for one neither option hides.
protected ImmutableArray<WorldLayer> VisibilityLayers { get; }Property Value
Methods
AddToScene()
Adds what the helper draws to the scene of the entity.
public virtual void AddToScene()GetArgument(int)
Gets an argument of the declaration, or null when it has fewer.
protected string? GetArgument(int index)Parameters
index int
Zero based index of the argument.
Returns
string?
The argument.
GetBooleanKey(string, bool)
Gets a key of the entity as a flag.
protected bool GetBooleanKey(string key, bool defaultValue = false)Parameters
key string
Name of the key.
defaultValue bool
The value where the entity has no such key.
Returns
bool
The flag.
GetColorArguments(int)
Gets the color given by three arguments of the declaration. A channel is full when its argument is missing. Each argument is read as the integer it starts with and wraps to a byte.
protected Color32 GetColorArguments(int start)Parameters
start int
Index of the first of the three.
Returns
The color, opaque.
GetFloatKey(string, float)
Gets a key of the entity as a number.
protected float GetFloatKey(string key, float defaultValue = 0)Parameters
key string
Name of the key.
defaultValue float
The value where the entity has no such key.
Returns
float
The value.
GetIntegerKey(string, int)
Gets a key of the entity as an integer.
protected int GetIntegerKey(string key, int defaultValue = 0)Parameters
key string
Name of the key.
defaultValue int
The value where the entity has no such key.
Returns
int
The value.
GetMetadata(string)
Gets a key of the metadata of the declaration as text.
protected string? GetMetadata(string key)Parameters
key string
Name of the key.
Returns
string?
The value, or null when the helper has no such key.
GetMetadataColor(string)
Gets a color given as three or four numbers in the metadata of the declaration.
protected Color32? GetMetadataColor(string key)Parameters
key string
Name of the key.
Returns
The color, or null when the block has no such color.
GetMetadataFlag(string, bool)
Gets a flag from the metadata of the declaration.
protected bool GetMetadataFlag(string key, bool defaultValue = false)Parameters
key string
Name of the key.
defaultValue bool
The value where the block has no such key.
Returns
bool
The flag.
GetObjectBounds(in Matrix4x4)
Gets EntityHelper.ObjectBounds boxed in another space, where the helper knows them more tightly.
public virtual AABB? GetObjectBounds(in Matrix4x4 worldToSpace)Parameters
worldToSpace Matrix4x4
The transform from the world into the space.
Returns
AABB?
GetStringKey(string)
Gets a key of the entity as text.
protected string GetStringKey(string key)Parameters
key string
Name of the key.
Returns
string
The value, empty when the entity has no such key.
GetVector2Key(string)
Gets a key of the entity as a two component vector.
protected Vector2 GetVector2Key(string key)Parameters
key string
Name of the key.
Returns
The value, zero where the entity has no such key.
GetVector3Key(string, Vector3)
Gets a key of the entity as a vector.
protected Vector3 GetVector3Key(string key, Vector3 defaultValue = default)Parameters
key string
Name of the key.
defaultValue Vector3
The value where the entity has no such key.
Returns
The value.
HasArgument(string)
Gets whether any argument of the declaration equals the flag, ignoring case.
protected bool HasArgument(string flag)Parameters
flag string
The flag.
Returns
bool
Whether the declaration has it.
Link()
Finds the entities the helper names. Called once every entity of the map exists, and again whenever one of them changes.
public virtual void Link()
