Skip to content

Commit

Permalink
Update groupnode/component to be compatible with frontend v1.2.64 (#1084
Browse files Browse the repository at this point in the history
)
  • Loading branch information
christian-byrne authored Sep 25, 2024
1 parent f3e9856 commit 3243096
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion glob/manager_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ def extract_nodes(sub_workflow):
if node_name in ['Reroute', 'Note']:
continue

if node_name is not None and not node_name.startswith('workflow/'):
if node_name is not None and not (node_name.startswith('workflow/') or node_name.startswith('workflow>')):
used_nodes.add(node_name)

if 'nodes' in workflow:
Expand Down
20 changes: 11 additions & 9 deletions js/components-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { sleep, show_message } from "./common.js";
import { GroupNodeConfig, GroupNodeHandler } from "../../extensions/core/groupNode.js";
import { ComfyDialog, $el } from "../../scripts/ui.js";

const SEPARATOR = ">"

let pack_map = {};
let rpack_map = {};

Expand All @@ -20,7 +22,7 @@ export function getPureName(node) {
let purename = node.comfyClass.substring(category.length+1);
return purename;
}
else if(node.comfyClass.startsWith('workflow/')) {
else if(node.comfyClass.startsWith('workflow/') || node.comfyClass.startsWith(`workflow${SEPARATOR}`)) {
return node.comfyClass.substring(9);
}
else {
Expand Down Expand Up @@ -76,7 +78,7 @@ export async function load_components() {

let category = data.packname;
if(data.category) {
category += "/" + data.category;
category += SEPARATOR + data.category;
}
if(category == '') {
category = 'components';
Expand All @@ -100,7 +102,7 @@ export async function load_components() {
try {
let category = nodeData.packname;
if(nodeData.category) {
category += "/" + nodeData.category;
category += SEPARATOR + nodeData.category;
}
if(category == '') {
category = 'components';
Expand Down Expand Up @@ -139,7 +141,7 @@ export async function load_components() {
try {
let category = nodeData.packname;
if(nodeData.workflow.category) {
category += "/" + nodeData.category;
category += SEPARATOR + nodeData.category;
}
if(category == '') {
category = 'components';
Expand Down Expand Up @@ -174,7 +176,7 @@ export async function load_components() {
try {
let category = nodeData.workflow.packname;
if(nodeData.workflow.category) {
category += "/" + nodeData.category;
category += SEPARATOR + nodeData.category;
}
if(category == '') {
category = 'components';
Expand Down Expand Up @@ -234,7 +236,7 @@ async function save_as_component(node, version, author, prefix, nodename, packna

let category = body.workflow.packname;
if(body.workflow.category) {
category += "/" + body.workflow.category;
category += SEPARATOR + body.workflow.category;
}
if(category == '') {
category = 'components';
Expand Down Expand Up @@ -266,7 +268,7 @@ async function import_component(component_name, component, mode) {

let category = component.packname;
if(component.category) {
category += "/" + component.category;
category += SEPARATOR + component.category;
}
if(category == '') {
category = 'components';
Expand Down Expand Up @@ -403,7 +405,7 @@ function handle_import_components(components) {
}

if(cnt == 1 && last_name) {
const node = LiteGraph.createNode(`workflow/${last_name}`);
const node = LiteGraph.createNode(`workflow${SEPARATOR}${last_name}`);
node.pos = [app.canvas.graph_mouse[0], app.canvas.graph_mouse[1]];
app.canvas.graph.add(node, false);
}
Expand Down Expand Up @@ -786,7 +788,7 @@ app.graphToPrompt = async function () {
// get used group nodes
let used_group_nodes = new Set();
for(let node of p.workflow.nodes) {
if(node.type.startsWith('workflow/')) {
if(node.type.startsWith(`workflow/`) || node.type.startsWith(`workflow${SEPARATOR}`)) {
used_group_nodes.add(node.type.substring(9));
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/custom-nodes-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ export class CustomNodesManager {

for (let i in nodes) {
const node_type = nodes[i].type;
if(node_type.startsWith('workflow/'))
if(node_type.startsWith('workflow/') || node_type.startsWith('workflow>'))
continue;

if (!registered_nodes.has(node_type)) {
Expand Down

0 comments on commit 3243096

Please sign in to comment.