Change to just highlight and log
This commit is contained in:
+17
-1
@@ -5,6 +5,7 @@ import { app } from "../../../scripts/app.js";
|
||||
|
||||
let replaceRegex;
|
||||
const id = "pysssss.PresetText.Presets";
|
||||
const MISSING = Symbol();
|
||||
|
||||
const getPresets = () => {
|
||||
let items;
|
||||
@@ -47,6 +48,19 @@ app.registerExtension({
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const drawNodeWidgets = LGraphCanvas.prototype.drawNodeWidgets
|
||||
LGraphCanvas.prototype.drawNodeWidgets = function(node) {
|
||||
const c = LiteGraph.WIDGET_BGCOLOR;
|
||||
try {
|
||||
if(node[MISSING]) {
|
||||
LiteGraph.WIDGET_BGCOLOR = "red"
|
||||
}
|
||||
return drawNodeWidgets.apply(this, arguments);
|
||||
} finally {
|
||||
LiteGraph.WIDGET_BGCOLOR = c;
|
||||
}
|
||||
}
|
||||
},
|
||||
registerCustomNodes() {
|
||||
class PresetTextNode {
|
||||
@@ -153,10 +167,12 @@ app.registerExtension({
|
||||
if (!w) continue;
|
||||
const preset = presets.find((p) => p.name === widget.value);
|
||||
if (!preset) {
|
||||
this[MISSING] = true;
|
||||
app.graph.setDirtyCanvas(true, true);
|
||||
const msg = `Preset text '${widget.value}' not found. Please fix this and queue again.`;
|
||||
alert(msg);
|
||||
throw new Error(msg);
|
||||
}
|
||||
delete this[MISSING];
|
||||
w.value = preset.value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user