Bases: MayaExtractorPlugin
Extract FBX from Maya.
This extracts reproducible FBX exports ignoring any of the settings set on the local machine in the FBX export options window.
Source code in client/ayon_maya/plugins/publish/extract_fbx.py
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 | class ExtractFBX(plugin.MayaExtractorPlugin):
"""Extract FBX from Maya.
This extracts reproducible FBX exports ignoring any of the
settings set on the local machine in the FBX export options window.
"""
order = pyblish.api.ExtractorOrder
label = "Extract FBX"
families = ["fbx"]
def process(self, instance):
fbx_exporter = fbx.FBXExtractor(log=self.log)
# Define output path
staging_dir = self.staging_dir(instance)
filename = "{0}.fbx".format(instance.name)
path = os.path.join(staging_dir, filename)
# The export requires forward slashes because we need
# to format it into a string in a mel expression
path = path.replace('\\', '/')
self.log.debug("Extracting FBX to: {0}".format(path))
members = instance.data["setMembers"]
self.log.debug("Members: {0}".format(members))
self.log.debug("Instance: {0}".format(instance[:]))
fbx_exporter.set_options_from_instance(instance)
# Export
with maintained_selection():
fbx_exporter.export(members, path)
if "representations" not in instance.data:
instance.data["representations"] = []
representation = {
'name': 'fbx',
'ext': 'fbx',
'files': filename,
"stagingDir": staging_dir,
}
instance.data["representations"].append(representation)
self.log.debug("Extract FBX successful to: {0}".format(path))
|