Skip to content

Commit 0a729c3

Browse files
authored
Merge pull request #3817 from ferdnyc/effect-parent
Use new effect.ParentClip() for more efficient property lookup, fix cutting closeEvent()
2 parents e81f0db + 3e49eea commit 0a729c3

File tree

2 files changed

+19
-33
lines changed

2 files changed

+19
-33
lines changed

src/windows/cutting.py

-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ def close(self):
356356

357357
def closeEvent(self, event):
358358
log.debug('closeEvent')
359-
event.accept()
360359

361360
# Stop playback
362361
self.preview_parent.worker.Stop()

src/windows/models/properties_model.py

+19-32
Original file line numberDiff line numberDiff line change
@@ -95,25 +95,24 @@ def update_item_timeout(self):
9595

9696
log.debug("Update item: %s" % item_type)
9797

98+
timeline = get_app().window.timeline_sync.timeline
9899
if item_type == "clip":
99-
c = get_app().window.timeline_sync.timeline.GetClip(item_id)
100-
if c:
101-
# Append to selected items
102-
self.selected.append((c, item_type))
103-
104-
if item_type == "transition":
105-
t = get_app().window.timeline_sync.timeline.GetEffect(item_id)
106-
if t:
107-
# Append to selected items
108-
self.selected.append((t, item_type))
109-
110-
if item_type == "effect":
111-
e = get_app().window.timeline_sync.timeline.GetClipEffect(item_id)
112-
if e:
113-
# Filter out basic properties, since this is an effect on a clip
114-
self.filter_base_properties = ["position", "layer", "start", "end", "duration"]
115-
# Append to selected items
116-
self.selected.append((e, item_type))
100+
item = timeline.GetClip(item_id)
101+
elif item_type == "transition":
102+
item = timeline.GetEffect(item_id)
103+
elif item_type == "effect":
104+
item = timeline.GetClipEffect(item_id)
105+
# Filter out basic properties, since this is an effect on a clip
106+
self.filter_base_properties = ["position", "layer", "start", "end", "duration"]
107+
if item:
108+
# We also need the parent
109+
self.selected_parent = item.ParentClip()
110+
else:
111+
item = None
112+
113+
if not item:
114+
return
115+
self.selected.append((item, item_type))
117116

118117
# Update frame # from timeline
119118
self.update_frame(get_app().window.preview_thread.player.Position(), reload_model=False)
@@ -135,21 +134,9 @@ def update_frame(self, frame_number, reload_model=True):
135134
# Ignore null clip
136135
return
137136

138-
# If effect, find the position of the parent clip
137+
# If effect, we really care about the position of the parent clip
139138
if item_type == "effect":
140-
# find parent clip
141-
effect = Effect.get(id=clip.Id())
142-
if not effect:
143-
# Invalid effect
144-
return
145-
146-
parent_clip_id = effect.parent["id"]
147-
148-
# Find this clip object
149-
c = get_app().window.timeline_sync.timeline.GetClip(parent_clip_id)
150-
if c:
151-
# Override the selected clip object (so the effect gets the correct starting position)
152-
clip = c
139+
clip = self.selected_parent
153140

154141
# Get FPS from project
155142
fps = get_app().project.get("fps")

0 commit comments

Comments
 (0)