MCPcopy Create free account
hub / github.com/6174/comflowyspace / getNodeRenderInfo

Function getNodeRenderInfo

packages/common/workflow-editor/node-rendering.tsx:12–139  ·  view source on GitHub ↗
(node: SDNode, widget: Widget)

Source from the content-addressed store, hash-verified

10 * @returns
11 */
12export function getNodeRenderInfo(node: SDNode, widget: Widget): WorkflowNodeRenderInfo {
13 if (Widget.isPrimitive(widget.name)) {
14 return getPrimitiveNodeRenderingInfo(node, widget);
15 }
16
17 let params: { property: string, input: Input }[] = []
18 let inputs = node.inputs || [];
19 let outputs = node.outputs || [];
20 let enabled = node.enabled || false;
21
22 if (node.parent) {
23 const parent = useAppStore.getState().graph[node.parent];
24 if (parent && parent.enabled) {
25 enabled = true;
26 }
27 }
28
29 const inputKeys = inputs.map(input => input.name);
30
31 if (widget.name === NODE_REROUTE) {
32 outputs = [{ name: "*", type: "*", links: [], slot_index: 0 }];
33 inputs = [{ name: "value", type: "*" }];
34 }
35
36 if (widget.name === NODE_GET) {
37 outputs = [{ name: "value", type: "*", links: [], slot_index: 0 }];
38 inputs = [];
39 }
40
41 if (widget.name === NODE_SET) {
42 outputs = [{ name: "value", type: "*", links: [], slot_index: 0 }];
43 inputs = [{name: "value", type: "*"}];
44 }
45
46 if ((widget?.input?.required?.image?.[1] as any)?.image_upload === true) {
47 widget.input.required.upload = ["IMAGEUPLOAD", {type: "image"}];
48 }
49
50 if (widget?.input?.required?.video && Input.isList(widget?.input?.required?.video)) {
51 widget.input.required.upload = ["IMAGEUPLOAD", { type: "video" }];
52 }
53
54 for (const [property, input] of Object.entries(widget?.input?.required || {})) {
55 if (!inputKeys.includes(property)) {
56 params.push({ property, input })
57 }
58 if (widget.name === "VHS_VideoCombine" && property === "format") {
59 const rawOptions = input[0] as any;
60 const value = node.fields[property];
61 const rawOption = rawOptions.find((it: any) => {
62 if (typeof it == "object") {
63 return it[0] === value
64 }
65 })
66 if (rawOption) {
67 const dynamicParams = rawOption[1]
68 if (dynamicParams.length > 0) {
69 dynamicParams.forEach((param: any[]) => {

Callers 10

parseSubflowFunction · 0.90
ReactflowNodePreviewCardFunction · 0.90
reactflow-node.tsxFile · 0.90
GroupSmallTransformStateFunction · 0.90
GroupCollapsedFunction · 0.90
GroupExpandedFunction · 0.90

Calls 2

dtFunction · 0.90

Tested by

no test coverage detected