Fix section range on update camera

This commit is contained in:
Simone Barbieri 2023-05-24 12:18:05 +01:00
parent 63b392f35c
commit b5827e8cdf

View file

@ -387,6 +387,30 @@ class CameraLoader(plugin.Loader):
str(representation["data"]["path"])
)
# 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.
project_name = legacy_io.active_project()
asset = container.get('asset')
data = get_asset_by_name(project_name, asset)["data"]
for possessable in new_sequence.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))
data = {
"representation": str(representation["_id"]),
"parent": str(representation["parent"])