allow extensions to sort themselves in UI

and other installed extensions will be on top now (including some resolution related UI extensions)
This commit is contained in:
lllyasviel
2024-02-17 08:15:29 -08:00
parent 07659efd88
commit ae51178629
10 changed files with 23 additions and 0 deletions

View File

@@ -94,6 +94,9 @@ class Script:
controls = None
"""A list of controls retured by the ui()."""
sorting_priority = 0
"""Larger number will appear downwards in the UI."""
def title(self):
"""this function should return the title of the script. This is what will be displayed in the dropdown menu."""
@@ -695,6 +698,8 @@ class ScriptRunner:
if scriptlist is None:
scriptlist = self.alwayson_scripts
scriptlist = sorted(scriptlist, key=lambda x: x.sorting_priority)
for script in scriptlist:
if script.alwayson and script.section != section:
continue