Scripting: SetCurrentTimecode() and SelectedTimelineItems()

  • Author
  • Message
Offline
User avatar

roger.magnusson

  • Posts: 3874
  • Joined: Wed Sep 23, 2015 4:58 pm

Scripting: SetCurrentTimecode() and SelectedTimelineItems()

PostFri Aug 13, 2021 12:17 pm

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.
Offline
User avatar

iddos-l

  • Posts: 803
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostFri Aug 13, 2021 12:55 pm

+1


Sent from my iPhone using Tapatalk
Offline
User avatar

TheBloke

  • Posts: 1905
  • Joined: Sat Nov 02, 2019 11:49 pm
  • Location: UK
  • Real Name: Tom Jobbins

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostFri Aug 13, 2021 12:57 pm

+1
Resolve Studio 17.4.3 and Fusion Studio 17.4.3 on macOS 11.6.1

Hackintosh:: X299, Intel i9-10980XE, 128GB DDR4, AMD 6900XT 16GB
Monitors: 1 x 3840x2160 & 3 x 1920x1200
Disk: 2TB NVMe + 4TB RAID0 NVMe; NAS: 36TB RAID6
BMD Speed Editor
Offline

Andy Mees

  • Posts: 4102
  • Joined: Wed Aug 22, 2012 7:48 am

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostFri Aug 13, 2021 1:03 pm

+1
Let's have a return to the glory days, when press releases for new versions included text like "...with over 300 new features and improvements that professional editors and colorists have asked for."
Offline
User avatar

roger.magnusson

  • Posts: 3874
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostWed Sep 01, 2021 10:03 pm

Another nice use of these functions would be a marker index on the Color page.
Offline
User avatar

visualfeast

  • Posts: 894
  • Joined: Sat May 19, 2018 6:51 pm
  • Real Name: BEN JORDAN

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostThu Sep 09, 2021 2:05 pm

+1


Sent from my iPhone using Tapatalk
•14700K/96G/4080SuperFE/24TB RAID/PA278CGV(x2)/U2415(x1)/StreamDeckXL+15
•5950x/64G/3080ti/80TB RAID/Intensity Pro 4K/U2415(x2)/Shogun 7/HPE LTO6/StreamDeck15
•ZBook 17 G3/64G/Quadro M5000M
•Inspiron 16+/32G/RTX3060
Studio v18.6.6, 19.1.4/Win10 Pro 22H2
Offline
User avatar

roger.magnusson

  • Posts: 3874
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostFri Oct 22, 2021 3:22 pm

Thanks to BMD for adding SetCurrentTimeCode! Now we're halfway there and just need a way to select timeline items.
Offline
User avatar

SeldomSeenKid

  • Posts: 472
  • Joined: Mon May 31, 2021 1:16 pm
  • Location: Germany
  • Real Name: Michael Adrian

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostTue Dec 21, 2021 2:00 pm

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.
Good judgement comes from experience. Experience comes from bad judgement.
# Threadripper 32 core / 160GB / RTX4000 8GB / WIN10 #
# BMCC / DVR17.4.6 Studio / Speed Editor / Tangent Ripple / X-Touch One / X-Touch mini / Space Explorer / 5.1 HDMI#
Offline

Andy Mees

  • Posts: 4102
  • Joined: Wed Aug 22, 2012 7:48 am

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostTue Dec 21, 2021 2:51 pm

Suspect SetCurrentTimecode() is expecting a timecode string, not a frame count integer.
Let's have a return to the glory days, when press releases for new versions included text like "...with over 300 new features and improvements that professional editors and colorists have asked for."
Offline
User avatar

