v0.14 to v0.15
Migration guide for Elodin v0.14 to v0.15
Elodin v0.15.0 is a breaking change that introduces the schematic configuration. This document shows how to upgrade code using Elodin v0.14.*.
Broad Strokes
The specification of UI panels, e.g., viewports, graphs, etc., and the UI representation of objects has been changed from Python to a KDL format called "schematics". This permits changes in the editor to be saved and reloaded without manipulating the Python code. For this section, the 0.14.2 ball example will be converted. The next section will show how to convert individual elements.
Remove Asset Handling
The ball example had the following code from v0.14.2:
=
=
We can remove the asset handling.
-ball_mesh = world.insert_asset(el.Mesh.sphere(BALL_RADIUS))
-ball_color = world.insert_asset(el.Material.color(12.7, 9.2, 0.5))
world.spawn(
[
el.Body(world_pos=el.SpatialTransform(linear=jnp.array([0.0, 0.0, 6.0]))),
- el.Shape(ball_mesh, ball_color),
WindData(seed=jnp.int64(seed)),
],
name="ball",
)
Remove UI Panel Spawning
Code that spawns UI elements can be removed.
- world.spawn(
- el.Panel.viewport(
- active=True,
- pos="(0.0,0.0,0.0, 0.0, 8.0, 2.0, 4.0)",
- look_at="(0.0,0.0,0.0,0.0, 0.0, 0.0, 3.0)",
- show_grid=True,
- hdr=True,
- ),
- name="Viewport",
- )
- world.spawn(el.Line3d("ball.world_pos", line_width=2.0))
Specify UI with New Schematics Call
All the preceding information can now be specified via schematics.
Details
The old code is python, and the new code is specified in a KDL string to the world.schematics()
method.
el.Panel.hsplit
to hsplit
OLD
NEW
el.Panel.vsplit
to vsplit
OLD
NEW
el.Panel.tabs
to tabs
OLD
NEW
el.Panel.viewport
to viewport
OLD
NEW
= = = =#true show_grid=#true active=#true
el.Panel.graph
to graph
OLD
NEW
=
el.Line3d
to line_3d
OLD
NEW
line_3d ball.world_pos line_width=2.0 color="yolk" perspective=#true
el.Shape
, insert_shape
, insert_asset
to object_3d
OLD
=
=
=
NEW
object_3d ball.world_pos {
sphere radius=0.2 r=12.7 g=9.2 b=0.5
}
world.glb()
to glb
OLD
= ,
NEW
object_3d rocket.world_pos {
glb path="https://storage.googleapis.com/elodin-assets/rocket.glb"
}
Unsupported in 0.15.0
There are a few APIs that were removed from 0.14.2 that are not yet supported.
el.BodyAxes
el.VectorArrow