Merge branch 'develop' into enhancement/OP-8105_Validate-Context

This commit is contained in:
Kayla Man 2024-03-04 18:41:28 +08:00 committed by GitHub
commit 93d1fae02e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 78 additions and 6 deletions

View file

@ -1,6 +1,6 @@
name: Bug Report
description: File a bug report
title: 'Bug: '
title: ''
labels:
- 'type: bug'
body:

View file

@ -1,6 +1,6 @@
name: Enhancement Request
description: Create a report to help us enhance a particular feature
title: "Enhancement: "
title: ""
labels:
- "type: enhancement"
body:

View file

@ -67,7 +67,7 @@ class CollectVrayROPRenderProducts(pyblish.api.InstancePlugin):
beauty_product = self.get_render_product_name(default_prefix)
render_products.append(beauty_product)
files_by_aov = {
"RGB Color": self.generate_expected_files(instance,
"": self.generate_expected_files(instance,
beauty_product)}
if instance.data.get("RenderElement", True):
@ -75,7 +75,9 @@ class CollectVrayROPRenderProducts(pyblish.api.InstancePlugin):
if render_element:
for aov, renderpass in render_element.items():
render_products.append(renderpass)
files_by_aov[aov] = self.generate_expected_files(instance, renderpass) # noqa
files_by_aov[aov] = self.generate_expected_files(
instance, renderpass)
for product in render_products:
self.log.debug("Found render product: %s" % product)

View file

@ -0,0 +1,58 @@
import pyblish.api
from ayon_core.hosts.max.api.action import SelectInvalidAction
from ayon_core.pipeline.publish import (
ValidateMeshOrder,
OptionalPyblishPluginMixin,
PublishValidationError
)
from pymxs import runtime as rt
class ValidateMeshHasUVs(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validate the current mesh has UVs.
This validator only checks if the mesh has UVs but not
whether all the individual faces of the mesh have UVs.
It validates whether the current mesh has texture vertices.
If the mesh does not have texture vertices, it does not
have UVs in Max.
"""
order = ValidateMeshOrder
hosts = ['max']
families = ['model']
label = 'Validate Mesh Has UVs'
actions = [SelectInvalidAction]
optional = True
@classmethod
def get_invalid(cls, instance):
meshes = [member for member in instance.data["members"]
if rt.isProperty(member, "mesh")]
invalid = [member for member in meshes
if member.mesh.numTVerts == 0]
return invalid
def process(self, instance):
invalid = self.get_invalid(instance)
if invalid:
bullet_point_invalid_statement = "\n".join(
"- {}".format(invalid.name) for invalid
in invalid
)
report = (
"Model meshes are required to have UVs.\n\n"
"Meshes detected with invalid or missing UVs:\n"
f"{bullet_point_invalid_statement}\n"
)
raise PublishValidationError(
report,
description=(
"Model meshes are required to have UVs.\n\n"
"Meshes detected with no texture vertice or missing UVs"),
title="Non-mesh objects found or mesh has missing UVs")

View file

@ -40,7 +40,10 @@ class CollectAudio(pyblish.api.ContextPlugin):
"webpublisher",
"aftereffects",
"flame",
"unreal"
"unreal",
"blender",
"houdini",
"max",
]
audio_product_name = "audioMain"

View file

@ -90,6 +90,10 @@ class PublishersModel(BaseSettingsModel):
default_factory=ValidateLoadedPluginModel,
title="Validate Loaded Plugin"
)
ValidateMeshHasUVs: BasicValidateModel = SettingsField(
default_factory=BasicValidateModel,
title="Validate Mesh Has UVs"
)
ExtractModelObj: BasicValidateModel = SettingsField(
default_factory=BasicValidateModel,
title="Extract OBJ",
@ -143,6 +147,11 @@ DEFAULT_PUBLISH_SETTINGS = {
"optional": True,
"family_plugins_mapping": []
},
"ValidateMeshHasUVs": {
"enabled": True,
"optional": True,
"active": False
},
"ExtractModelObj": {
"enabled": True,
"optional": True,

View file

@ -1 +1 @@
__version__ = "0.1.5"
__version__ = "0.1.6"