mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 22:02:15 +01:00
commit
cbe6469748
2 changed files with 71 additions and 39 deletions
|
|
@ -13,6 +13,7 @@ from collections import OrderedDict, defaultdict
|
|||
from maya import cmds, mel
|
||||
|
||||
from avalon import maya, io
|
||||
from cb.utils.maya import core
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -42,6 +43,42 @@ SHAPE_ATTRS = ["castsShadows",
|
|||
SHAPE_ATTRS = set(SHAPE_ATTRS)
|
||||
|
||||
|
||||
DEFAULT_MATRIX = [1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0]
|
||||
|
||||
# The maya alembic export types
|
||||
_alembic_options = {
|
||||
"startFrame": float,
|
||||
"endFrame": float,
|
||||
"frameRange": str, # "start end"; overrides startFrame & endFrame
|
||||
"eulerFilter": bool,
|
||||
"frameRelativeSample": float,
|
||||
"noNormals": bool,
|
||||
"renderableOnly": bool,
|
||||
"step": float,
|
||||
"stripNamespaces": bool,
|
||||
"uvWrite": bool,
|
||||
"wholeFrameGeo": bool,
|
||||
"worldSpace": bool,
|
||||
"writeVisibility": bool,
|
||||
"writeColorSets": bool,
|
||||
"writeFaceSets": bool,
|
||||
"writeCreases": bool, # Maya 2015 Ext1+
|
||||
"dataFormat": str,
|
||||
"root": (list, tuple),
|
||||
"attr": (list, tuple),
|
||||
"attrPrefix": (list, tuple),
|
||||
"userAttr": (list, tuple),
|
||||
"melPerFrameCallback": str,
|
||||
"melPostJobCallback": str,
|
||||
"pythonPerFrameCallback": str,
|
||||
"pythonPostJobCallback": str,
|
||||
"selection": bool
|
||||
}
|
||||
|
||||
|
||||
def unique(name):
|
||||
assert isinstance(name, basestring), "`name` must be string"
|
||||
|
||||
|
|
@ -362,37 +399,6 @@ def is_visible(node,
|
|||
return True
|
||||
|
||||
|
||||
# The maya alembic export types
|
||||
_alembic_options = {
|
||||
"startFrame": float,
|
||||
"endFrame": float,
|
||||
"frameRange": str, # "start end"; overrides startFrame & endFrame
|
||||
"eulerFilter": bool,
|
||||
"frameRelativeSample": float,
|
||||
"noNormals": bool,
|
||||
"renderableOnly": bool,
|
||||
"step": float,
|
||||
"stripNamespaces": bool,
|
||||
"uvWrite": bool,
|
||||
"wholeFrameGeo": bool,
|
||||
"worldSpace": bool,
|
||||
"writeVisibility": bool,
|
||||
"writeColorSets": bool,
|
||||
"writeFaceSets": bool,
|
||||
"writeCreases": bool, # Maya 2015 Ext1+
|
||||
"dataFormat": str,
|
||||
"root": (list, tuple),
|
||||
"attr": (list, tuple),
|
||||
"attrPrefix": (list, tuple),
|
||||
"userAttr": (list, tuple),
|
||||
"melPerFrameCallback": str,
|
||||
"melPostJobCallback": str,
|
||||
"pythonPerFrameCallback": str,
|
||||
"pythonPostJobCallback": str,
|
||||
"selection": bool
|
||||
}
|
||||
|
||||
|
||||
def extract_alembic(file,
|
||||
startFrame=None,
|
||||
endFrame=None,
|
||||
|
|
@ -761,7 +767,7 @@ def list_looks(asset_id):
|
|||
|
||||
# # get all subsets with look leading in
|
||||
# the name associated with the asset
|
||||
subset = io.find({"parent": asset_id,
|
||||
subset = io.find({"parent": bson.ObjectId(asset_id),
|
||||
"type": "subset",
|
||||
"name": {"$regex": "look*"}})
|
||||
|
||||
|
|
@ -799,8 +805,7 @@ def assign_look_by_version(nodes, version_id):
|
|||
log.info("Loading lookdev for the first time..")
|
||||
|
||||
# Define namespace
|
||||
assetname = shader_file['context']['asset']
|
||||
ns_assetname = "{}_".format(assetname)
|
||||
ns_assetname = "{}_".format(shader_file['context']['asset'])
|
||||
namespace = maya.unique_namespace(ns_assetname,
|
||||
format="%03d",
|
||||
suffix="_look")
|
||||
|
|
@ -816,8 +821,7 @@ def assign_look_by_version(nodes, version_id):
|
|||
# give along a fake "context" with only `representation`
|
||||
# because `maya.containerise` only used that key anyway
|
||||
context = {"representation": shader_file}
|
||||
subset_name = shader_file["context"]["subset"]
|
||||
maya.containerise(name=subset_name,
|
||||
maya.containerise(name=shader_file["context"]["subset"],
|
||||
namespace=namespace,
|
||||
nodes=shader_nodes,
|
||||
context=context)
|
||||
|
|
@ -1017,3 +1021,31 @@ def get_related_sets(node):
|
|||
sets = [s for s in sets if s not in defaults]
|
||||
|
||||
return sets
|
||||
|
||||
|
||||
def get_container_transforms(container, members=None, root=False):
|
||||
"""Retrieve the root node of the container content
|
||||
|
||||
When a container is created through a Loader the content
|
||||
of the file will be grouped under a transform. The name of the root
|
||||
transform is stored in the container information
|
||||
|
||||
Args:
|
||||
container (dict): the container
|
||||
members (list): optional and convenience argument
|
||||
root (bool): return highest node in hierachy if True
|
||||
|
||||
Returns:
|
||||
root (list / str):
|
||||
"""
|
||||
|
||||
if not members:
|
||||
members = cmds.sets(container["objectName"], query=True)
|
||||
|
||||
results = cmds.ls(members, type="transform", long=True)
|
||||
if root:
|
||||
root = core.getHighestInHierarchy(results)
|
||||
if root:
|
||||
results = root[0]
|
||||
|
||||
return results
|
||||
|
|
|
|||
|
|
@ -131,14 +131,14 @@ class MindbenderSubmitDeadline(pyblish.api.InstancePlugin):
|
|||
|
||||
# Optional, enable double-click to preview rendered
|
||||
# frames from Deadline Monitor
|
||||
"OutputFilename0": output_filename_0,
|
||||
"OutputFilename0": output_filename_0.replace("\\", "/"),
|
||||
},
|
||||
"PluginInfo": {
|
||||
# Input
|
||||
"SceneFile": fpath,
|
||||
|
||||
# Output directory and filename
|
||||
"OutputFilePath": dirname,
|
||||
"OutputFilePath": dirname.replace("\\", "/"),
|
||||
"OutputFilePrefix": render_variables["filename_prefix"],
|
||||
|
||||
# Mandatory for Deadline
|
||||
|
|
@ -241,7 +241,7 @@ class MindbenderSubmitDeadline(pyblish.api.InstancePlugin):
|
|||
padded_basename = "{}.{}.{}".format(layer, "#" * padding, ext)
|
||||
scene_layer_folder = "{}_{}".format(scene, layer)
|
||||
preview_fname = os.path.join(folder, scene, scene_layer_folder,
|
||||
layer, padded_basename)
|
||||
padded_basename)
|
||||
|
||||
return preview_fname
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue