Compare commits

...
5 Commits
Author SHA1 Message Date
shadow d38a7aa558 Merge pull request #14 from shadowcz007/v0.3-psd读取分层
v0.2.2
2023-12-01 19:54:15 +08:00
shadowcz007 0bdf1e47a6 v0.2.2
- 本地读取节点也可以更新prompt了
2023-12-01 19:53:50 +08:00
shadowcz007 a44016e57c Update README.md 2023-12-01 18:20:03 +08:00
shadowcz007 35a9351e53 1 2023-12-01 17:51:31 +08:00
shadowcz007 c1b2112bb8 Update requirements.txt 2023-12-01 16:39:16 +08:00
8 changed files with 128 additions and 70 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
##
![screenshare](./assets/screenshare.png)
@@ -61,7 +62,7 @@ pip3 install -r requirements.txt
>LoadImagesFromLocal
> LoadImagesFromLocal
![watch](./assets/load-watch.png)
+2 -2
View File
@@ -276,8 +276,8 @@ NODE_CLASS_MAPPINGS = {
"VAEDecodeConsistencyDecoder":VAEDecode,
"ScreenShare":ScreenShareNode,
"FloatingVideo":FloatingVideo,
"CLIPSeg":CLIPSeg,
"CombineMasks":CombineMasks
"CLIPSeg_":CLIPSeg,
"CombineMasks_":CombineMasks
}
# 一个包含节点友好/可读的标题的字典
+8 -7
View File
@@ -583,32 +583,33 @@ class LoadImagesFromPath:
"white_bg": (["disable","enable"],),
"newest_files": (["enable", "disable"],),
"index_variable":("INT", {
"default": -1,
"default": 0,
"min": -1, #Minimum value
"max": 2048, #Maximum value
"step": 1, #Slider's step
"display": "number" # Cosmetic only: display as "number" or "slider"
}),
"watcher":(["disable","enable"],),
"result": ("WATCHER",),
"result": ("WATCHER",),#为了激活本节点运行
"prompt": ("PROMPT",),
# "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}),
}
}
RETURN_TYPES = ('IMAGE','MASK',)
RETURN_TYPES = ('IMAGE','MASK','STRING')
FUNCTION = "run"
CATEGORY = "Mixlab/image"
# INPUT_IS_LIST = True
OUTPUT_IS_LIST = (True,True,)
OUTPUT_IS_LIST = (True,True,False,)
global watcher_folder
watcher_folder=None
# 运行的函数
def run(self,file_path,white_bg,newest_files,index_variable,watcher,result):
def run(self,file_path,white_bg,newest_files,index_variable,watcher,result,prompt):
global watcher_folder
# print('###监听:',watcher_folder,watcher,file_path,result)
@@ -642,8 +643,8 @@ class LoadImagesFromPath:
imgs=[imgs[index_variable]] if index_variable < len(imgs) else None
masks=[masks[index_variable]] if index_variable < len(masks) else None
return (imgs,masks,)
print('#prompt::::',prompt)
return (imgs,masks,prompt,)
# TODO 扩大选区的功能,重新输出mask
+3 -1
View File
@@ -1,3 +1,5 @@
numpy
pyOpenSSL
watchdog
watchdog
opencv-python-headless
matplotlib
+1 -1
View File
@@ -3,7 +3,7 @@ import { app } from '../../../scripts/app.js'
const repoOwner = 'shadowcz007' // 替换为仓库的所有者
const repoName = 'comfyui-mixlab-nodes' // 替换为仓库的名称
const version='v0.2.1'
const version='v0.2.2'
fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/releases/latest`)
+15 -8
View File
@@ -402,6 +402,7 @@ const base64Df =
app.registerExtension({
name: 'Mixlab.image.ScreenShareNode',
async getCustomWidgets (app) {
console.log('#Mixlab.image.ScreenShareNode', app)
return {
CHEESE (node, inputName, inputData, app) {
// We return an object containing a field CHEESE which has a function (taking node, name, data, app)
@@ -419,8 +420,8 @@ app.registerExtension({
return window._mixlab_screen_imagePath || base64Df
}
}
// widget.something = something; // maybe adds stuff to it
node.addCustomWidget(widget) // adds it to the node
// console.log('#Mixlab.image.ScreenShareNode',widget)
node.addCustomWidget(widget)
return widget // and returns it.
},
PROMPT (node, inputName, inputData, app) {
@@ -439,7 +440,7 @@ app.registerExtension({
return window._mixlab_screen_prompt || ''
}
}
console.log('###widget', widget)
// console.log('###widget', widget)
node.addCustomWidget(widget) // adds it to the node
return widget // and returns it.
}
@@ -990,11 +991,17 @@ app.registerExtension({
function handleKeyDown (event) {
if (event.key === 'Enter') {
console.log('##更新Prompt')
window._mixlab_screen_prompt =
window._mixlab_screen_prompt_input ||
window._mixlab_screen_prompt
document.querySelector('#queue-button').click()
if (!event.shiftKey) {
// 回车键被按下且未同时按下Shift键,执行你的操作
event.preventDefault() // 阻止默认行为(如提交表单)
// 在这里添加你的代码
console.log('##更新Prompt')
window._mixlab_screen_prompt =
window._mixlab_screen_prompt_input ||
window._mixlab_screen_prompt
document.querySelector('#queue-button').click()
}
}
}
+22
View File
@@ -14,6 +14,8 @@ async function getConfig () {
return await res.json()
}
if(!window._mixlab_screen_prompt) window._mixlab_screen_prompt="beautiful scenery nature glass bottle landscape,under water"
function get_position_style (ctx, widget_width, y, node_height) {
const MARGIN = 4 // the margin around the html element
@@ -69,6 +71,26 @@ app.registerExtension({
// widget.something = something; // maybe adds stuff to it
node.addCustomWidget(widget) // adds it to the node
return widget // and returns it.
},
PROMPT (node, inputName, inputData, app) {
// console.log('node', inputName, inputData[0])
const widget = {
type: inputData[0], // the type, CHEESE
name: inputName, // the name, slice
size: [128, 24], // a default size
draw (ctx, node, width, y) {
// a method to draw the widget (ctx is a CanvasRenderingContext2D)
},
computeSize (...args) {
return [128, 24] // a method to compute the current size of the widget
},
async serializeValue (nodeId, widgetIndex) {
return window._mixlab_screen_prompt || ''
}
}
// widget.something = something; // maybe adds stuff to it
node.addCustomWidget(widget) // adds it to the node
return widget // and returns it.
}
}
},
+75 -50
View File
@@ -1,6 +1,6 @@
{
"last_node_id": 23,
"last_link_id": 47,
"last_link_id": 48,
"nodes": [
{
"id": 11,
@@ -94,7 +94,7 @@
"Node name for S&R": "KSampler"
},
"widgets_values": [
882790958612696,
1088992701378297,
"randomize",
4,
1.6,
@@ -110,10 +110,10 @@
-470,
840
],
"size": [
430.924072265625,
253.48239135742188
],
"size": {
"0": 430.924072265625,
"1": 253.48239135742188
},
"flags": {},
"order": 0,
"mode": 0,
@@ -212,7 +212,7 @@
"1": 58
},
"flags": {},
"order": 9,
"order": 8,
"mode": 0,
"inputs": [
{
@@ -271,45 +271,6 @@
"control_scribble-fp16.safetensors"
]
},
{
"id": 8,
"type": "CLIPTextEncode",
"pos": [
678,
-77
],
"size": {
"0": 400,
"1": 200
},
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 32
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
39
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"superman,"
]
},
{
"id": 7,
"type": "CLIPTextEncode",
@@ -322,7 +283,7 @@
"1": 200
},
"flags": {},
"order": 6,
"order": 5,
"mode": 0,
"inputs": [
{
@@ -361,7 +322,7 @@
"1": 126
},
"flags": {},
"order": 7,
"order": 6,
"mode": 0,
"inputs": [
{
@@ -465,7 +426,7 @@
"1": 246
},
"flags": {},
"order": 8,
"order": 7,
"mode": 0,
"inputs": [
{
@@ -512,6 +473,53 @@
1
]
},
{
"id": 8,
"type": "CLIPTextEncode",
"pos": [
678,
-77
],
"size": [
400,
200
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 32
},
{
"name": "text",
"type": "STRING",
"link": 48,
"widget": {
"name": "text"
}
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
39
],
"shape": 3,
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "CLIPTextEncode"
},
"widgets_values": [
"superman,"
]
},
{
"id": 22,
"type": "LoadImagesFromPath",
@@ -521,7 +529,7 @@
],
"size": {
"0": 315,
"1": 202
"1": 238
},
"flags": {},
"order": 4,
@@ -542,6 +550,15 @@
"type": "MASK",
"links": null,
"shape": 6
},
{
"name": "STRING",
"type": "STRING",
"links": [
48
],
"shape": 3,
"slot_index": 2
}
],
"properties": {
@@ -813,6 +830,14 @@
18,
0,
"IMAGE"
],
[
48,
22,
2,
8,
1,
"STRING"
]
],
"groups": [