Help test improved FBX import: Reuse materials

Hi all.

I have made a small modification to the FBX import scripts of Blender.
It makes it possible to reuse existing materials already defined in the file when importing an FBX file.

I work with architectural visualisation often. I get models from CAD programs most often in the form of FBX and turn them into nice renders by tweaking the materials, light, furniture etc.
But very often (almost always), the visualisation work is early in the design process and the CAD project is always changing. I then receive an updated file and when importing that, I have to change all the materials again. And again. And again. Its very time consuming.

The small changes I made basically checks if the material in the FBX file is already in the Blender file by comparing the names of the materials. If the material is already defined that one is used. If not a new one is created.

I am not very experienced with the Blender code and I am not sure if this is the right way to do it or if I follow all coding guidelines etc. You are welcome to comment.
So if anybody could test this out and tell me if it works or if there is something I have done wrong etc.
And of course if it looks good, might it be considered for inclusion in official Blender and how?

Also, I feel this functionality is not specific for FBX only but all import/link workflows in Blender could use it. How would be the best way to maybe generalise it?

To test it, simply swap out the “io_scene_fbx” folder in the “…\scripts\addons” folder of the Blender install path. I have attached the modified version here.
Remember to make a copy of the one already there so you can change it back if you need to.

Download here from Google Drive

Best Regards
Ejnar Brendsdal

1 Like

While testing some more production files this evening this is more complex than my approach is.
I get an error when importing with more complex FBX materials as it tries to link different properties to the material upon import. But when the material is already present in the scene is does not necessarily have those properties to update.
I will look into it, but its a bit over my level.