Skip to content

Commit bb85b5b

Browse files
committed
Allow clearing the "Parent" and "Child Clip ID" properties of a clip / effect, and allow setting of the initial value to work correctly.
1 parent d37894c commit bb85b5b

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

src/windows/models/properties_model.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,11 @@ def value_updated(self, item, interpolation=-1, value=None, interpolation_detail
446446
clip_id, item_type = item.data()
447447

448448
# Get value (if any)
449-
if item.text():
449+
if item.text() or value:
450450
# Set and format value based on property type
451-
if value is not None:
451+
if value == "None":
452+
new_value = ""
453+
elif value is not None:
452454
# Override value
453455
new_value = value
454456
elif property_type == "string":

src/windows/video_widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def paintEvent(self, event, *args):
381381

382382
# Set scale as STRETCH if the clip is attached to an object
383383
if (
384-
raw_properties.get('parentObjectId').get('memo') != 'None'
384+
raw_properties.get('parentObjectId').get('memo') != ''
385385
and len(raw_properties.get('parentObjectId').get('memo')) > 0
386386
):
387387
scale = openshot.SCALE_STRETCH

src/windows/views/properties_tableview.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,7 @@ def contextMenuEvent(self, event):
486486
if (clip_path == clip_instance_path):
487487
# Generate the clip icon to show in the selection menu
488488
clip_instance_icon = clip_index.data(Qt.DecorationRole)
489-
effect_choices = [{"name": "None",
490-
"value": "None",
491-
"selected": False,
492-
"icon": QIcon()}]
489+
effect_choices = []
493490
# Iterate through clip's effects
494491
for effect_data in clip_instance_data["effects"]:
495492
# Make sure the user can only set a parent effect of the same type as this effect
@@ -528,12 +525,12 @@ def contextMenuEvent(self, event):
528525

529526
# Handle property to set the Tracked Object's child clip
530527
if property_key == "child_clip_id" and not self.choices:
531-
clip_choices = [{
528+
self.choices.append({
532529
"name": "None",
533530
"value": "None",
534531
"selected": False,
535532
"icon": QIcon()
536-
}]
533+
})
537534
# Instantiate the timeline
538535
timeline_instance = get_app().window.timeline_sync.timeline
539536
current_effect = timeline_instance.GetClipEffect(clip_id)
@@ -565,18 +562,8 @@ def contextMenuEvent(self, event):
565562
# Handle clip attach options
566563
if property_key == "parentObjectId" and not self.choices:
567564
# Add all Clips as choices - initialize with None
568-
tracked_choices = [{
569-
"name": "None",
570-
"value": "None",
571-
"selected": False,
572-
"icon": QIcon()
573-
}]
574-
clip_choices = [{
575-
"name": "None",
576-
"value": "None",
577-
"selected": False,
578-
"icon": QIcon()
579-
}]
565+
tracked_choices = []
566+
clip_choices = []
580567
# Instantiate the timeline
581568
timeline_instance = get_app().window.timeline_sync.timeline
582569
# Loop through timeline's clips
@@ -630,6 +617,7 @@ def contextMenuEvent(self, event):
630617
"value": tracked_objects,
631618
"selected": False,
632619
"icon": clip_instance_icon})
620+
self.choices.append({"name": _("None"), "value": "None", "selected": False, "icon": None})
633621
self.choices.append({"name": _("Tracked Objects"), "value": tracked_choices, "selected": False, "icon": None})
634622
self.choices.append({"name": _("Clips"), "value": clip_choices, "selected": False, "icon": None})
635623

0 commit comments

Comments
 (0)