I’ve brought up feature enhancements to MicroStation’s FBX exporter in the past, mainly to point out that it does a good job except for the fact that the Meshes should be named after the Material names rather than generically Mesh, Mesh 1, Mesh 2, etc. This can cause problems in Unity when we optimise individual Mesh settings and then expect Unity to keep track of those settings as we update the 3D model over the life time of a project. Depending on the type and extent of changes made to a 3D model, what used to be “Mesh 17” can all too easily become “Mesh 32”. By giving the individual Meshes an explicit name that remains constant over time, the Unity workflow become entirely seamless and a pleasure to work with.
Well now in 2023 it’s ChatGPT to the rescue. After quite a bit of cajoling I got it to help me write and build a C++ executable that renames the Meshes in a given FBX file to match their respective Material names. MicroStation has a tenancy to append a long list of “File” and “Reference File” information to the Material name but this C++ app truncates the Mesh names so that they match MicroStation’s original Material names. If there are any duplicate Mesh names it will append a version number but that is all.
You can download the FBXrename app from my Google Drive but be warned that this app will overwrite all FBX files in a given folder with the modified versions. You should work with copies of your FBX files until you are confident that the app does what you expect it to do and that it doesn’t mangle the FBX files in unexpected ways. One thing that it does do is strip out all the embedded texture files and puts them in a matching sub-folder. These sub-folders can be safely deleted and the fact that the modified FBX files no longer contain the embedded texture files is not a problem as the Unity FBX importer easily remaps embedded Materials to Unity Materials that have already been created and setup with the correct texture attachments.
I will try to attach a ZIP file to this post with the relevant files but if that doesn’t work you can download FBXrename from my Google Drive:
FBXrename_Download
To run the app, copy the "FBXrename.exe" and "libfbxsdk.dll" files to the folder containing your FBX files and double click on "FBXrename.exe".
communities.bentley.com/.../FBXrename.zip