Skip to content

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

show a license notice when install is pressed outside the setup page

sakalond4ab68083618c
diff --git a/stablegen/setup/operators.py b/stablegen/setup/operators.py
index 2bf4cc0..e622ef8 100644
--- a/stablegen/setup/operators.py
+++ b/stablegen/setup/operators.py
@@ -125,6 +125,12 @@ class STABLEGEN_OT_comfy_install(bpy.types.Operator):
self.report({'ERROR'}, "Allow online access in Blender's preferences (System) to download models")
return {'CANCELLED'}
runtime.begin_install([t for t in self.tags.split(",") if t])
+ from ..ui import studio
+ if (runtime.review is not None and runtime.review["notices"]
+ and not any(getattr(s, 'alive', True) for s in studio._sessions.values())
+ and (context.area is None or context.area.type != 'PREFERENCES')):
+ # the legacy panel: the license notices wait in the preferences (the StableGen panel shows its Setup page)
+ bpy.ops.preferences.addon_show('INVOKE_DEFAULT', module=runtime.ADDON_PKG)
return {'FINISHED'}
diff --git a/stablegen/setup/runtime.py b/stablegen/setup/runtime.py
index 109b712..4b3e65a 100644
--- a/stablegen/setup/runtime.py
+++ b/stablegen/setup/runtime.py
@@ -301,7 +301,7 @@ def notices_for(tags: List[str]) -> List[str]:
def begin_install(tags: List[str]):
"""Install these package tags, after the user accepts their license notices and, for a ComfyUI of their own,
- the changes to its Python (both shown in the preferences)."""
+ the changes to its Python (both shown on the Setup page and in the preferences)."""
global review
p = prefs()
folder = comfy_folder(p)
@@ -314,6 +314,8 @@ def begin_install(tags: List[str]):
lambda plan: _plan_done(current, plan))
elif not review["notices"]:
confirm_install()
+ if review is not None and review["notices"]:
+ show_review()
redraw()
@@ -323,9 +325,20 @@ def _plan_done(pending, plan):
pending["plan"] = plan or {"error": "run", "message": "the check did not finish"}
if not pending["notices"] and not needs_review(pending["plan"]):
confirm_install()
+ elif not pending["notices"]: # with notices the Install button already showed the review
+ show_review()
redraw()
+def show_review():
+ """Take the StableGen panel to its Setup page, where an install waiting for the user's OK is drawn, so an Install
+ pressed elsewhere (the line under Architecture) doesn't seem to do nothing."""
+ from ..ui import studio
+ for session in studio._sessions.values():
+ if getattr(session, 'alive', True) and session.page != 'SETUP':
+ session.navigate('SETUP')
+
+
def needs_review(plan: Optional[dict]) -> bool:
"""A plan worth showing: it changes ComfyUI's Python or moves a node someone may have updated."""
if not plan or "error" in plan: