Skip to main content

A library to parse .FGD files (editor schema definition files for the Source engine).

Project description

GPLv3 license PyPI pyversions Platforms PyPI version fury.io GitHub Workflow Status (with event) Test 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:

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:

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

and install it with:

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

>>> 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.

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

Getting entity schemas

You can get entity schematics from an Fgd object.

>>> 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

FgdEntityInput/Output

alt text

FgdEntityProperty

alt text

FgdEntityPropertyOption

alt text

FgdEntitySpawnflag

alt text

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

valvefgd-1.0.5.tar.gz (24.0 kB view hashes)

Uploaded Source

Built Distribution

valvefgd-1.0.5-py3-none-any.whl (23.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page