mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
resolve: fix testing utils import modules
This commit is contained in:
parent
5c73fc0713
commit
c7b78dad5b
2 changed files with 93 additions and 48 deletions
|
|
@ -1,56 +1,54 @@
|
|||
#! python3
|
||||
import os
|
||||
|
||||
|
||||
class TestGUI:
|
||||
resolve = bmd.scriptapp("Resolve") # noqa
|
||||
fu = resolve.Fusion()
|
||||
ui = fu.UIManager
|
||||
disp = bmd.UIDispatcher(fu.UIManager) # noqa
|
||||
title_font = ui.Font({"PixelSize": 18})
|
||||
_dialogue = disp.AddWindow(
|
||||
{
|
||||
"WindowTitle": "Get Testing folder",
|
||||
"ID": "TestingWin",
|
||||
"Geometry": [250, 250, 250, 100],
|
||||
"Spacing": 0,
|
||||
"Margin": 10
|
||||
},
|
||||
[
|
||||
ui.VGroup(
|
||||
{
|
||||
"Spacing": 2
|
||||
},
|
||||
[
|
||||
ui.Button(
|
||||
{
|
||||
"ID": "inputTestSourcesFolder",
|
||||
"Text": "Select folder with testing medias",
|
||||
"Weight": 1.25,
|
||||
"ToolTip": (
|
||||
"Chose folder with videos, sequences, "
|
||||
"single images, nested folders with "
|
||||
"medias"
|
||||
),
|
||||
"Flat": False
|
||||
}
|
||||
),
|
||||
ui.VGap(),
|
||||
ui.Button(
|
||||
{
|
||||
"ID": "openButton",
|
||||
"Text": "Process Test",
|
||||
"Weight": 2,
|
||||
"ToolTip": "Run the test...",
|
||||
"Flat": False
|
||||
}
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
resolve = bmd.scriptapp("Resolve") # noqa
|
||||
self.fu = resolve.Fusion()
|
||||
ui = self.fu.UIManager
|
||||
self.disp = bmd.UIDispatcher(self.fu.UIManager) # noqa
|
||||
self.title_font = ui.Font({"PixelSize": 18})
|
||||
self._dialogue = self.disp.AddWindow(
|
||||
{
|
||||
"WindowTitle": "Get Testing folder",
|
||||
"ID": "TestingWin",
|
||||
"Geometry": [250, 250, 250, 100],
|
||||
"Spacing": 0,
|
||||
"Margin": 10
|
||||
},
|
||||
[
|
||||
ui.VGroup(
|
||||
{
|
||||
"Spacing": 2
|
||||
},
|
||||
[
|
||||
ui.Button(
|
||||
{
|
||||
"ID": "inputTestSourcesFolder",
|
||||
"Text": "Select folder with testing medias",
|
||||
"Weight": 1.25,
|
||||
"ToolTip": (
|
||||
"Chose folder with videos, sequences, "
|
||||
"single images, nested folders with "
|
||||
"medias"
|
||||
),
|
||||
"Flat": False
|
||||
}
|
||||
),
|
||||
ui.VGap(),
|
||||
ui.Button(
|
||||
{
|
||||
"ID": "openButton",
|
||||
"Text": "Process Test",
|
||||
"Weight": 2,
|
||||
"ToolTip": "Run the test...",
|
||||
"Flat": False
|
||||
}
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
self._widgets = self._dialogue.GetItems()
|
||||
self._dialogue.On.TestingWin.Close = self._close_window
|
||||
self._dialogue.On.inputTestSourcesFolder.Clicked = self._open_dir_button_pressed # noqa
|
||||
|
|
|
|||
47
pype/hosts/resolve/utility_scripts/tests/test_otio_as_xml.py
Normal file
47
pype/hosts/resolve/utility_scripts/tests/test_otio_as_xml.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#! python3
|
||||
import os
|
||||
import sys
|
||||
import avalon.api as avalon
|
||||
import pype
|
||||
import opentimelineio as otio
|
||||
from opentimelineio_contrib import adapters as otio_adapters
|
||||
from pype.hosts.resolve import TestGUI
|
||||
import pype.hosts.resolve as bmdvr
|
||||
from pype.hosts.resolve.otio import davinci_export as otio_export
|
||||
|
||||
|
||||
class ThisTestGUI(TestGUI):
|
||||
extensions = [".exr", ".jpg", ".mov", ".png", ".mp4", ".ari", ".arx"]
|
||||
|
||||
def __init__(self):
|
||||
super(ThisTestGUI, self).__init__()
|
||||
# Registers pype's Global pyblish plugins
|
||||
pype.install()
|
||||
# activate resolve from pype
|
||||
avalon.install(bmdvr)
|
||||
|
||||
def _open_dir_button_pressed(self, event):
|
||||
# selected_path = self.fu.RequestFile(os.path.expanduser("~"))
|
||||
selected_path = self.fu.RequestDir(os.path.expanduser("~"))
|
||||
self._widgets["inputTestSourcesFolder"].Text = selected_path
|
||||
|
||||
# main function
|
||||
def process(self, event):
|
||||
self.input_dir_path = self._widgets["inputTestSourcesFolder"].Text
|
||||
project = bmdvr.get_current_project()
|
||||
otio_timeline = otio_export.create_otio_timeline(project)
|
||||
print(f"_ otio_timeline: `{otio_timeline}`")
|
||||
aaf_path = os.path.join(self.input_dir_path, "this_file_name.aaf")
|
||||
print(f"_ aaf_path: `{aaf_path}`")
|
||||
# xml_string = otio_adapters.fcpx_xml.write_to_string(otio_timeline)
|
||||
# print(f"_ xml_string: `{xml_string}`")
|
||||
otio.adapters.write_to_file(
|
||||
otio_timeline, aaf_path, adapter_name="AAF")
|
||||
# at the end close the window
|
||||
self._close_window(None)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_gui = ThisTestGUI()
|
||||
test_gui.show_gui()
|
||||
sys.exit(not bool(True))
|
||||
Loading…
Add table
Add a link
Reference in a new issue