Metadata-Version: 2.1
Name: valvefgd
Version: 1.0.5
Summary: A library to parse .FGD files (editor schema definition files for the Source engine).
Home-page: https://pysourcesdk.github.io/ValveFGD/
Author: Maxime Dupuis
Author-email: mdupuis@hotmail.ca
License: gpl-3.0
Project-URL: Documentation, https://pysourcesdk.github.io/ValveFGD/
Project-URL: Github, https://github.com/pySourceSDK/ValveFGD
Keywords: fgd,source,sourcesdk,hammer,valve
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: pyparsing
Requires-Dist: future

[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/pySourceSDK/ValveFGD/blob/master/LICENSE.txt)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/valvefgd.svg)](https://pypi.python.org/pypi/valvefgd/)
[![Platforms](https://img.shields.io/badge/platform-Linux,_MacOS,_Windows-blue)]()
[![PyPI version fury.io](https://badge.fury.io/py/valvefgd.svg)](https://pypi.python.org/pypi/valvefgd/)
[![GitHub Workflow Status (with event)](https://github.com/pySourceSDK/ValveFGD/actions/workflows/CI.yml/badge.svg)]()
[![Test coverage](https://github.com/pySourceSDK/ValveFGD/blob/master/docs/source/coverage.svg "coverage")]()
# ValveFGD

ValveFGD is a Python library designed to parse and edit .FGD files, which provides logic entity schemas for Valve's level editor as well as some configuration information.

Full documentation: https://pysourcesdk.github.io/ValveFGD/

## Installation

### PyPI

ValveFGD is available on the Python Package Index. This makes installing it with pip as easy as:

```bash
pip3 install valvefgd
```

### Git

If you want the latest code or even feel like contributing, the code is available on GitHub.

You can easily clone the code with git:

```bash
git clone git@github.com:pySourceSDK/ValveFGD.git
```

and install it with:

```bash
python3 setup.py install
```

## Usage

Here's a few example usage of ValveFGD

### Parsing

You can get a Fgd object by parsing an .fgd file using FgdParse

```python
>>> from valvefgd import FgdParse
>>> fgd = FgdParse('C:/Program Files (x86)/Steam/steamapps/common/Team Fortress 2/bin/tf.fgd')
```

### Writing

You can write an .fgd file from a Fgd object.


> Parsing/writing is destructive. Comments will be lost. The original structure of the file may be altered. The actual data about entities and the inheritance hierarchy is untouched however.

```python
>>> from valvefgd import FgdWrite
>>> FgdWrite(fgd, 'tf-clone.fgd')
```

### Getting entity schemas

You can get entity schematics from an Fgd object.

```python
>>> env_fire = fgd.entity_by_name('env_fire')
>>> print(env_fire.schema)
{'properties': {'targetname': {'type': 'string', 'description': 'The name...'}, ...},
'inputs': {'StartFire': {'type': 'void', 'description': 'Start the fire'}, ...},
'outputs': {'onIgnited': {'type': 'void', 'description':'Fires when...'}, ...}}
```

## Terminology

Here are some color coded charts for the terminology used in this library for fgd files.

### FgdEntity
![alt text](https://github.com/pySourceSDK/ValveFGD/raw/master/docs/source/_static/fgdentity.jpg "FgdEntity terminology")

### FgdEntityInput/Output
![alt text](https://github.com/pySourceSDK/ValveFGD/raw/master/docs/source/_static/fgdentityio.jpg "FgdEntityInput/Output terminology")

### FgdEntityProperty
![alt text](https://github.com/pySourceSDK/ValveFGD/raw/master/docs/source/_static/fgdentityproperty.jpg "FgdEntityProperty terminology")

### FgdEntityPropertyOption
![alt text](https://github.com/pySourceSDK/ValveFGD/raw/master/docs/source/_static/fgdentitypropertyoption.jpg "FgdEntityPropertyOption terminology")

### FgdEntitySpawnflag
![alt text](https://github.com/pySourceSDK/ValveFGD/raw/master/docs/source/_static/fgdentityspawnflags.jpg "FgdEntitySpawnflag terminology")

