A few questions regarding materials

Question 1: Is there a clean way to load in a bunch of separate .babylon files, but use a single material across them?

I’m contemplating writing my own handler for this, but I’m wanting to make sure I’m not reinventing the wheel. My scene has like 900 materials, but there’s really only ~50 unique materials. The rest are duplicates from objects being loaded in.

If I can’t find anything pre-built, I’ll probably just dispose all of the materials when loading in, and then replace the material with the material from code that will be re-used across all objects that use that material in the scene. This way there will be no duplicate materials. It would be ideal if when loading the materials, they could be considered the same as other materials that already exist within the scene, and then just use the existing materials.

Question 2:
Is there a clean way to identify individual submeshes of an object that is imported?
I’m currently identifying the submesh by the name of the material attached to it when it is imported. I then will change the individual submesh material by changing it’s multimaterial index. This seems unintuitive to me, but I don’t see a clean way to just label a submesh in blender, select it individually in code, and then just apply a material to that submesh.

Also, would it be inefficient to use a single multimaterial (that includes all materials) across all meshes, and just apply the necessary materials to the submeshes?

Please let me know if you have any ideas on how to better achieve these goals, I realize the ways I’m doing them are inefficient.

Question 1:
You could load your models without materials and add your materials with standalone gltf files to your scene:

BABYLON.SceneLoader.OnPluginActivatedObservable.add((plugin) => {
        plugin.loadAllMaterials = true;
    });