Bases: 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.
Source code in client/ayon_max/plugins/publish/validate_mesh_has_uv.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 | 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
settings_category = "max"
@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):
if not self.is_active(instance.data):
return
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")
|