### Parse and Export VCD and scenes.image Files (Python) Source: https://srctools.readthedocs.io/en/stable/modules/choreo Demonstrates the basic usage of reading and writing VCD files in text format and scenes.image files in binary format using the srctools.choreo module. It utilizes Tokenizer for text parsing and provides examples for both reading and writing. ```python from srctools.choreo import * from srctools.tokenizer import Tokenizer with open('some_scene.vcd') as file: scene = Scene.parse_text(Tokenizer(file)) with open('some_scene_copy.vcd', 'w') as file: scene.export_text(file) with open('scenes.image', 'rb') as file: image = parse_scenes_image(file) with open('new_scenes.image', 'wb') as file: save_scenes_image_sync(file, image) ``` -------------------------------- ### Get Compiler Executable Name in Python Source: https://srctools.readthedocs.io/en/stable/modules/run Retrieves the actual executable name for Source engine compilers like VBSP or VRAD. This is useful for ensuring the correct binary is being targeted, especially in different game installations or toolchains. ```python from srctools import run vbsp_name = run.get_compiler_name('VBSP') vrad_name = run.get_compiler_name('VRAD') print(f'VBSP executable: {vbsp_name}') print(f'VRAD executable: {vrad_name}') ``` -------------------------------- ### Build Keyvalues Tree with Context Manager (Python) Source: https://srctools.readthedocs.io/en/stable/modules/keyvalues Demonstrates how to use the `build()` context manager to conveniently append a tree of key-value pairs. It shows how to set names for properties and sub-properties, and how to retrieve the final serialized Keyvalues object. Dependencies include the `Keyvalues` class itself. ```python kv = Keyvalues('name', []) with kv.build() as builder: builder.root1('blah') builder.root2('blah') with builder.subprop: subprop = builder.config('value') builder['unusual name']('value') print(subprop) # doctest: +NORMALIZE_WHITESPACE "config" "value" print(kv.serialise()) # doctest: +NORMALIZE_WHITESPACE "name" { "root1" "blah" "root2" "blah" "subprop" { "config" "value" "unusual name" "value" } } ``` ```python with Keyvalues('name', []).build() as builder: builder.root1('blah') builder.root2('blah') kv = builder() print(repr(kv)) ``` -------------------------------- ### Get Number of Child Keyvalues Source: https://srctools.readthedocs.io/en/stable/modules/keyvalues Explains the `__len__` method, which returns the count of direct child keyvalues within a `Keyvalues` object. This is analogous to getting the length of a list. ```python Keyvalues.__len__() → int ``` -------------------------------- ### VPK File Creation and Writing Source: https://srctools.readthedocs.io/en/stable/modules/vpk This section details how to create new files within a VPK and write data to them. It covers creating empty files and then writing byte data, as well as combined operations. ```APIDOC ## VPK.new_file ### Description Create a new file within the VPK, optionally setting a root directory. Raises `FileExistsError` if the file already exists. ### Method `VPK.new_file` ### Endpoint N/A (Object method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_filename** (str | tuple[str, str] | tuple[str, str, str]) - Required - The name or path of the file to create. - **_root** (str) - Optional - The root directory to treat filenames relative to. Defaults to ''. ### Request Example ```python # Assuming 'vpk' is an instance of VPK vpk.new_file("_my_file.txt", root="assets/") ``` ### Response #### Success Response (200) - **FileInfo** (FileInfo) - An object representing the newly created file. #### Response Example ```json { "file_info": "" } ``` --- ## FileInfo.write ### Description Replace the content of an existing file with the provided byte data. ### Method `FileInfo.write` ### Endpoint N/A (Object method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_data** (bytes) - Required - The byte data to write to the file. - **_arch_index** (int | None) - Optional - The VPK archive file to write to (e.g., `pak_01_000.vpk`). `None` writes to the directory file. Ignored if the VPK is singular. Defaults to `None`. ### Request Example ```python # Assuming 'file_info' is an instance of FileInfo and 'data_bytes' contains file content file_info.write(data_bytes) ``` ### Response #### Success Response (200) None #### Response Example None --- ## VPK.add_file ### Description Add data to a new or existing file in the VPK. This method combines file creation and writing. ### Method `VPK.add_file` ### Endpoint N/A (Object method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_filename** (str | tuple[str, str] | tuple[str, str, str]) - Required - The name or path of the file to add. - **_data** (bytes) - Required - The byte data to write to the file. - **_root** (str) - Optional - The root directory to treat filenames relative to. Defaults to ''. - **_arch_index** (int | None) - Optional - The VPK archive file to write to. `0` writes to the directory file. Defaults to `0`. ### Request Example ```python # Assuming 'vpk' is an instance of VPK and 'file_content_bytes' contains data vpk.add_file("config.json", file_content_bytes) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Accessing VPK Files by Index Source: https://srctools.readthedocs.io/en/stable/modules/vpk Demonstrates the different ways to access a file within a VPK using indexing. This allows for precise file retrieval based on folder and extension. ```Python vpk['folders/name.ext'] vpk['folders', 'name.ext'] vpk['folders', 'name', 'ext'] ``` -------------------------------- ### srctools.choreo.Entry.duration Source: https://srctools.readthedocs.io/en/stable/modules/choreo Gets the duration of the entry in seconds. ```APIDOC ## srctools.choreo.Entry.duration ### Description Gets the duration of the entry in seconds. ### Returns - **float** - The duration of the entry in seconds. ``` -------------------------------- ### srctools.choreo.Entry.data Source: https://srctools.readthedocs.io/en/stable/modules/choreo Gets the raw data associated with the entry. ```APIDOC ## srctools.choreo.Entry.data ### Description Gets the raw data associated with the entry. ### Returns - **any** - The raw data. ``` -------------------------------- ### srctools.filesys.FileSystem method open_bin() Source: https://srctools.readthedocs.io/en/stable/genindex Description of the open_bin() method for srctools.filesys.FileSystem. ```APIDOC ## Method in srctools.filesys.FileSystem ### Description This section details the `open_bin()` method for the `srctools.filesys.FileSystem` class. ### Method `open_bin()` ### Parameters None ### Returns (type) - Description ``` -------------------------------- ### srctools.instancing.InstanceFile.parse() Source: https://srctools.readthedocs.io/en/stable/genindex Method to parse an instance file. ```APIDOC ## parse() ### Description Method `parse()` on `srctools.instancing.InstanceFile`. This method reads and parses an instance file, loading its structure, parameters, and other relevant data into an `InstanceFile` object. ### Method `InstanceFile.parse` ### Endpoint N/A ### Parameters Parameters would typically include the file path or a file-like object containing the instance file content. ### Request Example N/A ### Response #### Success Response (N/A) Returns an `InstanceFile` object populated with data from the parsed file. #### Response Example N/A ``` -------------------------------- ### srctools.vmf.DispVertex attributes Source: https://srctools.readthedocs.io/en/stable/genindex Details on DispVertex attributes starting with 'O'. ```APIDOC ## Attributes in srctools.vmf.DispVertex ### Description This section lists attributes within `srctools.vmf.DispVertex` that start with the letter 'O'. ### Attributes - **offset** - **offset_norm** ``` -------------------------------- ### srctools.bsp.BSP_LUMPS attributes Source: https://srctools.readthedocs.io/en/stable/genindex Details on BSP_LUMPS attributes starting with 'O'. ```APIDOC ## Attributes in srctools.bsp.BSP_LUMPS ### Description This section lists attributes within `srctools.bsp.BSP_LUMPS` that start with the letter 'O'. ### Attributes - **OCCLUSION** - **ORIGINALFACES** - **OVERLAY_FADES** - **OVERLAY_SYSTEM_LEVELS** - **OVERLAYS** ``` -------------------------------- ### Create TexInfo Entry with FileSystem Source: https://srctools.readthedocs.io/en/stable/modules/bsp Creates a TexInfo entry, automatically deriving material properties like size and reflectivity by reading from a provided FileSystem. This is useful when the material's VMT and VTF files are accessible. It allows for flexible texture positioning and flags. ```Python BSP.create_texinfo( _mat='materials/custom/my_texture.vmt', _fsys=my_filesystem_object ) -> TexInfo ``` ```Python BSP.create_texinfo( _mat='materials/custom/my_texture.vmt', _s_off=FrozenVec(10, 20, 0), _t_off=FrozenVec(30, 40, 0), _flags=SurfFlags.TRANSLUCENT, _fsys=my_filesystem_object ) -> TexInfo ``` -------------------------------- ### srctools.bsp.Overlay class Source: https://srctools.readthedocs.io/en/stable/genindex Documentation for the Overlay class in srctools.bsp. ```APIDOC ## Class in srctools.bsp ### Description This section details the `Overlay` class within the `srctools.bsp` module. ### Class `Overlay` ### Attributes None explicitly listed in input. ### Methods None explicitly listed in input. ``` -------------------------------- ### srctools.choreo.Entry.last_speak Source: https://srctools.readthedocs.io/en/stable/modules/choreo Gets the last spoken time of the entry in seconds. ```APIDOC ## srctools.choreo.Entry.last_speak ### Description Gets the last spoken time of the entry in seconds. ### Returns - **float** - The last spoken time in seconds. ``` -------------------------------- ### srctools.filesys.File method open_bin() Source: https://srctools.readthedocs.io/en/stable/genindex Description of the open_bin() method for srctools.filesys.File. ```APIDOC ## Method in srctools.filesys.File ### Description This section details the `open_bin()` method for the `srctools.filesys.File` class. ### Method `open_bin()` ### Parameters None ### Returns (type) - Description ``` -------------------------------- ### Locating Steam Source: https://srctools.readthedocs.io/en/stable/_sources/modules/steam.rst Functions for detecting Steam installation paths and libraries. ```APIDOC ## srctools.steam: Locating Steam ### Description Functions for detecting the Steam installation path and available game libraries. ### Functions #### get_steam_install_path() - **Description**: Detects the Steam installation path. - **Method**: GET - **Endpoint**: N/A (Function call) #### get_libraries() - **Description**: Retrieves a list of Steam game libraries. - **Method**: GET - **Endpoint**: N/A (Function call) #### clear_caches() - **Description**: Clears any cached Steam data. - **Method**: POST - **Endpoint**: N/A (Function call) ``` -------------------------------- ### srctools.steam - Locating Steam Source: https://srctools.readthedocs.io/en/stable/modules/steam Functions for retrieving Steam installation paths and library locations. ```APIDOC ## srctools.steam.get_steam_install_path() ### Description Retrieve the installation path of Steam. ### Method GET ### Endpoint /steam/install_path ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **path** (Path) - The installation path of Steam. #### Response Example ```json { "path": "/path/to/steam" } ``` ### Errors - **FileNotFoundError**: If no Steam installation could be located. ``` ```APIDOC ## srctools.steam.get_libraries() ### Description Locate all Steam library folders. ### Method GET ### Endpoint /steam/libraries ### Parameters #### Query Parameters - **_steam_installpath** (Path) - Optional - The Steam installation path. If not provided, it will be automatically detected. #### Request Body None ### Response #### Success Response (200) - **libraries** (Collection[Path]) - A collection of paths to Steam library folders. #### Response Example ```json { "libraries": [ "/path/to/steam/steamapps", "/another/library/path" ] } ``` ``` ```APIDOC ## srctools.steam.clear_caches() ### Description Clear cached data, so they will be parsed again. ### Method POST ### Endpoint /steam/clear_caches ### Parameters None ### Request Body None ### Response #### Success Response (200) - **message** (string) - Indicates that the caches have been cleared. #### Response Example ```json { "message": "Steam caches cleared successfully." } ``` ``` -------------------------------- ### VPK File Access and Context Management (Python) Source: https://srctools.readthedocs.io/en/stable/_sources/modules/vpk.rst Demonstrates how to open, read from, and write to VPK archives using the VPK class. It shows the use of VPK as a context manager for automatic saving and illustrates direct file access via indexing. ```python from srctools.vpk import VPK, OpenModes # Open a VPK in read/write mode with VPK('path/to/archive.vpk', OpenModes.read_write) as vpk: # Read a file file_content = vpk['path/to/file.txt'].read() print(f"Read content: {file_content}") # Write to a file (changes applied immediately to data files) new_content = b'Some new data' file_info = vpk.new_file('path/to/new_file.bin') file_info.write(new_content) # Add a file from disk vpk.add_file('local/file.dat', 'vpk/path/in/archive.dat') # Remove a file del vpk['old/file.txt'] # Changes to the directory are saved automatically upon exiting the 'with' block # Direct indexing examples file_data = vpk['folder/file.ext'] vpk['folder', 'file.ext'] vpk['folder', 'file', 'ext'] # Check if a file exists if 'another/file.txt' in vpk: print('File exists') # Get the number of files print(f'Number of files: {len(vpk)}') ``` -------------------------------- ### Keyvalues Serialization API Source: https://srctools.readthedocs.io/en/stable/modules/keyvalues Serializes Keyvalues data to a file or returns it as a string. Supports customizable indentation and starting indentation. ```APIDOC ## Method: Keyvalues.serialise ### Description Serializes the Keyvalues data to a file or returns it as a string if no file is provided. Does not handle cyclic loops in the tree. ### Method `Keyvalues.serialise(_file, _indent, _indent_braces, _start_indent_) `Keyvalues.serialise(_indent, _indent_braces, _start_indent_) ### Endpoint `Keyvalues.serialise(_file: _SupportsWrite_ | None, _indent: str = '\t'_, _indent_braces: bool = True_, _start_indent: str = ''_) `Keyvalues.serialise(_indent: str = '\t'_, _indent_braces: bool = True_, _start_indent: str = ''_) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None #### `_file` Parameter (First overload) - **_file** (_SupportsWrite_ | None) - Optional - The file to write to. If omitted, the data is returned as a string. #### `_indent` Parameter - **_indent** (str) - Optional - The characters to use for each indentation level. Defaults to tab (`\t`). #### `_indent_braces` Parameter - **_indent_braces** (bool) - Optional - If enabled, indents the braces to match the block contents instead of the name. Defaults to `True`. #### `_start_indent` Parameter - **_start_indent** (str) - Optional - The initial starting indentation. Useful for serializing inside an existing file or adding a prefix. ### Request Example ```python # Example writing to a file with open('output.txt', 'w') as write_file: kv.serialise(write_file) # Example getting data as a string kv_string = kv.serialise() ``` ### Response #### Success Response (200) - **None** - If writing to a file. - **str** - If returning as a string. #### Response Example ``` { "Key": "Value" } ``` ``` -------------------------------- ### srctools.fgd.Helper method overrides() Source: https://srctools.readthedocs.io/en/stable/genindex Description of the overrides() method for srctools.fgd. -------------------------------- ### srctools.vpk Module Documentation Source: https://srctools.readthedocs.io/en/stable/genindex Documentation for classes and functions related to Valve Pack Files (.vpk) in the srctools library. ```APIDOC ## srctools.vpk Module ### Classes - **FileInfo** - **VPK** ### Attributes - **ext** (FileInfo) - **EXTRA_FLAGS** (ResourceID) ### Methods - **VPK.extract_all()**: Extracts all files from a VPK. ``` -------------------------------- ### Get Root Bone Source: https://srctools.readthedocs.io/en/stable/modules/smd Retrieves the root bone from the mesh's bone hierarchy. This is the primary bone from which all other bones originate. ```python root_bone() -> Bone: """ Return the root of our bone hierachy. """ pass ``` -------------------------------- ### SoundChars Enum Source: https://srctools.readthedocs.io/en/stable/modules/sndscript Flags to represent sound characters which can be added to the start of sound filenames. These flags can be combined to represent different sound properties. ```APIDOC ## SoundChars Enum ### Description Flags to represent sound characters which can be added to the start of sound filenames. Despite comments in the SDK, more than 2 are permitted simultaneously. To re-assemble into a set of characters, call `str`. ### Flags - **none** (0x0): A filename with no characters included. - **stream** (0x1) - **user_vox** (0x2): Marks player voice chat data, shouldn't ever be used. - **sentence** (0x4): Dialog from the NPC sentence system. - **dry_mix** (0x8): DSP FX is bypassed for this sound. - **doppler** (0x10): Doppler encoded stereo wav: left wav (incoming) and right wav (outgoing). - **directional** (0x20): Stereo wav has direction cone: mix left wav (front facing) with right wav (rear facing) based on sound facing direction. - **dist_variant** (0x40): Distance variant encoded stereo wav (left is close, right is far). - **omni** (0x80): Non-directional - sound appears to play from everywhere, but still has distance volume falloff. - **spatial_stereo** (0x100): Spatialised stereo wav. - **dir_stereo** (0x200): Directional stereo wav (like doppler). - **fast_pitch** (0x400): Forces low quality, non-interpolated pitch shift. - **subtitled** (0x800): Indicates subtitles were forced on. - **hrtf_force** (0x1000): CSGO+ only. Enables HRTF for all players including the owner. - **hrtf** (0x2000): CSGO+ only. Enables HRTF for non-owners. - **hrtf_blend** (0x4000): CSGO+ only. Enables HRTF for non-owner players, fading to stereo instead if close. - **radio** (0x8000): CSGO+ only. Used for ‘radio’ sounds tha are played without spatialisation. - **music** (0x10000): CSGO+ only. Used for main menu music. ### Class Methods #### `from_fname(_filename : str_) -> tuple[SoundChars, str]` Parse sound characters out of a filename, then return both. ``` -------------------------------- ### srctools.vpk.VPK Method Source: https://srctools.readthedocs.io/en/stable/genindex Details the `new_file()` method for the VPK class in the vpk module. ```APIDOC ## srctools.vpk.VPK Method ### Description This section details the `new_file()` method for the `srctools.vpk.VPK` class. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) - **new_file()** (srctools.vpk.VPK method) - Description of the new_file() method. ``` -------------------------------- ### HelperExtAutoVisgroups for autovis() in Python Source: https://srctools.readthedocs.io/en/stable/modules/fgd Convenience helper for parsing and adding @AutoVisgroups to entities. It implies 'Auto' at the start and manages the path for these visgroups. ```python class _srctools.fgd.HelperExtAutoVisgroups(_path : list[str] = ..._, _* , _tags : frozenset[str] = frozenset({})): """Convenience for parsing, adds @AutoVisgroups to entities. ‘Auto’ is implied at the start.""" path_: list[str] IS_EXTENSION_: ClassVar[bool]__ = True TYPE_: ClassVar[HelperTypes | None]__ = 'autovis' def export() -> list[str]: """Produce the arguments for autovis().""" ... ``` -------------------------------- ### VPK Constants and Utilities Source: https://srctools.readthedocs.io/en/stable/modules/vpk Useful constants and utility functions for working with VPK files. ```APIDOC ## VPK_SIG ### Description Constant representing the signature bytes at the beginning of a VPK file. ### Method `srctools.vpk.VPK_SIG` ### Endpoint N/A (Constant) ### Parameters None ### Request Example ```python from srctools.vpk import VPK_SIG print(VPK_SIG) ``` ### Response #### Success Response (200) - **int** (int) - The VPK signature value. #### Response Example ```json { "signature": 1437209140 } ``` --- ## DIR_ARCH_INDEX ### Description Constant representing the archive index used for data stored in the VPK's directory file. ### Method `srctools.vpk.DIR_ARCH_INDEX` ### Endpoint N/A (Constant) ### Parameters None ### Request Example ```python from srctools.vpk import DIR_ARCH_INDEX print(DIR_ARCH_INDEX) ``` ### Response #### Success Response (200) - **int** (int) - The directory archive index value. #### Response Example ```json { "index": 32767 } ``` --- ## VPK.get_arch_filename ### Description Generate the filename for a VPK archive file based on a prefix and an optional index. ### Method `VPK.get_arch_filename` ### Endpoint N/A (Object method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_prefix** (str) - Optional - The base name for the archive file (e.g., 'pak01'). Defaults to 'pak01'. - **_index** (int | None) - Optional - The index of the data file. `None` indicates the directory file. Defaults to `None`. ### Request Example ```python # Assuming 'vpk' is an instance of VPK dir_file = vpk.get_arch_filename() data_file = vpk.get_arch_filename(index=1) ``` ### Response #### Success Response (200) - **str** (str) - The generated VPK archive filename. #### Response Example ```json { "filename": "pak01_dir.vpk" } ``` ``` -------------------------------- ### Custom FileSystem Implementation Methods Source: https://srctools.readthedocs.io/en/stable/modules/filesys Implementing custom filesystems involves subclassing the abstract FileSystem class and overriding specific methods. Key methods to override include `_file_exists`, `_get_file`, and `_get_cache_key` for core file operations and caching. ```python @abstractmethod def _file_exists(_name: str) -> bool: """Check if a file exists. The default implementation checks for FileNotFoundError.""" @abstractmethod def _get_file(_name: str) -> File[Self]: """Return a specific file.""" @abstractmethod def _get_cache_key(_file: File[Self]) -> int: """Return a checksum or last-modified date suitable for caching. This allows preventing reparsing the file. If not possible, return CACHE_KEY_INVALID (-1). """ ``` -------------------------------- ### Get Individual Matrix Element (Python) Source: https://srctools.readthedocs.io/en/stable/modules/math Retrieves a specific element from the matrix using its (x, y) coordinates, where x and y range from 0 to 2. This allows for direct access to matrix components. ```python MatrixBase.__getitem__(item: tuple[int, int]) -> float ``` -------------------------------- ### srctools.instancing.Manifest.parse() Source: https://srctools.readthedocs.io/en/stable/genindex Class method to parse an instancing manifest. ```APIDOC ## parse() ### Description Class method `parse()` on `srctools.instancing.Manifest`. This method parses data representing an instancing manifest, likely from a file or string, into a `Manifest` object. This manifest would typically define relationships and properties of instanced assets. ### Method `Manifest.parse` ### Endpoint N/A ### Parameters Parameters would typically include the source data (e.g., file path or string) for the manifest. ### Request Example N/A ### Response #### Success Response (N/A) Returns a `Manifest` object. #### Response Example N/A ``` -------------------------------- ### Get Up Vector from Matrix (Python) Source: https://srctools.readthedocs.io/en/stable/modules/math Returns a vector with a specified magnitude pointing along the positive Z axis (up) of the matrix's orientation. This represents the 'upward' direction in the rotated space. ```python MatrixBase.up(mag: float = 1.0) -> Vec ``` -------------------------------- ### Get Left Vector from Matrix (Python) Source: https://srctools.readthedocs.io/en/stable/modules/math Returns a vector with a specified magnitude pointing along the positive Y axis (left) of the matrix's orientation. This indicates the direction to the 'left' according to the rotation. ```python MatrixBase.left(mag: float = 1.0) -> Vec ``` -------------------------------- ### Read and Write Keyvalues Files in Python Source: https://srctools.readthedocs.io/en/stable/modules/keyvalues Demonstrates basic usage of `Keyvalues.parse()` to read a file and `Keyvalues.serialise()` to write its contents. Assumes `Keyvalues` class is imported and available. It reads from 'filename.txt' and writes to 'filename_2.txt'. ```python from srctools.keyvalues import Keyvalues with open('filename.txt', 'r') as read_file: kv = Keyvalues.parse(read_file, 'filename.txt') with open('filename_2.txt', 'w') as write_file: kv.serialise(write_file) ``` -------------------------------- ### Get Forward Vector from Matrix (Python) Source: https://srctools.readthedocs.io/en/stable/modules/math Returns a vector with a specified magnitude pointing along the positive X axis of the matrix's orientation. This represents the 'forward' direction defined by the rotation. ```python MatrixBase.forward(mag: float = 1.0) -> Vec ``` -------------------------------- ### srctools.filesys.FileSystem method open_str() Source: https://srctools.readthedocs.io/en/stable/genindex Description of the open_str() method for srctools.filesys.FileSystem. ```APIDOC ## Method in srctools.filesys.FileSystem ### Description This section details the `open_str()` method for the `srctools.filesys.FileSystem` class. ### Method `open_str()` ### Parameters None ### Returns (type) - Description ``` -------------------------------- ### Initialize srctools.mdl.Model from File Source: https://srctools.readthedocs.io/en/stable/modules/mdl Constructs a Model object by parsing data from a given file. It requires a filesystem object and a file object representing the MDL file. This process reads metadata but not detailed animation or geometry. ```python model = srctools.mdl.Model(_filesystem, _file) ``` -------------------------------- ### Get Known Keyvalue Options Source: https://srctools.readthedocs.io/en/stable/modules/fgd Iterates over all possible values for a keyvalue, determined by its default value and value list. This method helps in understanding the valid inputs for a specific keyvalue. ```python _for ... in _known_options() → Iterator[str] ``` -------------------------------- ### srctools.bsp.BSP.packfile() Source: https://srctools.readthedocs.io/en/stable/genindex Method to pack a file within the context of a BSP (Binary Space Partitioning) file object. ```APIDOC ## packfile() ### Description Method of the `srctools.bsp.BSP` class used to pack a file. This suggests functionality for embedding or managing external files associated with a BSP structure. ### Method `packfile` ### Endpoint N/A ### Parameters Parameters would likely include the file to be packed and potentially destination information within the BSP context. ### Request Example N/A ### Response #### Success Response (N/A) Indicates the success of the packing operation. #### Response Example N/A ``` -------------------------------- ### Get All Known Entity Classnames Source: https://srctools.readthedocs.io/en/stable/modules/fgd Returns a set of all known entity classnames available in the Hammer Addons database. This method provides a comprehensive list of entities that can be used or referenced. ```python _classmethod _engine_classes() → Set[str] ``` -------------------------------- ### srctools.instancing.InstanceFile.params Source: https://srctools.readthedocs.io/en/stable/genindex Attribute storing parameters for an instance file. ```APIDOC ## params ### Description Attribute within `srctools.instancing.InstanceFile` that stores the parameters associated with this instance. These parameters are used to configure the behavior or appearance of the instanced object. ### Method N/A (Attribute) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (N/A) Returns the parameters of the instance. #### Response Example N/A ``` -------------------------------- ### Create Empty Mesh Source: https://srctools.readthedocs.io/en/stable/modules/smd Creates an empty Mesh object with a single root bone. This is useful for programmatically constructing new SMD files or as a starting point for appending data. ```python _staticmethod _blank(_root_name: str) -> Mesh: """Create an empty mesh, with a single root bone. """ pass ``` -------------------------------- ### Srctools Library - 'B' Elements Source: https://srctools.readthedocs.io/en/stable/genindex This section provides a detailed list of components in the srctools library that start with the letter 'B'. Each entry includes its module and type (e.g., property, attribute, class, method). ```APIDOC ## Srctools Library - 'B' Elements ### Description This section lists various classes, attributes, properties, and methods within the srctools library whose names begin with the letter 'B'. This is a reference for understanding the structure and available components. ### Parameters This section does not define API endpoints with parameters, but rather lists library components. ### Code Examples #### b (srctools.bsp.Edge property) - **Type**: Property - **Module**: srctools.bsp #### b (srctools.bsp.RevEdge property) - **Type**: Property - **Module**: srctools.bsp #### b (srctools.dmx.Color attribute) - **Type**: Attribute - **Module**: srctools.dmx #### b (srctools.fgd.HelperLine attribute) - **Type**: Attribute - **Module**: srctools.fgd #### b (srctools.fgd.HelperRenderColor attribute) - **Type**: Attribute - **Module**: srctools.fgd #### b (srctools.fgd.HelperSphere attribute) - **Type**: Attribute - **Module**: srctools.fgd #### b (srctools.vtf.Pixel attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BACK (srctools.vtf.CubeSide attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BACKGROUND (srctools.sndscript.Channel attribute) - **Type**: Attribute - **Module**: srctools.sndscript #### BARE_DISALLOWED (in module srctools.tokenizer) - **Type**: Constant - **Module**: srctools.tokenizer #### BASE (srctools.fgd.EntityTypes attribute) - **Type**: Attribute - **Module**: srctools.fgd #### BASE_SOURCE_ENGINE_2 (srctools.const.GameID attribute) - **Type**: Attribute - **Module**: srctools.const #### bases (srctools.fgd.EntityDef attribute) - **Type**: Attribute - **Module**: srctools.fgd #### BaseTokenizer (class in srctools.tokenizer) - **Type**: Class - **Module**: srctools.tokenizer #### BBOX (srctools.fgd.HelperTypes attribute) - **Type**: Attribute - **Module**: srctools.fgd #### bbox() (srctools.math.VecBase class method) - **Type**: Class Method - **Module**: srctools.math.VecBase #### bbox_intersect() (srctools.math.VecBase static method) - **Type**: Static Method - **Module**: srctools.math.VecBase #### bbox_max (srctools.fgd.HelperBBox attribute) - **Type**: Attribute - **Module**: srctools.fgd #### bbox_max (srctools.fgd.HelperSize attribute) - **Type**: Attribute - **Module**: srctools.fgd #### bbox_max (srctools.mdl.Sequence attribute) - **Type**: Attribute - **Module**: srctools.mdl #### bbox_min (srctools.fgd.HelperBBox attribute) - **Type**: Attribute - **Module**: srctools.fgd #### bbox_min (srctools.fgd.HelperSize attribute) - **Type**: Attribute - **Module**: srctools.fgd #### bbox_min (srctools.mdl.Sequence attribute) - **Type**: Attribute - **Module**: srctools.mdl #### BGR565 (srctools.vtf.ImageFormats attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BGR888 (srctools.vtf.ImageFormats attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BGR888_BLUESCREEN (srctools.vtf.ImageFormats attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BGRA4444 (srctools.vtf.ImageFormats attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BGRA5551 (srctools.vtf.ImageFormats attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BGRA8888 (srctools.vtf.ImageFormats attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BGRX5551 (srctools.vtf.ImageFormats attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BGRX8888 (srctools.vtf.ImageFormats attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BILINEAR (srctools.vtf.FilterMode attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BIN_FMT (srctools.choreo.Curve attribute) - **Type**: Attribute - **Module**: srctools.choreo #### bin_folder() (srctools.game.Game method) - **Type**: Method - **Module**: srctools.game.Game #### bin_value() (srctools.vtf.ImageFormats method) - **Type**: Method - **Module**: srctools.vtf.ImageFormats #### BINARY (srctools.dmx.ValueType attribute) - **Type**: Attribute - **Module**: srctools.dmx #### binary() (srctools.dmx.Attribute class method) - **Type**: Class Method - **Module**: srctools.dmx.Attribute #### blank() (srctools.smd.Mesh static method) - **Type**: Static Method - **Module**: srctools.smd.Mesh #### block() (srctools.tokenizer.BaseTokenizer method) - **Type**: Method - **Module**: srctools.tokenizer.BaseTokenizer #### blocks (srctools.vmt.Material attribute) - **Type**: Attribute - **Module**: srctools.vmt #### BLOODY_GOOD_TIME (srctools.const.GameID attribute) - **Type**: Attribute - **Module**: srctools.const #### BLOODYFLESH (srctools.surfaceprop.SurfChar attribute) - **Type**: Attribute - **Module**: srctools.surfaceprop #### BModel (class in srctools.bsp) - **Type**: Class - **Module**: srctools.bsp #### bmodels (srctools.bsp.BSP attribute) - **Type**: Attribute - **Module**: srctools.bsp #### BODY (srctools.sndscript.Channel attribute) - **Type**: Attribute - **Module**: srctools.sndscript #### Bone (class in srctools.smd) - **Type**: Class - **Module**: srctools.smd #### bone (srctools.smd.BoneFrame attribute) - **Type**: Attribute - **Module**: srctools.smd.BoneFrame #### BoneFrame (class in srctools.smd) - **Type**: Class - **Module**: srctools.smd #### bones (srctools.smd.Mesh attribute) - **Type**: Attribute - **Module**: srctools.smd #### BOOL (srctools.dmx.ValueType attribute) - **Type**: Attribute - **Module**: srctools.dmx #### BOOL (srctools.fgd.ValueTypes attribute) - **Type**: Attribute - **Module**: srctools.fgd #### BOOL (srctools.vmt.VarType attribute) - **Type**: Attribute - **Module**: srctools.vmt #### bool() (srctools.dmx.Attribute class method) - **Type**: Class Method - **Module**: srctools.dmx.Attribute #### bool() (srctools.keyvalues.Keyvalues method) - **Type**: Method - **Module**: srctools.keyvalues.Keyvalues #### bool() (srctools.vmf.EntityFixup method) - **Type**: Method - **Module**: srctools.vmf.EntityFixup #### bool_as_int() (in module srctools) - **Type**: Function - **Module**: srctools #### BOOL_LOOKUP (in module srctools) - **Type**: Constant - **Module**: srctools #### BORDER (srctools.vtf.VTFFlags attribute) - **Type**: Attribute - **Module**: srctools.vtf #### bottom (srctools.vmf.PrismFace attribute) - **Type**: Attribute - **Module**: srctools.vmf #### bottom (srctools.vtf.TexCoord attribute) - **Type**: Attribute - **Module**: srctools.vtf #### BOUNCED_LIGHTING (srctools.bsp.StaticPropFlags attribute) - **Type**: Attribute - **Module**: srctools.bsp #### BOUNDING_BOX_HELPER (srctools.fgd.HelperTypes attribute) - **Type**: Attribute - **Module**: srctools.fgd #### BRACE_CLOSE (srctools.tokenizer.Token attribute) - **Type**: Attribute - **Module**: srctools.tokenizer #### BRACE_OPEN (srctools.tokenizer.Token attribute) - **Type**: Attribute - **Module**: srctools.tokenizer #### BRACK_CLOSE (srctools.tokenizer.Token attribute) - **Type**: Attribute - **Module**: srctools.tokenizer #### BRACK_OPEN (srctools.tokenizer.Token attribute) - **Type**: Attribute - **Module**: srctools.tokenizer #### BREAKABLE_CHUNK (srctools.const.FileType attribute) - **Type**: Attribute - **Module**: srctools.const #### BRICK (srctools.surfaceprop.SurfChar attribute) - **Type**: Attribute - **Module**: srctools.surfaceprop #### Brush (class in srctools.bsp) - **Type**: Class - **Module**: srctools.bsp #### BRUSH (srctools.fgd.EntityTypes attribute) - **Type**: Attribute - **Module**: srctools.fgd #### brush_ids (srctools.instancing.Instance attribute) - **Type**: Attribute - **Module**: srctools.instancing #### BRUSH_SIDES (srctools.fgd.HelperTypes attribute) - **Type**: Attribute - **Module**: srctools.fgd #### BrushContents (in module srctools.bsp) - **Type**: Class - **Module**: srctools.bsp #### brushes (srctools.bsp.BSP attribute) - **Type**: Attribute - **Module**: srctools.bsp #### BRUSHES (srctools.bsp.BSP_LUMPS attribute) - **Type**: Attribute - **Module**: srctools.bsp #### brushes (srctools.bsp.VisLeaf attribute) - **Type**: Attribute - **Module**: srctools.bsp #### brushes (srctools.vmf.VMF attribute) - **Type**: Attribute - **Module**: srctools.vmf #### BrushSide (class in srctools.bsp) - **Type**: Class - **Module**: srctools.bsp #### BRUSHSIDES (srctools.bsp.BSP_LUMPS attribute) - **Type**: Attribute - **Module**: srctools.bsp #### BSP (class in srctools.bsp) - **Type**: Class - **Module**: srctools.bsp #### BSP_LINE (srctools.choreo.Interpolation attribute) - **Type**: Attribute - **Module**: srctools.choreo #### BSP_LUMPS (class in srctools.bsp) - **Type**: Class - **Module**: srctools.bsp #### BSPContents (class in srctools.const) - **Type**: Class - **Module**: srctools.const #### build() (srctools.keyvalues.Keyvalues method) - **Type**: Method - **Module**: srctools.keyvalues.Keyvalues #### build_bbox() (srctools.smd.Mesh class method) - **Type**: Class Method - **Module**: srctools.smd.Mesh #### build_face() (srctools.geometry.Polygon method) - **Type**: Method - **Module**: srctools.geometry.Polygon #### build_resource() (srctools.vtf.HotspotRect class method) - **Type**: Class Method - **Module**: srctools.vtf.HotspotRect #### BUILDABLE (srctools.vmf.TriangleTag attribute) - **Type**: Attribute - **Module**: srctools.vmf #### BUMPLIGHT (srctools.const.SurfFlags attribute) - **Type**: Attribute - **Module**: srctools.const #### bumpmap_scale (srctools.vtf.VTF attribute) - **Type**: Attribute - **Module**: srctools.vtf #### by_class (srctools.vmf.VMF attribute) - **Type**: Attribute - **Module**: srctools.vmf #### bytes_encoding (srctools.filesys.VirtualFileSystem attribute) - **Type**: Attribute - **Module**: srctools.filesys.VirtualFileSystem ``` -------------------------------- ### HelperOverlayTransition for env_overlay_transition Source: https://srctools.readthedocs.io/en/stable/modules/fgd Specialized helper for env_overlay_transition. It manages tags associated with overlay transitions. ```python class _srctools.fgd.HelperOverlayTransition(_* , _tags : frozenset[str] = frozenset({})): """Specialized helper for env_overlay_transition.""" tags_: frozenset[str] TYPE_: ClassVar[HelperTypes | None]__ = 'overlay_transition' ``` -------------------------------- ### srctools.filesys.FileSystem Methods Source: https://srctools.readthedocs.io/en/stable/genindex This section details the methods available for the FileSystem class in srctools.filesys. ```APIDOC ## srctools.filesys.FileSystem Methods ### Description Provides documentation for various methods within the FileSystem class. ### Methods - __contains__() - __enter__() - __eq__() - __exit__() - __getitem__() - __init__() - __iter__() ### Parameters (No specific parameters documented for these general methods in the provided text.) ### Request Example (Not applicable for method documentation) ### Response (Not applicable for method documentation) ``` -------------------------------- ### HelperSweptPlayerHull for swept player bounding box in Python Source: https://srctools.readthedocs.io/en/stable/modules/fgd Draws the movement of a player-sized bounding box from a start point to an end point. This helper is used for defining swept volumes for player movement. ```python class _srctools.fgd.HelperSweptPlayerHull(_* , _tags : frozenset[str] = frozenset({})): """Draws the movement of a player-sized bounding box from A to B.""" tags_: frozenset[str] TYPE_: ClassVar[HelperTypes | None]__ = 'sweptplayerhull' ```