mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
🎨 add OBJ options
This commit is contained in:
parent
4539ed08f8
commit
de0049085d
1 changed files with 13 additions and 1 deletions
|
|
@ -20,6 +20,15 @@ class ExtractObj(publish.Extractor):
|
|||
label = "Extract OBJ"
|
||||
families = ["model"]
|
||||
|
||||
# OBJ export options
|
||||
obj_options = {
|
||||
"groups": 1,
|
||||
"ptgroups": 1,
|
||||
"materials": 1,
|
||||
"smoothing": 1,
|
||||
"normals": 1,
|
||||
}
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
# Define output path
|
||||
|
|
@ -47,6 +56,8 @@ class ExtractObj(publish.Extractor):
|
|||
cmds.loadPlugin('objExport')
|
||||
|
||||
strip_shader = instance.data.get("strip_shaders", True)
|
||||
if strip_shader:
|
||||
self.obj_options["materials"] = 0
|
||||
|
||||
# Export
|
||||
with lib.no_display_layers(instance):
|
||||
|
|
@ -57,12 +68,13 @@ class ExtractObj(publish.Extractor):
|
|||
pointsShaded=1,
|
||||
polygonObject=1):
|
||||
with lib.shader(members,
|
||||
shadingEngine="initialShadingGroup") if strip_shader else nullcontext(): # noqa: E501:
|
||||
shadingEngine="initialShadingGroup") if strip_shader else nullcontext(): # noqa: E501
|
||||
with lib.maintained_selection():
|
||||
cmds.select(members, noExpand=True)
|
||||
cmds.file(path,
|
||||
exportSelected=True,
|
||||
type='OBJexport',
|
||||
op=';'.join(f"{key}={val}" for key, val in self.obj_options.items()), # noqa: E501
|
||||
preserveReferences=True,
|
||||
force=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue