FgdEntity¶
-
class
fgdtools.
FgdEntity
(class_type, definitions, name, description=None, properties=[], spawnflags=[], inputs=[], outputs=[])[source]¶ An entity, as represented in a Fgd file.
-
__init__
(class_type, definitions, name, description=None, properties=[], spawnflags=[], inputs=[], outputs=[])[source]¶ Creates an instance of FgdEntity.
- Parameters
class_type (str) – The entity’s type. Ex: ‘BaseClass’, ‘SolidClass’, ‘PointClass’, etc…
definitions (list[dict]) – Information defining the entity within the editor. Ex: ‘base()’, ‘size()’, ‘line()’, ‘studioprop()’, etc…
name (str) – The entity’s name.
description (str, optional) – The entity’s description.
properties (list[FgdEntityProperty], optional) – The entity’s properties.
spawnflags (list[FgdEntitySpawnflag], optional) – The entity’s spawnflags.
inputs (list[FgdEntityInput], optional) – The entity’s inputs.
output (list[FgdEntityOutput], optional) – The entity’s outputs.
-
__repr__
()[source]¶ A partial, printable summary of a FgdEntity.
- Returns
A Python formated string.
- Return type
-
property
schema
¶ A schematic view of this entity’s attributes.
- Returns
A dictionary.
- Return type
-
property
properties_schema
¶ A schematic view of this entity’s properties.
-
property
inputs_schema
¶ A schematic view of this entity’s inputs.
-
property
outputs_schema
¶ A schematic view of this entity’s outputs.
-
property
spawnflags_schema
¶ A schematic view of this entity’s spanwnflags.
-
property
parents
¶ The entity’s parent entities, as defined in the entity’s base(definition).
-
property
properties
¶ The entity’s properties, including inherited properties.
Note: As in the way Hammer behaves, properties of the same name are overridden.
- Return type
-
property
spawnflags
¶ The entity’s spawnflags, including inherited spawnflags.
Note: As in the way Hammer behaves, the spawnflags definition will merge with inherited definitions only if there is no collision between values. If there is a collision, only the latest definition will be taken into account.
- Return type
-
property
inputs
¶ The entity’s inputs, including inherited inputs.
Note: As in the way Hammer behaves, inputs cannot be overridden. All duplicate inputs are ignored, only the oldest is returned.
- Return type
-
property
outputs
¶ The entity’s outputs, including inherited outputs.
Note: As in the way Hammer behaves, outputs cannot be overridden. All duplicate outputs are returned.
- Return type
-
property_by_name
(prop_name)[source]¶ Finds an entity property by its name.
- Parameters
prop_name (str) – The entity property name to look for.
- Raises
PropertyNotFound – Whenever an entity property could not be found.
- Returns
An entity property with matching name.
- Return type
-
spawnflag_by_value
(spawnflag_value)[source]¶ Finds a property choice by its value.
- Parameters
spawnflag_value (int) – The property spawnflag value to look for.
- Raises
SpawnflagNotFound – Whenever an entity spawnflag could not be found.
- Returns
An entity spawnflag with matching value.
- Return type
-
input_by_name
(input_name)[source]¶ Finds an entity input by its name.
- Parameters
input_name (str) – The entity input name to look for.
- Raises
InputNotFound – Whenever an entity input could not be found.
- Returns
An entity input with matching name.
- Return type
-
output_by_name
(output_name)[source]¶ Finds an entity output by its name.
- Parameters
output_name (str) – The entity output name to look for.
- Raises
OutputNotFound – Whenever an entity output could not be found.
- Returns
An entity output with matching name.
- Return type
-