Download

How to use python Customizing the Datasmith Import Process in Engine Version 4.19

https://docs.unrealengine.com/en-US/…Import-Process

I read the document find a way to Customizing-the-Datasmith-Import-Process ,but the entine version is 4.20 。

how to find this document in engine version 4.19 ??

How to use python Customizing the Datasmith_Import Process in Engine Version 4.19 ??

Hi,
that page was written for the 4.20 release, because we made a lot of improvements and made the process more consistent. There are also improvements to the Python scripting plugin in 4.20, and the EditorScriptingUtilities plugin. I’d definitely suggest updating to 4.20 if that’s at all possible for you.

That said, I just looked at my 4.19.2 install, and if you’re importing a .udatasmith file the Python and Blueprint APIs look the same as what’s described on that doc page for 4.20.

I just want to use python importing a .udatasmith file


import unreal
ds_file_on_disk = "D:\\1536215961_B2FT.udatasmith"
ds_scene_in_memory = unreal.DatasmithSceneElement.construct_datasmith_scene_from_file(ds_file_on_disk)

but in my 4.19.2 has error but in 4.20.2 is normal 。

error
LogPython: Error: Traceback (most recent call last):
LogPython: Error: File “<string>”, line 1, in <module>
LogPython: Error: AttributeError: ‘module’ object has no attribute ‘DatasmithSceneElement’

It looks like in 4.19 the DatasmithSceneElement was named DatasmithScene:

Also, if you use the DatasmithCADScene to convert a native CAD file instead of a .udatasmith file, you’ll have to call its process_scene() method after you call construct_datasmith_scene_from_file(), but before import_scene().
That method is no longer required in 4.20.

Thank you very much.