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

Blender exporter exports non-existent animations, crashing the ObjectLoader #8723

Closed
AndrewRayCode opened this issue Apr 23, 2016 · 4 comments

Comments

@AndrewRayCode
Copy link
Contributor

Description of the problem

Even though my Blender file has no keyframe animation, an invalid "animations" key is exported to the JSON file, something like:

"animations":[{
    "name":"default",
    "fps":24,
    "tracks":[{
        "keys":[],
        "name":"Cylinder.position",
        "type":"vector3"
    },{
        "keys":[],
        "name":"Cylinder.scale",
        "type":"vector3"
    },{
        "keys":[],
        "name":"Cylinder.quaternion",
        "type":"quaternion"
    }]
}]

When this is loaded into Three, it throws the error Uncaught Error: no keyframes in track named Cylinder.position

As mentioned in this comment by @phfatmonkey, one solution to this is to delete "unused" tracks from Blender's mysterious NLA editor. I don't think this is a great solution because Blender frequently creates those random tracks as some sort of warped backup mechanism. It would be better if only "valid" animations were exported. If that's not possible for some reason, as in if it's not possible using the Blender API to determine which named animations are real and which are fake, then I guess this ticket can be closed.

A fast workaround if you find yourself in this state is to manually delete the animations key from the exported JSON file. For any rigged animation I've ever exported, the real animation data is nested inside the geometry key. I don't know why an empty, invalid top level animations key would ever be exported.

You can download the .blend file in question to try this out: eye-test.blend.zip

Three.js version
  • ✅ Dev
  • ✅ r76
@AndrewRayCode
Copy link
Contributor Author

AndrewRayCode commented Apr 23, 2016

I created a node script to fix morph targets and also delete the top level animation key for any exported file. Use at your own risk https://gist.github.com/AndrewRayCode/15340499495afea654e45d9ace113d28

@dlinning
Copy link

This was actually part of my issue ( #8677 ), I had

"animations":[{
        "name":"default",
        "fps":24,
        "tracks":[]
    }]

being generated at the top level. The geometry key also holds the correct animations.

@bakajin
Copy link

bakajin commented Sep 19, 2016

If you turn on to export animation, the exporter just seems to set up animation on everything in the scene. Thus creating these empty key sets. Though you might want to double check which animation types you actually check on in the export, it is rather specific.

If you ask me it would be best if the loader doesn't stop when it finds an empty key set. But instead just note that it is empty and move on.

@Mugen87
Copy link
Collaborator

Mugen87 commented May 31, 2018

The JSON Blender exporter has been removed with R93 (#14117).

Also see: https://threejs.org/docs/#manual/introduction/Loading-3D-models

@Mugen87 Mugen87 closed this as completed May 31, 2018
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

No branches or pull requests

4 participants