Bases: MayaInstancePlugin
, OptionalPyblishPluginMixin
Validates at least a single node is visible in frame range.
This validation only validates if the visibleOnly
flag is enabled on the instance - otherwise the validation is skipped.
Source code in client/ayon_maya/plugins/publish/validate_visible_only.py
11
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 | class ValidateAlembicVisibleOnly(plugin.MayaInstancePlugin,
OptionalPyblishPluginMixin):
"""Validates at least a single node is visible in frame range.
This validation only validates if the `visibleOnly` flag is enabled
on the instance - otherwise the validation is skipped.
"""
order = ValidateContentsOrder + 0.05
label = "Alembic Visible Only"
families = ["pointcache", "animation"]
actions = [ayon_maya.api.action.SelectInvalidAction]
optional = False
def process(self, instance):
if not self.is_active(instance.data):
return
if not instance.data.get("visibleOnly", False):
self.log.debug("Visible only is disabled. Validation skipped..")
return
invalid = self.get_invalid(instance)
if invalid:
start, end = self.get_frame_range(instance)
raise PublishValidationError(
f"No visible nodes found in frame range {start}-{end}."
)
@classmethod
def get_invalid(cls, instance):
if instance.data["productType"] == "animation":
# Special behavior to use the nodes in out_SET
nodes = instance.data["out_hierarchy"]
else:
nodes = instance[:]
start, end = cls.get_frame_range(instance)
if not any(iter_visible_nodes_in_range(nodes, start, end)):
# Return the nodes we have considered so the user can identify
# them with the select invalid action
return nodes
@staticmethod
def get_frame_range(instance):
data = instance.data
return data["frameStartHandle"], data["frameEndHandle"]
|