Jump to content

Blender plugin for exporting .anim


Aglaia
 Share

You are about to reply to a thread that has been inactive for 188 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello!

A few months ago i created this Blender Exporter plugin for exporting animations in the .anim format. So today i've decided to share it with the community, and i hoping it will help as much as it helped me!

WHY A .ANIM EXPORTER?

If you create your animations with Avastar or Bento Buddy, you do NOT need this plugin, because Avastar and Bento Buddy have already everything for exporting to .anim. But if:

- if you create your animations in plain blender (without Avastar and without Bento Buddy)
- if you create your animations in some other softwares then want to import then SL as .anim format

then this plugin could help you!

Personally, i make my animations either in Cascadeur 3D, or in Rokoko Studio. It is not possible to export in a custom format with these softwares. So i export my anims from Cascadeur or from Rokoko to some standard format (fbx, bvh, etc), import them in Blender, then export them to .anim with this plugin. Another solution would be to retarget the anim to either Avastar or Bento Buddy rigs, but 1/ it takes time and 2/ not everybody has these add-ons.


Credits:
I've used a lot from the blender source code itself, especially the bvh exporter, that i've used as a base for collecting data about the animation. I've also reused from code from https://github.com/FelixWolf/SecondLifeTools/blob/master/animjson for writting the anim file and json file.

HOW TO INSTALL?

Go to the Releases page on Github: https://github.com/aglaia-resident/blender-anim-exporter/releases 
In the latest release, download the file blender-sl-anim-exporter.zip
This zip file is the plugin.

Then install it as any other plugin:
- In Blender, go to Edit > Preferences > Add-ons
- Click Install
- Select the zip file that you have downloaded
- Then don't forget to tick the checkbox to enable it.

Now if you go to File > Export, you should see a new option "Second Life Animation (.anim)"

WHAT MODEL TO USE?

Your model can come from another software, as long as it respects the SL rig bones hierarchy.

If you don't have any model yet, you need a rig for creating your animation. You can use the Avatar Workbench that is available for free:
https://www.avalab.org/avatar-workbench/

For starting, you can also use the simple rig and mesh that i provide on google drive:
https://drive.google.com/drive/folders/1gXWxunKk8z1QulD1lHNPzbZ1Y9TMfUPq
Donwload avatar.blend and open it in Blender. IT REQUIRES BLENDER 3.0 OR UPPER

I've made this rig from the Avatar Workbench. I removed all bones except the body ones, so you get the torso, neck, head, arms and legs.
If you want to animate bento bones and volume bones, then please use the avatar workbench.

ORIENTATION OF THE MODEL

In Blender, your model must face you when you are in front view. Type 1 on the numpad to go in front view: the model look at you.

Indeed, the orientation of an avatar in SL is facing X. But in Blender, the convention is to have the avatar facing -Y, which means facing you in front view. It makes the use of mirror tools easier. So i've followed the Blender convention.

Make sure the avatar is facing you in front view, and check that its orientation is 0,0,0. If not, select the armature and tick Object > Apply > Rotation

orientation.thumb.png.60250ea4d02925805b669d401c0e29fb.png

 

HOW TO USE?

Create your animation.

If you have several actions in your blender file: select the one you want to export in the Dopesheet > Action Editor.

Then select the armature and go to File > Export > Second Life Animation 

Here are some options. If you don't see the options on the right, click the Cog icon:

options.png.54cd77b74cb882b38b377dcfe1024025.png

OPTIONS

- Start frame, End frame, FPS: these settings cannot be changed here. Indeed, they come from your blender scene itself. You can change Start frame and End frame in the timline:

timeline.png.d3d9653b7dd56ea935932e1efe117c62.png

And you can change the FPS in the Output Properties panel:

fps.png.6eda2d7a6258bf9c415ca675a13c87fa.png

 

- Export Translations: Most of the time, in SL, you want to animate bones by rotation + translation for mPelvis, and rotation only for all other bones. If you check this box, all existing translation channels will be exported. If you don't check it (which is the default), only mPelvis translation will be exported, and all other bones translations will be ignored. If you are unsure, do not check it.

- Priority: choose between 0 and 6

- Loop: tick this box if your animation should run in loop

- Looop starts at frame: sets which frame is the first frame of the loop. This has no effect if you didn't check the "Loop?" checkbox.

- Ease in and Ease out 

- Dump as JSON : this is for debug purpose. If you want to analyze your animation, this file could help you. You can open it with any text editor, like notepad.

KNOWN ISSUES

In some rare and random cases, after an export, the model gets rotated by 90 degrees around Z. If this happens, please re-rotate it correctly by typing R Z -90 then Object > Apply Rotation.

SOURCE CODE

https://github.com/aglaia-resident/blender-anim-exporter

 

Edited by Aglaia
  • Like 3
Link to comment
Share on other sites

Welcome. I think i will improve it soon for:

- Add a "Rotation only" checkbox in the Exporter widget

- Automatically duplicate the first frame if there is only one (since an animation cannot be a single frame)

- Try to fix the bug that i mention in the Known issue.

But it should work fine. I've been using it for several weeks now and it seems stable enough.

