API

Viewer Migration (V1 -> V2)

While the Babylon team strives to maintain API backward compatibility, unfortunately it was not possible to preserve backward compatibility and adopt modern technology for the V2 Babylon Viewer. One of the primary challenges is that V1 used Handlebars, which allows attributes and elements to be used interchangeably. For example, all of the following are equivalent in Handlebars:

<babylon camera.behaviors.auto-rotate="0" />
<babylon>
<camera behaviors.auto-rotate="0" />
</babylon>
<babylon>
<camera>
<behaviors auto-rotate="0" />
</camera>
</babylon>

Handlebars was an open-source technology that predated Web Components, the web standard that covers custom elements. As part of both modernizing the Babylon Viewer and shrinking bundle sizes, we wanted to move to web standards that are already supported by the browser. However, Web Components custom elements require attributes to be statically declared, so the Handlebars attribute/element model cannot practically be retained.

This means some manual steps are required to migrate from Babylon Viewer V1 to V2. We don't currently have a migration guide or tooling, but if you run into problems migrating, please reach out on the Babylon forum.