Skip to content

Commit

Permalink
Merge pull request #5424 from OpenShot/fix-copy-effects
Browse files Browse the repository at this point in the history
Copy Effects Between Clips (bug fix)
  • Loading branch information
jonoomph authored Feb 16, 2024
2 parents 35729be + 6f2c96e commit a5320b2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/windows/views/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,7 @@ def Copy_Triggered(self, action, clip_ids, tran_ids):
elif action == MENU_COPY_EFFECTS:
self.copy_clipboard[clip_id]['effects'] = clip.data['effects']


# Loop through transition objects
for tran_id in tran_ids:

Expand Down Expand Up @@ -1669,6 +1670,10 @@ def Paste_Triggered(self, action, position, layer_id, clip_ids, tran_ids):
clip.type = 'insert'
clip.data.pop('id')

# Update effect IDs
clip.data['effects'] = [{k: (get_app().project.generate_id() if k == 'id' else v)
for k, v in effect.items()} for effect in clip.data['effects']]

# Adjust the position and track
clip.data['position'] += position_diff
clip.data['layer'] += layer_diff
Expand Down Expand Up @@ -1706,6 +1711,10 @@ def Paste_Triggered(self, action, position, layer_id, clip_ids, tran_ids):
# Apply clipboard to clip (there should only be a single key in this dict)
for k, v in self.copy_clipboard[list(self.copy_clipboard)[0]].items():
if k != 'id':
if k == 'effects':
# Update effect IDs
v = [{k: (get_app().project.generate_id() if k == 'id' else v)
for k, v in effect.items()} for effect in v]
# Overwrite clips properties (which are in the clipboard)
clip.data[k] = v

Expand Down

0 comments on commit a5320b2

Please sign in to comment.