Steps to Reproduce
I’m using the Unreal Editor Python API to automate the creation of some components in an existing blueprint, based on what’s found in a user’s scene/level. This is working well for turning static mesh actors in a level into StaticMeshComponents in the target BP. Now I’m attempting the same with Blueprint Actors used for lighting. These lighting BPs are placed in the level and often customized per-instance, with modified light colors, attenuation, etc. Those property overrides need to be replicated in the target BP as well. This is working up to a point…
First I’m turning them into ChildActorComponents in the target BP, as shown below. After that runs, the desired lighting BP shows up as expected in the target BP when loaded in the blueprint editor. The property overrides applied in the “source” level do not. This isn’t surprising since all I’m doing is referencing that BP’s class in the ChildActorComponent. I thought the solution may be to set the “child_actor” property on the component to be the one from the level. Something like this:
child_actor_comp.set_editor_property(‘child_actor’, actor)
However, that editor property is read-only. I’ve found no way to set the actual child actor, or otherwise bring the overrides over into the target BP this is building.
Is what I’m attempting possible/correct, but just a limit of the current Python API exposure? Or is there a better approach for this?
Thank you.
`add_light_params = unreal.AddNewSubobjectParams(
parent_handle=scene_handle,
new_class=unreal.ChildActorComponent,
blueprint_context=bp_asset,
)
subobj_data_subsys.rename_subobject(handle=subobj_handle, new_name=actor.get_name())
subobj_data_subsys.attach_subobject(owner_handle=scene_handle, child_to_add_handle=subobj_handle)
child_actor_comp = unreal.SubobjectDataBlueprintFunctionLibrary.get_object(unreal.SubobjectDataBlueprintFunctionLibrary.get_data(subobj_handle))
child_actor_comp.set_child_actor_class(actor.get_class())
child_actor_comp.set_world_transform(actor.get_actor_transform(), False, False)`