SeldomSeenKid

  • Posts: 472
  • Joined: Mon May 31, 2021 1:16 pm
  • Location: Germany
  • Real Name: Michael Adrian

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostTue Dec 21, 2021 3:05 pm

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!
Good judgement comes from experience. Experience comes from bad judgement.
# Threadripper 32 core / 160GB / RTX4000 8GB / WIN10 #
# BMCC / DVR17.4.6 Studio / Speed Editor / Tangent Ripple / X-Touch One / X-Touch mini / Space Explorer / 5.1 HDMI#
Offline
User avatar

X-Raym

  • Posts: 153
  • Joined: Thu Apr 18, 2013 4:05 pm
  • Location: France
  • Real Name: Raymond Radet

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostMon Feb 28, 2022 5:11 pm

+1 for selected clips in timeline functions

this also has been discussed there: viewtopic.php?f=21&t=134835
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
My Resolve Scripting API Doc: https://www.extremraym.com/en/resolve-api-doc-release/
Donation: https://paypal.me/extremraym
Offline

Nowadays

  • Posts: 11
  • Joined: Wed Dec 14, 2022 5:20 pm
  • Real Name: Giovanni Zuliani

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostWed Dec 14, 2022 5:23 pm

Another +1 for the GetSelectedTimelineItems() API. Thanks!
Offline

philipbowser

  • Posts: 399
  • Joined: Tue Oct 14, 2014 11:53 pm

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostThu May 11, 2023 2:19 pm

+1
Offline
User avatar

Robert Niessner

  • Posts: 5620
  • Joined: Thu Feb 21, 2013 9:51 am
  • Location: Graz, Austria

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostTue May 23, 2023 1:17 pm

+1
Saying "Thx for help!" is not a crime.
--------------------------------
Robert Niessner
LAUFBILDkommission
Graz / Austria
--------------------------------
Blackmagic Camera Blog (German):
http://laufbildkommission.wordpress.com

Read the blog in English via Google Translate:
http://tinyurl.com/pjf6a3m
Offline
User avatar

Vojta Filipi

  • Posts: 73
  • Joined: Wed May 18, 2022 4:24 pm
  • Real Name: Vojtěch Filipi

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostThu Feb 22, 2024 9:24 am

+1
Offline

seb.reategui

  • Posts: 11
  • Joined: Sat Aug 15, 2020 9:54 am
  • Real Name: Sebastian Reategui

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostWed Apr 03, 2024 9:54 pm

+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.
Offline
User avatar

Olivier MATHIEU

  • Posts: 1056
  • Joined: Thu Aug 04, 2016 1:55 pm
  • Location: Paris/Grenoble, FRANCE

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostThu Apr 04, 2024 6:31 am

+1
Resolve Studio 19.x & 20.x & Fusion Studio 20.x | MacOS 14.7.x | GUI : 3840 x 2160 | Ntw : 10Gb/s
MacbookPro M2 Max

Compositing VFX Artist, Editor
Davinci Resolve & Fusion Certified Trainer
Offline

jasonhanley

  • Posts: 35
  • Joined: Sun Nov 08, 2020 11:52 pm
  • Location: Vancouver, Canada
  • Real Name: Jason Hanley

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostSun Apr 28, 2024 10:47 pm

+1 Yes, this seems really critical. Definitely needed for any of my current script ideas.
Resolve Studio 19.1.2 Build 3
Acer Predator Helios 300, i7-9750H, 16GB RAM
Windows 10 Home 64-bit 21H1 19045.5371
GeForce GTX 1660Ti 6GB, Studio driver 566.36
Offline
User avatar

X-Raym

  • Posts: 153
  • Joined: Thu Apr 18, 2013 4:05 pm
  • Location: France
  • Real Name: Raymond Radet

Re: Scripting: SetCurrentTimecode() and SelectedTimelineItem

PostWed Oct 02, 2024 9:04 am

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 ;)
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
My Resolve Scripting API Doc: https://www.extremraym.com/en/resolve-api-doc-release/
Donation: https://paypal.me/extremraym

Return to DaVinci Resolve Feature Requests

Who is online

Users browsing this forum: No registered users and 11 guests