make the reload texture being optional and only enabled when the reloadTextures being enabled

This commit is contained in:
Kayla Man 2023-11-23 17:28:08 +08:00
parent ba83d4cc2f
commit 51f4d8f06f
7 changed files with 25 additions and 8 deletions

View file

@ -174,9 +174,13 @@ def maintained_selection():
cmds.select(clear=True)
def reload_textures():
def reload_textures(preset):
"""Reload textures during playblast
"""
if not preset["viewport_options"]["reloadTextures"]:
self.log.debug("Reload Textures during playblasting is disabled.")
return
texture_files = cmds.ls(type="file")
if not texture_files:
return

View file

@ -44,7 +44,7 @@ class ExtractPlayblast(publish.Extractor):
)
)
if "textures" in preset["viewport_options"]:
lib.reload_textures()
lib.reload_textures(preset)
path = capture.capture(log=self.log, **preset)
self.log.debug("playblast path {}".format(path))
@ -182,7 +182,6 @@ class ExtractPlayblast(publish.Extractor):
capture_preset["Viewport Options"]["override_viewport_options"]
)
self.log.debug("{}".format(instance.data["panel"]))
# Force viewer to False in call to capture because we have our own
# viewer opening call to allow a signal to trigger between
# playblast and viewer

View file

@ -152,10 +152,10 @@ class ExtractThumbnail(publish.Extractor):
json.dumps(preset, indent=4, sort_keys=True)
)
)
if "textures" in preset["viewport_options"]:
lib.reload_textures()
path = capture.capture(**preset)
playblast = self._fix_playblast_output_path(path)
if "textures" in preset["viewport_options"]:
lib.reload_textures(preset)
path = capture.capture(**preset)
playblast = self._fix_playblast_output_path(path)
_, thumbnail = os.path.split(playblast)

View file

@ -1289,6 +1289,7 @@
"twoSidedLighting": true,
"lineAAEnable": true,
"multiSample": 8,
"reloadTextures": false,
"useDefaultMaterial": false,
"wireframeOnShaded": false,
"xray": false,

View file

@ -236,6 +236,11 @@
{
"type": "splitter"
},
{
"type": "boolean",
"key": "reloadTextures",
"label": "Reload Textures"
},
{
"type": "boolean",
"key": "useDefaultMaterial",
@ -908,6 +913,12 @@
{
"type": "splitter"
},
{
"type": "boolean",
"key": "reloadTextures",
"label": "Reload Textures",
"default": false
},
{
"type": "boolean",
"key": "useDefaultMaterial",

View file

@ -108,6 +108,7 @@ class ViewportOptionsSetting(BaseSettingsModel):
True, title="Enable Anti-Aliasing", section="Anti-Aliasing"
)
multiSample: int = Field(8, title="Anti Aliasing Samples")
reloadTextures: bool = Field(False, title="Reload Textures")
useDefaultMaterial: bool = Field(False, title="Use Default Material")
wireframeOnShaded: bool = Field(False, title="Wireframe On Shaded")
xray: bool = Field(False, title="X-Ray")
@ -302,6 +303,7 @@ DEFAULT_PLAYBLAST_SETTING = {
"twoSidedLighting": True,
"lineAAEnable": True,
"multiSample": 8,
"reloadTextures": False,
"useDefaultMaterial": False,
"wireframeOnShaded": False,
"xray": False,

View file

@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring addon version."""
__version__ = "0.1.6"
__version__ = "0.1.7"