(API) Issues Adding Titles and Generators from the 'Effects'

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

SerhiiK

  • Posts: 4
  • Joined: Sat Mar 02, 2024 2:12 pm
  • Real Name: Serhii Kalinin

(API) Issues Adding Titles and Generators from the 'Effects'

PostSun Mar 17, 2024 8:24 pm

Hello, community!

I'm working on a project in DaVinci Resolve and trying to automate adding elements to the timeline using the DaVinci API. The documentation describes various methods for adding effects like titles and generators, but I'm facing some difficulties in implementing them.

Here are the methods I'm using:

InsertGeneratorIntoTimeline(generatorName) and InsertTitleIntoTimeline(titleName) work fine and add simple titles and generators to the timeline.
However, when it comes to Fusion titles and generators using InsertFusionGeneratorIntoTimeline(generatorName) and InsertFusionTitleIntoTimeline(titleName), the code doesn't work as expected. Attempts to add Fusion elements to the timeline are unsuccessful.

Here's a snippet of my code:

Code: Select all
import DaVinciResolveScript as dvr_script

resolve = dvr_script.scriptapp("Resolve")
projectManager = resolve.GetProjectManager()
currentProject = projectManager.GetCurrentProject()
currentTimeline = currentProject.GetCurrentTimeline()

# Simple titles and generators are added to the timeline without problems
# Examples:
simple_title = currentTimeline.InsertTitleIntoTimeline('Text') #work correct
simple_title = currentTimeline.InsertTitleIntoTimeline('Scroll') #work correct
simple_title = currentTimeline.InsertTitleIntoTimeline('Middle Lower Third') #work correct
simple_generator = currentTimeline.InsertGeneratorIntoTimeline('Solid Color') #work correct
simple_generator = currentTimeline.InsertGeneratorIntoTimeline('Window') #work correct
simple_generator = currentTimeline.InsertGeneratorIntoTimeline('10 Step') #work correct

# Fusion titles and generators are NOT added to the timeline
# Examples:
fusion_title = currentTimeline.InsertFusionTitleIntoTimeline('Call Out') #fail
fusion_title = currentTimeline.InsertFusionTitleIntoTimeline('Drop In') #fail
fusion_title = currentTimeline.InsertFusionTitleIntoTimeline('Jitter') #fail
fusion_generator = currentTimeline.InsertFusionGeneratorIntoTimeline('Noise Gradient') #fail
fusion_generator = currentTimeline.InsertFusionGeneratorIntoTimeline('Contours') #fail
fusion_generator = currentTimeline.InsertFusionGeneratorIntoTimeline('Texture Background') #fail
# fusion_generator => None and fusion_title => None too.


I can't figure out what I'm doing wrong or if there are any API limitations that I'm not aware of. I'd appreciate any help or advice from anyone who has faced a similar issue.

Thanks in advance!
Offline

kolibril13

  • Posts: 6
  • Joined: Mon Apr 25, 2022 6:05 am
  • Real Name: Jan-Hendrik Müller

Re: (API) Issues Adding Titles and Generators from the 'Effe

PostThu May 16, 2024 10:36 am

Hi there!
I just was stumbling about the same question, and I solved it like this:
```
import sys

sys.path.append("/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules")
import DaVinciResolveScript as dvr_script

resolve = dvr_script.scriptapp("Resolve")

projectManager = resolve.GetProjectManager()
currentProject = projectManager.GetCurrentProject()
currentTimeline = currentProject.GetCurrentTimeline()

# Insert a Fusion composition into the timeline
obj = currentTimeline.InsertFusionCompositionIntoTimeline()
fusion_comp = obj.AddFusionComp()

# Add a Text+ tool to the Fusion composition
text_tool = fusion_comp.AddTool("TextPlus")

# Set the text value
text_tool.SetInput("StyledText", "Hello World")

# Increase the font size
text_tool.SetInput("Size", 0.2)

# Find the MediaOut1 tool
media_out_tool = fusion_comp.FindTool("MediaOut1")

# Connect the Text+ tool directly to the MediaOut1 node
media_out_tool.ConnectInput("Input", text_tool)
```
this works fine on MacOS, hope this is useful for you as well!
Attachments
Clipboard 16. May 2024 at 12.34.png
Clipboard 16. May 2024 at 12.34.png (529.98 KiB) Viewed 44 times

Return to DaVinci Resolve

Who is online

Users browsing this forum: BartReynaard, Bing [Bot], Omar Mohammad, Phil Vivarelli and 174 guests