Bases: InstancePlugin
Collect new audio for shot.
Source code in client/ayon_resolve/plugins/publish/collect_audio.py
8
9
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
54
55
56
57
58
59
60
61
62
63
64
65 | class CollectShotAudio(pyblish.api.InstancePlugin):
"""Collect new audio for shot."""
order = pyblish.api.CollectorOrder - 0.48
label = "Collect Shot Audio"
hosts = ["resolve"]
families = ["audio"]
settings_category = "resolve"
def process(self, instance):
"""
Args:
instance (pyblish.Instance): The shot instance to update.
"""
otio_timeline = instance.context.data["otioTimeline"]
otio_clip, marker = utils.get_marker_from_clip_index(
otio_timeline, instance.data["clip_index"]
)
if not otio_clip:
raise PublishError(
"Could not retrieve otioClip for audio"
f' {dict(instance.data)}'
)
instance.data["otioClip"] = otio_clip
# Retrieve instance data from parent instance shot instance.
parent_instance_id = instance.data["parent_instance_id"]
try:
edit_shared_data = instance.context.data["editorialSharedData"]
instance.data.update(
edit_shared_data[parent_instance_id]
)
# Ensure shot instance related to the audio instance exists.
except KeyError:
raise PublishError(
f'Could not find shot instance for {instance.data["label"]}.'
" Please ensure it is set and enabled."
)
# solve reviewable options
review_switch = instance.data["creator_attributes"].get("review")
if review_switch is True:
instance.data["reviewAudio"] = True
instance.data.pop("review", None)
clip_src = instance.data["otioClip"].source_range
clip_src_in = clip_src.start_time.to_frames()
clip_src_out = clip_src_in + clip_src.duration.to_frames()
instance.data.update({
"clipInH": clip_src_in,
"clipOutH": clip_src_out
})
self.log.debug(pprint.pformat(instance.data))
|
process(instance)
Parameters:
| Name | Type | Description | Default |
instance | Instance | The shot instance to update. | required |
Source code in client/ayon_resolve/plugins/publish/collect_audio.py
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 | def process(self, instance):
"""
Args:
instance (pyblish.Instance): The shot instance to update.
"""
otio_timeline = instance.context.data["otioTimeline"]
otio_clip, marker = utils.get_marker_from_clip_index(
otio_timeline, instance.data["clip_index"]
)
if not otio_clip:
raise PublishError(
"Could not retrieve otioClip for audio"
f' {dict(instance.data)}'
)
instance.data["otioClip"] = otio_clip
# Retrieve instance data from parent instance shot instance.
parent_instance_id = instance.data["parent_instance_id"]
try:
edit_shared_data = instance.context.data["editorialSharedData"]
instance.data.update(
edit_shared_data[parent_instance_id]
)
# Ensure shot instance related to the audio instance exists.
except KeyError:
raise PublishError(
f'Could not find shot instance for {instance.data["label"]}.'
" Please ensure it is set and enabled."
)
# solve reviewable options
review_switch = instance.data["creator_attributes"].get("review")
if review_switch is True:
instance.data["reviewAudio"] = True
instance.data.pop("review", None)
clip_src = instance.data["otioClip"].source_range
clip_src_in = clip_src.start_time.to_frames()
clip_src_out = clip_src_in + clip_src.duration.to_frames()
instance.data.update({
"clipInH": clip_src_in,
"clipOutH": clip_src_out
})
self.log.debug(pprint.pformat(instance.data))
|