I already have a alembic loaded in unreal.
Can anyone help me with a python code to reimport alembic file in unreal.
import unreal
def main():
task = unreal.AssetImportTask()
task.filename = "C:\\Path\\To\\foo.abc"
task.destination_path = "/Game/Path/To"
task.destination_name = "SM_Foo"
task.replace_existing = True
task.automated = True
task.options = unreal.AbcImportSettings()
task.options.import_type = unreal.AlembicImportType.STATIC_MESH
asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
asset_tools.import_asset_tasks([task])
if __name__ == '__main__':
main()
Worked importing a cube, and overwriting it with a cone.
Far from doing all the things FReimportManager does which gets called from the menu youâre showing, but couldnât find that for python. The FReimportManager accessed through the menu does extra stuff like broadcasting that a reimport was done and other validation steps.
Guess one could potentially get that FUIAction, set context browser selection and execute that command - or maybe there is a way to do all the same stuff as FReimportManager in python through AssetImportTask.
You can see the code for the menu in AssetFileContextMenu.cpp
Thanks a lot Andreas.
That worked perfect.
The alembic that i imported is the actor in the level. But i was not able to update this actor in the level.
So I was trying to set the âgeometry cacheâ property in the actor details.
But i have 2 problems
1. set_geometry_cache takes NewGeomCache as an arg.How do i do that?
2. In the following method I had to hardcode the name of the actor. Is there any other way, than hardcoding it?
this is my script:
all_actors = unreal.EditorLevelLibrary().get_all_level_actors()
for actor in all_actors:
if actor.get_name() == âRequiredActorNameâ:
actComp = actor.get_editor_property(âgeometry_cache_componentâ)
actComp.set_geometry_cache(NewGeomCache)
Thanks
Assuming your Alembic is the Geometry Cache, you load that asset and pass it to your unreal.GeometryCacheComponent.set_geometry_cache
To not hardcode youâd make it into a function
def print_name(name):
print(name)
Got it workingâŠthanks a lot
Hey, Ive been trying o import python libraries in ue4 python but i it always shows the same error âModuleNotFoundErrorâ. can you help me with this??