1
$\begingroup$

I need to convert a batch of .obj models to .fbx

I'm using Autodesk 2013 FBX Converter GUI. Is it possible to do it from the terminal? I haven't been able to find much.

Thanks!

============== EDIT ==============

Thanks for the replies, I think I need to go into more detail.

I'm writing a blender script to do some changes to a model then automatically export that model to both .obj and .fbx

The .obj export works like a charm, but the blender fbx exporter has some problems. 1) It can't embed all the media so I need to relink textures 2) The scale/rotation is off

But, I found that if I use the fbx converter on the .obj model I exported it looks great, so I was wondering if I could automate that conversion from my addon.

$\endgroup$
  • 3
    $\begingroup$ Is this question related to blender? $\endgroup$ – cegaton Jul 11 '16 at 5:00
  • $\begingroup$ Yes it is sorry for the confusion. I'm writing a blender script to do some changes to a model then automatically export that model to both .obj and .fbx The .obj export works like a charm, but the blender fbx exporter has some problems. 1) It can't embed all the media so I need to relink textures 2) The scale/rotation is off But, I found that if I use the fbx converter on the .obj model I exported it looks great, so I was wondering if I could automate that conversion from my addon. $\endgroup$ – Robert Cornwall Jul 11 '16 at 18:25
  • $\begingroup$ @RobertCornwall There are the same path_mode options, so this should work for both: blender.org/api/blender_python_api_current/…, right? $\endgroup$ – p2or Jul 11 '16 at 18:56
2
$\begingroup$

You won't get any help using the Autodesk converter here, but if you are asking whether you can use blender to do the conversions, then the answer might be yes. Blender is able to import and export both obj and fbx files, you will need to do some tests to see if the models you have are handled correctly.

Blender has a python interpreter built into it, you can use blender's python console to enter python commands to do your conversion. You can also open a text file in blender's text editor and run it as a python script.

You could also start blender in the terminal and have it act as an interactive python console in the terminal without using blender's gui.

The commands you want to use to convert your models are bpy.ops.import_scene.obj() and bpy.ops.export_scene.fbx()

You could start with a script like

import bpy
import os

src_dir = '/Users/name/Desktop/obj_files'
dest_dir = '/Users/name/Desktop/fbx_files'

for f in os.listdir(src_dir):
    # delete all existing objects
    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete()
    bpy.ops.import_scene.obj(filepath=os.path.join(src_dir,f))
    bpy.ops.export_scene.fbx(filepath=os.path.join(dest_dir,f))
$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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