Bases: MayaExtractorPlugin
Producing Yeti cache files using scene time range.
This will extract Yeti cache file sequence and fur settings.
Source code in client/ayon_maya/plugins/publish/extract_unreal_yeticache.py
7
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 | class ExtractUnrealYetiCache(plugin.MayaExtractorPlugin):
"""Producing Yeti cache files using scene time range.
This will extract Yeti cache file sequence and fur settings.
"""
label = "Extract Yeti Cache (Unreal)"
families = ["yeticacheUE"]
def process(self, instance):
yeti_nodes = cmds.ls(instance, type="pgYetiMaya")
if not yeti_nodes:
raise RuntimeError("No pgYetiMaya nodes found in the instance")
# Define extract output file path
dirname = self.staging_dir(instance)
# Collect information for writing cache
start_frame = instance.data["frameStartHandle"]
end_frame = instance.data["frameEndHandle"]
preroll = instance.data["preroll"]
if preroll > 0:
start_frame -= preroll
kwargs = {}
samples = instance.data.get("samples", 0)
if samples == 0:
kwargs.update({"sampleTimes": "0.0 1.0"})
else:
kwargs.update({"samples": samples})
self.log.debug(f"Writing out cache {start_frame} - {end_frame}")
filename = f"{instance.name}.abc"
path = os.path.join(dirname, filename)
cmds.pgYetiCommand(yeti_nodes,
writeAlembic=path,
range=(start_frame, end_frame),
asUnrealAbc=True,
**kwargs)
if "representations" not in instance.data:
instance.data["representations"] = []
representation = {
'name': 'abc',
'ext': 'abc',
'files': filename,
'stagingDir': dirname
}
instance.data["representations"].append(representation)
self.log.debug(f"Extracted {instance} to {dirname}")
|