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

Multiple actions in Blender exporter broken #7631

Closed
daniel-nth opened this issue Nov 18, 2015 · 10 comments
Closed

Multiple actions in Blender exporter broken #7631

daniel-nth opened this issue Nov 18, 2015 · 10 comments

Comments

@daniel-nth
Copy link
Contributor

7812b25 broke the export of multiple actions for me. Instead, only the currently active animation of an armature will be exported.
Isn't looping over data.actions and then checking for each action if it is identical to armature.animation_data.action the same as just exporting armature.animation_data.action in the first place?

@mrdoob mrdoob assigned repsac and unassigned repsac Nov 18, 2015
@mrdoob
Copy link
Owner

mrdoob commented Nov 18, 2015

/ping @bhouston

@bhouston
Copy link
Contributor

/ping @jackcaron

@jackcaron
Copy link
Contributor

@daniel-nth
data.actions holds every action in the scene, just like data.objects holds every objects. So using only actions relevant to this armature seems to be right approach.

But if you can provide me with a simpler Blender file that can reproduce this bug, I would like to look at it and see how I could fix this.

@antont
Copy link
Contributor

antont commented Nov 18, 2015

we've used this model to test blender -> three.js exports, including multiple skeleton animations:
https://github.com/realXtend/chesapeakebay/blob/master/objects/White_Tailed_Deer/White_Tail_Deer_all.blend

that file has multiple actions / animations for the same armature / skeleton -- just mentioning in case if is helpful for you. we exported it succesfully with the old r6* era three.js and the old exporter and got it pretty much figured for current too with the help of nice people in the other issues about the blender exporter.

IIRC in that file they are as actions normally but also put to the sequencer timeline as those blends were originally authored for Ogre 3D and for an exporter with which you had put the actions you wanna export to the sequencer timeline one after another .. it also stepped through the anims as part of the export, perhaps to bake modifiers or something? This old exporter: https://code.google.com/p/blender2ogre/ . Interestingly enough the last commit it says "Extended the node animation script to support action user retrieval by NLA."

i don't remember exactly how it goes with multiple anims and the blender export now, should check more still too.

@daniel-nth
Copy link
Contributor Author

@antont Thanks! With the current exporter I get zero animations in the exported JSON. When reverting 7812b25, I get three. When I link an animation in the action editor, that one action gets exported.

@jackcaron Thanks for looking into it!
I committed a simple test file that we made for animation testing a while ago over here: https://github.com/daniel-nth/three.js-issue-7631. The behaviour is the same as with the deer, only a linked animation gets exported. Neither me nor our Blender guy know a way to link more than one animation to an armature in the action editor.

@satori99
Copy link
Contributor

@daniel-nth

I am fairly certain that Blender actions are completely decoupled from armatures they may act apon.
Any action can be applied to any armature, and if the action group names match any bone names, they will be animated by the action data.

I have 'solved' this in a blender script by checking each actions' group names against armature deform bone name. I deem an action as applicable to an armature object if the action does not contain any groups which don't correspond to armature bones.

Something like this

It's not bullet-proof but it works well enough if your armature bone names are descriptive and not simply 'Bone, Bone.001, ...'.

Unfortunately, I don't know enough about the current exporter addon code to know if/how/where this could be applied.

daniel-nth pushed a commit to daniel-nth/three.js that referenced this issue Nov 19, 2015
@bhouston
Copy link
Contributor

So just to clarify, the reason we did this was because if you had multiple rigged characters in a scene, like a dog, a person and a robot, the exporter would export every animation for every character. Thus if there was 3 dogs animations, 1 person animation and 2 robot animation, the export would give the dog 6 animations, 3 of which were not his, the person 6 animations, 5 of which were not his, and the robot 6 animations, 4 of which were not his.

The current solution though clearly is exporting not enough, but the previous solution exported too many improper duplicates.

I guess one can undo our change until we get proper filtering.

@bhouston
Copy link
Contributor

@daniel-nth if you wanted to make a PR with your fix, I think that would be a good idea. Sorry for the trouble.

daniel-nth pushed a commit to daniel-nth/three.js that referenced this issue Nov 23, 2015
@daniel-nth
Copy link
Contributor Author

@bhouston Thanks! PR is on the way.

mrdoob added a commit that referenced this issue Nov 23, 2015
Blender exporter: work around #7631, export all actions
@mrdoob
Copy link
Owner

mrdoob commented Nov 23, 2015

#7666

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

7 participants