Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial play animation branch commit. #2

Open
wants to merge 4 commits into
base: initial-work-merge
Choose a base branch
from

Conversation

petermart
Copy link

  • Added new generalized "engine callback" which includes an arbitrary path and value, as well as a callback for on complete. IE, when the animation is finished, our on complete should be run the next node. Note this path does not reflect a gltf path and can be anything that we want.
  • Changed Babylon decorator to go through all nodes and set correct engine callbacks and known pointer functionalities for all transform and animations.
  • Fixed animations not clearing when scene reset, and made all animations stopped by default (must define a playAnimation)
  • Added play animation node that roughly follows authoring spec

I do believe we may want an instantaneous finish as well as an async finish. Right now, done only reflects the asyc finish.
Also, targetTime is there to reflect the draft spec but has no implementation yet.

@CLAassistant
Copy link

CLAassistant commented Nov 10, 2023

CLA assistant check
All committers have signed the CLA.

}
});

for (let i = 0; i < gltfNodesSize; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you only have to register it once for the highest number, so we could just do nodes/${glTFNodesSize}/scale etc..

this.validateFlows(this.flows);
this.validateConfigurations(this.configuration);

const {animation, speed, loopCount, targetTime} = this.evaluateAllValues(this.REQUIRED_VALUES.map(val => val.id));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

values should not be evaluated at construction time, general practice is configuration = "class" private variables and the values are temporary variables only evaluated and used during the processNode function

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha

const file = fileInputRef.current!.files![0]

const url = URL.createObjectURL(file);

const container = await SceneLoader.LoadAssetContainerAsync("", url, sceneRef.current, undefined, ".glb");
container.addAllToScene();

// Stop all animations by default (only apply based off of play animation node)
for (let i = 0; i < (sceneRef.current?.animationGroups?.length ?? 0); i ++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}, "float4")
const gltfNodesSize:number = this.world.glTFNodes.length;

this.registerEngineCallback(`playAnimation`, (value, onComplete) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a path, I do like the idea of abstracting the callbacks outside of babylon, but maybe we can do this someplace other than the json get/set trie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants