The current practice of using the name
property to filter and locate items in the timeline (VideoClipTrackItem
) and project panel (ProjectItem
) is fundamentally unreliable. This approach suffers from critical flaws:
- Non-Uniqueness: It is common for users to have multiple items with the exact same name (e.g., multiple
shot_v1
clips, severalbgm
audio tracks, or duplicated assets). - Mutability: Users can freely rename items at any time, causing name-based lookup logic to break unexpectedly and introducing bugs that are difficult to trace.
- Fragility: This makes automation scripts and plugins brittle. Any change to an item’s name by the user can disrupt their functionality.
Relying on name
as a unique identifier is an anti-pattern that significantly reduces the robustness and reliability of code built on top of the API.
// CURRENT: Finding an item by name (Unreliable)
let fragileItem = project.findItemByName("MyClipName");
if (fragileItem) {
// If another item named "MyClipName" exists, this logic fails.
doSomething(fragileItem);
}