Download

Add user-defined dataprep operation

Using EditorDataprepAssetLibrary class I can add an action to the existing dataprep asset like this:

dataprep_asset_library = unreal.EditorDataprepAssetLibrary()
dataprep_action = dataprep_asset_library.add_action(dataprep_asset)

There are also many predefined classes in the unreal module, that can be added as a step to the newly created action. For example, to add a step for material replacement I would write:

dataprep_step = dataprep_asset_library.add_step(dataprep_action, unreal.DataprepSubstituteMaterialByTableOperation)

Now I have created a user-defined operation:
user_defined_dataprep_operation
and would like to add it as a step to the dataprep action.
How could it be done?

The ‘add_step’ function only accepts the class (basically the type) of the step. I actually see no way to add an existing class as a step…
Do I miss something or is there a workaround for that?

Best regards,
AK

Hello reg_ex_us,

with some internal help I got your answer:
you need to get the generated class of the custom fetcher / operation assets

custom_fetcher_typeClass = unreal.EditorAssetLibrary.load_blueprint_class('/Game/test/DF_Custom')
custom_operation_typeClass = unreal.EditorAssetLibrary.load_blueprint_class('/Game/test/DO_Test')
...
dataprep_step1 = dataprep_asset_library.add_step(dataprep_action, custom_fetcher_typeClass)
dataprep_step2 = dataprep_asset_library.add_step(dataprep_action, custom_operation_typeClass)

1 Like

Hello UE_FlavienP,

now I see, ‘load_blueprint_class’ is the function that I was missing.

Gave it a try now and it works like a charm, thank you so much!

Best regards,
AK