Skip to content

Commit

Permalink
Merge pull request #35 from quadproduction/release/1.6.0
Browse files Browse the repository at this point in the history
release/1.6.0
  • Loading branch information
BenSouchet authored Feb 19, 2024
2 parents 59d052a + 8d19ac5 commit 4860db1
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def process(self, instance):
continue

filesnames = representation.get("files")

#if only one frame is publish, transform representation["files"] into a list qith a single element
if type(filesnames) != list:
filesnames = [filesnames]

if not filesnames:
self.log.warning("No files found following sequence extract.")
raise IndexError
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from maya import cmds
import pyblish.api

try:
from maya import cmds
except ImportError:
# Ignoring, we don't want misleading error logs on jobs log on deadline.
# Because the farm publish function imports every publish file before filtering.
pass

from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import (
ValidateContentsOrder
Expand Down
12 changes: 10 additions & 2 deletions quad_pyblish_module/plugins/nuke/publish/collect_licence_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ class CollectLicenseData(pyblish.api.InstancePlugin):
hosts = ["nuke"]
label = "Collect License Data"
order = pyblish.api.CollectorOrder + 0.4990

# TODO: avoid hardcoded path
rlm_path = "/prod/softprod/tools/linux/rlmutil"
# Match with server adress
foundry_licence = re.search(r':(\d+@[\w\.]+)', os.environ["foundry_LICENSE"]).group(1)
# Match with server address
foundry_licence_regex_result = re.search(r':(\d+@[\w.]+)', os.environ.get("foundry_LICENSE", ""))
foundry_licence = foundry_licence_regex_result.group(1) if foundry_licence_regex_result else None

def get_available_licenses(self):
if not self.foundry_licence:
return False

# Define the command to run
avail_command = f'{self.rlm_path} rlmstat -c {self.foundry_licence} -avail'

Expand All @@ -44,6 +49,9 @@ def get_available_licenses(self):
return True

def get_user_licenses(self):
if not self.foundry_licence:
return False

# Define the pattern for matching user licenses for nuke_i
user_command = f'{self.rlm_path} rlmstat -c {self.foundry_licence} -u {os.environ["USER"]}'

Expand Down
44 changes: 31 additions & 13 deletions quad_pyblish_module/plugins/tvpaint/publish/extract_psd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import json
import tempfile
from pathlib import Path

import pyblish.api
from openpype.settings import get_project_settings
Expand All @@ -19,7 +20,9 @@ class ExtractPsd(pyblish.api.InstancePlugin):
project_settings = get_project_settings(project_name)

enabled = project_settings['fix_custom_settings']['tvpaint']['publish'][
'ExtractPsd'].get('enabled')
'ExtractPsd'].get('enabled', False)

staging_dir_prefix = "tvpaint_export_json_psd_"

def process(self, instance):
if not self.enabled:
Expand All @@ -32,6 +35,19 @@ def process(self, instance):
repres = instance.data.get("representations")
if not repres:
return

scene_mark_in = int(instance.context.data["sceneMarkIn"])
output_dir = instance.data.get("stagingDir")

if output_dir:
# Only convert to a Path object if not None or empty
output_dir = Path(output_dir)

if not output_dir or not output_dir.exists():
# Create temp folder if staging dir is not set
output_dir = Path(tempfile.mkdtemp(
prefix=self.staging_dir_prefix).replace("\\", "/"))
instance.data['stagingDir'] = output_dir.resolve()

new_psd_repres = []
for repre in repres:
Expand All @@ -42,29 +58,24 @@ def process(self, instance):
json.dumps(repre, sort_keys=True, indent=4)
))

output_dir = instance.data.get("stagingDir")
if not output_dir or not os.path.exists(output_dir):
# Create temp folder if staging dir is not set
output_dir = (
tempfile.mkdtemp(prefix="tvpaint_export_json_psd_")
).replace("\\", "/")

if not isinstance(repre['files'], list):
files = [repre['files']]
else:
files = repre['files']

new_filenames = []
for filename in files:
new_filename = os.path.splitext(filename)[0]
dst_filepath = os.path.join(repre["stagingDir"], new_filename)
for offset, filename in enumerate(files):
new_filename = Path(filename).stem
dst_filepath = output_dir.joinpath(new_filename)
new_filenames.append(new_filename + '.psd')

frame_start = self.get_frame_start(repre)

# george command to export psd files for each image
george_script_lines.append(
"tv_clipsavestructure \"{}\" \"PSD\" \"image\" {}".format(
dst_filepath,
int(new_filename) - 1
dst_filepath.resolve(),
scene_mark_in + offset
)
)

Expand Down Expand Up @@ -93,3 +104,10 @@ def process(self, instance):
)
)
)

def get_frame_start(self, representation):
frame_start = representation.get('frameStart')
if not frame_start:
frame_start = str(lib.execute_george("tv_startframe"))

return frame_start

0 comments on commit 4860db1

Please sign in to comment.