[backport core/1.36] fix: restore mask editor compatibility with Impact-Pack plugin (#7800)

Backport of #7762 to `core/1.36`

Automatically created by backport workflow.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7800-backport-core-1-36-fix-restore-mask-editor-compatibility-with-Impact-Pack-plugin-2d96d73d365081429479ffcf2e2b5181)
by [Unito](https://www.unito.io)

Co-authored-by: Terry Jia <terryjia88@gmail.com>
This commit is contained in:
Comfy Org PR Bot
2025-12-31 04:54:26 +09:00
committed by GitHub
parent 7b68b19f11
commit 1d6d3fdc77
2 changed files with 25 additions and 3 deletions

View File

@@ -104,7 +104,8 @@ export function useMaskEditorLoader() {
// If we have a widget filename, we should prioritize it over the node image
// because the node image might be stale (e.g. from a previous save)
// while the widget value reflects the current selection.
if (widgetFilename) {
// Skip internal reference formats (e.g. "$35-0" used by some plugins like Impact-Pack)
if (widgetFilename && !widgetFilename.startsWith('$')) {
try {
// Parse the widget value which might be in format "subfolder/filename [type]" or just "filename"
let filename = widgetFilename

View File

@@ -1,7 +1,7 @@
import _ from 'es-toolkit/compat'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import { app } from '@/scripts/app'
import { app, ComfyApp } from '@/scripts/app'
import { useMaskEditorStore } from '@/stores/maskEditorStore'
import { useDialogStore } from '@/stores/dialogStore'
import { useMaskEditor } from '@/composables/maskeditor/useMaskEditor'
@@ -20,6 +20,18 @@ function openMaskEditor(node: LGraphNode): void {
useMaskEditor().openMaskEditor(node)
}
// Open mask editor from clipspace (for plugin compatibility)
// This is called when ComfyApp.open_maskeditor() is invoked without arguments
function openMaskEditorFromClipspace(): void {
const node = ComfyApp.clipspace_return_node as LGraphNode | null
if (!node) {
console.error('[MaskEditor] No clipspace_return_node found')
return
}
openMaskEditor(node)
}
// Check if the dialog is already opened
function isOpened(): boolean {
return useDialogStore().isDialogOpen('global-mask-editor')
@@ -78,7 +90,16 @@ app.registerExtension({
label: 'Decrease Brush Size in MaskEditor',
function: () => changeBrushSize((old) => _.clamp(old - 4, 1, 100))
}
]
],
init() {
// Set up ComfyApp static methods for plugin compatibility (deprecated)
ComfyApp.open_maskeditor = openMaskEditorFromClipspace
console.warn(
'[MaskEditor] ComfyApp.open_maskeditor is deprecated. ' +
'Plugins should migrate to using the command system or direct node context menu integration.'
)
}
})
const changeBrushSize = async (sizeChanger: (oldSize: number) => number) => {