Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/extensions/core/maskeditor.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import _ from 'es-toolkit/compat'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'

import { t } from '@/i18n'
import { useMaskEditor } from '@/composables/maskeditor/useMaskEditor'
import { useToastStore } from '@/platform/updates/common/toastStore'
import { app } from '@/scripts/app'
import { ComfyApp } from '@/scripts/app'
import { useMaskEditorStore } from '@/stores/maskEditorStore'
import { useDialogStore } from '@/stores/dialogStore'
import { MaskEditorDialogOld } from './maskEditorOld'
import { useMaskEditorStore } from '@/stores/maskEditorStore'
import { ClipspaceDialog } from './clipspace'
import { useMaskEditor } from '@/composables/maskeditor/useMaskEditor'
import { MaskEditorDialogOld } from './maskEditorOld'

const warnLegacyMaskEditorDeprecation = () => {
const warningMessage = t('toastMessages.legacyMaskEditorDeprecated')
console.warn(`[Comfy.MaskEditor] ${warningMessage}`)
useToastStore().add({
severity: 'warn',
summary: 'Alert',
detail: warningMessage,
life: 4096
})
}

function openMaskEditor(node: LGraphNode): void {
if (!node) {
Expand All @@ -27,6 +40,7 @@ function openMaskEditor(node: LGraphNode): void {
if (useNewEditor) {
useMaskEditor().openMaskEditor(node)
} else {
warnLegacyMaskEditorDeprecation()
// Use old editor
ComfyApp.copyToClipspace(node)
// @ts-expect-error clipspace_return_node is an extension property added at runtime
Expand Down Expand Up @@ -122,6 +136,7 @@ app.registerExtension({
'Comfy.MaskEditor.UseNewEditor'
)
if (!useNewEditor) {
warnLegacyMaskEditorDeprecation()
const dlg = MaskEditorDialogOld.getInstance() as any
if (dlg?.isOpened && !dlg.isOpened()) {
dlg.show()
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,7 @@
"noTemplatesToExport": "No templates to export",
"failedToFetchLogs": "Failed to fetch server logs",
"migrateToLitegraphReroute": "Reroute nodes will be removed in future versions. Click to migrate to litegraph-native reroute.",
"legacyMaskEditorDeprecated": "The legacy mask editor is deprecated and will be removed soon.",
"userNotAuthenticated": "User not authenticated",
"failedToFetchBalance": "Failed to fetch balance: {error}",
"failedToCreateCustomer": "Failed to create customer: {error}",
Expand Down