mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
Merge pull request #2102 from Ellipsanime/fix-djv-view-for-openpype3
DJV: fix djv view loader for openpype3
This commit is contained in:
commit
da349dfc80
1 changed files with 19 additions and 19 deletions
|
|
@ -1,26 +1,28 @@
|
|||
import os
|
||||
import subprocess
|
||||
from avalon import api
|
||||
from openpype.api import ApplicationManager
|
||||
|
||||
|
||||
def existing_djv_path():
|
||||
djv_paths = os.environ.get("DJV_PATH") or ""
|
||||
for path in djv_paths.split(os.pathsep):
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
return None
|
||||
app_manager = ApplicationManager()
|
||||
djv_list = []
|
||||
|
||||
for app_name, app in app_manager.applications.items():
|
||||
if 'djv' in app_name and app.find_executable():
|
||||
djv_list.append(app_name)
|
||||
|
||||
return djv_list
|
||||
|
||||
class OpenInDJV(api.Loader):
|
||||
"""Open Image Sequence with system default"""
|
||||
|
||||
djv_path = existing_djv_path()
|
||||
families = ["*"] if djv_path else []
|
||||
djv_list = existing_djv_path()
|
||||
families = ["*"] if djv_list else []
|
||||
representations = [
|
||||
"cin", "dpx", "avi", "dv", "gif", "flv", "mkv", "mov", "mpg", "mpeg",
|
||||
"mp4", "m4v", "mxf", "iff", "z", "ifl", "jpeg", "jpg", "jfif", "lut",
|
||||
"1dl", "exr", "pic", "png", "ppm", "pnm", "pgm", "pbm", "rla", "rpf",
|
||||
"sgi", "rgba", "rgb", "bw", "tga", "tiff", "tif", "img"
|
||||
"sgi", "rgba", "rgb", "bw", "tga", "tiff", "tif", "img", "h264",
|
||||
]
|
||||
|
||||
label = "Open in DJV"
|
||||
|
|
@ -41,20 +43,18 @@ class OpenInDJV(api.Loader):
|
|||
)
|
||||
|
||||
if not remainder:
|
||||
seqeunce = collections[0]
|
||||
first_image = list(seqeunce)[0]
|
||||
sequence = collections[0]
|
||||
first_image = list(sequence)[0]
|
||||
else:
|
||||
first_image = self.fname
|
||||
filepath = os.path.normpath(os.path.join(directory, first_image))
|
||||
|
||||
self.log.info("Opening : {}".format(filepath))
|
||||
|
||||
cmd = [
|
||||
# DJV path
|
||||
os.path.normpath(self.djv_path),
|
||||
# PATH TO COMPONENT
|
||||
os.path.normpath(filepath)
|
||||
]
|
||||
last_djv_version = sorted(self.djv_list)[-1]
|
||||
|
||||
# Run DJV with these commands
|
||||
subprocess.Popen(cmd)
|
||||
app_manager = ApplicationManager()
|
||||
djv = app_manager.applications.get(last_djv_version)
|
||||
djv.arguments.append(filepath)
|
||||
|
||||
app_manager.launch(last_djv_version)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue