Files
OATH-Studio-comfy-LoRA-iter…/lora_iterator.js
T
2026-03-22 23:27:48 -06:00

25 lines
948 B
JavaScript

import { ComfyApp, app } from "../../scripts/app.js";
app.registerExtension({
name: "LoRAIterator.DynamicDirectory",
nodeCreated(node, app) {
if (node.comfyClass !== "LoRADirectoryIterator") return;
const lora_names_widget = node.widgets[node.widgets.findIndex(obj => obj.name === 'lora_name')];
var full_lora_list = lora_names_widget.options.values;
const directory_widget = node.widgets[node.widgets.findIndex(obj => obj.name === 'directory')];
Object.defineProperty(lora_names_widget.options, "values", {
set: (x) => {
full_lora_list = x;
},
get: () => {
if (directory_widget.value === '[All]')
return full_lora_list;
return full_lora_list.filter(x => x.includes('/' + directory_widget.value + '/') || x.includes('\\' + directory_widget.value + '\\'));
}
});
}
});