mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 17:30:07 +00:00
Add Comfy.Workflow.SortNodeIdOnSave setting (#502)
* Update litegraph (Sort order) * nit * Add sort node on save setting * nit
This commit is contained in:
@@ -1925,7 +1925,10 @@ export class ComfyApp {
|
||||
|
||||
// Save current workflow automatically
|
||||
setInterval(() => {
|
||||
const workflow = JSON.stringify(this.graph.serialize())
|
||||
const sortNodes =
|
||||
this.vueAppReady &&
|
||||
useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave')
|
||||
const workflow = JSON.stringify(this.graph.serialize({ sortNodes }))
|
||||
localStorage.setItem('workflow', workflow)
|
||||
if (api.clientId) {
|
||||
sessionStorage.setItem(`workflow:${api.clientId}`, workflow)
|
||||
@@ -2396,7 +2399,10 @@ export class ComfyApp {
|
||||
}
|
||||
}
|
||||
|
||||
const workflow = graph.serialize()
|
||||
const sortNodes =
|
||||
this.vueAppReady &&
|
||||
useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave')
|
||||
const workflow = graph.serialize({ sortNodes })
|
||||
const output = {}
|
||||
// Process nodes in order of execution
|
||||
for (const outerNode of graph.computeExecutionOrder(false)) {
|
||||
|
||||
@@ -117,6 +117,13 @@ export const useSettingStore = defineStore('setting', {
|
||||
max: 24
|
||||
}
|
||||
})
|
||||
|
||||
app.ui.settings.addSetting({
|
||||
id: 'Comfy.Workflow.SortNodeIdOnSave',
|
||||
name: 'Sort node IDs on save',
|
||||
type: 'boolean',
|
||||
defaultValue: false
|
||||
})
|
||||
},
|
||||
|
||||
set<K extends keyof Settings>(key: K, value: Settings[K]) {
|
||||
|
||||
@@ -426,7 +426,8 @@ const zSettings = z.record(z.any()).and(
|
||||
'Comfy.SnapToGrid.GridSize': z.number(),
|
||||
'Comfy.TextareaWidget.FontSize': z.number(),
|
||||
'Comfy.UseNewMenu': z.any(),
|
||||
'Comfy.Validation.Workflows': z.boolean()
|
||||
'Comfy.Validation.Workflows': z.boolean(),
|
||||
'Comfy.Workflow.SortNodeIdOnSave': z.boolean()
|
||||
})
|
||||
.optional()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user