Last active
April 8, 2019 19:19
-
-
Save Arbos/b3f749ca1b914841e6c0575cadda1697 to your computer and use it in GitHub Desktop.
Blender to MDB/GR2 and back
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import sys | |
argv = sys.argv | |
argv = argv[argv.index("--") + 1:] # get all args after "--" | |
fbx_out = argv[0] | |
bpy.ops.export_scene.fbx(filepath=fbx_out, | |
axis_forward='-Z', | |
axis_up='Y', | |
use_tspace=True, | |
use_custom_props=True, | |
add_leaf_bones=False, | |
bake_anim=True, | |
bake_anim_use_all_bones=False, | |
bake_anim_use_nla_strips=False, | |
bake_anim_use_all_actions=False, | |
bake_anim_force_startend_keying=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"%~dp0blend2nw.cmd" %* > log.txt 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blender %1 --background --python "%~dp0blend2fbx.py" -- "%~dpn1.fbx" | |
"%~dp0fbx2nw" "%~dpn1.fbx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import sys | |
argv = sys.argv | |
argv = argv[argv.index("--") + 1:] # get all args after "--" | |
fbx_in = argv[0] | |
blend_out = argv[1] | |
# Clear scene | |
bpy.ops.object.select_all(action='SELECT') | |
bpy.ops.object.delete() | |
bpy.ops.import_scene.fbx(filepath=fbx_in, | |
use_image_search=False) | |
bpy.ops.wm.save_mainfile(filepath=blend_out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"%~dp0nw2blend.cmd" %* > log.txt 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"%~dp0nw2fbx" %* | |
IF ERRORLEVEL 1 EXIT /B 1 | |
blender --background --python "%~dp0fbx2blend.py" -- "%~dpn1.fbx" "%~dpn1.blend" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment