Easily assigning materials to meshes

I did a quick write-up on a method I stumbled upon and thought might be handy for others.

And for those who just want a fast summary:

  • Create a simple map of the FBX/glTF material to new material
  • Loop through the FBX/glTF and grab the meshes
  • Match the mesh.surface_get_name(i) against your map
  • Override the material as appropriate via _node.set_surface_override_material(i, override_map[surf_name])

Very fast, very simple, and lets you use avoid having to make the object local in order to override it in the editor or roll through explictly with $node/object/mesh.set_surface_override_material(slot_num, new_material).

Full write-up with code and screenshot on my forum there above.

1 Like