0
$\begingroup$

I am using the bpy.ops.export_scene.fbx operator and it works perfectly, but I was wondering if I am able to use the material overwrite for the export?

$\endgroup$
  • $\begingroup$ What do you mean by "material overwrite"? $\endgroup$ – Robert Gützkow Sep 21 '19 at 16:39
  • $\begingroup$ in the properties panel under scene/overwrite/material overwrite $\endgroup$ – Nburgess Sep 21 '19 at 16:42
  • $\begingroup$ I thought you meant an options for fbx export. No, that won't work it's for rendering in Blender only. $\endgroup$ – Robert Gützkow Sep 21 '19 at 16:46
0
$\begingroup$

So I made a work around. The key was saving the original material, assigning the overwrite material, then reapplying the original. You will need to change the settings for the fbx export click here for its structure.

 fbxs = [ ob for ob in bpy.context.selected_objects]
 bpy.ops.object.select_all(action='DESELECT')

    for ob in fbxs:
         ob.select_set(True)
         mat = bpy.data.materials['Overwrite']
         original_mat = ob.data.materials
         ob.data.materials[0] = mat

         bpy.ops.export_scene.fbx(...)

         ob.data.materials[0] = original_mat
         bpy.ops.object.select_all(action='DESELECT')
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.