Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve: update to new publisher #157

Closed
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f7e514a
Updating Resolve API reference
jakubjezek001 Mar 7, 2024
f943fe7
Add Ayon core constants and menu changes, update AyonMenu class, and …
jakubjezek001 Mar 7, 2024
09d7dc6
Update Resolve API functions and markers for Ayon compatibility.
jakubjezek001 Mar 7, 2024
fbd0fc5
Update plugin classes and imports for backward compatibility with new…
jakubjezek001 Mar 7, 2024
b692cde
Add import statement, update class inheritance, and define new attrib…
jakubjezek001 Mar 7, 2024
f634f19
Add workfile auto-creator plugin with instance creation logic.
jakubjezek001 Mar 7, 2024
666c76a
Update timeline frame rate settings and add otio metadata to Resolve …
jakubjezek001 Mar 7, 2024
6c42394
Refactor timeline item retrieval functions and menu launchers
jakubjezek001 Mar 7, 2024
18ccc00
Update Resolve API functions, containerization methods, and marker ha…
jakubjezek001 Mar 7, 2024
cabf6be
Remove deprecated functions and use constants for clip color in Resol…
jakubjezek001 Mar 7, 2024
bb5a23d
Merge branch 'develop' into feature/AY-979_Resolve-update-to-new-publ…
jakubjezek001 Mar 8, 2024
5517438
fixing bits after renaming and moving into constants
jakubjezek001 Mar 12, 2024
0c84f6f
adding function for getting native otio file
jakubjezek001 Mar 12, 2024
2a64d72
adding HostContext class for dealing with context in creators
jakubjezek001 Mar 12, 2024
0d90f57
adding abstracted plugins for dealing with new publisher
jakubjezek001 Mar 12, 2024
d03c2bf
create otio timeline can optionally add own timeline
jakubjezek001 Mar 12, 2024
17cfa43
Merge branch 'develop' into feature/AY-979_Resolve-update-to-new-publ…
jakubjezek001 Jun 12, 2024
6e1851f
Refactor menu stylesheet loading, update plugin creation logic
jakubjezek001 Jun 12, 2024
553602e
Merge branch 'develop' into feature/AY-979_Resolve-update-to-new-publ…
jakubjezek001 Jun 12, 2024
cdc55ed
Update API documentation and keyframe mode information. Remove outdat…
jakubjezek001 Jun 13, 2024
e1dea1c
Refactor otio file handling functions, add temp dir logic.
jakubjezek001 Jun 13, 2024
e4a11ef
Refactor get_otio_temp_dir to handle missing timeline.
jakubjezek001 Jun 13, 2024
932dfd6
Merge branch 'develop' into feature/AY-979_Resolve-update-to-new-publ…
jakubjezek001 Jun 13, 2024
3d1f0d7
reverting latest commit changes partly
jakubjezek001 Jun 13, 2024
d105d13
Update server_addon/resolve/client/ayon_resolve/api/lib.py
jakubjezek001 Jun 14, 2024
4ea3887
Merge branch 'develop' into feature/AY-979_Resolve-update-to-new-publ…
jakubjezek001 Jun 14, 2024
cd003ba
Merge branch 'develop' into feature/AY-979_Resolve-update-to-new-publ…
iLLiCiTiT Jun 20, 2024
210d23d
Merge branch 'develop' into feature/AY-979_Resolve-update-to-new-publ…
iLLiCiTiT Jul 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/ayon_core/hosts/resolve/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
![image](https://user-images.githubusercontent.com/40640033/102792588-ffcb1c80-43a8-11eb-9c6b-bf2114ed578e.png) with installed CMake in PATH.
- make sure Resolve Fusion (Fusion Tab/menu/Fusion/Fusion Settings) is set to Python 3.6
![image](https://user-images.githubusercontent.com/40640033/102631545-280b0f00-414e-11eb-89fc-98ac268d209d.png)
- Open OpenPype **Tray/Admin/Studio settings** > `applications/resolve/environment` and add Python3 path to `RESOLVE_PYTHON3_HOME` platform related.
- Open Ayon **Tray/Admin/Studio settings** > `applications/resolve/environment` and add Python3 path to `RESOLVE_PYTHON3_HOME` platform related.

## Editorial setup

This is how it looks on my testing project timeline
![image](https://user-images.githubusercontent.com/40640033/102637638-96ec6600-4156-11eb-9656-6e8e3ce4baf8.png)
Notice I had renamed tracks to `main` (holding metadata markers) and `review` used for generating review data with ffmpeg confersion to jpg sequence.

1. you need to start OpenPype menu from Resolve/EditTab/Menu/Workspace/Scripts/Comp/**__OpenPype_Menu__**
1. you need to start Ayon menu from Resolve/EditTab/Menu/Workspace/Scripts/Comp/**__Ayon_Menu__**
2. then select any clips in `main` track and change their color to `Chocolate`
3. in OpenPype Menu select `Create`
3. in Ayon Menu select `Create`
4. in Creator select `Create Publishable Clip [New]` (temporary name)
5. set `Rename clips` to True, Master Track to `main` and Use review track to `review` as in picture
![image](https://user-images.githubusercontent.com/40640033/102643773-0d419600-4160-11eb-919e-9c2be0aecab8.png)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Updated as of 26 May 2023
Updated as of 18 December 2023
----------------------------
In this package, you will find a brief introduction to the Scripting API for DaVinci Resolve Studio. Apart from this README.txt file, this package contains folders containing the basic import
modules for scripting access (DaVinciResolve.py) and some representative examples.
Expand Down Expand Up @@ -101,6 +101,10 @@ Resolve
SaveLayoutPreset(presetName) --> Bool # Saves current UI layout as a preset named 'presetName'.
ImportLayoutPreset(presetFilePath, presetName) --> Bool # Imports preset from path 'presetFilePath'. The optional argument 'presetName' specifies how the preset shall be named. If not specified, the preset is named based on the filename.
Quit() --> None # Quits the Resolve App.
ImportRenderPreset(presetPath) --> Bool # Import a preset from presetPath (string) and set it as current preset for rendering.
ExportRenderPreset(presetName, exportPath) --> Bool # Export a preset to a given path (string) if presetName(string) exists.
ImportBurnInPreset(presetPath) --> Bool # Import a data burn in preset from a given presetPath (string)
ExportBurnInPreset(presetName, exportPath) --> Bool # Export a data burn in preset to a given path (string) if presetName (string) exists.

ProjectManager
ArchiveProject(projectName,
Expand Down Expand Up @@ -131,6 +135,14 @@ ProjectManager
# 'DbType': 'Disk' or 'PostgreSQL' (string)
# 'DbName': database name (string)
# 'IpAddress': IP address of the PostgreSQL server (string, optional key - defaults to '127.0.0.1')
CreateCloudProject({cloudSettings}) --> Project # Creates and returns a cloud project.
# '{cloudSettings}': Check 'Cloud Projects Settings' subsection below for more information.
ImportCloudProject(filePath, {cloudSettings}) --> Bool # Returns True if import cloud project is successful; False otherwise
# 'filePath': String; filePath of file to import
# '{cloudSettings}': Check 'Cloud Projects Settings' subsection below for more information.
RestoreCloudProject(folderPath, {cloudSettings}) --> Bool # Returns True if restore cloud project is successful; False otherwise
# 'folderPath': String; path of folder to restore
# '{cloudSettings}': Check 'Cloud Projects Settings' subsection below for more information.

Project
GetMediaPool() --> MediaPool # Returns the Media Pool object.
Expand Down Expand Up @@ -198,7 +210,7 @@ MediaPool
CreateTimelineFromClips(name, clip1, clip2,...) --> Timeline # Creates new timeline with specified name, and appends the specified MediaPoolItem objects.
CreateTimelineFromClips(name, [clips]) --> Timeline # Creates new timeline with specified name, and appends the specified MediaPoolItem objects.
CreateTimelineFromClips(name, [{clipInfo}]) --> Timeline # Creates new timeline with specified name, appending the list of clipInfos specified as a dict of "mediaPoolItem", "startFrame" (int), "endFrame" (int), "recordFrame" (int).
ImportTimelineFromFile(filePath, {importOptions}) --> Timeline # Creates timeline based on parameters within given file (AAF/EDL/XML/FCPXML/DRT/ADL) and optional importOptions dict, with support for the keys:
ImportTimelineFromFile(filePath, {importOptions}) --> Timeline # Creates timeline based on parameters within given file (AAF/EDL/XML/FCPXML/DRT/ADL/OTIO) and optional importOptions dict, with support for the keys:
# "timelineName": string, specifies the name of the timeline to be created. Not valid for DRT import
# "importSourceClips": Bool, specifies whether source clips should be imported, True by default. Not valid for DRT import
# "sourceClipsPath": string, specifies a filesystem path to search for source clips if the media is inaccessible in their original path and if "importSourceClips" is True
Expand All @@ -225,6 +237,8 @@ MediaPool
ExportMetadata(fileName, [clips]) --> Bool # Exports metadata of specified clips to 'fileName' in CSV format.
# If no clips are specified, all clips from media pool will be used.
GetUniqueId() --> string # Returns a unique ID for the media pool
CreateStereoClip(LeftMediaPoolItem,
RightMediaPoolItem) --> MediaPoolItem # Takes in two existing media pool items and creates a new 3D stereoscopic media pool entry replacing the input media in the media pool.

Folder
GetClipList() --> [clips...] # Returns a list of clips (items) within the folder.
Expand All @@ -233,6 +247,8 @@ Folder
GetIsFolderStale() --> bool # Returns true if folder is stale in collaboration mode, false otherwise
GetUniqueId() --> string # Returns a unique ID for the media pool folder
Export(filePath) --> bool # Returns true if export of DRB folder to filePath is successful, false otherwise
TranscribeAudio() --> Bool # Transcribes audio of the MediaPoolItems within the folder and nested folders. Returns True if successful; False otherwise
ClearTranscription() --> Bool # Clears audio transcription of the MediaPoolItems within the folder and nested folders. Returns True if successful; False otherwise.

MediaPoolItem
GetName() --> string # Returns the clip name.
Expand Down Expand Up @@ -340,8 +356,11 @@ Timeline
GrabStill() --> galleryStill # Grabs still from the current video clip. Returns a GalleryStill object.
GrabAllStills(stillFrameSource) --> [galleryStill] # Grabs stills from all the clips of the timeline at 'stillFrameSource' (1 - First frame, 2 - Middle frame). Returns the list of GalleryStill objects.
GetUniqueId() --> string # Returns a unique ID for the timeline
CreateSubtitlesFromAudio() --> Bool # Creates subtitles from audio for the timeline. Returns True on success, False otherwise.
CreateSubtitlesFromAudio({autoCaptionSettings}) --> Bool # Creates subtitles from audio for the timeline.
# Takes in optional dictionary {autoCaptionSettings}. Check 'Auto Caption Settings' subsection below for more information.
# Returns True on success, False otherwise.
DetectSceneCuts() --> Bool # Detects and makes scene cuts along the timeline. Returns True if successful, False otherwise.
ConvertTimelineToStereo() --> Bool # Converts timeline to stereo. Returns True if successful; False otherwise.

TimelineItem
GetName() --> string # Returns the item name.
Expand Down Expand Up @@ -428,7 +447,8 @@ GalleryStillAlbum
GetStills() --> [galleryStill] # Returns the list of GalleryStill objects in the album.
GetLabel(galleryStill) --> string # Returns the label of the galleryStill.
SetLabel(galleryStill, label) --> Bool # Sets the new 'label' to GalleryStill object 'galleryStill'.
ExportStills([galleryStill], folderPath, filePrefix, format) --> Bool # Exports list of GalleryStill objects '[galleryStill]' to directory 'folderPath', with filename prefix 'filePrefix', using file format 'format' (supported formats: dpx, cin, tif, jpg, png, ppm, bmp, xpm).
ImportStills([filePaths]) --> Bool # Imports GalleryStill from each filePath in [filePaths] list. True if at least one still is imported successfully. False otherwise.
ExportStills([galleryStill], folderPath, filePrefix, format) --> Bool # Exports list of GalleryStill objects '[galleryStill]' to directory 'folderPath', with filename prefix 'filePrefix', using file format 'format' (supported formats: dpx, cin, tif, jpg, png, ppm, bmp, xpm, drx).
DeleteStills([galleryStill]) --> Bool # Deletes specified list of GalleryStill objects '[galleryStill]'.

GalleryStill # This class does not provide any API functions but the object type is used by functions in other classes.
Expand All @@ -439,6 +459,24 @@ Beside primitive data types, Resolve's Python API mainly uses list and dict data
As Lua does not support list and dict data structures, the Lua API implements "list" as a table with indices, e.g. { [1] = listValue1, [2] = listValue2, ... }.
Similarly the Lua API implements "dict" as a table with the dictionary key as first element, e.g. { [dictKey1] = dictValue1, [dictKey2] = dictValue2, ... }.

Cloud Projects Settings
--------------------------------------
This section covers additional notes for the functions "ProjectManager:CreateCloudProject," "ProjectManager:ImportCloudProject," and "ProjectManager:RestoreCloudProject"

All three functions take in a {cloudSettings} dict, that have the following keys:
* resolve.CLOUD_SETTING_PROJECT_NAME: String, ["" by default]
* resolve.CLOUD_SETTING_PROJECT_MEDIA_PATH: String, ["" by default]
* resolve.CLOUD_SETTING_IS_COLLAB: Bool, [False by default]
* resolve.CLOUD_SETTING_SYNC_MODE: syncMode (see below), [resolve.CLOUD_SYNC_PROXY_ONLY by default]
* resolve.CLOUD_SETTING_IS_CAMERA_ACCESS: Bool [False by default]

Where syncMode is one of the following values:
* resolve.CLOUD_SYNC_NONE,
* resolve.CLOUD_SYNC_PROXY_ONLY,
* resolve.CLOUD_SYNC_PROXY_AND_ORIG

All three "ProjectManager:CreateCloudProject," "ProjectManager:ImportCloudProject," and "ProjectManager:RestoreCloudProject" require resolve.PROJECT_MEDIA_PATH to be defined. "ProjectManager:CreateCloudProject" also requires resolve.PROJECT_NAME to be defined.

Looking up Project and Clip properties
--------------------------------------
This section covers additional notes for the functions "Project:GetSetting", "Project:SetSetting", "Timeline:GetSetting", "Timeline:SetSetting", "MediaPoolItem:GetClipProperty" and
Expand Down Expand Up @@ -478,6 +516,49 @@ Affects:
• x = MediaPoolItem:GetClipProperty('Super Scale') and MediaPoolItem:SetClipProperty('Super Scale', x)
• for '2x Enhanced' --> MediaPoolItem:SetClipProperty('Super Scale', 2, sharpnessValue, noiseReductionValue), where sharpnessValue is a float in the range [0.0, 1.0] and noiseReductionValue is a float in the range [0.0, 1.0]

Auto Caption Settings
----------------------
This section covers the supported settings for the method Timeline.CreateSubtitlesFromAudio({autoCaptionSettings})

The parameter setting is a dictionary containing the following keys:
* resolve.SUBTITLE_LANGUAGE: languageID (see below), [resolve.AUTO_CAPTION_AUTO by default]
* resolve.SUBTITLE_CAPTION_PRESET: presetType (see below), [resolve.AUTO_CAPTION_SUBTITLE_DEFAULT by default]
* resolve.SUBTITLE_CHARS_PER_LINE: Number between 1 and 60 inclusive [42 by default]
* resolve.SUBTITLE_LINE_BREAK: lineBreakType (see below), [resolve.AUTO_CAPTION_LINE_SINGLE by default]
* resolve.SUBTITLE_GAP: Number between 0 and 10 inclusive [0 by default]

Note that the default values for some keys may change based on values defined for other keys, as per the UI.
For example, if the following dictionary is supplied,
CreateSubtitlesFromAudio( { resolve.SUBTITLE_LANGUAGE = resolve.AUTO_CAPTION_KOREAN,
resolve.SUBTITLE_CAPTION_PRESET = resolve.AUTO_CAPTION_NETFLIX } )
the default value for resolve.SUBTITLE_CHARS_PER_LINE will be 16 instead of 42

languageIDs:
* resolve.AUTO_CAPTION_AUTO
* resolve.AUTO_CAPTION_DANISH
* resolve.AUTO_CAPTION_DUTCH
* resolve.AUTO_CAPTION_ENGLISH
* resolve.AUTO_CAPTION_FRENCH
* resolve.AUTO_CAPTION_GERMAN
* resolve.AUTO_CAPTION_ITALIAN
* resolve.AUTO_CAPTION_JAPANESE
* resolve.AUTO_CAPTION_KOREAN
* resolve.AUTO_CAPTION_MANDARIN_SIMPLIFIED
* resolve.AUTO_CAPTION_MANDARIN_TRADITIONAL
* resolve.AUTO_CAPTION_NORWEGIAN
* resolve.AUTO_CAPTION_PORTUGUESE
* resolve.AUTO_CAPTION_RUSSIAN
* resolve.AUTO_CAPTION_SPANISH
* resolve.AUTO_CAPTION_SWEDISH

presetTypes:
* resolve.AUTO_CAPTION_SUBTITLE_DEFAULT
* resolve.AUTO_CAPTION_TELETEXT
* resolve.AUTO_CAPTION_NETFLIX

lineBreakTypes:
* resolve.AUTO_CAPTION_LINE_SINGLE
* resolve.AUTO_CAPTION_LINE_DOUBLE

Looking up Render Settings
--------------------------
Expand Down
53 changes: 32 additions & 21 deletions client/ayon_core/hosts/resolve/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
containerise,
update_container,
maintained_selection,
remove_instance,
list_instances
)

from .lib import (
maintain_current_timeline,
publish_clip_color,
get_project_manager,
get_current_project,
get_current_resolve_project,
get_current_project, # backward compatibility
get_current_timeline,
get_any_timeline,
get_new_timeline,
Expand All @@ -30,9 +28,12 @@
get_timeline_item,
get_video_track_names,
get_current_timeline_items,
get_pype_timeline_item_by_name,
get_timeline_item_pype_tag,
set_timeline_item_pype_tag,
get_timeline_item_by_name,
get_pype_timeline_item_by_name, # backward compatibility
get_timeline_item_ayon_tag,
get_timeline_item_pype_tag, # backward compatibility
set_timeline_item_ayon_tag,
set_timeline_item_pype_tag, # backward compatibility
imprint,
set_publish_attribute,
get_publish_attribute,
Expand All @@ -44,13 +45,15 @@
get_reformated_path
)

from .menu import launch_pype_menu
from .menu import launch_ayon_menu

from .plugin import (
ClipLoader,
TimelineItemLoader,
Creator,
PublishClip
ResolveCreator,
Creator, # backward compatibility
PublishableClip,
PublishClip, # backward compatibility
)

from .workio import (
Expand All @@ -64,31 +67,34 @@

from .testing_utils import TestGUI


# Resolve specific singletons
bmdvr = None
bmdvf = None
project_manager = None
media_storage = None


__all__ = [
"bmdvr",
"bmdvf",
"project_manager",
"media_storage",

# pipeline
"ResolveHost",
"ls",
"containerise",
"update_container",
"maintained_selection",
"remove_instance",
"list_instances",

# utils
"get_resolve_module",

# lib
"maintain_current_timeline",
"publish_clip_color",
"get_project_manager",
"get_current_project",
"get_current_resolve_project",
"get_current_project", # backward compatibility
"get_current_timeline",
"get_any_timeline",
"get_new_timeline",
Expand All @@ -99,9 +105,12 @@
"get_timeline_item",
"get_video_track_names",
"get_current_timeline_items",
"get_pype_timeline_item_by_name",
"get_timeline_item_pype_tag",
"set_timeline_item_pype_tag",
"get_timeline_item_by_name",
"get_pype_timeline_item_by_name", # backward compatibility
"get_timeline_item_ayon_tag",
"get_timeline_item_pype_tag", # backward compatibility
"set_timeline_item_ayon_tag",
"set_timeline_item_pype_tag", # backward compatibility
"imprint",
"set_publish_attribute",
"get_publish_attribute",
Expand All @@ -113,13 +122,15 @@
"get_reformated_path",

# menu
"launch_pype_menu",
"launch_ayon_menu",

# plugin
"ClipLoader",
"TimelineItemLoader",
"Creator",
"PublishClip",
"ResolveCreator",
"Creator", # backward compatibility
"PublishableClip",
"PublishClip", # backward compatibility

# workio
"open_file",
Expand Down
18 changes: 18 additions & 0 deletions client/ayon_core/hosts/resolve/api/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Ayon sequential rename variables
rename_index = 0
rename_add = 0

publish_clip_color = "Pink"
ayon_marker_workflow = True

# Ayon compound clip workflow variable
ayon_tag_name = "VFX Notes"

# Ayon marker workflow variables
ayon_marker_name = "AyonData"
ayon_marker_duration = 1
ayon_marker_color = "Mint"
temp_marker_frame = None

# Ayon default timeline
ayon_timeline_name = "AyonTimeline"
Loading