mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-25 16:59:45 +00:00
Add node video previews (#2635)
This commit is contained in:
@@ -7,7 +7,11 @@ import { applyTextReplacements } from '../../scripts/utils'
|
||||
app.registerExtension({
|
||||
name: 'Comfy.SaveImageExtraOutput',
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
if (nodeData.name === 'SaveImage' || nodeData.name === 'SaveAnimatedWEBP') {
|
||||
if (
|
||||
nodeData.name === 'SaveImage' ||
|
||||
nodeData.name === 'SaveAnimatedWEBP' ||
|
||||
nodeData.name === 'SaveAnimatedWEBM'
|
||||
) {
|
||||
const onNodeCreated = nodeType.prototype.onNodeCreated
|
||||
// When the SaveImage node is created we want to override the serialization of the output name widget to run our S&R
|
||||
nodeType.prototype.onNodeCreated = function () {
|
||||
|
||||
@@ -4,10 +4,17 @@ import { app } from '../../scripts/app'
|
||||
|
||||
// Adds an upload button to the nodes
|
||||
|
||||
const isImageComboInput = (inputSpec: InputSpec) => {
|
||||
const isMediaUploadComboInput = (inputSpec: InputSpec) => {
|
||||
const [inputName, inputOptions] = inputSpec
|
||||
if (!inputOptions || inputOptions['image_upload'] !== true) return false
|
||||
return isComboInputSpecV1(inputSpec) || inputName === 'COMBO'
|
||||
if (!inputOptions) return false
|
||||
|
||||
const isUploadInput =
|
||||
inputOptions['image_upload'] === true ||
|
||||
inputOptions['video_upload'] === true
|
||||
|
||||
return (
|
||||
isUploadInput && (isComboInputSpecV1(inputSpec) || inputName === 'COMBO')
|
||||
)
|
||||
}
|
||||
|
||||
const createUploadInput = (
|
||||
@@ -29,10 +36,10 @@ app.registerExtension({
|
||||
if (!required) return
|
||||
|
||||
const found = Object.entries(required).find(([_, input]) =>
|
||||
isImageComboInput(input)
|
||||
isMediaUploadComboInput(input)
|
||||
)
|
||||
|
||||
// If image combo input found, attach upload input
|
||||
// If media combo input found, attach upload input
|
||||
if (found) {
|
||||
const [inputName, inputSpec] = found
|
||||
required.upload = createUploadInput(inputName, inputSpec)
|
||||
|
||||
Reference in New Issue
Block a user