Import glTF animations and generate flat BasicShapes in a Linux UE6 commandlet
Section titled “Import glTF animations and generate flat BasicShapes in a Linux UE6 commandlet”- Status: Current.
- Engine: ue6-main
61e2877e1, Linux x86_64, Epic clang 23.1.5. - Context: Standalone UE6 editor with PythonScriptPlugin, EditorScriptingUtilities and Interchange. The example uses the Coop Zero slice project.
- Prerequisites: Enable
Interchange.FeatureFlags.Import.Enable=Truein[ConsoleVariables]in DefaultEngine.ini. Use an editor commandlet with Vulkan SM6 rendering when creating or recompiling the materials.
Symptom
Section titled “Symptom”A skinned glTF file with local animation clips must become a skeletal mesh, skeleton and animation sequences. The environment also needs copies of the engine shapes with custom flat tints. Calling material.set_shading_model(...) from Python in this build gives AttributeError: 'Material' object has no attribute 'set_shading_model'.
For a translucent mesh on a Nanite-enabled BasicShapes copy, the rendered placement first logged Invalid material [MI_ghost] used on Nanite static mesh [SM_Cube_ghost] with [BLEND_Translucent] blend mode was specified.
Smallest example / reproduction
Section titled “Smallest example / reproduction”Run the following in the editor commandlet with a skinned and animated local hen.glb. Inspect the object paths that Interchange returns. The default pipeline can add the source basename and asset-type subfolders to the requested destination path.
import unreal
task = unreal.AssetImportTask()task.filename = "/absolute/path/to/hen.glb"task.destination_path = "/Game/CoopZero/ThirdParty/Styloo/hen"task.automated = Truetask.replace_existing = Truetask.save = Trueunreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])for asset in task.get_objects(): unreal.log(f"{asset.get_class().get_name()} {asset.get_path_name()}")Solution
Section titled “Solution”For an unlit translucent variant, create a Material with MaterialFactoryNew, then edit its reflected properties.
material.set_editor_property("blend_mode", unreal.BlendMode.BLEND_TRANSLUCENT)material.set_editor_property("shading_model", unreal.MaterialShadingModel.MSM_UNLIT)library = unreal.MaterialEditingLibrarytint = library.create_material_expression(material, unreal.MaterialExpressionVectorParameter, -360, 0)tint.set_editor_property("parameter_name", "BaseTint")library.connect_material_property(tint, "RGB", unreal.MaterialProperty.MP_EMISSIVE_COLOR)library.connect_material_property(tint, "A", unreal.MaterialProperty.MP_OPACITY)errors = library.recompile_material(material)if errors: raise RuntimeError(errors)For an opaque lit master, connect RGB to MP_BASE_COLOR and use a constant for roughness. Set used_with_skeletal_mesh on the opaque master before compiling when an instance will tint a skeletal mesh. Create a MaterialInstanceConstant with the corresponding parent and set BaseTint. Duplicate a BasicShapes mesh using EditorAssetLibrary.duplicate_asset, then call set_material(0, instance) on the duplicate and save it.
Translucent mesh on a Nanite-enabled BasicShapes copy. The duplicated cube inherited Nanite from the source. Before setting the mesh on its placed component, opt into its regular fallback mesh.
component.set_editor_property("disallow_nanite", True)component.set_static_mesh(ghost_mesh)Why it works
Section titled “Why it works”UMaterial::SetShadingModel is a native method on this engine revision. The editable ShadingModel property is reflected and writing it through set_editor_property updates the material in the editor. Duplicating /Engine/BasicShapes before calling set_material keeps the slot change in a project asset. An imported skeletal actor can serialize an idle with override_animation_data, which also selects single-node animation mode.
Verified
Section titled “Verified”- Evidence level: Runs in editor.
- How:
- The lane’s wrapper ran
UnrealEditor-Cmd CoopZero.uproject -run=PythonScript -Script=Scripts/ue_import.py -unattended -AllowCommandletRendering -RenderOffscreen. The editor loggedSTYLOO_IMPORT source=hen.glb types=AnimSequence,MaterialInstanceConstant,PhysicsAsset,SkeletalMesh,Skeleton,Texture2D animations=hencockdoodledooLOL,henidle,henrun,henspotted,henwalk_. The rooster also returned five animation sequences. The coop returned two static meshes. - The same command with
Scripts/make_placeholders.pyloggedPLACEHOLDER_KIT meshes=27 colours=17after the shading property change. Coop ZeroREPORT.mdhas the full command lines and log paths. - Translucent mesh on a Nanite-enabled BasicShapes copy: with this property saved,
UnrealEditor-Cmd CoopZero.uproject -run=PythonScript -Script=Scripts/build_slice_map.py -unattended -AllowCommandletRendering -RenderOffscreenreloaded the map withSLICE_MAP actors=67 map=/Game/Maps/Slice unmanaged=0. The rendered editor logSaved/step05-place-clean.loghad zero occurrences of the Nanite material warning. This opt-out applies to the placed component.
- The lane’s wrapper ran
- Date / by: 2026-11-25, not recorded.
Limits and assumptions
Section titled “Limits and assumptions”The glTF result reflects the tested files and Interchange defaults on this engine revision. The catalogue also contains imported materials and textures. Coop Zero assigns separate flat instances on the placed scenery. The step does not exercise clip switching or chicken rules.