In your case, you would also need a plugin for importing Cascadeur files, to automatically remove the scale channels, location channels, non used bones, armature channels, etc... I have another plugin for this, but right now i have customized it a lot, it will not fit for generic use cases. For example i remove all face channels except for mFaceJaw, and for the eyelids, i remove all volume bones except for breasts, and other custom things like that that will annoy most users if i deliver it as it is.

  • Like 1
Link to comment
Share on other sites

Well, I'm very close! Your cascadeur file works beautifully. The rig seems perfect. But I suspect I'm not exporting properly from Blender. The animation does upload into SL, but when I play it in world, nothing happens. And the exported file is just 2K, which seems small, though it is just 5 or 10 frames with only 2 keyframes. I tried looking at the .anim file with notepad but couldn't read most of it, though I do see the various joints are in there, so something did export.

Maybe I'm not highlighting the right thing when I export the file from Blender? Do I need to highlight anything? Nothing? Everything? I just upgraded to Blender 3.5, by the way.  I followed your instructions to clean the file in Blender. Having to do that for every test anim would be a major headache, as I usually make dozens, so I can see why you wrote a custom importer. Maybe I'll try to figure out how to do that. Er, python scripting is not my strong suit, but maybe I can learn?

Also, is there a way to designate priority level for the animation before committing it to SL? Or is that available only for .bvh files? My .anim file is priority 4.

Finally, "Greedy me" wonders whether you might have a bento version of your cascadeur file available, but I've never animated for bento before, so I'm in no rush.)

Thanks again! I feel I'm VERY close to the big breakthrough here.

Link to comment
Share on other sites

Hard to say. I think the easiest is you to send me your blender file if you're ok. And also the json file so i will check it. I send you my email in private message. Or you can share on google drive or whatever.

In the exporter widget, you can select the priority of the animation. Options are on the rigt side of the widget. If you don,t see the options, unhide them by clicking the cog icon. Here you can set the priority:

Unlike bvh format, with .anim you can NOT change the priority when uploading to SL.

 

cog.png

Edited by Aglaia
Link to comment
Share on other sites

On 4/24/2023 at 9:30 PM, Aglaia said:

- Looop starts at frame: sets which frame is the first frame of the loop. This has no effect if you didn't check the "Loop?" checkbox

It misses the loop end frame, which is a feature to embed a loop within an animation and have sort of "intro" and "outro" sequence for the animation start and when the stop animation is called, so to have a nicer interpolation in and out of the current animation when a sequence of animations are needed.

  • Like 1
Link to comment
Share on other sites

21 hours ago, OptimoMaximo said:

It misses the loop end frame, which is a feature to embed a loop within an animation and have sort of "intro" and "outro" sequence for the animation start and when the stop animation is called, so to have a nicer interpolation in and out of the current animation when a sequence of animations are needed.

You're right and i will add that as soon as possible 🙂

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
On 4/26/2023 at 8:54 PM, OptimoMaximo said:

It misses the loop end frame, which is a feature to embed a loop within an animation and have sort of "intro" and "outro" sequence for the animation start and when the stop animation is called, so to have a nicer interpolation in and out of the current animation when a sequence of animations are needed.

I've updated the .anim exporter:

1/ It now offers the "loop end frame" option that was missing.

2/ It now offers the option "Export translations". If not checked, translations are ignored (except translations of mPelvis which are still exported if they exist)

3/ It doesn't require anymore channels to be grouped by bone in the dopesheet (this was mainly a problem when importing a fbx file in the older versions of Blender)

4/ It now ignores all bones that are not part of the SL rig. 

5/ It now displays a progression loader under the mouse cursror when the export is processing.

By the way, points 3 and 4 make much easier the Cascadeur worflow exposed here. Indeed, thanks to these few improvements, there is no need for any cleaning anymore of the fbx file exported from Cascadeur and imported into Blender. Not only easier, it makes it also compatible with older versions of Blender (3.0 and upper)

I think the last thing to do on this plugin is to fix the bug that sometimes make the model rotating by 90 degrees after an export. It happens rarely and randomly and i'm stuck on it so far.

Edit: same url for downloading the .anim exporter blender plugin: download the blender-sl-anim-exporter.zip file in the latest release on this page: https://github.com/aglaia-resident/blender-anim-exporter/releases

Edited by Aglaia
  • Like 1
Link to comment
Share on other sites

  • 5 months later...
On 5/9/2023 at 7:47 PM, Aglaia said:

Edit: same url for downloading the .anim exporter blender plugin: download the blender-sl-anim-exporter.zip file in the latest release on this page: https://github.com/aglaia-resident/blender-anim-exporter/releases

Hey hey. I know the post is a smidge old, but I noticed the link is giving a 404 error. I've been itching to test this plugin. Any chance there's an updated link? I couldn't find you by name over there either. :( 

Link to comment
Share on other sites

  • 3 weeks later...
On 10/10/2023 at 11:51 AM, YaniiMarie said:

Hey hey. I know the post is a smidge old, but I noticed the link is giving a 404 error. I've been itching to test this plugin. Any chance there's an updated link? I couldn't find you by name over there either. :( 

Seems like a few months ago this was still available. Unfortunately I also tried searching online and wasn't able to find this project anywhere either. I might just cough up the money for Avastar instead.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 188 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...