DiscoverLearnDocumentationGet OpenPLXSearch Contact

Bundles overview

OpenPLX implements a feature to package multiple .openplx files into a bundle. This is how we distribute OpenPLX physics. When building models that you want to distribute over multiple .openplx files it is also necessary to organize them in a local bundle. Local bundles can depend on other local bundles allowing reuse over multiple OpenPLX projects.

Creating a bundle

Creating a bundle is as easy as creating a config.openplx file in the root of your project:

config is BundleConfig:
    name: "MyBundle"

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

Namespaces

Once you have a config.openplx in the root of you project you can put .openplx files nested in subdirectories. Each subdirectory implicitly creates a OpenPLX namespace with the same name as the folder.

my_project/
  - MyNamespace/
    - stuff.openplx
  - config.openplx
  - scene.openplx

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

RootModel is MyNamespace.SomeModel:
    # ...
    attribute is MyNamespace.SomeType

Further nesting is possible by adding directories and thereby creating subnamespaces.

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: "MyBundle"
    dependencies: ["MyOtherBundle", "Physics3D", "Math"]

Versioning

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

config is BundleConfig:
    name: "MyBundle"
    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