Hi! I’m making script-plugins in Python. Currently I’m trying to get objects, that camera sees through the frame range of camera cut section.
def find_rendered_objects(camera_cut_section, sequence, step=10):
unreal.LevelSequenceEditorBlueprintLibrary.open_level_sequence(sequence)
unreal.LevelSequenceEditorBlueprintLibrary.set_lock_camera_cut_to_viewport(True)
start_frame = camera_cut_section.get_start_frame()
end_frame = camera_cut_section.get_end_frame()
bindings = sequence.get_spawnables()
rendered_bindings = list()
for frame in range(start_frame, end_frame, step):
unreal.LevelSequenceEditorBlueprintLibrary.set_current_time(frame)
unreal.LevelSequenceEditorBlueprintLibrary.refresh_current_level_sequence()
for binding in bindings:
binding_id = binding.get_binding_id()
objects = unreal.LevelSequenceEditorBlueprintLibrary.get_bound_objects(binding_id)
for obj in objects:
if unreal.Actor.cast(obj).was_recently_rendered(0.0001):
rendered_bindings.append(binding)
bindings.remove(binding)
return rendered_bindings
The problem is, that the execution blocks the render during run and the functions was_recently_rendered() doesn’t work properly. Is there any method in Python Unreal API, that can force update/refresh viewport?