Count tags on parent subgraphs as being on child nodes and ignore tags

on reroutes
This commit is contained in:
space-nuko
2023-05-25 17:05:54 -05:00
parent e6b446079a
commit d70f430383
5 changed files with 3277 additions and 3270 deletions

View File

@@ -2,6 +2,7 @@ import type { ComfyWidgetNode } from "$lib/nodes/widgets";
import { BuiltInSlotType, LiteGraph, NodeMode, type ITextWidget, type IToggleWidget, type SlotLayout } from "@litegraph-ts/core";
import { get } from "svelte/store";
import ComfyGraphNode, { type ComfyGraphNodeProperties } from "../ComfyGraphNode";
import { nodeHasTag } from "$lib/components/ComfyPromptSerializer";
export interface ComfySetNodeModeActionProperties extends ComfyGraphNodeProperties {
targetTags: string,
@@ -52,7 +53,7 @@ export default class ComfySetNodeModeAction extends ComfyGraphNode {
for (const node of this.graph._nodes) {
if ("tags" in node.properties) {
const comfyNode = node as ComfyGraphNode;
const hasTag = tags.some(t => comfyNode.properties.tags.indexOf(t) != -1);
const hasTag = tags.some(t => nodeHasTag(comfyNode, t));
if (hasTag) {
let newMode: NodeMode;
if (enabled) {

View File

@@ -2,6 +2,7 @@ import { type DragItemID } from "$lib/stores/layoutStates";
import { BuiltInSlotType, LiteGraph, NodeMode, type ITextWidget, type IToggleWidget, type PropertyLayout, type SlotLayout } from "@litegraph-ts/core";
import { get } from "svelte/store";
import ComfyGraphNode, { type ComfyGraphNodeProperties } from "../ComfyGraphNode";
import { nodeHasTag } from "$lib/components/ComfyPromptSerializer";
export type TagAction = {
tag: string,
@@ -68,7 +69,7 @@ export default class ComfySetNodeModeAdvancedAction extends ComfyGraphNode {
for (const node of this.graph.iterateNodesInOrderRecursive()) {
if ("tags" in node.properties) {
const comfyNode = node as ComfyGraphNode;
const hasTag = comfyNode.properties.tags.indexOf(action.tag) != -1;
const hasTag = nodeHasTag(comfyNode, action.tag);
if (hasTag) {
let newMode: NodeMode;