unity3d-jp / MeshSync

A package for synchronizing meshes/models editing in DCC tools into Unity in real time.
Other
1.55k stars 174 forks source link

Mesh Export option update [PoC, don't merge] #70

Closed bitinn closed 4 years ago

bitinn commented 5 years ago

As described in #67, I tried to add an option that allows Y-up mesh export, it works for my cases.

Screen Shot 2019-04-28 at 21 37 51

Things to note:

i-saint commented 5 years ago

thank you very much. but there are still many remaining problems. bindposes as you mentioned, blendshapes, animations, and performance (this is slow). I think this issue should be handled at import time instead of export time. please leave it to me. I will work on it soon.

bitinn commented 5 years ago

@i-saint Thx for reviewing this PR.

I needed a quick fix for myself, thought a proof of concept might help someone else, this is not really intended to be merged, I have changed the title to reflect that.

Also I have opened a bug report 1150048 to deal with the Mesh asset update issue. Not sure if you got access to fogbugz backend, but fixing this issue might help MeshSync in future.

bitinn commented 5 years ago

A small update regarding modifying existing mesh asset correctly, apparently the correct order is to:

var destMesh = AssetDatabase.LoadAssetAtPath<Mesh>(dstPath);
destMesh.Clear();
EditorUtility.CopySerialized(srcMesh, destMesh);
AssetDatabase.SaveAssets();

Doing all 3 calls will ensure:

  1. scene view is updated with srcMesh data;
  2. mesh preview of destMesh is updated with srcMesh data;
  3. changes to destMesh is flushed to file;
  4. existing references to destMesh aren't lost.

Just something to consider for your next release of Export Mesh function :)

sasa42 commented 4 years ago

FYI. Here some additional Y-up conversion helpers e.g. for keyframed animations

https://www.edy.es/dev/2014/02/a-better-blender-to-unity-3d-importer/