Download

Python Scripting Gltf Import

I am trying to import GLTF File through a python script but getting Following error Wither I use any of the following class:
unreal.GLTFImportFactory
unreal.DatasmithImportOptions
unreal.DatasmithStaticMeshGLTFImportData

None of them worked …

from os import path
import unreal

unreal.log("Creating Folder")
localfilePath=r"D:\Valorant_map_exporter\Test.gltf"
assetGamePath="/game/triad_art/"
assetName=path.splitext(path.basename(localfilePath))[0]
content_name="Light"
content_path=assetGamePath+content_name
#Content
unreal.EditorAssetLibrary.make_directory(content_path)
unreal.log(print(content_path))


task = unreal.AssetImportTask()
task.filename= localfilePath
task.destination_name=assetName
task.destination_path= assetGamePath
task.replace_existing = True
task.automated=True
task.save=True
#task.factory=unreal.DatasmithGLTFImportOptions()


task.options=unreal.GLTFImportFactory()
#task.options.Import_Uniform_Scale=100.0
#task.options.generate_lightmap_u_vs = False
#task.options.include_animation=True
#task.options.Lights=False
#task.options.Cameras=False
#task.options.Animation=False

unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])
importedAssets = task.get_editor_property('imported_object_paths')
if not importedAssets:unreal.log_error('Failed to import {0}'.format(localfilePath))
else: unreal.log('Sucessfully Imported {0}'.format(localfilePath))

the error that I got is:

Cmd: py "D:/Valorant_map_exporter/Unreal Scripting/Test.py"
LogPython: Creating Folder
LogPython: /game/triad_art/Light
LogPython: None
LogFactory: FactoryCreateFile: StaticMesh with GLTFImportFactory (0 0 D:\Valorant_map_exporter\Test.gltf)
D:\Valorant_map_exporter\Test.gltf
LogSlate: Warning: A modal window tried to take control while running in unattended script mode. The window was canceled.
LogStats: FPlatformStackWalk::StackWalkAndDump -  0.005 s
LogOutputDevice: Error: === FDebug::DumpStackTrace(): ===
LogOutputDevice: Error: [Callstack] 0x00007ff9d31bccba UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9aaf32867 UE4Editor-GLTFImporter.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9aaf2fe6a UE4Editor-GLTFImporter.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9c352c0b1 UE4Editor-UnrealEd.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9b8f87c16 UE4Editor-AssetTools.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9b8f84a59 UE4Editor-AssetTools.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9b8fed2ca UE4Editor-AssetTools.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9c2932604 UE4Editor-CoreUObject.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9c2bc0e63 UE4Editor-CoreUObject.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adbb7ea1 UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb9967f UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb98e7a UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb9a035 UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb4ab4c UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa0d92f2b6 python37.dll!_PyObject_FastCallKeywords() [c:\a\18\s\objects\call.c:199]
LogOutputDevice: Error: [Callstack] 0x00007ffa0d92dc3b python37.dll!call_function() [c:\a\18\s\python\ceval.c:4619]
LogOutputDevice: Error: [Callstack] 0x00007ffa0d9353b8 python37.dll!_PyEval_EvalFrameDefault() [c:\a\18\s\python\ceval.c:3095]
LogOutputDevice: Error: [Callstack] 0x00007ffa0d92e3ac python37.dll!_PyEval_EvalCodeWithName() [c:\a\18\s\python\ceval.c:3930]
LogOutputDevice: Error: [Callstack] 0x00007ffa0d93b573 python37.dll!PyEval_EvalCodeEx() [c:\a\18\s\python\ceval.c:3966]
LogOutputDevice: Error: [Callstack] 0x00007ffa0d93b4d1 python37.dll!PyEval_EvalCode() [c:\a\18\s\python\ceval.c:530]
LogOutputDevice: Error: [Callstack] 0x00007ff9adb50395 UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb81efd UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb50950 UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb507fa UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb50716 UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d39d1000 UE4Editor-Core.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9c2b21d47 UE4Editor-CoreUObject.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9c5db4c2a UE4Editor-Engine.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9c33db448 UE4Editor-UnrealEd.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9c3c5db77 UE4Editor-UnrealEd.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb66cda UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9adb51021 UE4Editor-PythonScriptPlugin.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d32bee15 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d32c5600 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d329b807 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d333859e UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d335071e UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d32c6d75 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d31946be UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d3217f14 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d3200337 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff9d31f3632 UE4Editor-Slate.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa1595bcb5 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa15949197 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa1595e389 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa15944310 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa358fe858 USER32.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa358fe299 USER32.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa1595f914 UE4Editor-ApplicationCore.dll!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7df748848 UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7df76117c UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7df76125a UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7df7752bd UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ff7df777fea UE4Editor.exe!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa34317034 KERNEL32.DLL!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffa35f62651 ntdll.dll!UnknownFunction []
LogAssetTools: The import task was canceled.
LogFileHelpers: No new changes to save!
LogPython: Error: Failed to import D:\Valorant_map_exporter\Test.gltf

please help me out… :slight_smile:

same here.