31 lines
862 B
JavaScript
31 lines
862 B
JavaScript
import { app } from "/scripts/app.js";
|
|
import { findWidgetByName, handleInputsVisibility } from "./utils.js";
|
|
|
|
|
|
app.registerExtension({
|
|
name: "Comfy.D2.D2_XYStringToPlot",
|
|
|
|
nodeCreated(node) {
|
|
if (node.constructor.title == "D2 XY String To Plot"){
|
|
if (node.widgets){
|
|
const countWidget = findWidgetByName(node, "string_count");
|
|
let widgetValue = countWidget.value;
|
|
handleInputsVisibility(node, widgetValue, ["string"], "STRING")
|
|
|
|
// string_count.value の再定義
|
|
Object.defineProperty(countWidget, 'value', {
|
|
get() {
|
|
return widgetValue;
|
|
},
|
|
set(newVal) {
|
|
if (newVal !== widgetValue) {
|
|
widgetValue = newVal;
|
|
handleInputsVisibility(node, newVal, ["string"], "STRING")
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
});
|