mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Addressed a concern raised for how file_formats are extracted from instance.
Renamed `expectMipMap` to `publishMipMap` to make it more clear. Added `linear` & `auto` to possible color spaces.
This commit is contained in:
parent
9c73a4181e
commit
46ab3b8e3a
6 changed files with 20 additions and 29 deletions
|
|
@ -12,4 +12,4 @@ class CreateMultiverseLook(plugin.Creator):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(CreateMultiverseLook, self).__init__(*args, **kwargs)
|
||||
self.data["fileFormat"] = ["usda", "usd"]
|
||||
self.data["expectMipMap"] = True
|
||||
self.data["publishMipMap"] = True
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ SHAPE_ATTRS = ["castsShadows",
|
|||
"opposite"]
|
||||
|
||||
SHAPE_ATTRS = set(SHAPE_ATTRS)
|
||||
COLOUR_SPACES = ['sRGB']
|
||||
COLOUR_SPACES = ['sRGB', 'linear', 'auto']
|
||||
MIPMAP_EXTENSIONS = ['tdl']
|
||||
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ class CollectMultiverseLookData(pyblish.api.InstancePlugin):
|
|||
files = []
|
||||
sets = {}
|
||||
instance.data["resources"] = []
|
||||
expectMipMap = instance.data["expectMipMap"]
|
||||
publishMipMap = instance.data["publishMipMap"]
|
||||
|
||||
for node in nodes:
|
||||
self.log.info("Getting resources for '{}'".format(node))
|
||||
|
|
@ -262,7 +262,7 @@ class CollectMultiverseLookData(pyblish.api.InstancePlugin):
|
|||
files = cmds.ls(history, type="file", long=True)
|
||||
|
||||
for f in files:
|
||||
resources = self.collect_resource(f, expectMipMap)
|
||||
resources = self.collect_resource(f, publishMipMap)
|
||||
instance.data["resources"].append(resources)
|
||||
|
||||
elif isinstance(matOver, multiverse.MaterialSourceUsdPath):
|
||||
|
|
@ -275,7 +275,7 @@ class CollectMultiverseLookData(pyblish.api.InstancePlugin):
|
|||
"relationships": sets
|
||||
}
|
||||
|
||||
def collect_resource(self, node, expectMipMap):
|
||||
def collect_resource(self, node, publishMipMap):
|
||||
"""Collect the link to the file(s) used (resource)
|
||||
Args:
|
||||
node (str): name of the node
|
||||
|
|
@ -330,7 +330,7 @@ class CollectMultiverseLookData(pyblish.api.InstancePlugin):
|
|||
source = source.replace("\\", "/")
|
||||
|
||||
files = get_file_node_files(node)
|
||||
files = self.handle_files(files, expectMipMap)
|
||||
files = self.handle_files(files, publishMipMap)
|
||||
if len(files) == 0:
|
||||
self.log.error("No valid files found from node `%s`" % node)
|
||||
|
||||
|
|
@ -348,11 +348,11 @@ class CollectMultiverseLookData(pyblish.api.InstancePlugin):
|
|||
"files": files,
|
||||
"color_space": color_space} # required for resources
|
||||
|
||||
def handle_files(self, files, expectMipMap):
|
||||
def handle_files(self, files, publishMipMap):
|
||||
"""This will go through all the files and make sure that they are
|
||||
either already mipmapped or have a corresponding mipmap sidecar and
|
||||
add that to the list."""
|
||||
if not expectMipMap:
|
||||
if not publishMipMap:
|
||||
return files
|
||||
|
||||
extra_files = []
|
||||
|
|
|
|||
|
|
@ -133,18 +133,15 @@ class ExtractMultiverseUsd(openpype.api.Extractor):
|
|||
|
||||
return options
|
||||
|
||||
def get_file_format(self, instance):
|
||||
fileFormat = instance.data["fileFormat"]
|
||||
if fileFormat in range(len(self.file_formats)):
|
||||
self.scene_type = self.file_formats[fileFormat]
|
||||
|
||||
def process(self, instance):
|
||||
# Load plugin first
|
||||
cmds.loadPlugin("MultiverseForMaya", quiet=True)
|
||||
|
||||
# Define output file path
|
||||
staging_dir = self.staging_dir(instance)
|
||||
self.get_file_format(instance)
|
||||
file_format = instance.data.get("fileFormat", 0)
|
||||
if file_format in range(len(self.file_formats)):
|
||||
self.scene_type = self.file_formats[file_format]
|
||||
file_name = "{0}.{1}".format(instance.name, self.scene_type)
|
||||
file_path = os.path.join(staging_dir, file_name)
|
||||
file_path = file_path.replace('\\', '/')
|
||||
|
|
|
|||
|
|
@ -75,18 +75,15 @@ class ExtractMultiverseUsdComposition(openpype.api.Extractor):
|
|||
|
||||
return options
|
||||
|
||||
def get_file_format(self, instance):
|
||||
fileFormat = instance.data["fileFormat"]
|
||||
if fileFormat in range(len(self.file_formats)):
|
||||
self.scene_type = self.file_formats[fileFormat]
|
||||
|
||||
def process(self, instance):
|
||||
# Load plugin first
|
||||
cmds.loadPlugin("MultiverseForMaya", quiet=True)
|
||||
|
||||
# Define output file path
|
||||
staging_dir = self.staging_dir(instance)
|
||||
self.get_file_format(instance)
|
||||
file_format = instance.data.get("fileFormat", 0)
|
||||
if file_format in range(len(self.file_formats)):
|
||||
self.scene_type = self.file_formats[file_format]
|
||||
file_name = "{0}.{1}".format(instance.name, self.scene_type)
|
||||
file_path = os.path.join(staging_dir, file_name)
|
||||
file_path = file_path.replace('\\', '/')
|
||||
|
|
|
|||
|
|
@ -60,18 +60,15 @@ class ExtractMultiverseUsdOverride(openpype.api.Extractor):
|
|||
"timeSamplesSpan": 0.0
|
||||
}
|
||||
|
||||
def get_file_format(self, instance):
|
||||
fileFormat = instance.data["fileFormat"]
|
||||
if fileFormat in range(len(self.file_formats)):
|
||||
self.scene_type = self.file_formats[fileFormat]
|
||||
|
||||
def process(self, instance):
|
||||
# Load plugin first
|
||||
cmds.loadPlugin("MultiverseForMaya", quiet=True)
|
||||
|
||||
# Define output file path
|
||||
staging_dir = self.staging_dir(instance)
|
||||
self.get_file_format(instance)
|
||||
file_format = instance.data.get("fileFormat", 0)
|
||||
if file_format in range(len(self.file_formats)):
|
||||
self.scene_type = self.file_formats[file_format]
|
||||
file_name = "{0}.{1}".format(instance.name, self.scene_type)
|
||||
file_path = os.path.join(staging_dir, file_name)
|
||||
file_path = file_path.replace("\\", "/")
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import openpype.hosts.maya.api.action
|
|||
|
||||
import os
|
||||
|
||||
COLOUR_SPACES = ['sRGB']
|
||||
COLOUR_SPACES = ['sRGB', 'linear', 'auto']
|
||||
MIPMAP_EXTENSIONS = ['tdl']
|
||||
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ class ValidateMvLookContents(pyblish.api.InstancePlugin):
|
|||
|
||||
def process(self, instance):
|
||||
intent = instance.context.data['intent']['value']
|
||||
expectMipMap = instance.data["expectMipMap"]
|
||||
publishMipMap = instance.data["publishMipMap"]
|
||||
enforced = True
|
||||
if intent in self.enforced_intents:
|
||||
self.log.info("This validation will be enforced: '{}'"
|
||||
|
|
@ -55,7 +55,7 @@ class ValidateMvLookContents(pyblish.api.InstancePlugin):
|
|||
.format(node, fname))
|
||||
invalid.add(node)
|
||||
|
||||
if expectMipMap and not self.is_or_has_mipmap(fname, files):
|
||||
if publishMipMap and not self.is_or_has_mipmap(fname, files):
|
||||
msg = "File node '{}'/'{}' does not have a mipmap".format(
|
||||
node, fname)
|
||||
if enforced:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue