Bases: BlenderInstancePlugin
, OptionalPyblishPluginMixin
Ensure that meshes don't have a negative scale.
Source code in client/ayon_blender/plugins/publish/validate_mesh_no_negative_scale.py
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 | class ValidateMeshNoNegativeScale(
plugin.BlenderInstancePlugin,
OptionalPyblishPluginMixin
):
"""Ensure that meshes don't have a negative scale."""
order = ValidateContentsOrder
hosts = ["blender"]
families = ["model"]
label = "Mesh No Negative Scale"
actions = [ayon_blender.api.action.SelectInvalidAction]
@staticmethod
def get_invalid(instance) -> List:
invalid = []
for obj in instance:
if isinstance(obj, bpy.types.Object) and obj.type == 'MESH':
if any(v < 0 for v in obj.scale):
invalid.append(obj)
return invalid
def process(self, instance):
if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)
if invalid:
names = ", ".join(obj.name for obj in invalid)
raise PublishValidationError(
f"Meshes found in instance with negative scale: {names}"
)
|