* Added forced rate and size properties to python. Implemented client-based show/hide logic. * Refactoring. Fixed backward-compatibility issues. * Added VHS' force size and rate functionality. * Removed 'force_rate' as it didn't make sense in our case. * Initial refactoring. * Additional refactoring. * Added placeholder method for canvas menu extension. Minor refactoring. Updated group menu. * Bugfix. * Added logic for storing group's node IDs into group itself. * Registered 'add group' function. * Created extended groups folder on startup. Minor cleanup. * BE refactoring. * Minor bugfix. * Implemented basic group fetch from the saved JSON files. * Minor refactoring. * Implemented basic graph data load from the version file. * Trying to import group items into scene without removing the previous content. * Frame positioning bugfix. * Final fixes. * Added saved nodes to graph. * Updated nodes' ids during load. * Added groups and links. * Minor bugfixes. * Implemented group repositioning depending on the touch location of the menu. * Updated version structure. * Implemented version data persistence across serialization and configuration for groups. * Separated versioned/unversioned groups menu context. * Implemented unversioned group save. * Implemented group data update as well as object update upon first group save. * Implemented existing group save. * Removed unneeded data ID rewrite. * Minor stylistic changes. * Added support for saving as new version. * Added support for loading old versions. * Fixed a bug where links wouldn't get stored in a version file. * Fixed an issue where "null" link would get storred. * Added last change timestamp so we get more info about a specific version on the client. * Final link bugfix. * Minor stylistic changes. * Group object/value bugfix. * Added version info to the right of the group name. * Replaced delete version option and a refresh option. Minor refactoring and cleanup. * Removed unneeded code. * Minor bugfix. * Added more verbose versioning info to groups. * Minor stylistic changes. * Implemented versioned group data removal in case that the corresponding history data isn't found in the local comfy history folder. * Fixed an issue where links from initial group load on an empty canvas weren't displayed. * Implemented README for enhanced groups. * Update README.md * Uploaded images. * Removed all deprecated versions. * Fixed an issue where clamp wasn't working. * Updated the way duration is calculated. * Bugfix. * Additional bugfix. * Made sure that web video player encompases all frames. * Fixed video generation on the backend. * Group creation bugfix. * Moved config and serialization overrides earlier in the group extension lifecycle. * Fixed an issue where a group wouldn't retain versioning data upon reload. * Reverted drawing of off-screen nodes. * Implemented immediate group versioning display in the group title. * Fixed an issue where the first refresh would cause some nodes not to get deleted.
90 lines
2.6 KiB
JavaScript
90 lines
2.6 KiB
JavaScript
'use strict';
|
|
|
|
import { api } from "../../../scripts/api.js";
|
|
import { $el } from "../../../scripts/ui.js";
|
|
|
|
export async function processVideoEntry(path) {
|
|
const body = {
|
|
path: path,
|
|
};
|
|
const result = await api.fetchApi("/process_video_entry", { method: "POST", body: JSON.stringify(body) });
|
|
if (result.error) {
|
|
console.error(`processVideoEntry error: ${result.error}`);
|
|
return undefined;
|
|
}
|
|
const jsonData = await result.json();
|
|
const frameDuration = jsonData.duration / jsonData.total_frames;
|
|
jsonData.frame_duration = frameDuration;
|
|
return jsonData;
|
|
}
|
|
|
|
/*
|
|
Attribution: ComfyUI-Custom-Scripts
|
|
|
|
Portions of this code are adapted from GitHub repository `https://github.com/pythongosssss/ComfyUI-Custom-Scripts`,
|
|
which is licensed under the MIT License:
|
|
*/
|
|
export function lnlAddStylesheet(url) {
|
|
$el("link", {
|
|
parent: document.head,
|
|
rel: "stylesheet",
|
|
type: "text/css",
|
|
href: url.startsWith("http") ? url : lnlGetUrl(url),
|
|
});
|
|
}
|
|
|
|
/*
|
|
Attribution: ComfyUI-Custom-Scripts
|
|
|
|
Portions of this code are adapted from GitHub repository `https://github.com/pythongosssss/ComfyUI-Custom-Scripts`,
|
|
which is licensed under the MIT License:
|
|
*/
|
|
export function lnlGetUrl(path, baseUrl) {
|
|
if (baseUrl) {
|
|
return new URL(path, baseUrl).toString();
|
|
}
|
|
else {
|
|
return new URL("../" + path, import.meta.url).toString();
|
|
}
|
|
}
|
|
|
|
/*
|
|
Attribution: ComfyUI-VideoHelperSuite
|
|
|
|
Portions of this code are adapted from GitHub repository `https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite`,
|
|
which is licensed under the GNU General Public License version 3 (GPL-3.0):
|
|
*/
|
|
export async function lnlUploadFile(file) {
|
|
//TODO: Add uploaded file to cache with Cache.put()?
|
|
try {
|
|
// Wrap file in formdata so it includes filename
|
|
const body = new FormData();
|
|
const i = file.webkitRelativePath.lastIndexOf('/');
|
|
const subfolder = file.webkitRelativePath.slice(0,i+1)
|
|
const new_file = new File([file], file.name, {
|
|
type: file.type,
|
|
lastModified: file.lastModified,
|
|
});
|
|
body.append("image", new_file);
|
|
if (i > 0) {
|
|
body.append("subfolder", subfolder);
|
|
}
|
|
const resp = await api.fetchApi("/upload/image", {
|
|
method: "POST",
|
|
body,
|
|
});
|
|
|
|
if (resp.status === 200) {
|
|
return resp.status
|
|
} else {
|
|
alert(resp.status + " - " + resp.statusText);
|
|
}
|
|
} catch (error) {
|
|
alert(error);
|
|
}
|
|
}
|
|
|
|
export function clamp(value, min, max) {
|
|
return Math.max(min, Math.min(value, max));
|
|
}
|