DatasmithをPythonで読み込むには、こんな感じで書きます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import unreal # ファイルを指定 ds_file = r"ここにDatasmithファイルパスを書く" # メモリに読み込む ds_mem = unreal.DatasmithSceneElement.construct_datasmith_scene_from_file(ds_file) # 一応Nullチェックしておく if ds_mem is None: print "[Error] File is Null." quit() # インポートオプション(必要に応じて設定) options = unreal.DatasmithImportBaseOptions() # 読み込む(※必ずGameで始まるパスにする) ds_mem.import_scene("/Game/NewData", options) # メモリ開放 ds_mem.destroy_scene() print "Import process is complete!" |