FBXエクスポート演算子-スケーリングモードを変更するにはどうすればよいですか?

Aug 24 2020

Blenderのスケーリングモードを変更したい

ドキュメントに基づいて私はそれを行うことができます:

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)) –

Blenderでスケーリングモードをユニットスケーリングに変更しようとしましたが、なぜそれが機能しなかったのかわかりません

import bpy

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

コンソールに次のエラーがあります。

また、コンソールに例をコピーして貼り付けようとしましたが、同じエラーが発生します!:

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')

回答

SeyedMortezaKamali Aug 23 2020 at 23:40

RobertGützkowとbrockmannが私が道を設定しなかったと言ったので、このばかげた質問をお詫びします

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)

Pythonのos.path.join()メソッドは、1つ以上のパスコンポーネントをインテリジェントに結合します。このメソッドは、最後のパスコンポーネントを除く空でない各部分の後に、ディレクトリ区切り文字( '/')を1つだけ付けて、さまざまなパスコンポーネントを連結します。結合される最後のパスコンポーネントが空の場合、ディレクトリ区切り文字( '/')が最後に配置されます。

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)

パスを手動で設定する代わりに、このソリューションを使用します