mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
feat(lora-stacker): conditionally update trigger words based on node mode
Add node mode checks to ensure trigger words are only updated when the stacker node is active (mode 0 for Always or mode 3 for On Trigger). This prevents unnecessary updates when the node is inactive (mode 2 for Never or mode 4 for Bypass), improving performance and ensuring trigger words reflect the actual active state of the node. The changes include: - Adding mode checks before updating active LoRA names in the stacker callback - Modifying collectActiveLorasFromChain to only include active nodes - Adding comments to clarify node mode behavior
This commit is contained in:
@@ -287,6 +287,7 @@ export function getActiveLorasFromNode(node) {
|
||||
}
|
||||
|
||||
// Recursively collect all active loras from a node and its input chain
|
||||
// A node is considered active only if its mode is 0 (Always) or 3 (On Trigger)
|
||||
export function collectActiveLorasFromChain(node, visited = new Set()) {
|
||||
// Prevent infinite loops from circular references
|
||||
const nodeKey = getNodeKey(node);
|
||||
@@ -298,8 +299,12 @@ export function collectActiveLorasFromChain(node, visited = new Set()) {
|
||||
}
|
||||
visited.add(nodeKey);
|
||||
|
||||
// Get active loras from current node
|
||||
const allActiveLoraNames = getActiveLorasFromNode(node);
|
||||
// Check if node is active (mode 0 for Always, mode 3 for On Trigger)
|
||||
// Mode 2 is Never, Mode 4 is Bypass
|
||||
const isNodeActive = node.mode === undefined || node.mode === 0 || node.mode === 3;
|
||||
|
||||
// Get active loras from current node only if node is active
|
||||
const allActiveLoraNames = isNodeActive ? getActiveLorasFromNode(node) : new Set();
|
||||
|
||||
// Get connected input stackers and collect their active loras
|
||||
const inputStackers = getConnectedInputStackers(node);
|
||||
|
||||
Reference in New Issue
Block a user