This commit is contained in:
BennyKok
2023-09-27 18:10:52 +08:00
parent 6c20047ed1
commit 99febf17bc
7 changed files with 17 additions and 34 deletions
+1
View File
@@ -2,6 +2,7 @@
# Edit at https://www.toptal.com/developers/gitignore?templates=node,python,react
js/output.css
js/tw-styles.css
### Node ###
# Logs
+11 -5
View File
@@ -21,6 +21,12 @@ import { loadNpyTensor } from "./onnx.js";
import "https://code.iconify.design/3/3.1.0/iconify.min.js";
import { drawSegment, getClicks } from "./LayerEditor.js";
const stylesheet = document.createElement('link')
stylesheet.setAttribute('type', "text/css")
stylesheet.setAttribute('rel', "stylesheet")
stylesheet.setAttribute('href', './avatar-graph-comfyui/tw-styles.css')
document.head.appendChild(stylesheet)
/** @type {import( '../../../web/types/litegraph.js').LGraphGroup} */
const recomputeInsideNodesOps = LGraphGroup.prototype.recomputeInsideNodes;
LGraphGroup.prototype.recomputeInsideNodes = function () {
@@ -336,11 +342,11 @@ const ext = {
BLENDSHAPES_CONFIG(node, inputName, inputData, app) {
const btn = node.addWidget("button", "Edit Shape Flow", "", () => {
targetNode.val = node;
// openInAvatechEditor(
// "https://editor.avatech.ai?comfyui=true",
// fileName.val
// );
openInAvatechEditor("http://localhost:3006?comfyui=true", fileName.val);
openInAvatechEditor(
"https://editor.avatech.ai?comfyui=true",
fileName.val
);
// openInAvatechEditor("http://localhost:3006?comfyui=true", fileName.val);
});
btn.serialize = false;
File diff suppressed because one or more lines are too long
View File
+1 -2
View File
@@ -4,14 +4,13 @@
"description": "",
"main": "index.js",
"scripts": {
"dev": "concurrently \"tailwindcss -i ./js/style.css -o ./js/output.css --watch -m\" \"node ./style-watcher.js\""
"dev": "tailwindcss -i ./js/styles.css -o ./js/tw-styles.css --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"chokidar": "^3.5.3",
"concurrently": "^8.2.1",
"daisyui": "^3.7.5",
"tailwindcss": "^3.3.3"
}
+4
View File
@@ -32,6 +32,10 @@ for item in server.PromptServer.instance.routes._items:
routes.append(item)
server.PromptServer.instance.routes._items = routes
@server.PromptServer.instance.routes.get("/avatar-graph-comfyui/tw-styles.css")
async def get_web_styles(request):
filename = os.path.join(os.path.dirname(__file__), "js/tw-styles.css")
return web.FileResponse(filename)
@server.PromptServer.instance.routes.get("/sam_model")
async def get_sam_model(request):
-24
View File
@@ -1,24 +0,0 @@
const fs = require('fs');
const chokidar = require('chokidar');
const path = require('path');
// Initialize watcher.
const watcher = chokidar.watch(path.resolve(__dirname, './js/output.css'), {
persistent: true
});
// Add event listeners.
watcher
.on('change', filePath => {
console.log(`File ${filePath} has been changed`);
let cssContent = fs.readFileSync(filePath, 'utf8');
let jsContent = `let style = document.createElement('style');
style.innerHTML = \`${cssContent.replace(/\\/g, '\\\\')}\`;
document.head.appendChild(style);`;
fs.writeFileSync(path.resolve(__dirname, './js/style-inject.js'), jsContent);
});
// On script exit, close the watcher
process.on('exit', (code) => {
watcher.close();
});