Fix paste filter to track regression #1922

Merged
ddennedy opened 6:06pm on September 29, 2026 wanted to merge 203 Δ into mltframework/shotcut master from
fix-paste-track-filter

Pull Request Overview

  • Opened on September 30, 2026
  • Status Merged
  • Commit count 2 with first commit September 30, 2026

Total Delta

203 Total Diff Delta

Open Days

Open 33 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.0 days Authoring 1 commit before pull request opened for review
 
0.0 days Awaiting first review
 
0.2 days Revising work with 1 commit in response to 3 reviews that left 5 comments
Set up deploy tracking to begin tracking full PR start-to-deploy times

Total time for pull request 0.2 business days from first commit authored to merge
Deploy tracking has not been set up

Author avatar

Fix paste filter to track regression

See bug report https://forum.shotcut.org/t/copying-a-filter-from-a-clip-to-a-track-creates-an-empty-fake/51989

This pull request improves the handling of filter ordering and indexing in the filter management logic, particularly to ensure correct placement of user-visible and hidden filters (such as the track audio-level meter) and to fix related bugs in filter paste and model row mapping. The changes enhance both internal correctness and user interface consistency.

Filter Ordering and Placement Improvements:


  • Added a new firstPostUserFilterIndex function in mltcontroller.cpp to accurately locate the first hidden post-user filter, ensuring that track volume filters and pasted filters are positioned correctly relative to hidden filters like the audio-level meter. Updated the moveTrackVolumeFilterToEnd function to use this logic for more precise placement.

  • Updated the filter pasting logic in copyFilters to ensure that pasted filters are placed ahead of hidden post filters and that GPU filters are inserted at the correct destination index, preventing UI binding issues and maintaining correct filter order.

  • Removed redundant adjustment of filters in pasteFilters, as this is now handled more accurately within copyFilters and moveTrackVolumeFilterToEnd.

Model Row and Filter Index Mapping:


  • Replaced the userFilterCount function with a new userFilterMltIndex function in attachedfiltersmodel.cpp to correctly map model rows to MLT filter indices, skipping hidden filters and ensuring user actions target the correct filters. Updated mltFilterIndex to use this new logic.

Comments Threads Pending Resolution

bmatherly reviewed and approved this work on September 30, 2026
bmatherly left a comment

Adding the track volume and level hidden filters certainly added some complexity. This change looks good to me. I did not test this. But the logic is sound and I will do some testing after it merges.

ljharb reviewed on September 30, 2026
ljharb left a comment

## Copilot review overview

### 🔵 Needs a closer look

A moderate filter-paste ordering issue remains when GPU and non-GPU filters are interleaved.

**Review effort:** Lite
**Findings:** None

Resolved since last review (1)

- Medium severity [Use correct user-filter index when inserting service filters](#discussion_r4140155930)

ljharb reviewed on September 30, 2026
ljharb left a comment

## Copilot review overview

### 🟡 Changes recommended

Moderate issues remain in paste refresh behavior, GPU insertion ordering, and filter insertion mapping.

**Review effort:** Lite
**Findings:** 1 Medium severity

Open (1)

- Medium severity [Use correct user-filter index when inserting service filters](#discussion_r4140155930) · New

What changed in this PR

Fixes filter ordering and visible-row-to-MLT index mapping when pasting filters around hidden track filters.

**Changes:**
- Adds hidden-filter-aware user filter indexing.
- Improves pasted filter and track-volume placement.
- Removes redundant paste adjustment.

| File | Description |
|---|---|
| `src/​models/​attachedfiltersmodel.cpp` | Maps visible filter rows to actual MLT indices. |
| `src/​mltcontroller.cpp` | Handles pasted filter placement and hidden-filter ordering. |

---

💡 Add a `code-review` agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

src/models/attachedfiltersmodel.cpp
133
                return -1;
134
            }
135
        }
136
        return userFilterMltIndex(producer, row - linkCount);

Resolved Comment Threads

No resolved comments have been left on this PR.