Thursday, January 14, 2016

Import your 3d models into blender from file manager or terminal.

# Simple script to import models from the command line or via "default application".
#
# 1. Copy the next line into something like blender-import.sh
#    /path/to/blender --python /path/to/blender-import.py -- $1
#
# 2. Set as your "default application" to open 3ds, fbx, and obj files.
#   a. Right-click on filename.fbx
#   b. Open With > Other Application...
#   c. Browse to the blender-import.sh in the dialog that pops-up. ( Click folder icon. )
#   d. Click "Set as Default"
#
# 2016.01, thendrix
#
# https://www.blender.org/api/blender_python_api_2_76b_release/bpy.ops.import_scene.html
#

import bpy, sys
if sys.argv[-1].lower().endswith( ".3ds" ):
        bpy.ops.import_scene.autodesk_3ds(filepath=sys.argv[-1])

elif sys.argv[-1].lower().endswith( ".fbx" ):
        bpy.ops.import_scene.fbx(filepath=sys.argv[-1])

elif sys.argv[-1].lower().endswith( ".obj" ):
        bpy.ops.import_scene.obj(filepath=sys.argv[-1])

No comments: