Page 1 of 1

Scripting: SetCurrentTimecode() and SelectedTimelineItems()

PostPosted: Fri Aug 13, 2021 12:17 pm
by roger.magnusson
Request
The Resolve scripting API Timeline object has a function for getting the position of the playhead:
  • string GetCurrentTimecode()
It would be very helpful to be able to set the playhead position as well:
  • bool SetCurrentTimeCode(string timecode)
and, perhaps more easily:
  • bool SetCurrentFrame(int frame)


Also, selecting Timeline Items is a much needed function:
  • table SetSelectedTimelineItems(table items)
The returned items table would represent all selected items including linked items that weren't explicitly specified in the function call. Of course, we would want a function for getting the currently selected items as well:
  • table GetSelectedTimelineItems()

Rationale
These additions would enable programmatic navigation of the timeline, for example you could create a search function for subtitles and display the search results in a window. Clicking each result would take the user to the correct position on the timeline and select the subtitle, displaying its settings in the Inspector.

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Fri Aug 13, 2021 12:55 pm
by iddos-l
+1


Sent from my iPhone using Tapatalk

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Fri Aug 13, 2021 12:57 pm
by TheBloke
+1

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Fri Aug 13, 2021 1:03 pm
by Andy Mees
+1

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Wed Sep 01, 2021 10:03 pm
by roger.magnusson
Another nice use of these functions would be a marker index on the Color page.

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Thu Sep 09, 2021 2:05 pm
by visualfeast
+1


Sent from my iPhone using Tapatalk

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Fri Oct 22, 2021 3:22 pm
by roger.magnusson
Thanks to BMD for adding SetCurrentTimeCode! Now we're halfway there and just need a way to select timeline items.

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Tue Dec 21, 2021 2:00 pm
by SeldomSeenKid
Hm... can someone please enlighten me on how I to use this function properly?
For example: I want to position the playhead at the start of the timeline so in my lua script I do

local proj = pm:GetCurrentProject()
local tm = proj:GetCurrentTimeline()

tm:SetCurrentTimecode(tm:GetStartFrame())

but my playhead doesn't move. GetStartFrame() returns 108.000, which is correct on a 30fps timeline and I expected that the playhead is positioned at TL start. SetCurrentTimecode returns false.

I am using 17.4.2 on Windows.

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Tue Dec 21, 2021 2:51 pm
by Andy Mees
Suspect SetCurrentTimecode() is expecting a timecode string, not a frame count integer.

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Tue Dec 21, 2021 3:05 pm
by SeldomSeenKid
ARGHH..!

Your assumption is correct!
An integer would make much more sense to me, but hey, that's what it is.

Thanks a lot, you made my day!

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Mon Feb 28, 2022 5:11 pm
by X-Raym
+1 for selected clips in timeline functions

this also has been discussed there: viewtopic.php?f=21&t=134835

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Wed Dec 14, 2022 5:23 pm
by Nowadays
Another +1 for the GetSelectedTimelineItems() API. Thanks!

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Thu May 11, 2023 2:19 pm
by philipbowser
+1

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Tue May 23, 2023 1:17 pm
by Robert Niessner
+1

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Thu Feb 22, 2024 9:24 am
by Vojta Filipi
+1

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Wed Apr 03, 2024 9:54 pm
by seb.reategui
+1

Please add GetSelectedTimelineItems() and SetSelectedTimelineItems()

There is huge potential to change clip properties, run tasks on selected clips, update metadata and a myriad of other possibilities.

The timeline from a user perspective is a great place to select clips - you can see the clip preview, its name, its position in the timeline, it's the ultimate user control that gives you the feeling of "I know what this clip is". The thumbnail strip as well also affords this feeling.

So it is a no-brainer to permit scripts and Workflow Extensions to access the clips that the user has selected, so tasks can be performed on those clips.

The current API implementation only allows the clip underneath the playhead, or to get all timeline items.

This is not sufficient!

A user's selection can be of multiple clips located anywhere in the timeline, in a non-linear fashion.

In many cases, the user does NOT want to perform tasks to all clips in the timeline, this is too aggressive.

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Thu Apr 04, 2024 6:31 am
by Olivier MATHIEU
+1

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Sun Apr 28, 2024 10:47 pm
by jasonhanley
+1 Yes, this seems really critical. Definitely needed for any of my current script ideas.

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostPosted: Wed Oct 02, 2024 9:04 am
by X-Raym
Update: in v19.0.2, we got

Code: Select all
  GetSelectedClips()                              --> [MediaPoolItems]   # Returns the current selected MediaPoolItems
  SetSelectedClip(MediaPoolItem)                  --> Bool               # Sets the selected MediaPoolItem to the given MediaPoolItem


But this is just for MediaPool. One stop away from having it in timeline. Thx BM if you are considering this ;)