Skip to main content

A toolkit for handling Geometry Dash level data.

Project description

PyPI Python License

GMD Toolkit

Python toolkit for modifying & creating Geometry Dash plist files, including gmd & gmdl (GDShare level & level list export) and the encoded dat format (GD savefiles).

[!CAUTION] There are no safety checks or warnings when modifying levels or save files. You should always keep backups or save copies of any file you edit. Avoid editing in-place where possible.

[!NOTE] Editing levels or save files does not ensure safe round-trip if nothing was changed. This library saves level objects slightly differently and discards unknown characters if they cannot be resolved.

Installation

Install the latest release from PyPI:

pip install gmdkit

Install the latest development version from GitHub:

pip install git+https://github.com/UHDanke/gmdkit.git

Clone and install in editable mode:

git clone https://github.com/UHDanke/gmdkit.git
cd gmdkit
pip install -e .

Basic Usage

Importing, modifying a level and saving it:

# import level
from gmdkit import Level

# import object
from gmdkit import Object

# import property mappings
from gmdkit.mappings import obj_prop

# import object functions
import gmdkit.functions.object as obj_func

# open file
level = Level.from_file("example.gmd")

# get inner level properties
start = level.start

# get level objects as an ObjectList()
# object lists subclass list() so they can use all list methods alongside the ones defined by ListClass
# level.objects WILL throw an error if the level lacks an object string,
# or if you passed load = False to Level.from_file(), which skips loading objects
# LevelSave by default does not load the objects of levels
# so for any level you want to edit the objects of you must call level.load() first
obj_list = level.objects

# filter by condition
after_origin = obj_list.where(lambda obj: obj.get(obj_prop.X, 0) > 0)

# apply functions, kwargs are filtered for each called function
# ex: obj_func.fix_lighter has 'replacement' as a key argument
after_origin.apply(obj_func.clean_duplicate_groups, obj_func.fix_lighter, replacement=0)

# create new object
new_obj = Object.default(1)
# set properties of object
# objects subclass dict() so they can use all dict methods alongside the ones defined by DictClass
new_obj.update(
  {
    obj_prop.X: 100,
    obj_prop.Y: 200,
    obj_prop.SCALE_X: 2,
    obj_prop.SCALE_Y: 2
  }
)

# append object to the level's object list
# can also be done directly to level.objects or level['k4'].objects (which level.objects references)
# lvl_prop.level.OBJECT_STRING also maps to 'k4'
obj_list.append(new_obj)
    
# export level
level.to_file("example.gmd")

Documentation (WIP)

You can find the work-in-progress documentation at:

https://UHDanke.github.io/gmdkit/

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

gmdkit-0.6.1.tar.gz (8.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gmdkit-0.6.1-py3-none-any.whl (172.1 kB view details)

Uploaded Python 3

File details

Details for the file gmdkit-0.6.1.tar.gz.

File metadata

  • Download URL: gmdkit-0.6.1.tar.gz
  • Upload date:
  • Size: 8.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gmdkit-0.6.1.tar.gz
Algorithm Hash digest
SHA256 70d50b380fd4cee61c081c87dd7812ce45087f715d2c864c2c5f567df33a6ed4
MD5 b639d8e17cd6a4102f91e58205c3ff79
BLAKE2b-256 902f033b304cdcd9bd2f77d1b7fdbe3744525e8364623bfed3c38e30d2a8ae6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmdkit-0.6.1.tar.gz:

Publisher: pypi.yml on UHDanke/gmdkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gmdkit-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: gmdkit-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 172.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gmdkit-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2e6c2373fc6e8a8782fa93caabc6547d4104c1332edfbbc783b2ff7afc018e0
MD5 5b048f51f4195ce0fd179255c6f3669d
BLAKE2b-256 c3ea3dc37433f43343c02f9c2e4e3d77d4a798e4830d989e5daa400de2bbe56d

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmdkit-0.6.1-py3-none-any.whl:

Publisher: pypi.yml on UHDanke/gmdkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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