Merge pull request #5002 from ynput/bugfix/unreal-fix_frame_range_camera

This commit is contained in:
Simone Barbieri 2023-05-22 14:30:01 +01:00 committed by GitHub
commit 0aae3e9b2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,6 +286,26 @@ class CameraLoader(plugin.Loader):
self.fname
)
# Set range of all sections
# Changing the range of the section is not enough. We need to change
# the frame of all the keys in the section.
for possessable in cam_seq.get_possessables():
for tracks in possessable.get_tracks():
for section in tracks.get_sections():
section.set_range(
data.get('clipIn'),
data.get('clipOut') + 1)
for channel in section.get_all_channels():
for key in channel.get_keys():
old_time = key.get_time().get_editor_property(
'frame_number')
old_time_value = old_time.get_editor_property(
'value')
new_time = old_time_value + (
data.get('clipIn') - data.get('frameStart')
)
key.set_time(unreal.FrameNumber(value=new_time))
# Create Asset Container
unreal_pipeline.create_container(
container=container_name, path=asset_dir)