Hello,
I’ve wrote a python script to import fbx files into Maya but when trying import the same fbx twice it would not import a duplicate. I worked around this by creating the duplicate fbx as a reference than converted back to a standard mesh. I’m finding I’m getting duplicate materials. Does anyone know an easier way to import duplicate fbx’s or a way to fix duplicate materials from being created. Here is the current code I’m using:
if not does_fbx_exist_scene:
# If fbx does not exist within scene then import.
new_nodes = cmds.file(model_path, absoluteName=False, i=True)
print(f"FBX piece imported as: {selected_model_name}")
# If nothing was added to the scene, import as reference
else:
# If fbx does exist within scene then import as ref and use scene namespace as name.
# Then convert ref to mesh object!
cmds.file(model_path, mnc=True, reference=True)
# Make reference part of the scene
cmds.file(model_path, importReference=True)
ref_name = cmds.ls(f"{selected_model_name}*", type="transform")[-1]
Thanks