mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge branch 'develop' of bitbucket.org:pypeclub/pype into develop
This commit is contained in:
commit
160d285d9e
6 changed files with 63 additions and 8 deletions
40
pype/plugins/maya/publish/validate_unicode_strings.py
Normal file
40
pype/plugins/maya/publish/validate_unicode_strings.py
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
import os
|
||||||
|
from maya import cmds
|
||||||
|
|
||||||
|
import pyblish.api
|
||||||
|
import pype.api
|
||||||
|
import pype.maya.action
|
||||||
|
|
||||||
|
|
||||||
|
class ValidateUnicodeStrings(pyblish.api.Validator):
|
||||||
|
"""Validate all environment variables are string type.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
order = pype.api.ValidateContentsOrder
|
||||||
|
hosts = ['maya']
|
||||||
|
families = ['review']
|
||||||
|
label = 'Unicode Strings'
|
||||||
|
actions = [pype.api.RepairAction]
|
||||||
|
|
||||||
|
def process(self, instance):
|
||||||
|
invalid = self.get_invalid(instance)
|
||||||
|
if invalid:
|
||||||
|
raise RuntimeError("Found unicode strings in environment variables.")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_invalid(cls, instance):
|
||||||
|
invalid = []
|
||||||
|
for key, value in os.environ.items():
|
||||||
|
if type(value) is type(u't'):
|
||||||
|
invalid.append((key, value))
|
||||||
|
|
||||||
|
return invalid
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def repair(cls, instance):
|
||||||
|
"""Retype all unicodes to strings."""
|
||||||
|
|
||||||
|
for key, value in os.environ.items():
|
||||||
|
if type(value) is type(u't'):
|
||||||
|
os.environ[key] = str(value)
|
||||||
|
|
@ -109,7 +109,7 @@ class CollectContextDataSAPublish(pyblish.api.ContextPlugin):
|
||||||
if component["preview"]:
|
if component["preview"]:
|
||||||
instance.data["families"].append("review")
|
instance.data["families"].append("review")
|
||||||
instance.data["repreProfiles"] = ["h264"]
|
instance.data["repreProfiles"] = ["h264"]
|
||||||
component["tags"] = ["review", "delete"]
|
component["tags"] = ["review"]
|
||||||
self.log.debug("Adding review family")
|
self.log.debug("Adding review family")
|
||||||
|
|
||||||
instance.data["representations"].append(component)
|
instance.data["representations"].append(component)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import tempfile
|
||||||
|
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
from pype.vendor import clique
|
from pype.vendor import clique
|
||||||
|
|
@ -82,9 +83,10 @@ class ExtractReviewSP(pyblish.api.InstancePlugin):
|
||||||
full_input_path = os.path.join(staging_dir, repre["files"])
|
full_input_path = os.path.join(staging_dir, repre["files"])
|
||||||
filename = repre["files"].split(".")[0]
|
filename = repre["files"].split(".")[0]
|
||||||
|
|
||||||
|
# prepare output file
|
||||||
repr_file = filename + "_{0}.{1}".format(name, ext)
|
repr_file = filename + "_{0}.{1}".format(name, ext)
|
||||||
|
out_stagigng_dir = tempfile.mkdtemp(prefix="extract_review_")
|
||||||
full_output_path = os.path.join(staging_dir, repr_file)
|
full_output_path = os.path.join(out_stagigng_dir, repr_file)
|
||||||
|
|
||||||
self.log.info("input {}".format(full_input_path))
|
self.log.info("input {}".format(full_input_path))
|
||||||
self.log.info("output {}".format(full_output_path))
|
self.log.info("output {}".format(full_output_path))
|
||||||
|
|
@ -169,18 +171,25 @@ class ExtractReviewSP(pyblish.api.InstancePlugin):
|
||||||
"name": name,
|
"name": name,
|
||||||
"ext": ext,
|
"ext": ext,
|
||||||
"files": repr_file,
|
"files": repr_file,
|
||||||
|
"stagingDir": out_stagigng_dir,
|
||||||
"tags": new_tags,
|
"tags": new_tags,
|
||||||
"outputName": name,
|
"outputName": name,
|
||||||
"startFrameReview": 1,
|
"startFrameReview": 1,
|
||||||
"endFrameReview": video_len
|
"endFrameReview": video_len
|
||||||
})
|
})
|
||||||
if repre_new.get("preview"):
|
# cleanup thumbnail from new repre
|
||||||
repre_new.pop("preview")
|
|
||||||
if repre_new.get("thumbnail"):
|
if repre_new.get("thumbnail"):
|
||||||
repre_new.pop("thumbnail")
|
repre_new.pop("thumbnail")
|
||||||
|
if "thumbnail" in repre_new["tags"]:
|
||||||
|
repre_new["tags"].remove("thumbnail")
|
||||||
|
|
||||||
# adding representation
|
# adding representation
|
||||||
self.log.debug("Adding: {}".format(repre_new))
|
self.log.debug("Adding: {}".format(repre_new))
|
||||||
|
# cleanup repre from preview
|
||||||
|
if "preview" in repre:
|
||||||
|
repre.pop("preview")
|
||||||
|
if "preview" in repre["tags"]:
|
||||||
|
repre["tags"].remove("preview")
|
||||||
new_repres.append(repre_new)
|
new_repres.append(repre_new)
|
||||||
|
|
||||||
for repre in instance.data["representations"]:
|
for repre in instance.data["representations"]:
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,8 @@ class Window(QtWidgets.QDialog):
|
||||||
'''
|
'''
|
||||||
if self.shadow_widget.isVisible():
|
if self.shadow_widget.isVisible():
|
||||||
self.shadow_widget.setVisible(False)
|
self.shadow_widget.setVisible(False)
|
||||||
|
# Refresh version
|
||||||
|
self.widget_family.on_version_refresh()
|
||||||
|
|
||||||
def set_valid_family(self, valid):
|
def set_valid_family(self, valid):
|
||||||
''' Sets `valid_family` attribute for validation
|
''' Sets `valid_family` attribute for validation
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from . import Node
|
||||||
class TreeModel(QtCore.QAbstractItemModel):
|
class TreeModel(QtCore.QAbstractItemModel):
|
||||||
|
|
||||||
COLUMNS = list()
|
COLUMNS = list()
|
||||||
NodeRole = QtCore.Qt.UserRole + 1
|
ItemRole = QtCore.Qt.UserRole + 1
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(TreeModel, self).__init__(parent)
|
super(TreeModel, self).__init__(parent)
|
||||||
|
|
@ -35,7 +35,7 @@ class TreeModel(QtCore.QAbstractItemModel):
|
||||||
key = self.COLUMNS[column]
|
key = self.COLUMNS[column]
|
||||||
return node.get(key, None)
|
return node.get(key, None)
|
||||||
|
|
||||||
if role == self.NodeRole:
|
if role == self.ItemRole:
|
||||||
return index.internalPointer()
|
return index.internalPointer()
|
||||||
|
|
||||||
def setData(self, index, value, role=QtCore.Qt.EditRole):
|
def setData(self, index, value, role=QtCore.Qt.EditRole):
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ class AssetWidget(QtWidgets.QWidget):
|
||||||
|
|
||||||
def collect_data(self):
|
def collect_data(self):
|
||||||
project = self.dbcon.find_one({'type': 'project'})
|
project = self.dbcon.find_one({'type': 'project'})
|
||||||
asset = self.dbcon.find_one({'_id': self.get_active_asset()})
|
asset = self.get_active_asset()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
index = self.task_view.selectedIndexes()[0]
|
index = self.task_view.selectedIndexes()[0]
|
||||||
|
|
@ -219,6 +219,10 @@ class AssetWidget(QtWidgets.QWidget):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_parents(self, entity):
|
def get_parents(self, entity):
|
||||||
|
ent_parents = entity.get("data", {}).get("parents")
|
||||||
|
if ent_parents is not None and isinstance(ent_parents, list):
|
||||||
|
return ent_parents
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
if entity.get('data', {}).get('visualParent', None) is None:
|
if entity.get('data', {}).get('visualParent', None) is None:
|
||||||
return output
|
return output
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue