Hide bar-driven widgets from node bodies (JS only; Python untouched)

The control bars are now the ONLY visible controls; the node input widgets
they drive are hidden via a new hideWidgets() util (uiComponents.js). The
widgets keep existing -- values still serialize into the workflow and flow to
Python as inputs -- they just stop rendering on the node body.

- Multi / VTK preview / Batch: `mode` widget hidden (bar Mode selector drives
  it). Batch keeps its `index` widget visible (useful for typing an exact
  index).
- Dual: `layout`, `mode`, `opacity_1`, `opacity_2` all hidden. Opacity moves
  into the bar (shown only for the Overlay layout) and is applied
  CLIENT-SIDE: changing it updates the hidden widgets (persistence + next
  run) and re-posts to the viewer immediately -- no re-run. render() now
  prefers widget values over the last message's, which also fixes the
  `|| 1.0` bug that made opacity 0 impossible.

No Python or export-format changes, per direction.
This commit is contained in:
PozzettiAndrea
2026-08-14 14:18:15 +02:00
parent 6047a30e1b
commit 54c3ad01aa
5 changed files with 76 additions and 28 deletions
+24
View File
@@ -74,6 +74,30 @@ export function createFullscreenButton(container) {
return btn;
}
/**
* Permanently hide node input widgets that are driven by a control bar
* instead. The widgets keep existing (their values still serialize into the
* workflow and flow to Python as inputs) -- they just stop being drawn on the
* node body, so the bar is the single visible control.
*
* @param {Object} node - The LiteGraph node
* @param {string[]} names - Widget names to hide
*/
export function hideWidgets(node, names) {
let changed = false;
for (const nm of names) {
const w = node.widgets?.find((x) => x.name === nm);
if (w && w.type !== "geometrypack_hidden") {
w._gpOrigType = w.type;
w._gpOrigComputeSize = w.computeSize;
w.type = "geometrypack_hidden"; // unknown type -> not drawn
w.computeSize = () => [0, -4];
changed = true;
}
}
if (changed) node.setSize(node.computeSize());
}
/**
* Create an info panel for displaying mesh metadata
* @param {string} placeholder - Initial placeholder text