aws-samples / aws-tools-for-babylonjs-editor

AWS Tools for Babylon.JS Editor is a suite of tools meant to interact with Babylon.JS Editor by utilizing the capabilities of AWS products.
Apache License 2.0
32 stars 10 forks source link

Fix: skeletons and animations now load/reload correctly #14

Closed JuliaABurch closed 2 years ago

JuliaABurch commented 2 years ago

Description

This PR fixes two issues that were preventing animations from playing on a host once a scene had been saved/reloaded:

  1. Skeletons and bones would not be exported and therefore reloaded on the model, so the animations had nothing to 'attach' to
  2. The metadata that included the paths to the animations would be the full, absolute paths to the local files, so while it would work when "play" was pressed in the editor, the web server would error out when loading these files external to the editor.

To address # 1, fixBones utility method was created that sets various properties on the skeletons so that the editor will export/reimport them properly.

To address # 2, two sets of metadata are now stored with the host object - the first set contains absolute paths to local files and can be used by the editor or any local application, while the second set contains relative paths which will be used by the web server.

This fix relies on the following PR to be merged: https://github.com/BabylonJS/Editor/pull/368 Without this PR, the transformationNodes won't be linked to the bones, which will prevent the animations from physically manipulating the model.

Reviewer Testing Instructions

  1. You may need to pull down the Editor PR and compile the editor locally to test this change fully.
  2. Create a new project workspace. You will need to manually run npm install @amazon-sumerian-hosts/babylon or npm link @amazon-sumerian-hosts/babylon in the project workspace. Add a host. Press "play", or "Run -> Open in Web Server", and note that the animations will play.
  3. Save the project, File -> Reload Workspace.
  4. Press "play" or "Run -< Open in Web Server". When you have this change, the animations will continue to play. Without this change, the model will be stuck in its default T-pose.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.