Transform your 3D texturing workflow with the power of generative AI, directly within Blender!
feat: add more timeout settings, better progress readouts for texture generation, add artifact filtering variables to settings
sakalond86caa7aeeb67
diff --git a/stablegen/__init__.py b/stablegen/__init__.pyindex c150e06..026cc13 100644--- a/stablegen/__init__.py+++ b/stablegen/__init__.py@@ -423,6 +423,18 @@ class StableGenAddonPreferences(bpy.types.AddonPreferences):precision=0,) # type: ignore+ timeout_mesh_gen: bpy.props.FloatProperty(+ name="Mesh Generation Timeout (s)",+ description="Timeout for TRELLIS.2 mesh generation WebSocket. "+ "Mesh simplification / post-processing can take several "+ "minutes without sending progress messages",+ default=600.0,+ min=60.0,+ max=3600.0,+ step=100,+ precision=0,+ ) # type: ignore+def draw(self, context):"""Draws the preferences panel.@@ -481,6 +493,7 @@ class StableGenAddonPreferences(bpy.types.AddonPreferences):col.prop(self, "timeout_api")col.prop(self, "timeout_transfer")col.prop(self, "timeout_reboot")+ col.prop(self, "timeout_mesh_gen")class CheckServerStatus(bpy.types.Operator):"""Checks if the ComfyUI server is reachable."""@@ -2835,6 +2848,11 @@ def register():description="Toggle TRELLIS.2 camera placement settings",default=False)+ bpy.types.Scene.show_trellis2_artifact_filter = bpy.props.BoolProperty(+ name="Show Artifact Filtering",+ description="Toggle TRELLIS.2 artifact filtering settings",+ default=False+ )bpy.types.Scene.trellis2_last_input_image = bpy.props.StringProperty(name="TRELLIS.2 Last Input Image",description="Path to the image most recently used as TRELLIS.2 input (set automatically after generation)",@@ -3058,6 +3076,38 @@ def register():update=update_parameters)+ # Artifact Filtering+ bpy.types.Scene.trellis2_artifact_laplacian_sigma = bpy.props.FloatProperty(+ name="Laplacian Sigma",+ description="Laplacian displacement outlier threshold in standard deviations. "+ "Vertices displaced more than this many σ from the mesh-wide mean "+ "are flagged as spikes. Lower = stricter filtering",+ default=8.0,+ min=1.0,+ max=30.0,+ step=10,+ precision=1,+ update=update_parameters+ )+ bpy.types.Scene.trellis2_artifact_spike_abs_max = bpy.props.IntProperty(+ name="Max Spike Count",+ description="Maximum number of Laplacian-outlier vertices allowed before "+ "the mesh is considered corrupt and triggers a retry",+ default=25,+ min=1,+ max=500,+ update=update_parameters+ )+ bpy.types.Scene.trellis2_artifact_max_retries = bpy.props.IntProperty(+ name="Max Retries",+ description="Maximum number of retry attempts when artifact filtering "+ "detects a corrupt mesh (each retry clears Triton cache and reboots ComfyUI)",+ default=1,+ min=0,+ max=10,+ update=update_parameters+ )+def unregister():"""Unregisters the addon.@@ -3209,6 +3259,8 @@ def unregister():'trellis2_auto_lighting','trellis2_skip_texture', 'trellis2_low_vram', 'trellis2_bg_removal', 'trellis2_background_color','trellis2_fill_holes',+ 'trellis2_artifact_laplacian_sigma', 'trellis2_artifact_spike_abs_max',+ 'trellis2_artifact_max_retries', 'show_trellis2_artifact_filter',]for prop in trellis2_props:if hasattr(bpy.types.Scene, prop):diff --git a/stablegen/generator.py b/stablegen/generator.pyindex 14d5376..bba6bd2 100644--- a/stablegen/generator.py+++ b/stablegen/generator.py@@ -385,6 +385,21 @@ class ComfyUIGenerate(bpy.types.Operator):self._progress = 0self._wait_event = threading.Event()self.workflow_manager = WorkflowManager(self)++ def _run_on_main_thread(self, func):+ """Execute *func* on Blender's main thread via a timer callback and+ block until it completes. Sets ``self._error`` on failure."""+ def _callback():+ try:+ func()+ except Exception as exc:+ self._error = str(exc)+ traceback.print_exc()+ self._wait_event.set()+ return None # one-shot timer+ bpy.app.timers.register(_callback)+ self._wait_event.wait()+ self._wait_event.clear()def _get_qwen_context_colors(self, context):fallback = (1.0, 0.0, 1.0)@@ -586,63 +601,7 @@ class ComfyUIGenerate(bpy.types.Operator):if not context.scene.overwrite_material or self._material_id == -1 or (context.scene.generation_method == 'local_edit' or (context.scene.model_architecture.startswith('qwen') and context.scene.qwen_generation_method == 'local_edit')):self._material_id += 1- if context.scene.generation_mode == 'standard' or context.scene.generation_mode == 'regenerate_selected':- # If there is depth controlnet unit- if any(unit["unit_type"] == "depth" for unit in controlnet_units) or (context.scene.use_flux_lora and context.scene.model_architecture == 'flux1') or (context.scene.model_architecture == 'qwen_image_edit' and context.scene.qwen_guidance_map_type == 'depth') or (context.scene.model_architecture.startswith('qwen') and context.scene.qwen_generation_method in ('refine', 'local_edit') and context.scene.qwen_refine_use_depth):- if context.scene.generation_method != 'uv_inpaint':- # Export depth maps for each camera- for i, camera in enumerate(self._cameras):- bpy.context.scene.camera = camera- with _SGCameraResolution(context, camera):- self.export_depthmap(context, camera_id=i)- if context.scene.generation_method == 'grid':- self.combine_maps(context, self._cameras, type="depth")- # If there is canny controlnet unit- if any(unit["unit_type"] == "canny" for unit in controlnet_units):- if context.scene.generation_method != 'uv_inpaint':- # Export canny maps for each camera- for i, camera in enumerate(self._cameras):- bpy.context.scene.camera = camera- with _SGCameraResolution(context, camera):- export_canny(context, camera_id=i, low_threshold=context.scene.canny_threshold_low, high_threshold=context.scene.canny_threshold_high)- if context.scene.generation_method == 'grid':- self.combine_maps(context, self._cameras, type="canny")- # If there is normal controlnet unit- if any(unit["unit_type"] == "normal" for unit in controlnet_units) or (context.scene.model_architecture == 'qwen_image_edit' and context.scene.qwen_guidance_map_type == 'normal'):- if context.scene.generation_method != 'uv_inpaint':- # Export normal maps for each camera- for i, camera in enumerate(self._cameras):- bpy.context.scene.camera = camera- with _SGCameraResolution(context, camera):- self.export_normal(context, camera_id=i)- if context.scene.generation_method == 'grid':- self.combine_maps(context, self._cameras, type="normal")-- # If Qwen guidance using Workbench- if context.scene.model_architecture == 'qwen_image_edit' and context.scene.qwen_guidance_map_type == 'workbench':- if context.scene.generation_method != 'uv_inpaint':- # Export workbench render for each camera- # We need to target the directory that get_file_path(..., subtype="workbench") expects- workbench_dir = get_dir_path(context, "controlnet")["workbench"]- for i, camera in enumerate(self._cameras):- bpy.context.scene.camera = camera- # Filename logic must match get_file_path: "render{camera_id}" -> "render{camera_id}0001.png"- with _SGCameraResolution(context, camera):- export_render(context, camera_id=i, output_dir=workbench_dir, filename=f"render{i}")- if context.scene.generation_method == 'grid':- self.combine_maps(context, self._cameras, type="workbench")- # If Qwen guidance using Viewport- elif context.scene.model_architecture == 'qwen_image_edit' and context.scene.qwen_guidance_map_type == 'viewport':- if context.scene.generation_method != 'uv_inpaint':- # Export viewport render for each camera- viewport_dir = get_dir_path(context, "controlnet")["viewport"]- for i, camera in enumerate(self._cameras):- bpy.context.scene.camera = camera- # Filename logic must match get_file_path: "viewport{camera_id}.png"- with _SGCameraResolution(context, camera):- export_viewport(context, camera_id=i, output_dir=viewport_dir, filename=f"viewport{i}")- if context.scene.generation_method == 'grid':- self.combine_maps(context, self._cameras, type="viewport")+ self._controlnet_units = list(controlnet_units)# Prepare for generatingif context.scene.generation_method == 'grid':@@ -661,21 +620,6 @@ class ComfyUIGenerate(bpy.types.Operator):self._original_visibility[obj.name] = obj.hide_renderobj.hide_render = True- # Refine/Local Edit mode preparation- if context.scene.generation_method in ('refine', 'local_edit') or (context.scene.model_architecture.startswith('qwen') and context.scene.qwen_generation_method in ('refine', 'local_edit')):- for i, camera in enumerate(self._cameras):- bpy.context.scene.camera = camera- with _SGCameraResolution(context, camera):- export_emit_image(context, self._to_texture, camera_id=i)- # Render per-camera geometry silhouette mask for edge feathering- if context.scene.refine_edge_feather_projection and (- context.scene.generation_method == 'local_edit'- or (context.scene.model_architecture.startswith('qwen')- and context.scene.qwen_generation_method == 'local_edit')):- render_edge_feather_mask(- context, self._to_texture, camera, i,- feather_width=context.scene.refine_edge_feather_width,- softness=context.scene.refine_edge_feather_softness)# UV inpainting mode preparationif context.scene.generation_method == 'uv_inpaint':@@ -693,6 +637,7 @@ class ComfyUIGenerate(bpy.types.Operator):baked_texture_path = get_file_path(context, "baked", object_name=obj.name)if not os.path.exists(baked_texture_path):# Bake the texture if it doesn't exist+ self._stage = f"Baking UV Textures ({obj.name})"prepare_baking(context)unwrap(obj, method='pack', overlap_only=True)bake_texture(context, obj, texture_resolution=2048, output_dir=get_dir_path(context, "baked"))@@ -725,9 +670,11 @@ class ComfyUIGenerate(bpy.types.Operator):return {'CANCELLED'}# Export visibility masks for each object+ self._stage = f"Computing Visibility ({obj.name})"export_visibility(context, None, obj)if context.scene.view_blend_use_color_match and self._to_texture:+ self._stage = "Matching Colors"# Use the first target object as the reference for viewport colorref_np = _get_viewport_ref_np(self._to_texture[0])if ref_np is not None:@@ -950,6 +897,159 @@ class ComfyUIGenerate(bpy.types.Operator):ComfyUIGenerate._active_ws = Noneremove_empty_dirs(context)+ # ------------------------------------------------------------------+ # Map preparation — runs from the async thread via timer callbacks+ # so that _stage updates are visible in real time through the modal.+ # ------------------------------------------------------------------+ def _prepare_maps(self, context):+ """Render ControlNet / refine maps. Called at the start of the async+ thread; every Blender render is dispatched to the main thread via+ ``_run_on_main_thread`` so the progress bar can update between calls."""+ controlnet_units = self._controlnet_units+ cameras = self._cameras++ if context.scene.generation_mode in ('standard', 'regenerate_selected'):+ need_depth = (+ any(u["unit_type"] == "depth" for u in controlnet_units)+ or (context.scene.use_flux_lora and context.scene.model_architecture == 'flux1')+ or (context.scene.model_architecture == 'qwen_image_edit'+ and context.scene.qwen_guidance_map_type == 'depth')+ or (context.scene.model_architecture.startswith('qwen')+ and context.scene.qwen_generation_method in ('refine', 'local_edit')+ and context.scene.qwen_refine_use_depth)+ )+ if need_depth and context.scene.generation_method != 'uv_inpaint':+ for i, camera in enumerate(cameras):+ self._stage = f"Rendering Depth Maps ({i+1}/{len(cameras)})"+ _i, _cam = i, camera+ def _render_depth(_i=_i, _cam=_cam):+ bpy.context.scene.camera = _cam+ with _SGCameraResolution(context, _cam):+ self.export_depthmap(context, camera_id=_i)+ self._run_on_main_thread(_render_depth)+ if self._error:+ return+ if context.scene.generation_method == 'grid':+ self._run_on_main_thread(+ lambda: self.combine_maps(context, cameras, type="depth"))+ if self._error:+ return++ need_canny = any(u["unit_type"] == "canny" for u in controlnet_units)+ if need_canny and context.scene.generation_method != 'uv_inpaint':+ for i, camera in enumerate(cameras):+ self._stage = f"Rendering Canny Maps ({i+1}/{len(cameras)})"+ _i, _cam = i, camera+ def _render_canny(_i=_i, _cam=_cam):+ bpy.context.scene.camera = _cam+ with _SGCameraResolution(context, _cam):+ export_canny(context, camera_id=_i,+ low_threshold=context.scene.canny_threshold_low,+ high_threshold=context.scene.canny_threshold_high)+ self._run_on_main_thread(_render_canny)+ if self._error:+ return+ if context.scene.generation_method == 'grid':+ self._run_on_main_thread(+ lambda: self.combine_maps(context, cameras, type="canny"))+ if self._error:+ return++ need_normal = (+ any(u["unit_type"] == "normal" for u in controlnet_units)+ or (context.scene.model_architecture == 'qwen_image_edit'+ and context.scene.qwen_guidance_map_type == 'normal')+ )+ if need_normal and context.scene.generation_method != 'uv_inpaint':+ for i, camera in enumerate(cameras):+ self._stage = f"Rendering Normal Maps ({i+1}/{len(cameras)})"+ _i, _cam = i, camera+ def _render_normal(_i=_i, _cam=_cam):+ bpy.context.scene.camera = _cam+ with _SGCameraResolution(context, _cam):+ self.export_normal(context, camera_id=_i)+ self._run_on_main_thread(_render_normal)+ if self._error:+ return+ if context.scene.generation_method == 'grid':+ self._run_on_main_thread(+ lambda: self.combine_maps(context, cameras, type="normal"))+ if self._error:+ return++ # Qwen guidance using Workbench+ if (context.scene.model_architecture == 'qwen_image_edit'+ and context.scene.qwen_guidance_map_type == 'workbench'+ and context.scene.generation_method != 'uv_inpaint'):+ workbench_dir = get_dir_path(context, "controlnet")["workbench"]+ for i, camera in enumerate(cameras):+ self._stage = f"Rendering Workbench ({i+1}/{len(cameras)})"+ _i, _cam = i, camera+ def _render_wb(_i=_i, _cam=_cam):+ bpy.context.scene.camera = _cam+ with _SGCameraResolution(context, _cam):+ export_render(context, camera_id=_i,+ output_dir=workbench_dir, filename=f"render{_i}")+ self._run_on_main_thread(_render_wb)+ if self._error:+ return+ if context.scene.generation_method == 'grid':+ self._run_on_main_thread(+ lambda: self.combine_maps(context, cameras, type="workbench"))+ if self._error:+ return++ # Qwen guidance using Viewport+ elif (context.scene.model_architecture == 'qwen_image_edit'+ and context.scene.qwen_guidance_map_type == 'viewport'+ and context.scene.generation_method != 'uv_inpaint'):+ viewport_dir = get_dir_path(context, "controlnet")["viewport"]+ for i, camera in enumerate(cameras):+ self._stage = f"Rendering Viewport ({i+1}/{len(cameras)})"+ _i, _cam = i, camera+ def _render_vp(_i=_i, _cam=_cam):+ bpy.context.scene.camera = _cam+ with _SGCameraResolution(context, _cam):+ export_viewport(context, camera_id=_i,+ output_dir=viewport_dir, filename=f"viewport{_i}")+ self._run_on_main_thread(_render_vp)+ if self._error:+ return+ if context.scene.generation_method == 'grid':+ self._run_on_main_thread(+ lambda: self.combine_maps(context, cameras, type="viewport"))+ if self._error:+ return++ # Refine / Local Edit mode — emit images + edge feather masks+ is_refine = (+ context.scene.generation_method in ('refine', 'local_edit')+ or (context.scene.model_architecture.startswith('qwen')+ and context.scene.qwen_generation_method in ('refine', 'local_edit'))+ )+ if is_refine:+ need_feather = (+ context.scene.refine_edge_feather_projection+ and (context.scene.generation_method == 'local_edit'+ or (context.scene.model_architecture.startswith('qwen')+ and context.scene.qwen_generation_method == 'local_edit'))+ )+ for i, camera in enumerate(cameras):+ self._stage = f"Preparing Refinement Maps ({i+1}/{len(cameras)})"+ _i, _cam = i, camera+ def _render_refine(_i=_i, _cam=_cam):+ bpy.context.scene.camera = _cam+ with _SGCameraResolution(context, _cam):+ export_emit_image(context, self._to_texture, camera_id=_i)+ if need_feather:+ render_edge_feather_mask(+ context, self._to_texture, _cam, _i,+ feather_width=context.scene.refine_edge_feather_width,+ softness=context.scene.refine_edge_feather_softness)+ self._run_on_main_thread(_render_refine)+ if self._error:+ return+def async_generate(self, context, camera_id = None):"""Asynchronously generates the image using ComfyUI.@@ -958,6 +1058,11 @@ class ComfyUIGenerate(bpy.types.Operator):"""self._error = Nonetry:+ # --- Render ControlNet / refine maps with live progress ---+ self._prepare_maps(context)+ if self._error:+ return+while self._threads_left > 0 and ComfyUIGenerate._is_running and not context.scene.generation_mode == 'project_only':# Swap scene resolution to per-camera values if stored.# Must use a timer callback so the write happens on the@@ -1064,7 +1169,7 @@ class ComfyUIGenerate(bpy.types.Operator):for unit in context.scene.controlnet_units:unit.strength = 0.0else:- self._stage = "Generating Image"+ self._stage = "Uploading to Server"self._progress = 0# Generate the image@@ -1089,6 +1194,8 @@ class ComfyUIGenerate(bpy.types.Operator):else:image = self.workflow_manager.generate(context, controlnet_info=controlnet_info, ipadapter_ref_info=ipadapter_ref_info)else:+ self._stage = "Preparing Next Camera"+ self._progress = 0def context_callback():try:# Export visibility mask and render for the current camera, we need to use a callback to be in the main thread@@ -1118,6 +1225,7 @@ class ComfyUIGenerate(bpy.types.Operator):self._wait_event.clear()if self._error:return+ self._stage = "Uploading to Server"# Get info for the previous render and maskrender_info = self._get_uploaded_image_info(context, "inpaint", subtype="render", camera_id=self._current_image)mask_info = self._get_uploaded_image_info(context, "inpaint", subtype="visibility", camera_id=self._current_image)@@ -1186,6 +1294,7 @@ class ComfyUIGenerate(bpy.types.Operator):# Sequential mode callbackif context.scene.generation_method == 'sequential':+ self._stage = "Projecting Image"def image_project_callback():try:redraw_ui(context)@@ -1276,6 +1385,7 @@ class ComfyUIGenerate(bpy.types.Operator):return Noneif context.scene.view_blend_use_color_match and self._to_texture:+ self._stage = "Matching Colors"# Use the first object in the target list as the color referenceref_np = _get_viewport_ref_np(self._to_texture[0])if ref_np is not None:diff --git a/stablegen/stablegen.py b/stablegen/stablegen.pyindex 891b7d5..5683fed 100644--- a/stablegen/stablegen.py+++ b/stablegen/stablegen.py@@ -771,6 +771,18 @@ class StableGenPanel(bpy.types.Panel):row = content_box.row()row.prop(scene, "trellis2_low_vram", text="Low VRAM Background Removal", toggle=True, icon="GHOST_ENABLED")+ content_box.separator()++ # Artifact Filtering (nested collapsible)+ af_box = draw_collapsible_section(content_box, "show_trellis2_artifact_filter", "Artifact Filtering", icon="FILTER")+ if af_box:+ row = af_box.row()+ row.prop(scene, "trellis2_artifact_laplacian_sigma", text="Laplacian Sigma")+ row = af_box.row()+ row.prop(scene, "trellis2_artifact_spike_abs_max", text="Max Spike Count")+ row = af_box.row()+ row.prop(scene, "trellis2_artifact_max_retries", text="Max Retries")+# --- TRELLIS.2: Native Texture Settings ---if is_trellis2 and trellis2_tex_mode == 'native':content_box = draw_collapsible_section(advanced_params_box, "show_trellis2_texture_settings", "Texture Settings (TRELLIS.2 Native)", icon="TEXTURE")diff --git a/stablegen/timeout_config.py b/stablegen/timeout_config.pyindex 9eab434..31d7de3 100644--- a/stablegen/timeout_config.py+++ b/stablegen/timeout_config.py@@ -2,7 +2,7 @@import bpy # pylint: disable=import-error-_DEFAULTS = {'ping': 1.0, 'api': 10.0, 'transfer': 120.0, 'reboot': 120.0}+_DEFAULTS = {'ping': 1.0, 'api': 10.0, 'transfer': 120.0, 'reboot': 120.0, 'mesh_gen': 600.0}def get_timeout(category, default=None):diff --git a/stablegen/workflows.py b/stablegen/workflows.pyindex 30e2eb4..6fbec3b 100644--- a/stablegen/workflows.py+++ b/stablegen/workflows.py@@ -1173,13 +1173,10 @@ class WorkflowManager:# ── GLB mesh validation ───────────────────────────────────────────_GLB_VERTEX_THRESHOLD = 10.0 # absolute coordinate cap_GLB_OUTLIER_SIGMA = 8.0 # for absolute-value outlier check- _GLB_LAPLACIAN_SIGMA = 8.0 # Laplacian displacement outlier threshold — set high- # (10σ) so only truly extreme needle-like spikes are- # flagged; legitimate sharp edges/corners sit at ~5-8σ+ _GLB_LAPLACIAN_SIGMA = 8.0 # fallback — overridden by scene property_GLB_SPIKE_FRACTION = 0.002 # 0.02% — very tight because at 10σ virtually all# flagged vertices are genuine artifacts- _GLB_SPIKE_ABS_MAX = 25 # absolute cap — with 10σ even a handful of- # flagged vertices indicates corruption+ _GLB_SPIKE_ABS_MAX = 25 # fallback — overridden by scene property@staticmethoddef _validate_glb_mesh(glb_bytes, threshold=None, sigma=None):@@ -1202,7 +1199,10 @@ class WorkflowManager:threshold = WorkflowManager._GLB_VERTEX_THRESHOLDif sigma is None:sigma = WorkflowManager._GLB_OUTLIER_SIGMA- lap_sigma = WorkflowManager._GLB_LAPLACIAN_SIGMA+ # Read user-facing settings if available, else use class defaults+ _scene = getattr(bpy.context, 'scene', None)+ lap_sigma = getattr(_scene, 'trellis2_artifact_laplacian_sigma',+ WorkflowManager._GLB_LAPLACIAN_SIGMA)spike_frac = WorkflowManager._GLB_SPIKE_FRACTIONif not glb_bytes or len(glb_bytes) < 20:@@ -1355,7 +1355,8 @@ class WorkflowManager:# Check overall spike count (absolute cap + fraction)if total_verts > 0 and total_spikes > 0:frac = total_spikes / total_verts- abs_max = WorkflowManager._GLB_SPIKE_ABS_MAX+ abs_max = getattr(_scene, 'trellis2_artifact_spike_abs_max',+ WorkflowManager._GLB_SPIKE_ABS_MAX)if total_spikes > abs_max:return False, (f"Mesh has {total_spikes} Laplacian-outlier vertices "@@ -1528,6 +1529,7 @@ class WorkflowManager:is_local = self._is_local_server(server_address)original_seed = context.scene.trellis2_seed+ max_retries = getattr(context.scene, 'trellis2_artifact_max_retries', 1)try:# ── First attempt ──────────────────────────────────────────@@ -1544,18 +1546,26 @@ class WorkflowManager:# Mesh is corrupt — Triton JIT cache is the most common cause.print(f"[TRELLIS2] Mesh validation FAILED: {reason}")- print("[TRELLIS2] Attempting automatic recovery "- "(Triton cache clear + ComfyUI reboot)...")- # ── Recovery: clear cache + reboot ─────────────────────────- if is_local:- self._clear_triton_cache()+ if max_retries <= 0:+ print("[TRELLIS2] Artifact retries disabled (max_retries=0).")+ else:+ print(f"[TRELLIS2] Attempting automatic recovery "+ f"(up to {max_retries} retries, Triton cache clear + ComfyUI reboot)...")- rebooted = self._reboot_comfyui(server_address)+ rebooted = False+ for retry_i in range(max_retries):+ # ── Recovery: clear cache + reboot ─────────────────────+ if is_local:+ self._clear_triton_cache()- if rebooted:- # One final attempt after a clean reboot- print("[TRELLIS2] Running final attempt after reboot...")+ rebooted = self._reboot_comfyui(server_address)++ if not rebooted:+ print(f"[TRELLIS2] Could not reboot ComfyUI — aborting retries.")+ break++ print(f"[TRELLIS2] Retry {retry_i + 1}/{max_retries} after reboot...")new_seed = random.randint(0, 2**31 - 1)context.scene.trellis2_seed = new_seedclient_id = str(uuid.uuid4())@@ -1569,8 +1579,7 @@ class WorkflowManager:if ok:return result- print(f"[TRELLIS2] Post-reboot attempt also failed: {reason}")- # Fall through to the warning below+ print(f"[TRELLIS2] Retry {retry_i + 1}/{max_retries} also failed: {reason}")# ── Truly exhausted ────────────────────────────────────────if is_local:@@ -1723,6 +1732,11 @@ class WorkflowManager:if ws is None:return {"error": "conn_failed"}+ # TRELLIS.2 simplification / post-processing can take several+ # minutes without sending any WS messages. Use the user-+ # configurable mesh generation timeout.+ ws.settimeout(get_timeout('mesh_gen'))+# Let the operator close this WS on cancelif hasattr(self.operator, '_active_ws'):self.operator._active_ws = ws@@ -1793,6 +1807,13 @@ class WorkflowManager:while True:try:out = ws.recv()+ except websocket.WebSocketTimeoutException:+ # Timeout on recv — server is still alive but a heavy+ # step (e.g. simplification) took longer than expected.+ # Keep waiting instead of treating it as a crash.+ print("[TRELLIS2] WebSocket recv timed out — "+ "server may still be processing. Retrying...")+ continueexcept (ConnectionError, OSError, Exception) as ws_err:err_name = type(ws_err).__name__print(f"[TRELLIS2] WebSocket died ({err_name}): {ws_err}")@@ -2553,6 +2574,10 @@ class WorkflowManager:progress = (message['data']['value'] / message['data']['max']) * 100if progress != 0:self.operator._progress = progress # Update progress for UI+ # Transition stage from "Uploading" to "Generating" on+ # first actual sampler progress from the server.+ if self.operator._stage == "Uploading to Server":+ self.operator._stage = "Generating Image"# Also update 3-tier detail when called from Trellis2Generateif hasattr(self.operator, '_detail_progress'):self.operator._detail_progress = progress