Skip to content

Commit

Permalink
Added Category
Browse files Browse the repository at this point in the history
  • Loading branch information
TitusLVR committed Dec 12, 2022
1 parent 9c94269 commit 3c8f33a
Show file tree
Hide file tree
Showing 4 changed files with 299 additions and 119 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bl_info = {
"name": "BMAX Connector",
"author": "Titus Lavrov / Email: [email protected]",
"version": (0, 1, 4),
"version": (0, 1, 6),
"blender": (2, 80, 0),
"location": "View3D > Toolbar and View3D",
"warning": "",
Expand Down
113 changes: 56 additions & 57 deletions functions/FBX_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,61 @@
import tempfile
from .misc import (BMAX_Add_Custom_prop, BMAX_Delete_Custom_prop)

def BMAX_Export():
#---Variables---
prefs = bpy.context.preferences.addons['BMAX_Connector'].preferences
customPath = prefs.tempFolder
if customPath == '':
path = "" + tempfile.gettempdir() + "\\BMAX"
path = '/'.join(path.split('\\'))
if not os.path.exists(path):
os.makedirs(path)
else:
path = prefs.tempFolder

temp_file_blender = path + "/BMAX_TMP_BLENDER.fbx"

#---EXPORT---
if prefs.export_reset_location or prefs.export_reset_rotation or prefs.export_reset_scale:
BMAX_Add_Custom_prop()
def BMAX_Export():
#---Variables---
prefs = bpy.context.preferences.addons['BMAX_Connector'].preferences
customPath = prefs.tempFolder
if customPath == '':
path = "" + tempfile.gettempdir() + "\\BMAX"
path = '/'.join(path.split('\\'))
if not os.path.exists(path):
os.makedirs(path)
else:
path = prefs.tempFolder

temp_file_blender = path + "/BMAX_TMP_BLENDER.fbx"

global_scale = bpy.context.preferences.addons['BMAX_Connector'].preferences.global_scale_export
bpy.ops.export_scene.fbx(filepath = temp_file_blender,
check_existing=True,
filter_glob="*.fbx",
use_selection=True,
use_active_collection=False,
global_scale=global_scale,
apply_unit_scale=True,
apply_scale_options='FBX_SCALE_ALL',
bake_space_transform=True,
object_types= {'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH', 'OTHER'},
use_mesh_modifiers=True,
use_mesh_modifiers_render=True,
mesh_smooth_type='OFF',
use_mesh_edges=False,
use_tspace=False,
use_custom_props=True,
add_leaf_bones=False,
primary_bone_axis='Y',
secondary_bone_axis='X',
use_armature_deform_only=False,
armature_nodetype='NULL',
bake_anim=False,
bake_anim_use_all_bones=False,
bake_anim_use_nla_strips=False,
bake_anim_use_all_actions=False,
bake_anim_force_startend_keying=False,
bake_anim_step=1,
bake_anim_simplify_factor=1,
path_mode='AUTO',
embed_textures=False,
batch_mode='OFF',
use_batch_own_dir=True,
use_metadata=False,
axis_forward='Y',
axis_up='Z'
)

if prefs.export_reset_location or prefs.export_reset_rotation or prefs.export_reset_scale:
BMAX_Delete_Custom_prop()
#---EXPORT---
if prefs.export_reset_location or prefs.export_reset_rotation or prefs.export_reset_scale:
BMAX_Add_Custom_prop()

bpy.ops.export_scene.fbx(filepath = temp_file_blender,
check_existing=True,
filter_glob="*.fbx",
use_selection=True,
use_active_collection=False,
global_scale=prefs.global_scale_export,
apply_unit_scale=prefs.fbx_export_apply_unit_scale,
apply_scale_options=prefs.fbx_export_apply_scale_options,
use_space_transform =prefs.fbx_export_use_space_transform,
bake_space_transform=prefs.fbx_export_bake_space_transform,
object_types={'EMPTY', 'CAMERA', 'LIGHT', 'ARMATURE', 'MESH', 'OTHER'},
use_mesh_modifiers=prefs.fbx_export_use_mesh_modifiers,
use_mesh_modifiers_render=prefs.fbx_export_use_mesh_modifiers_render,
mesh_smooth_type=prefs.fbx_export_mesh_smooth_type,
use_mesh_edges=prefs.fbx_export_use_mesh_edges,
use_tspace=prefs.fbx_export_use_tspace,
use_custom_props=prefs.fbx_export_use_custom_props,
add_leaf_bones=False,
primary_bone_axis='Y',
secondary_bone_axis='X',
use_armature_deform_only=False,
armature_nodetype='NULL',
bake_anim=False,
bake_anim_use_all_bones=False,
bake_anim_use_nla_strips=False,
bake_anim_use_all_actions=False,
bake_anim_force_startend_keying=False,
bake_anim_step=1,
bake_anim_simplify_factor=1,
path_mode='AUTO',
embed_textures=False,
batch_mode='OFF',
use_batch_own_dir=True,
use_metadata=True,
axis_forward=prefs.fbx_export_axis_forward,
axis_up=prefs.fbx_export_axis_up,
)

if prefs.export_reset_location or prefs.export_reset_rotation or prefs.export_reset_scale:
BMAX_Delete_Custom_prop()
6 changes: 3 additions & 3 deletions functions/FBX_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def BMAX_Import():
use_anim=False,
anim_offset=1,
use_custom_props=True,
use_custom_props_enum_as_string=False,
ignore_leaf_bones=False,
use_custom_props_enum_as_string=True,
ignore_leaf_bones=True,
force_connect_children=False,
automatic_bone_orientation=False,
automatic_bone_orientation=True,
primary_bone_axis='Y',
secondary_bone_axis='X',
use_prepost_rot=True,
Expand Down
Loading

0 comments on commit 3c8f33a

Please sign in to comment.