Python API - SetRenderSettings(...) - set macro in Filename?

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

michaelZ

  • Posts: 3
  • Joined: Tue Aug 03, 2021 2:13 pm
  • Real Name: Michael Zangrando

Python API - SetRenderSettings(...) - set macro in Filename?

PostTue Aug 03, 2021 2:25 pm

I'm using the Python API in Resolve 16.

I'd like to set the name of the output file in the render settings (in the deliver tab).

This is easily done with the command

Code: Select all
project.SetRenderSettings({'CustomName':'the name that I want'})


However, I would like to add a few macro's in the filename. In the GUI they are available by typing "%<macro name>", for instance "%Scene", so that the Scene number that's in the clip's metadata ends up in the filename.

I can't find a way to do this in Python... using "%Scene" doesn't work. I find no pointers in the documentation on how to do this. Does anyone know how to do this?
Offline
User avatar

roger.magnusson

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

Re: Python API - SetRenderSettings(...) - set macro in Filen

PostTue Aug 03, 2021 6:51 pm

I haven't tested it in Python but try escaping it with another %:
"%%Scene"
Offline
User avatar

Igor Riđanović

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

Re: Python API - SetRenderSettings(...) - set macro in Filen

PostTue Aug 03, 2021 9:57 pm

You should be able to access these values by calling GetMetadata() on a media pool item.
www.metafide.com - DaVinci Resolve™ Apps
Offline

michaelZ

  • Posts: 3
  • Joined: Tue Aug 03, 2021 2:13 pm
  • Real Name: Michael Zangrando

Re: Python API - SetRenderSettings(...) - set macro in Filen

PostWed Aug 04, 2021 1:31 pm

Found the answer to my own question... posting for future reference:

Code: Select all
project.SetRenderSettings({'CustomName':'%{Scene}_%{Take}'})


does the trick.

Return to DaVinci Resolve

Who is online

Users browsing this forum: ghost355, Majestic-12 [Bot], MSNbot Media and 214 guests