Acurate Use of the "Set Base Options"- Node of Datasmith importer at runtime

I am not sure about how to connect Targt of the “Set Base Options”- Node. My Feeling ist that i can only use Datasmith Runtime Import Options properly. ( i am importing gltf Files at runtime. ) In the BaseOptions struct “DatasmithImportBaseOptions” there is the option to remove degenerates (Triangles that look like lines) , that i want to activate. Please enlighten me about the accurate use of the Set Base Options.

I am not sure the option is available to you in datasmith.

Are you on 5.1 or higher? You should not use datasmith for glTF import anymore
I would thus use interchange instead: Box go to editor blueprint > Interchange import

  1. Basically you need that code and to call the import scene if you want the import to spawn your gltf in the runtime application or the import asset if you want to just get assets and then you do the spawning yourself

  2. If you do not mind that all you import (obj, fbx and gltf) got same remove degenerates options I would just replace the default pipeline for the asset/scene import with one that as remove degenerates enabled by default.
    go and look for the pipeline asset (according to asset or scene) depending on your target import

  3. make a copy in a custom folder


  4. edit it to have remove degenerates at on by default

  5. replace the pipeline in your default asset/scene import

Now any default interchange import into level will have remove degenerates toggle by default.

If you want to only switch for some format you can add some code to override the pipelines on import (see in 1) graph) and point to your custom pipeline instead of the default one.

yes i am on 5.1 , okay i will try it out. Thanky you und have a happy Weekend.

Okay i have done your steps, but no idea how to go on from there.

with Datasmith import i get back a reference so that i can proceed with tests and move the imported actor arround. Here i have only the created source.
i can’t spawn the source directly as an Actor. Should i use reimport pin ? (on an Empty spawned Actor , i alrdy tried without success in my first attempt. ).

The loaded Files at runtime will be part of a simulation.

First I forgot that you might have to add the /interchange/ folder to your cook folder as you might miss somethings on import: do you get any warnings on material, pipelines or any assets that UE cannot find?

Then if you import using Import Scene it should spawn the actor in the scene directly, then you might have to look for it by browsing the actor in the scene
Else you can do an asset import but then you will need to
Spawn the actor manually, parse the folder where you did the import of assets to look for static meshes there.


Yes indeed got Errors with "load scene node
fehlermeldung interchange import.txt (4.0 KB)
"
even after adding the interchange folder the error log remains unchanged( various interchange folders were already listed.

i am still interested in an alternative way for importing at runtime.
Since i have still crashes with Datasmith.

I have two reports of failure to ship with interchange.
I am trying to investigate that on my spare time and will give update when I sort it out.

The alternate route, that should be working is to go with datasmith runtime, activating gltf support for datasmith.

Thank you, Importing with Datasmith works most of the time. I have one Crash at startup and occasionally during runtime. Thats why i am looking for interchange.

Thank you for your time.

Okay so glTF import in 5.1 runtime works with Interchange:

I tried:

  • in an empty game template
  • and adding the /interchange path to cooking folder (so UE ships the default material needed at runtime)
  • and enabling the Datasmith Interchange plugin, that is not intuitive but that is necessary to get the reference to the struct ImportAssetParemeters. I will see if that could be put somewhere else.
  • and in build development (does not work in shipping)

glTFRuntimeImport51.zip (41.2 KB)
Just change the path to the gltf files in the UW_ImportButton asset.

I tested it out this mornig. i put 2 example files from me in the default path of duck and boat. It seems the first Import works with a warning, but ne second import crashes alsways: ( no matter if i click the same button again or the other one, the engine crashes. ) the problem maybe lies partly in the files, i use. The Warnig i get by the first import is: LogStaticMesh: Warning: test_part has degenerate tangent bases which will result in incorrect shading. MikkTSpace relies on tangent bases and may result in mesh corruption, consider disabling this option.
LogStaticMesh: Warning: test_part has some nearly zero bi-normals which can create some issues. (Tolerance of 1E-4)"

Either way u helped me very much with your example project. Thank you very much.
[spoiler]

Assertion failed: StaticMesh->GetRenderData()->IsInitialized() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\Components\StaticMeshComponent.cpp] [Line: 2195] Uninitialized Renderdata for Mesh: test_part, Mesh NeedsLoad: 0, Mesh NeedsPostLoad: 0, Mesh Loaded: 0, Mesh NeedInit: 0, Mesh IsDefault: 0

