mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-23 21:00:16 +08:00
Merge branch 'comfyanonymous:master' into feature/preview-latent
This commit is contained in:
commit
f7c1e8b6ff
37
server.py
37
server.py
@ -261,23 +261,34 @@ class PromptServer():
|
|||||||
async def get_prompt(request):
|
async def get_prompt(request):
|
||||||
return web.json_response(self.get_queue_info())
|
return web.json_response(self.get_queue_info())
|
||||||
|
|
||||||
|
def node_info(node_class):
|
||||||
|
obj_class = nodes.NODE_CLASS_MAPPINGS[node_class]
|
||||||
|
info = {}
|
||||||
|
info['input'] = obj_class.INPUT_TYPES()
|
||||||
|
info['output'] = obj_class.RETURN_TYPES
|
||||||
|
info['output_is_list'] = obj_class.OUTPUT_IS_LIST if hasattr(obj_class, 'OUTPUT_IS_LIST') else [False] * len(obj_class.RETURN_TYPES)
|
||||||
|
info['output_name'] = obj_class.RETURN_NAMES if hasattr(obj_class, 'RETURN_NAMES') else info['output']
|
||||||
|
info['name'] = node_class
|
||||||
|
info['display_name'] = nodes.NODE_DISPLAY_NAME_MAPPINGS[node_class] if node_class in nodes.NODE_DISPLAY_NAME_MAPPINGS.keys() else node_class
|
||||||
|
info['description'] = ''
|
||||||
|
info['category'] = 'sd'
|
||||||
|
if hasattr(obj_class, 'CATEGORY'):
|
||||||
|
info['category'] = obj_class.CATEGORY
|
||||||
|
return info
|
||||||
|
|
||||||
@routes.get("/object_info")
|
@routes.get("/object_info")
|
||||||
async def get_object_info(request):
|
async def get_object_info(request):
|
||||||
out = {}
|
out = {}
|
||||||
for x in nodes.NODE_CLASS_MAPPINGS:
|
for x in nodes.NODE_CLASS_MAPPINGS:
|
||||||
obj_class = nodes.NODE_CLASS_MAPPINGS[x]
|
out[x] = node_info(x)
|
||||||
info = {}
|
return web.json_response(out)
|
||||||
info['input'] = obj_class.INPUT_TYPES()
|
|
||||||
info['output'] = obj_class.RETURN_TYPES
|
@routes.get("/object_info/{node_class}")
|
||||||
info['output_is_list'] = obj_class.OUTPUT_IS_LIST if hasattr(obj_class, 'OUTPUT_IS_LIST') else [False] * len(obj_class.RETURN_TYPES)
|
async def get_object_info_node(request):
|
||||||
info['output_name'] = obj_class.RETURN_NAMES if hasattr(obj_class, 'RETURN_NAMES') else info['output']
|
node_class = request.match_info.get("node_class", None)
|
||||||
info['name'] = x
|
out = {}
|
||||||
info['display_name'] = nodes.NODE_DISPLAY_NAME_MAPPINGS[x] if x in nodes.NODE_DISPLAY_NAME_MAPPINGS.keys() else x
|
if (node_class is not None) and (node_class in nodes.NODE_CLASS_MAPPINGS):
|
||||||
info['description'] = ''
|
out[node_class] = node_info(node_class)
|
||||||
info['category'] = 'sd'
|
|
||||||
if hasattr(obj_class, 'CATEGORY'):
|
|
||||||
info['category'] = obj_class.CATEGORY
|
|
||||||
out[x] = info
|
|
||||||
return web.json_response(out)
|
return web.json_response(out)
|
||||||
|
|
||||||
@routes.get("/history")
|
@routes.get("/history")
|
||||||
|
|||||||
@ -921,8 +921,9 @@ export class ComfyApp {
|
|||||||
this.graph.start();
|
this.graph.start();
|
||||||
|
|
||||||
function resizeCanvas() {
|
function resizeCanvas() {
|
||||||
canvasEl.width = canvasEl.offsetWidth;
|
canvasEl.width = canvasEl.offsetWidth * window.devicePixelRatio;
|
||||||
canvasEl.height = canvasEl.offsetHeight;
|
canvasEl.height = canvasEl.offsetHeight * window.devicePixelRatio;
|
||||||
|
canvasEl.getContext("2d").scale(window.devicePixelRatio, window.devicePixelRatio);
|
||||||
canvas.draw(true, true);
|
canvas.draw(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -155,18 +155,24 @@ function addMultilineWidget(node, name, opts, app) {
|
|||||||
computeSize(node.size);
|
computeSize(node.size);
|
||||||
}
|
}
|
||||||
const visible = app.canvas.ds.scale > 0.5 && this.type === "customtext";
|
const visible = app.canvas.ds.scale > 0.5 && this.type === "customtext";
|
||||||
const t = ctx.getTransform();
|
|
||||||
const margin = 10;
|
const margin = 10;
|
||||||
|
const elRect = ctx.canvas.getBoundingClientRect();
|
||||||
|
const transform = new DOMMatrix()
|
||||||
|
.scaleSelf(elRect.width / ctx.canvas.width, elRect.height / ctx.canvas.height)
|
||||||
|
.multiplySelf(ctx.getTransform())
|
||||||
|
.translateSelf(margin, margin + y);
|
||||||
|
|
||||||
Object.assign(this.inputEl.style, {
|
Object.assign(this.inputEl.style, {
|
||||||
left: `${t.a * margin + t.e}px`,
|
transformOrigin: "0 0",
|
||||||
top: `${t.d * (y + widgetHeight - margin - 3) + t.f}px`,
|
transform: transform,
|
||||||
width: `${(widgetWidth - margin * 2 - 3) * t.a}px`,
|
left: "0px",
|
||||||
background: (!node.color)?'':node.color,
|
top: "0px",
|
||||||
height: `${(this.parent.inputHeight - margin * 2 - 4) * t.d}px`,
|
width: `${widgetWidth - (margin * 2)}px`,
|
||||||
|
height: `${this.parent.inputHeight - (margin * 2)}px`,
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
|
background: (!node.color)?'':node.color,
|
||||||
color: (!node.color)?'':'white',
|
color: (!node.color)?'':'white',
|
||||||
zIndex: app.graph._nodes.indexOf(node),
|
zIndex: app.graph._nodes.indexOf(node),
|
||||||
fontSize: `${t.d * 10.0}px`,
|
|
||||||
});
|
});
|
||||||
this.inputEl.hidden = !visible;
|
this.inputEl.hidden = !visible;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -39,6 +39,8 @@ body {
|
|||||||
padding: 2px;
|
padding: 2px;
|
||||||
resize: none;
|
resize: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfy-modal {
|
.comfy-modal {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user