Discover Learn Reference Get OpenPLXSearch Contact

Bundle

OpenPLX implements a feature to package multiple .openplx files into a bundle. 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.

This tutorial page introduces the core bundle ideas before the more hands-on bundle pages below.

Creating a bundle

Creating a bundle starts with 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 share scope and can access models and attributes from each other.

Namespaces

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

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

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

RootModel is MyNamespace.SomeModel:
    attribute is MyNamespace.SomeType

Further nesting is possible by adding more directories, which creates deeper subnamespaces.

Dependencies

If your bundle uses other bundles you need to add a dependencies attribute to the BundleConfig:

config is BundleConfig:
    name: "MyBundle"
    dependencies: ["MyOtherBundle", "Physics3D", "Math"]

Versioning

The BundleConfig also supports a version attribute, and dependencies can specify explicit versions:

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