DiscoverLearnDocumentationGet OpenPLXSearch Contact

Creating Custom Bundles

To create a bundle we create a config.openplx file in the root of your project:

config is BundleConfig:
    name: "MyVehicleBundle"

With this file present all .openplx files in that folder will share scope and can access models and attributes from each other.

Lets say we have a directory structure as following:

MyVehicleBundle/

  • Cars/
    • Volvo.openplx
  • config.openplx
  • scene.openplx

Using our new model in our custom bundle

Everything in Volvo.openplx is now accessible in every .openplx file in the bundle using the namespace MyVehicleBundle. This could look something like this in scene.openplx:

Volvo is Cars.Volvo:
    attribute is Cars.SomeType

Just as with the official bundles further nesting can be done by adding more subdirectories therefore creating subnamespaces.

Example:

  • MyVehicleBundle/
    • Cars/
      • MuscleCars/
        • Volvo.openplx
    • config.openplx
    • scene.openplx

Which can be accessed as following:

Volvo is Cars.MuscleCars.Volvo:
    attribute is Cars.SomeType

Dependencies

If your bundle uses other bundles you will need to add a dependencies attribute to the BundleConfig in config.openplx:

config is BundleConfig:
    name: "MyVehicleBundle"
    dependencies: ["MyOtherBundle@0.1.2", "Physics3D@1.0.0", "Math@1.0.0"]

Versioning

The BundleConfig supports a version attribute as well as specifying explicit versions on dependencies:

config is BundleConfig:
    name: "MyVehicleBundle"
    version: "1.0.0"
    dependencies: ["MyOtherBundle@0.1.2", "Physics3D@1.0.0", "Math@1.0.0"]

Adding a version is good practice since it tells users which openplx version your bundle is compatible with. Trying to load your bundle with the wrong openplx version will generate an error.

OpenPLX is a work in progress. This draft version will evolve with user feedback and experience. We welcome your input and collaboration.
X