make sure the texture only loaded when the texture is being enabled

This commit is contained in:
Kayla Man 2024-01-02 22:51:51 +08:00
parent 3fd9d47a38
commit cf29a532d2
4 changed files with 13 additions and 13 deletions

View file

@ -227,19 +227,19 @@ def render_capture_preset(preset):
)
preset = copy.deepcopy(preset)
# not supported by `capture` so we pop it off of the preset
reload_textures = preset["viewport_options"].pop("reloadTextures", True)
reload_textures = preset["viewport_options"].get("loadTextures")
panel = preset.pop("panel")
with ExitStack() as stack:
stack.enter_context(maintained_time())
stack.enter_context(panel_camera(panel, preset["camera"]))
stack.enter_context(viewport_default_options(panel, preset))
if preset["viewport_options"].get("textures"):
if reload_textures:
# Force immediate texture loading when to ensure
# all textures have loaded before the playblast starts
stack.enter_context(material_loading_mode("immediate"))
if reload_textures:
# Regenerate all UDIM tiles previews
reload_all_udim_tile_previews()
stack.enter_context(material_loading_mode(mode="immediate"))
# Regenerate all UDIM tiles previews
reload_all_udim_tile_previews()
preset["viewport_options"].pop("loadTextures")
path = capture.capture(log=self.log, **preset)
return path

View file

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

View file

@ -238,8 +238,8 @@
},
{
"type": "boolean",
"key": "reloadTextures",
"label": "Reload Textures"
"key": "loadTextures",
"label": "Load Textures"
},
{
"type": "boolean",
@ -915,8 +915,8 @@
},
{
"type": "boolean",
"key": "reloadTextures",
"label": "Reload Textures",
"key": "loadTextures",
"label": "Load Textures",
"default": false
},
{

View file

@ -108,7 +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")
loadTextures: 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")
@ -303,7 +303,7 @@ DEFAULT_PLAYBLAST_SETTING = {
"twoSidedLighting": True,
"lineAAEnable": True,
"multiSample": 8,
"reloadTextures": False,
"loadTextures": False,
"useDefaultMaterial": False,
"wireframeOnShaded": False,
"xray": False,