FR (API): Split items function in scripts

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline
User avatar

X-Raym

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

FR (API): Split items function in scripts

PostMon Jan 03, 2022 12:57 pm

Hi,

I would love to be able to split items in timeline with scripting API,
But I don't see any function for that.

Do I miss something, is there any workaround ?

Or should I contact BM for a feature request ?

Thx!
Last edited by X-Raym on Sun Jan 23, 2022 5:38 pm, edited 2 times in total.
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
Donation: https://paypal.me/extremraym
Offline

Annaël Beauchemin

  • Posts: 93
  • Joined: Thu Nov 24, 2016 7:12 am

Re: FR/Q: Split items via scripting API?

PostMon Jan 03, 2022 3:23 pm

The only way I found is via AppleScript or some other way (external Python libraries) of accessing the menu item "Razor".
Offline
User avatar

X-Raym

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

Re: FR/Q: Split items via scripting API?

PostMon Jan 03, 2022 4:04 pm

Thx for the hints,

Code: Select all
 (external Python libraries) of accessing the menu item "Razor".


Is this possible via scripting api ? There is no tool access as far as I know :?
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
Donation: https://paypal.me/extremraym
Offline
User avatar

iddos-l

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

Re: FR/Q: Split items via scripting API?

PostMon Jan 03, 2022 8:37 pm

X-Raym wrote:Thx for the hints,

Code: Select all
 (external Python libraries) of accessing the menu item "Razor".


Is this possible via scripting api ? There is no tool access as far as I know :?

Not with the official Resolve API.
As mentioned, you can try some hacks like sending a keyboard input or a mouse click with an external script.


Sent from my iPhone using Tapatalk
Offline
User avatar

Igor Riđanović

  • Posts: 1596
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: FR/Q: Split items via scripting API?

PostMon Jan 03, 2022 10:16 pm

it's pretty straightforward using pyautogui:

Code: Select all
with pyautogui.hold('ctrl'):
    pyautogui.press('b')
www.metafide.com - DaVinci Resolve™ Apps
Offline
User avatar

iddos-l

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

Re: FR/Q: Split items via scripting API?

PostMon Jan 03, 2022 10:26 pm

Yeah
You do need to mind the user keyboard customization though.
Hopefully we will get some nice releases of “set” type functions in the coming upgrades. Some important stuff is still inaccessible.
Offline
User avatar

X-Raym

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

Re: FR/Q: Split items via scripting API?

PostTue Jan 04, 2022 1:27 am

I think it is a reasonable feature request then

a function like

split(item, position)

would allow so much editing possibilities.
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
Donation: https://paypal.me/extremraym
Offline
User avatar

X-Raym

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

Re: FR/Q: Split items via scripting API?

PostTue Jan 04, 2022 1:28 am

Igor Riđanović wrote:it's pretty straightforward using pyautogui:

Code: Select all
with pyautogui.hold('ctrl'):
    pyautogui.press('b')


but is there any way to plug that into a davinci resolve script ?
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
Donation: https://paypal.me/extremraym
Offline
User avatar

Igor Riđanović

  • Posts: 1596
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: FR/Q: Split items via scripting API?

PostTue Jan 04, 2022 1:45 am

Yes, of course.

The thing to remember though any keyboard press emulation is done at a larger scope. The pyautogui emulated CTRL+B is not aware of Resolve in any way. It will apply this keyboard shortcut to whatever application is in focus. If MS Word is in focus this will enable bold style. If Resolve is in focus, and the edit page timeline is in focus, this will split the clips that happen to be under the playhead.

The complexity of this solution can quickly grow. There is a way to test if an app is in focus but these things are hacky and highly OS dependent. The BMD API can check if the Edit page is open and so forth. It's all possible to solve though.
www.metafide.com - DaVinci Resolve™ Apps
Offline
User avatar

X-Raym

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

Re: FR/Q: Split items via scripting API?

PostTue Jan 04, 2022 1:56 am

@Igor
This indeed make things quite complex,
Especially consideraring there is no way to actually select certain clips as far as I know so the split actions can perform on more tracks than necessary.

We really need this in native API :P !
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
Donation: https://paypal.me/extremraym
Offline
User avatar

Igor Riđanović

  • Posts: 1596
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: FR/Q: Split items via scripting API?

PostTue Jan 04, 2022 3:04 am

You can't select clips but you can lock tracks to avoid splitting clips you don't want to cut. Without knowing the details of your use case this still sounds possible, although it would require some work.
www.metafide.com - DaVinci Resolve™ Apps
Offline
User avatar

X-Raym

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

Re: FR/Q: Split items via scripting API?

PostTue Jan 04, 2022 9:22 am

@Igor Riđanović
My end goal would be somethin like : split selected clips at green markers positions.

This would be fairmy easy to code and manage with a split clip function API as there is function to get marker and its properties.

I contacted support for exposing my feature request. Scripting API with editing feature will be more useful.
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
Donation: https://paypal.me/extremraym
Offline
User avatar

X-Raym

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

Re: FR/Q: Split items via scripting API?

PostSun Jan 23, 2022 5:37 pm

We in fact need a dedicate split clip API function, cause the razor tool is too broad and require deactivate/activated track for edition, and this can't be done via script.

Some we need something like

Code: Select all
[b]item:Split( frame_pos )[/b]


This would help so much!
My DaVinci Resolve Scripts: https://github.com/X-Raym/DaVinci-Resolve-Scripts
Donation: https://paypal.me/extremraym

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Jim Simon, thetoolsmith and 116 guests