make sure error will be raised if there is neither texture nor image search path

This commit is contained in:
Kayla Man 2023-12-21 15:43:08 +08:00
parent da93e19ca9
commit fcd605ae7d
3 changed files with 9 additions and 19 deletions

View file

@ -6,6 +6,7 @@ from maya import cmds
import pyblish.api
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import KnownPublishError
SETTINGS = {"renderDensity",
@ -116,7 +117,6 @@ class CollectYetiRig(pyblish.api.InstancePlugin):
resources = []
image_search_paths = cmds.getAttr("{}.imageSearchPath".format(node))
texture_filenames = []
if image_search_paths:
# TODO: Somehow this uses OS environment path separator, `:` vs `;`
@ -124,8 +124,8 @@ class CollectYetiRig(pyblish.api.InstancePlugin):
image_search_paths = [p for p in
image_search_paths.split(os.path.pathsep) if p]
# find all ${TOKEN} tokens and replace them with $TOKEN env. variable
image_search_paths = self._replace_tokens(image_search_paths)
# find all ${TOKEN} tokens and replace them with $TOKEN env. variable
image_search_paths = self._replace_tokens(image_search_paths)
# List all related textures
texture_nodes = cmds.pgYetiGraph(
@ -163,7 +163,7 @@ class CollectYetiRig(pyblish.api.InstancePlugin):
break
if not files:
self.log.warning(
raise KnownPublishError(
"No texture found for: %s "
"(searched: %s)" % (texture, image_search_paths))

View file

@ -142,20 +142,10 @@ class ExtractYetiRig(publish.Extractor):
instance.data['transfers'] = []
for resource in instance.data.get('resources', []):
if resource["files"]:
for file in resource['files']:
src = file
dst = os.path.join(
image_search_path, os.path.basename(file))
instance.data['transfers'].append([src, dst])
else:
for file in resource['source']:
src = (
file if os.path.isabs(file) else os.path.abspath(file)
)
dst = os.path.join(
image_search_path, os.path.basename(file))
instance.data['transfers'].append([src, dst])
for file in resource['files']:
src = file
dst = os.path.join(image_search_path, os.path.basename(file))
instance.data['transfers'].append([src, dst])
self.log.debug("adding transfer {} -> {}". format(src, dst))

View file

@ -74,7 +74,7 @@ def get_template_name_profiles(
project_settings
["global"]
["publish"]
["IntegrateAssetNew"]
["IntegrateHeroVersion"]
["template_name_profiles"]
)
if legacy_profiles: