Automate Baking for Export
16 February 2016 15:26
Hi,
I was hoping I could automate the export of html files from Blender using Python scripts. I want to be able to run a batch script that will take the animation, bake any actions that require it, and then export it out. Preferably this would all run as a background script (as in with no GUI).
I am able to export the file out through running scripts at the command line with Blender, with no issues.
It's when I try to bake actions prior to export, I have been encountering issues.
In the .blend file I have attached. It contains a model that is rigged with Rigify and whose actions need to be baked. I am able to manually bake its actions and then export it to a file and have it run correctly in the browser. Running a script following the same steps, I am not able to get the same result when I export.
Originally I was unable to call the Blend4Web bake through the script due to context issues. It started out being a problem relating to running scripts in the background. As the anim_bake script uses the context.area.type when running, which does not exist when run without a GUI. Removing the background flag (so the script would run as the Blender GUI opened) when calling Blender removed this problem.
When I run it then it will bake the action but not in the desired way. It seems to fix my model to it's final rigged position and only apply location key framing.
I then tried a different approach, using the NLA bake native to Blender, as this is able to run through a script with Blender's background flag set. However when I do this and export the resulting file has distortion in the model's animation.
In my code I followed every step of the tutorial posted on the forum for NLA baking, but still was unable to remove the distortions. Even following the process manually I had the same results.
Would you have any idea what might be going wrong with the steps I'm taking? Or do you have a better way to carry out the action bake?
As mentioned I've attached the .blend file I was using. And I have also attached my script, which shows both methods I have tried in order to bake the animation. I'm using Blender 2.75.
Many Thanks!
I was hoping I could automate the export of html files from Blender using Python scripts. I want to be able to run a batch script that will take the animation, bake any actions that require it, and then export it out. Preferably this would all run as a background script (as in with no GUI).
I am able to export the file out through running scripts at the command line with Blender, with no issues.
It's when I try to bake actions prior to export, I have been encountering issues.
In the .blend file I have attached. It contains a model that is rigged with Rigify and whose actions need to be baked. I am able to manually bake its actions and then export it to a file and have it run correctly in the browser. Running a script following the same steps, I am not able to get the same result when I export.
Originally I was unable to call the Blend4Web bake through the script due to context issues. It started out being a problem relating to running scripts in the background. As the anim_bake script uses the context.area.type when running, which does not exist when run without a GUI. Removing the background flag (so the script would run as the Blender GUI opened) when calling Blender removed this problem.
When I run it then it will bake the action but not in the desired way. It seems to fix my model to it's final rigged position and only apply location key framing.
I then tried a different approach, using the NLA bake native to Blender, as this is able to run through a script with Blender's background flag set. However when I do this and export the resulting file has distortion in the model's animation.
In my code I followed every step of the tutorial posted on the forum for NLA baking, but still was unable to remove the distortions. Even following the process manually I had the same results.
Would you have any idea what might be going wrong with the steps I'm taking? Or do you have a better way to carry out the action bake?
As mentioned I've attached the .blend file I was using. And I have also attached my script, which shows both methods I have tried in order to bake the animation. I'm using Blender 2.75.
Many Thanks!
16 February 2016 20:15
Hello and welcome to the forum!
Actually, we do not perform animation baking automation at the moment. As you have already mentioned, the anim baking script is not applicable for such tasks, firstly because of GUI-specific checks. However, it is a good idea to modify it to support console behavior. I think, we can make some adjustments.
Btw. I also check manual baking for your .blend with b4w and Blender's native bakers. Only the first result was acceptable. So it seems, that b4w baker needs not too much improvements/fixes to support the described behavior.
Actually, we do not perform animation baking automation at the moment. As you have already mentioned, the anim baking script is not applicable for such tasks, firstly because of GUI-specific checks. However, it is a good idea to modify it to support console behavior. I think, we can make some adjustments.
Btw. I also check manual baking for your .blend with b4w and Blender's native bakers. Only the first result was acceptable. So it seems, that b4w baker needs not too much improvements/fixes to support the described behavior.
18 February 2016 23:55
Hi Evgeny!
Thanks so much for replying.
I was hoping to carry out the automation for a college project I'm working on. Would it be possible for me to try to recreate the code within anim_baker in order to run the functionality as part of a batch job?
I would send any working code I manage to write to you guys for your own use, of course.
Thanks again!
Thanks so much for replying.
I was hoping to carry out the automation for a college project I'm working on. Would it be possible for me to try to recreate the code within anim_baker in order to run the functionality as part of a batch job?
I would send any working code I manage to write to you guys for your own use, of course.
Thanks again!
05 October 2019 05:33
hi all,
how do you change the export directory of blender2kt?
here is the problem that i got
Starting Scene Conversion
scene conversion done.
no export directory set in user default ——- this is the problem
will try temp instead: c:docume1stanmarshlocals1temp
couldnt read installdir value. is kerkythea correctly installed?
i want to change the user default export directory for kerkythea, so that i can carry it portably without installing kt on another machine. how to change user default export directory?
thanks
how do you change the export directory of blender2kt?
here is the problem that i got
Starting Scene Conversion
scene conversion done.
no export directory set in user default ——- this is the problem
will try temp instead: c:docume1stanmarshlocals1temp
couldnt read installdir value. is kerkythea correctly installed?
i want to change the user default export directory for kerkythea, so that i can carry it portably without installing kt on another machine. how to change user default export directory?
thanks