Bases: HoudiniInstancePlugin
, OptionalPyblishPluginMixin
Validate name of Unreal Static Mesh.
This validator checks if output node name has a collision prefix
This validator also checks if product name is correct - {static mesh prefix}_{FolderName}{Variant}.
Source code in client/ayon_houdini/plugins/publish/validate_unreal_staticmesh_naming.py
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 | class ValidateUnrealStaticMeshName(plugin.HoudiniInstancePlugin,
OptionalPyblishPluginMixin):
"""Validate name of Unreal Static Mesh.
This validator checks if output node name has a collision prefix:
- UBX
- UCP
- USP
- UCX
This validator also checks if product name is correct
- {static mesh prefix}_{FolderName}{Variant}.
"""
families = ["staticMesh"]
label = "Unreal Static Mesh Name (FBX)"
order = ValidateContentsOrder + 0.1
actions = [SelectInvalidAction]
optional = True
collision_prefixes = []
static_mesh_prefix = ""
@classmethod
def apply_settings(cls, project_settings):
settings = (
project_settings["houdini"]["create"]["CreateStaticMesh"]
)
cls.collision_prefixes = settings["collision_prefixes"]
cls.static_mesh_prefix = settings["static_mesh_prefix"]
def process(self, instance):
if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)
if invalid:
nodes = [n.path() for n in invalid]
raise PublishValidationError(
"See log for details. "
"Invalid nodes: {0}".format(nodes)
)
@classmethod
def get_invalid(cls, instance):
invalid = []
rop_node = hou.node(instance.data["instance_node"])
output_node = instance.data.get("output_node")
if output_node is None:
cls.log.debug(
"No Output Node, skipping check.."
)
return
if rop_node.evalParm("buildfrompath"):
# This validator doesn't support naming check if
# building hierarchy from path' is used
cls.log.info(
"Using 'Build Hierarchy from Path Attribute', skipping check.."
)
return
# Check nodes names
all_outputs = get_output_children(output_node, include_sops=False)
for output in all_outputs:
for prefix in cls.collision_prefixes:
if output.name().startswith(prefix):
invalid.append(output)
cls.log.error(
"Invalid node name: Node '%s' "
"includes a collision prefix '%s'",
output.path(), prefix
)
break
return invalid
|