Unity-Runtime-Animation-Recorder icon indicating copy to clipboard operation
Unity-Runtime-Animation-Recorder copied to clipboard

Fbx exporter - Maya file naming

Open smarcosanderson opened this issue 6 years ago • 9 comments

First of all thanks for the initiative and the project!!

Well, I am facing some problems with the fbx export. For a simple file, it is taking over 1 hour to complete the process, and failing in the last stage.

I changed a bit your code, since it was hanging my Unity. the cause of that was the while loops being executed (and called through the Update function)

If you have a sample of fbx would be helpful. I tested with some from Mixamo, after open them in Maya and export as ASC II.

Many Thanks, Marcos

Ps. I should mention that I notice that for Maya files, whenever some Transform is named with special character such as : the process fail showing the error: Could not find part of "transformName"_dataX

smarcosanderson avatar May 05 '18 07:05 smarcosanderson

Thanks for the report! The naming issue is due to the naming limitations on the operating system though (windows / osx). Because the system not allowed characters like ':' or ']' as file's name, and my script is using your gameobject's name in Unity (which might include those characters), so the data writing process is failed.

And the FBX Export part, since the ASCII structure is a bit complicated to deal with, I have not complete the function yet (still lots of bugs). But I just found another way to export FBX very successfully.

Unity now offers "FBX Exporter" in AssetStore, and it can also export animations. You can use the UnityAnimationRecorder to record animations into Unity's .anim file format. And then you use the Unity's FBX Exporter to export the model with the animation. I've just test it and it was fast and successful. Please have a try!

newyellow avatar May 08 '18 03:05 newyellow

Wow!! Thanks so much... I will take a look on that.

I actually was coding on top of your code... I can send you later. The problem with the long time was "for some reason" the IEnumerator. So I took out put in another thread, and also changed a bit the way for getting nodes. Now is much faster. But I still need to get the animation... I hope I can get this working today... hahaha

smarcosanderson avatar May 08 '18 03:05 smarcosanderson

Sure, please feel free to make a pull request when you done, I will definitely look into it.

When I was doing the FBX part, I found there are some setting are really tricky. For example, the time unit FBX use to store the animation key frames, it is a very large number.

So I was thinking about using FBX SDK to export, rather than reading the ASCII code by myself. But I didn't want to learn FBX SDK that time lol. But after completing the very simple version of FBX exporter, I found there were too many problems, so I was thinking about the SDK again.

But ... now Unity release the FBX Exporter, and it's totally free. So maybe there's no reason to reinvent the wheel now though. :P

newyellow avatar May 08 '18 03:05 newyellow

Hi, newyellow,

Well, for some reason I am getting some problems when I try to record Humanoid animation ( in .anim files) and then playing then in the same character. Do you know how I could fix that? image

Ah, also, do you know if it is possible to use the FBX Exporter in realtime? I dont think so, but...

About the fbx, I think I could export the information, however, the character seems broken... like all the bones were mixed... image

smarcosanderson avatar May 08 '18 20:05 smarcosanderson

Nevermind! I figured out! The animation clip should be set as Legacy.

However, seems like it is not possible to have the runtime FbxExporter working. Only working at UnityEditor... =/

smarcosanderson avatar May 09 '18 02:05 smarcosanderson

@smarcosanderson alright I will do some test today!

newyellow avatar May 09 '18 05:05 newyellow

Well, I did not actually do a pull, so my scripts are kind messy... but I zipped them here, so you can take a look if you want to....

I just change the ones in FbxExporter folder and also the TransformTracker, in order to use another thread.

General.zip

FbxExporter.zip

smarcosanderson avatar May 09 '18 06:05 smarcosanderson

@smarcosanderson thank you, I definitely check them out. I've done some test with the Unity's FBX Exporter , but it seems that humanoid animation is not supported for now (do not support hierarchy bones). So for now maybe the best way to export humanoid animation is through Maya Exporter.

newyellow avatar May 09 '18 18:05 newyellow

@newyellow sorry, but what you mean by, humanoid animation is not supported?

Because I could animate through your script (since setting the clip as Legacy) and then export it as a fbx at runtime, but only in the editor... I am looking for a way I could export it from the standalone player.

But, yes.. Maya has "less" complications, however, the application I am builting requires load and export of models at runtime... I could not find any runtime importer for Maya. otherwise, I would use it. Do you know any?

Thanks.

smarcosanderson avatar May 09 '18 18:05 smarcosanderson