added corrupt-asset-animation detection
This commit is contained in:
parent
e368b74e4f
commit
e52dd993dc
2 changed files with 218 additions and 1237 deletions
File diff suppressed because one or more lines are too long
|
|
@ -39,14 +39,26 @@ xrf.frag.t.setupMixer = function(opts){
|
||||||
let {model,file,url} = opts
|
let {model,file,url} = opts
|
||||||
let mixer = model.mixer = new xrf.THREE.AnimationMixer(model.scene)
|
let mixer = model.mixer = new xrf.THREE.AnimationMixer(model.scene)
|
||||||
|
|
||||||
mixer.play = (play) => {
|
mixer.initClips = () => {
|
||||||
mixer.isPlaying = play
|
if( mixer.clipsInited ) return // fire only once
|
||||||
model.animations.map( (anim) => {
|
model.animations.map( (anim) => {
|
||||||
|
let zombies = anim.tracks.map( (t) => !model.scene.getObjectByName(t.name) ? {anim:anim.name,obj:t.name} : undefined )
|
||||||
if( !anim.action ){
|
if( !anim.action ){
|
||||||
anim.action = mixer.clipAction( anim )
|
anim.action = mixer.clipAction( anim )
|
||||||
anim.action.enabled = true
|
|
||||||
anim.action.setLoop(THREE.LoopOnce)
|
anim.action.setLoop(THREE.LoopOnce)
|
||||||
}
|
}
|
||||||
|
if( zombies.length > 0 ){
|
||||||
|
zombies.map( (z) => console.warn(`gltf: object '${z.obj}' not found (anim: '${z.anim}'`) )
|
||||||
|
console.warn(`TIP: remove dots in objectnames in blender (which adds dots when duplicating)`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
mixer.clipsInited = true
|
||||||
|
}
|
||||||
|
|
||||||
|
mixer.play = (play) => {
|
||||||
|
mixer.initClips()
|
||||||
|
mixer.isPlaying = play
|
||||||
|
model.animations.map( (anim) => {
|
||||||
if( mixer.isPlaying === false) anim.action.stop()
|
if( mixer.isPlaying === false) anim.action.stop()
|
||||||
else{
|
else{
|
||||||
anim.action.play()
|
anim.action.play()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue