I am trying to import an alembic groom and apply conversion settings via Python.
In the unreal
module I’ve found unreal.GroomImportOptions
and unreal.GroomConversionSettings
. I’ve created instances of both, and set the “conversion_settings” editor property of the GroomImportOptions
with my GroomConversionSettings
. The GroomImportOptions
are then passed to my asset import function. The imported groom did not receive the conversion settings during the import.
I’m new to unreal and wondering where this is breaking down. Is my build_import_task function breaking something, or missing something? Do I need to modify the editor’s Groom Import Options (the ui) via Python somehow before attempting to import? Using UE 4.26. Appreciate any help here. Thanks!
Here’s the code I’m using:
def build_groom_options():
# xgen conversion values
vec_rot = unreal.Vector(-90, 0.0, 0.0)
vec_scl = unreal.Vector(1.0, 1.0, -1.0)
# conversion settings
groom_settings = unreal.GroomConversionSettings()
groom_settings.set_editor_property('rotation', vec_rot)
groom_settings.set_editor_property('scale', vec_scl)
# generate options and combine conversion settings
groom_options = unreal.GroomImportOptions()
groom_options.set_editor_property('conversion_settings', groom_settings)
return groom_options
def build_import_task(path, destination, name=None, options=None):
if not name:
name = "no_name"
task = unreal.AssetImportTask()
task.set_editor_property('automated', True)
task.set_editor_property('destination_name', name)
task.set_editor_property('destination_path', destination)
task.set_editor_property('filename', path)
task.set_editor_property('replace_existing', True)
task.set_editor_property('replace_existing_settings', True)
task.set_editor_property('save', False)
task.set_editor_property('options', options)
return task
def exec_import(tasks):
result = unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks(tasks)
return result
def import_asset(path, destination, name=None, options=None):
task = build_import_task(path, destination, name, options)
exec_import([task])
return task
# test
path = "/path/to/hair.abc"
dest = "/Game/Hair"
name = "hair_001"
options = build_groom_options()
import_asset(path, dest, name, options)