Skip to content

Transform your 3D texturing workflow with the power of generative AI, directly within Blender!

keep a running generation's status when the server is rechecked

sakalond678bbcd19bc4
diff --git a/stablegen/core/callbacks.py b/stablegen/core/callbacks.py
index 26630b6..f15639e 100644
--- a/stablegen/core/callbacks.py
+++ b/stablegen/core/callbacks.py
@@ -295,7 +295,7 @@ def update_combined(self, context):
return
update_parameters(None, bpy.context)
- load_handler(None)
+ load_handler(None, file_loaded=False)
def _deferred_refresh():
try:
@@ -310,7 +310,7 @@ def update_combined(self, context):
_run_async(_bg_work, _on_done, track_generation=True)
update_parameters(self, context)
- load_handler(None)
+ load_handler(None, file_loaded=False)
return None
diff --git a/stablegen/core/load_handlers.py b/stablegen/core/load_handlers.py
index 5af64ed..c27d393 100644
--- a/stablegen/core/load_handlers.py
+++ b/stablegen/core/load_handlers.py
@@ -15,8 +15,12 @@ from .architectures import QWEN_ARCHITECTURES
@persistent
-def load_handler(dummy):
- """Set default ControlNet/LoRA units and sync checkpoint cache on file load."""
+def load_handler(dummy, file_loaded=True):
+ """Set default ControlNet/LoRA units and sync checkpoint cache on file load.
+
+ Server checks reuse it with file_loaded=False: a generation may be
+ running then, so its status must not be reset.
+ """
from ..ui.model_units import get_lora_models
from . import state as _state
from ..texturing.print_export import prepopulate_palette
@@ -95,7 +99,7 @@ def load_handler(dummy):
# "running" or "waiting", which leaves the Generate button permanently
# stuck after reopening. Runtime status is SKIP_SAVE now, but normalize
# legacy files as well.
- for loaded_scene in bpy.data.scenes:
+ for loaded_scene in (bpy.data.scenes if file_loaded else ()):
if getattr(loaded_scene, "generation_status", 'idle') != 'idle':
loaded_scene.generation_status = 'idle'
if hasattr(loaded_scene, "generation_progress"):
diff --git a/stablegen/core/preferences.py b/stablegen/core/preferences.py
index 5ad4f5e..90c61c9 100644
--- a/stablegen/core/preferences.py
+++ b/stablegen/core/preferences.py
@@ -335,7 +335,7 @@ class CheckServerStatus(bpy.types.Operator):
if result.get('online', False):
print(f"[StableGen] ComfyUI server is online at {server_addr}.")
- load_handler(None)
+ load_handler(None, file_loaded=False)
def _deferred_refresh():
try:
bpy.ops.stablegen.refresh_checkpoint_list('INVOKE_DEFAULT')