0

I want to change the scaling mode in blender

enter image description here

based on documentation I can do it:

apply_unit_scale

apply_unit_scale (boolean, (optional)) – Apply Unit, Take into account current Blender units settings (if unset, raw Blender Units values are used as-is)

apply_scale_options

apply_scale_options (enum in ['FBX_SCALE_NONE', 'FBX_SCALE_UNITS', 'FBX_SCALE_CUSTOM', 'FBX_SCALE_ALL'], (optional)) –

I tried to change the scaling mode to unit scaling in blender but I don't know why it didn't work

import bpy

bpy.ops.export_scene.fbx(apply_unit_scale=True) bpy.ops.export_scene.fbx(apply_scale_options='FBX_SCALE_UNITS')

I have this error in the console:

enter image description here

I also tried to copy and paste the example in the console but I have same error!:

bpy.ops.export_scene.fbx(filepath="", check_existing=True, filter_glob="*.fbx", use_selection=False, use_active_collection=False, global_scale=1.0, apply_unit_scale=True, apply_scale_options='FBX_SCALE_NONE', bake_space_transform=False, object_types={'ARMATURE', 'CAMERA', 'EMPTY', 'LIGHT', 'MESH', 'OTHER'}, use_mesh_modifiers=True, use_mesh_modifiers_render=True, mesh_smooth_type='OFF', use_subsurf=False, use_mesh_edges=False, use_tspace=False, use_custom_props=False, add_leaf_bones=True, primary_bone_axis='Y', secondary_bone_axis='X', use_armature_deform_only=False, armature_nodetype='NULL', bake_anim=True, bake_anim_use_all_bones=True, bake_anim_use_nla_strips=True, bake_anim_use_all_actions=True, bake_anim_force_startend_keying=True, bake_anim_step=1.0, bake_anim_simplify_factor=1.0, path_mode='AUTO', embed_textures=False, batch_mode='OFF', use_batch_own_dir=True, use_metadata=True, axis_forward='-Z', axis_up='Y')
brockmann
  • 12,613
  • 4
  • 50
  • 93

1 Answers1

0

oh sorry for this stupid question as Robert Gützkow and brockmann mentioned I didn't set the path

import bpy

#example path to store files path = os.path.expanduser("~/Desktop")

#export fbx filename = path + 'Test.fbx' bpy.ops.export_scene.fbx(filepath=filename, use_selection=True,apply_scale_options='FBX_SCALE_UNITS',apply_unit_scale=True)

os.path.join() method in Python join one or more path components intelligently. This method concatenates various path components with exactly one directory separator (‘/’) following each non-empty part except the last path component. If the last path component to be joined is empty then a directory seperator (‘/’) is put at the end.

import bpy

importing os module

import os

#example path to store files path = os.path.expanduser("~/Desktop")

Join various path components

filename = os.path.join(path, 'Test.fbx')

bpy.ops.export_scene.fbx(filepath=filename, use_selection=True,apply_scale_options='FBX_SCALE_UNITS',apply_unit_scale=True)

Instead of setting path manually, I use this solution