Bases: InstancePlugin
Ensures that there is an audio file in the scene.
If you are sure that you want to send render without audio, you can disable this validator before clicking on "publish"
Source code in client/ayon_harmony/plugins/publish/validate_audio.py
10
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 | class ValidateAudio(pyblish.api.InstancePlugin):
"""Ensures that there is an audio file in the scene.
If you are sure that you want to send render without audio, you can
disable this validator before clicking on "publish"
"""
order = pyblish.api.ValidatorOrder
label = "Validate Audio"
families = ["render"]
hosts = ["harmony"]
settings_category = "harmony"
optional = True
def process(self, instance):
node = None
if instance.data.get("setMembers"):
node = instance.data["setMembers"][0]
if not node:
return
# Collect scene data.
func = """function func(write_node)
{
return [
sound.getSoundtrackAll().path()
]
}
func
"""
result = harmony.send(
{"function": func, "args": [node]}
)["result"]
audio_path = result[0]
msg = "You are missing audio file:\n{}".format(audio_path)
formatting_data = {
"audio_url": audio_path
}
if not os.path.isfile(audio_path):
raise PublishXmlValidationError(self, msg,
formatting_data=formatting_data)
|