mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-02 11:40:00 +00:00
fix: restore mask editor compatibility with Impact-Pack plugin (#7762)
## Summary - Skip widget filenames starting with '$' (internal reference format) - Add deprecated ComfyApp.open_maskeditor for plugin compatibility - Register MaskEditor button in ClipspaceDialog fix https://github.com/Comfy-Org/ComfyUI_frontend/issues/7665 and https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/1165 https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/1158 https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/1157 ## Screenshots (if applicable) before https://github.com/user-attachments/assets/356dd920-8b64-40f4-8839-90b955ffafc3 after https://github.com/user-attachments/assets/dff9abcd-530a-4995-bb4b-51f408d4eca9 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7762-fix-restore-mask-editor-compatibility-with-Impact-Pack-plugin-2d46d73d36508199bdaecbd5ba838483) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user