Skip to content

Commit ae5fd16

Browse files
authored
Update PythonConsole.md
using updated PyFbxFactory to import animation assets
1 parent ae2eff3 commit ae5fd16

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

docs/PythonConsole.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ This is an ad-hoc factory subclassing the standard FbxFactory (many thanks to Ch
121121
import unreal_engine as ue
122122
import os
123123
import os.path
124+
from unreal_engine.classes import PyFbxFactory, Skeleton
125+
from unreal_engine.enums import EFBXImportType
124126

125127
"""
126128
Scan a directory for FBX's and import them with a single skeleton
@@ -135,23 +137,19 @@ skeleton_name = 'UE4_Mannequin_Skeleton'
135137
skeleton = ue.find_object(skeleton_name)
136138

137139
# get the PyFbxFactory
138-
factory = ue.find_class('PyFbxFactory')
140+
factory = PyFbxFactory()
139141

140142
# setup fbx importer options
141-
fbx_import_ui_class = ue.find_class('FbxImportUI')
142-
fbx_import_ui = ue.new_object(fbx_import_ui_class)
143-
fbx_import_ui.set_property('Skeleton', skeleton)
144-
143+
factory.ImportUI.MeshTypeToImport = EFBXImportType.FBXIT_Animation
144+
factory.ImportUI.Skeleton = skeleton
145145

146146
# the fbx import procedure
147147
def fbx_import(filename, asset_name):
148148
ue.log('importing ' + filename + ' to ' + asset_name)
149-
# set import options
150-
ue.set_fbx_import_option(fbx_import_ui)
151-
# import he file using PyFbxFactory
152-
asset = ue.import_asset(filename, asset_name, factory)
149+
# import the file using PyFbxFactory
150+
asset = factory.factory_import_object(filename, asset_name)
153151
# print the skeleton name
154-
ue.log('FBX imported with skeleton: ' + asset.get_property('Skeleton').get_name())
152+
ue.log('FBX imported with skeleton: ' + asset.Skeleton.get_name())
155153

156154

157155
# scan the directory and uatomatically assign a name using an incremental id

0 commit comments

Comments
 (0)