mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
♻️ remove init shading context manager and reformat options
This commit is contained in:
parent
9592eead41
commit
696c67462a
1 changed files with 11 additions and 11 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import os
|
import os
|
||||||
from contextlib import nullcontext
|
|
||||||
|
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
from ayon_core.hosts.maya.api import lib
|
from ayon_core.hosts.maya.api import lib
|
||||||
|
|
@ -60,6 +59,9 @@ class ExtractObj(publish.Extractor):
|
||||||
self.obj_options["materials"] = 0
|
self.obj_options["materials"] = 0
|
||||||
|
|
||||||
# Export
|
# Export
|
||||||
|
# format options for the exporter
|
||||||
|
options = ';'.join(
|
||||||
|
f"{key}={val}" for key, val in self.obj_options.items())
|
||||||
with lib.no_display_layers(instance):
|
with lib.no_display_layers(instance):
|
||||||
with lib.displaySmoothness(members,
|
with lib.displaySmoothness(members,
|
||||||
divisionsU=0,
|
divisionsU=0,
|
||||||
|
|
@ -67,16 +69,14 @@ class ExtractObj(publish.Extractor):
|
||||||
pointsWire=4,
|
pointsWire=4,
|
||||||
pointsShaded=1,
|
pointsShaded=1,
|
||||||
polygonObject=1):
|
polygonObject=1):
|
||||||
with lib.shader(members,
|
with lib.maintained_selection():
|
||||||
shadingEngine="initialShadingGroup") if strip_shader else nullcontext(): # noqa: E501
|
cmds.select(members, noExpand=True)
|
||||||
with lib.maintained_selection():
|
cmds.file(path,
|
||||||
cmds.select(members, noExpand=True)
|
exportSelected=True,
|
||||||
cmds.file(path,
|
type='OBJexport',
|
||||||
exportSelected=True,
|
op=options,
|
||||||
type='OBJexport',
|
preserveReferences=True,
|
||||||
op=';'.join(f"{key}={val}" for key, val in self.obj_options.items()), # noqa: E501
|
force=True)
|
||||||
preserveReferences=True,
|
|
||||||
force=True)
|
|
||||||
|
|
||||||
if "representation" not in instance.data:
|
if "representation" not in instance.data:
|
||||||
instance.data["representation"] = []
|
instance.data["representation"] = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue