Convert Static to Skeletal Mesh via Python API

Hi,

Via the Python API, how can I do the equivalent to:
static mesh “right click” > “Convert to Skeletal Mesh” > (set options) > Convert
(step 2 in the “Creating a Skeletal mesh” section here)

I came across the InterchangePipelineMeshesUtilitiesContext docs, but I am not sure if I am heading in the right direction. Any guidance/snippets will be really appreciated! :pray:

Thanks beforehand!

Hello Rubb85,

With Interchange you could import your assets to be SkeletalMesh always, via setting the ForceAllMeshAsType variable on the CommonMeshesPropertiesof the AssetsPipeline.

Here is a snippet to help you get started:

import os
import sys
import unreal

import_file = os.path.normpath('pathToYourFile')
import_directory = 'PathToContentFolder' 
#for example /Game/ImportFolder

import_asset_parameters = unreal.ImportAssetParameters()
# To import without import dialog popping:
import_asset_parameters.is_automated = True 
interchange_manager = unreal.InterchangeManager.get_interchange_manager_scripted()
source_data = interchange_manager.create_source_data(import_file)

# Create pipeline in case you don't have your own yet.
assets_pipeline = unreal.InterchangeGenericAssetsPipeline()
# Force all Mesh types to be SkeletalMeshes:
assets_pipeline.common_meshes_properties.force_all_mesh_as_type = unreal.InterchangeForceMeshType.IFMT_SKELETAL_MESH

# To use the created pipeline with the force all mesh setting:
import_asset_parameters.override_pipelines.append(unreal.SoftObjectPath(assets_pipeline.get_path_name()))

interchange_manager.import_asset(import_directory,source_data,import_asset_parameters)

Hope this helps on your journey!

Much obliged,
Balazs Toereki
4D Pipeline