UnrealEditor_Engine!UStaticMeshComponent::SetStaticMesh() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\Components\StaticMeshComponent.cpp:2188]
UnrealEditor_InterchangeImport!UInterchangeStaticMeshActorFactory::SetupStaticMeshActor() [D:\build\++UE5\Sync\Engine\Plugins\Interchange\Runtime\Source\Import\Private\Scene\InterchangeStaticMeshActorFactory.cpp:59]
UnrealEditor_InterchangeImport!UInterchangeStaticMeshActorFactory::CreateSceneObject() [D:\build\++UE5\Sync\Engine\Plugins\Interchange\Runtime\Source\Import\Private\Scene\InterchangeStaticMeshActorFactory.cpp:32]
UnrealEditor_InterchangeEngine!UE::Interchange::FTaskCreateSceneObjects::DoTask() [D:\build\++UE5\Sync\Engine\Source\Runtime\Interchange\Engine\Private\Tasks\InterchangeTaskCreateSceneObjects.cpp:78]
UnrealEditor_InterchangeEngine!TGraphTask<UE::Interchange::FTaskCreateSceneObjects>::ExecuteTask() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:1348]
UnrealEditor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:760]
UnrealEditor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:649]
UnrealEditor_Core!FTaskGraphCompatibilityImplementation::WaitUntilTasksComplete() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:2203]
UnrealEditor_InterchangeEngine!UE::Interchange::FImportResult::WaitUntilDone() [D:\build\++UE5\Sync\Engine\Source\Runtime\Interchange\Engine\Private\InterchangeManager.cpp:472]
UnrealEditor_InterchangeEngine!UInterchangeManager::ImportScene() [D:\build\++UE5\Sync\Engine\Source\Runtime\Interchange\Engine\Private\InterchangeManager.cpp:956]
UnrealEditor_InterchangeEngine!UInterchangeManager::execImportScene() [D:\build\++UE5\Sync\Engine\Intermediate\Build\Win64\UnrealEditor\Inc\InterchangeEngine\UHT\InterchangeManager.gen.cpp:324]
UnrealEditor_CoreUObject!UFunction::Invoke() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:6455]
UnrealEditor_CoreUObject!UObject::CallFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1129]
UnrealEditor_CoreUObject!UObject::ProcessContextOpcode() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:3139]
UnrealEditor_CoreUObject!UObject::execLetBool() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:3030]
UnrealEditor_CoreUObject!ProcessLocalScriptFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1199]
UnrealEditor_CoreUObject!ProcessScriptFunction<void (__cdecl*)(UObject *,FFrame &,void *)>() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1029]
UnrealEditor_CoreUObject!ProcessLocalFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1269]
UnrealEditor_CoreUObject!ProcessLocalScriptFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1199]
UnrealEditor_CoreUObject!UObject::ProcessInternal() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1296]
UnrealEditor_CoreUObject!UFunction::Invoke() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:6455]
UnrealEditor_CoreUObject!UObject::ProcessEvent() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:2127]
UnrealEditor_UMG!TMulticastScriptDelegate<FWeakObjectPtr>::ProcessMulticastDelegate<UObject>() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\UObject\ScriptDelegates.h:493]
UnrealEditor_UMG!UButton::SlateHandleClicked() [D:\build\++UE5\Sync\Engine\Source\Runtime\UMG\Private\Components\Button.cpp:219]
UnrealEditor_UMG!TBaseUObjectMethodDelegateInstance<0,UButton,FReply __cdecl(void),FDefaultDelegateUserPolicy>::Execute() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:601]
UnrealEditor_Slate!SButton::ExecuteOnClick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Slate\Private\Widgets\Input\SButton.cpp:465]
UnrealEditor_Slate!SButton::OnMouseButtonUp() [D:\build\++UE5\Sync\Engine\Source\Runtime\Slate\Private\Widgets\Input\SButton.cpp:390]
UnrealEditor_Slate!<lambda_51e270ca99ea7ce852539efd04dd453f>::operator()() [D:\build\++UE5\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:5046]
UnrealEditor_Slate!FEventRouter::Route<FReply,FEventRouter::FToLeafmostPolicy,FPointerEvent,<lambda_51e270ca99ea7ce852539efd04dd453f> >() [D:\build\++UE5\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:412]
UnrealEditor_Slate!FSlateApplication::RoutePointerUpEvent() [D:\build\++UE5\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:5032]
UnrealEditor_Slate!FSlateApplication::ProcessMouseButtonUpEvent() [D:\build\++UE5\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:5601]
UnrealEditor_Slate!FSlateApplication::OnMouseUp() [D:\build\++UE5\Sync\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:5566]
UnrealEditor_ApplicationCore!FWindowsApplication::ProcessDeferredMessage() [D:\build\++UE5\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:2219]
UnrealEditor_ApplicationCore!FWindowsApplication::DeferMessage() [D:\build\++UE5\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:2726]
UnrealEditor_ApplicationCore!FWindowsApplication::ProcessMessage() [D:\build\++UE5\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:1895]
UnrealEditor_ApplicationCore!FWindowsApplication::AppWndProc() [D:\build\++UE5\Sync\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:925]
user32
user32
InkObj

[/spoiler]

Hello!
I would like to inquire about the issue of importing datasmith files from runtime.
I use datasmith runtime to import files, but after the program is packaged, the imported lights will be lost.
When using pipeline import, all imported RectLight will become pointlight.