Shared config, CLI, .parkobj, and object.json scaffolding for OpenRCT2 object generators.
Project description
OpenRCT2 Object Common
Shared scaffolding for the OpenRCT2 object generators. This package sits between
the renderer and the generators, so the vehicle and scenery tools share one
config layer, one CLI flow, and one .parkobj packaging path instead of each
re-implementing them.
openrct2-x7-renderer the Embree-backed iso renderer (meshes -> sprites)
▲
OpenRCT2-ObjectCommon config, CLI, placement, object.json, .parkobj ← you are here
▲
┌────┴─────┐
Vehicle Scenery the generators (+ their Blender add-ons)
Rendering is handled by the external
openrct2-x7-renderer package
(an Embree-backed ray tracer shipping prebuilt, vendored wheels), so this repo is
pure Python, with no compiler or Embree needed.
Part of the OpenRCT2-Tools family — the renderer, VehicleGenerator, and SceneryGenerator all build on this package.
Requirements
- Python ≥ 3.11
- uv (recommended);
uv syncpulls everything, including the renderer wheel from PyPI.
Develop
uv sync
uv run pytest # coverage is enabled by default via pyproject.toml
uv run ruff check .
uv run mypy
What's here
| Module | What it provides |
|---|---|
config |
parse_config (JSON/YAML) and the require_* / optional_* validation helpers; load_meshes / load_preview |
cli |
run_cli (parse args → read config → resolve lights → render), make_context, parse_cli_args, output_directory_of |
objectjson |
object_json_header — the id / originalId / version / authors / objectType block every object shares |
placement |
add_model_to_scene and orientation_to_matrix — turn a Model into render-scene geometry |
parkobj |
assemble_parkobj (render-or-reuse → write object.json → zip) and write_images_dat_lgx |
blender.lights |
lights_from_items / default_lights — build the renderer's light rig from add-on UI items |
blender.modal |
RenderModalBase — the off-main-thread modal render operator the add-ons subclass |
Usage
CLI scaffolding
A generator's __main__ wires its loader/exporter into the shared flow:
from openrct2_object_common.cli import make_context, output_directory_of, run_cli
def _render(args, root, lights):
obj = build_object(root) # generator-specific
context = make_context(lights, obj.units_per_tile, args.test)
export(obj, context, output_directory_of(root), skip_render=args.skip_render)
def main(argv=None):
return run_cli("openrct2-my-generator", argv, _render)
Packaging a .parkobj
from openrct2_object_common.objectjson import object_json_header
from openrct2_object_common.parkobj import assemble_parkobj, write_images_dat_lgx
def export_to(obj, context, parkobj_path, work_dir, skip_render=False):
obj_json = object_json_header(obj.id, object_type="scenery_small", authors=obj.authors)
obj_json["properties"] = build_properties(obj)
assemble_parkobj(
obj_json, parkobj_path, work_dir,
lambda wd: write_images_dat_lgx(render_sprites(obj, context), wd),
skip_render=skip_render,
)
Blender helpers
The blender subpackage imports bpy (only blender.modal — blender.lights
does not), so install the extra when working with it outside Blender:
pip install "OpenRCT2-ObjectCommon[blender]"
License
GPL-3.0-or-later.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openrct2_objectcommon-0.1.0.tar.gz.
File metadata
- Download URL: openrct2_objectcommon-0.1.0.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77a80f56c30d1a088da2367bd0929779661e87dbd48bd332a917f24ba3c5d1a0
|
|
| MD5 |
b94c8a619c00b9d2347b490e129f675b
|
|
| BLAKE2b-256 |
0aa2310088fb8f75afe0b73fa91decbae841b2de864c47d523b9859420615835
|
Provenance
The following attestation bundles were made for openrct2_objectcommon-0.1.0.tar.gz:
Publisher:
publish.yml on alex-parisi/OpenRCT2-ObjectCommon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openrct2_objectcommon-0.1.0.tar.gz -
Subject digest:
77a80f56c30d1a088da2367bd0929779661e87dbd48bd332a917f24ba3c5d1a0 - Sigstore transparency entry: 1729382443
- Sigstore integration time:
-
Permalink:
alex-parisi/OpenRCT2-ObjectCommon@0c60b5b14005ab4902c3fb65971132cbccefc850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alex-parisi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c60b5b14005ab4902c3fb65971132cbccefc850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file openrct2_objectcommon-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openrct2_objectcommon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b420880ae96ff9301954046b8ab28794f54c1ebb2e2def98fb12e04fbefbf36d
|
|
| MD5 |
47907f259a782e823fef0dc1285d6d18
|
|
| BLAKE2b-256 |
c46a95e72cfe49a8fc1d5bda4d9319c0347689e682c4a12a9b72dd2f07d407ad
|
Provenance
The following attestation bundles were made for openrct2_objectcommon-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on alex-parisi/OpenRCT2-ObjectCommon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openrct2_objectcommon-0.1.0-py3-none-any.whl -
Subject digest:
b420880ae96ff9301954046b8ab28794f54c1ebb2e2def98fb12e04fbefbf36d - Sigstore transparency entry: 1729382552
- Sigstore integration time:
-
Permalink:
alex-parisi/OpenRCT2-ObjectCommon@0c60b5b14005ab4902c3fb65971132cbccefc850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/alex-parisi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c60b5b14005ab4902c3fb65971132cbccefc850 -
Trigger Event:
push
-
Statement type: