-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: initial-work-merge
Are you sure you want to change the base?
Initial play animation branch commit. #2
Conversation
} | ||
}); | ||
|
||
for (let i = 0; i < gltfNodesSize; i++) { |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Babylon has a loader plugin to do this (see https://forum.babylonjs.com/t/how-to-prevent-animations-from-auto-starting-by-sceneloader/27945)
}, "float4") | ||
const gltfNodesSize:number = this.world.glTFNodes.length; | ||
|
||
this.registerEngineCallback(`playAnimation`, (value, onComplete) => { |
There was a problem hiding this comment.
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
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.