diff --git a/app/css/base_style_sb.css b/app/css/base_style_sb.css index d9ae8af..2496bb9 100644 --- a/app/css/base_style_sb.css +++ b/app/css/base_style_sb.css @@ -520,6 +520,7 @@ height: 10px; float: inline-start; margin-right: 8px; + margin-top: 3px; } @@ -596,7 +597,7 @@ .sb_row { display: grid; - grid-template-columns: 10px 1fr 1fr 1fr 10px; + grid-template-columns: 10px 1fr 1fr 0fr 10px; grid-column-gap: 10px; align-items: baseline; padding-left: 9px; @@ -619,6 +620,13 @@ .sb_inherit { display: inherit; + width: max-content; + flex: revert-layer; + } + + .sb_inherit_orig { + display: inherit; + } .long_field { @@ -638,6 +646,7 @@ background: var(--comfy-input-bg); font-weight: bold; color: var(--error-text); + margin-bottom: 3px; } #sb_scrollToTopButton { diff --git a/app/js/functions/sb_fn.js b/app/js/functions/sb_fn.js index 2fe1565..0718b43 100644 --- a/app/js/functions/sb_fn.js +++ b/app/js/functions/sb_fn.js @@ -150,6 +150,7 @@ function createNodePreview(nodeID) { let description = ""; let rows = ""; let last_rows = ""; + let error = ''; const data = LiteGraph.registered_node_types; @@ -181,10 +182,29 @@ function createNodePreview(nodeID) { secondV = inputs.required[inputKeysRequired[i]][0][0]; thirdV = inputs.required[inputKeysRequired[i]][0][0]; } - if (inputs.required[inputKeysRequired[i]][1]!=undefined){ - + + let isArr = false + + try { + if( typeof inputs.required[inputKeysRequired[i]][0] === 'object'){ + isArr = true + } + } + catch(err) { + console.log("error",err) + } + if (inputs.required[inputKeysRequired[i]][1]!=undefined && Object.keys(inputs.required[inputKeysRequired[i]][1]).length > 0){ + + + if (!isArr){ //object thirdV = inputs.required[inputKeysRequired[i]][1].default; + } + else{ + thirdV = inputs.required[inputKeysRequired[i]][0][0]; + } + + } @@ -196,6 +216,7 @@ function createNodePreview(nodeID) { try{ for (let i = 0; i < inputKeysOptional.length; i++) { + try{ let thirdV = null; let secondV = inputs.optional[inputKeysOptional[i]][0]; if (Array.isArray(secondV)){ @@ -203,19 +224,39 @@ function createNodePreview(nodeID) { secondV = inputs.optional[inputKeysOptional[i]][0][0]; thirdV = inputs.optional[inputKeysOptional[i]][0][0]; } - if (inputs.optional[inputKeysOptional[i]][1]!=undefined){ + + let isArr = false + + try { + if( typeof inputs.optional[inputKeysOptional[i]][0] === 'object'){ + isArr = true + } + } + catch(err) { + console.log("error",err) + } - //object - thirdV = inputs.optional[inputKeysOptional[i]][1].default; + if (inputs.optional[inputKeysOptional[i]][1]!=undefined && Object.keys(inputs.optional[inputKeysOptional[i]][1]).length > 0){ + + if (!isArr){ + //object + thirdV = inputs.optional[inputKeysOptional[i]][1].default; + } + else{ + thirdV = inputs.optional[inputKeysOptional[i]][0][0]; + } } inputArray.push([inputKeysOptional[i],secondV,thirdV]); + }catch(err){ + console.log("error",err) + } } }catch(err){ console.log(err) } - + for (let i = 0; i < outputs.length; i++) { @@ -230,16 +271,14 @@ function createNodePreview(nodeID) { } - - - let length_loop = outputArray.length; if (inputArray.length> outputArray.length){ + length_loop = inputArray.length; } for (let i = 0; i < length_loop; i++) { - + const inputList= inputArray[i] ? inputArray[i] : null; const outputList= outputArray[i] ? outputArray[i] : null; let inputName = ""; @@ -267,17 +306,44 @@ function createNodePreview(nodeID) { outputType = "sb_hidden"; outputName = ""; } - - + + array_list_type = [ + "BOOLEAN", + "CLIP", + "CLIP_VISION", + "CLIP_VISION_OUTPUT", + "CONDITIONING", + "CONTROL_NET", + "CONTROL_NET_WEIGHTS", + "FLOAT", + "GLIGEN", + "IMAGE", + "IMAGEUPLOAD", + "INT", + "LATENT", + "LATENT_KEYFRAME", + "MASK", + "MODEL", + "SAMPLER", + "SIGMAS", + "STRING", + "STYLE_MODEL", + "T2I_ADAPTER_WEIGHTS", + "TAESD", + "TIMESTEP_KEYFRAME", + "UPSCALE_MODEL", + "VAE", + ] if (inputValue != null){ if (inputType == "STRING"){ last_rows += `
${inputName}
-
${inputValue}
+
${inputValue}
`; + }else{ last_rows += `
◀
@@ -286,12 +352,25 @@ function createNodePreview(nodeID) {
${inputValue}
▶
`; + + } inputType = "sb_hidden"; inputName = ""; } - + else{ + if (inputType == "STRING"){ + last_rows += `
+
+
${inputName}
+
+
+
+
`; + } + } + if (inputType != "STRING"){ rows += `
${inputName}
@@ -300,7 +379,7 @@ function createNodePreview(nodeID) {
`; - + } @@ -311,20 +390,15 @@ function createNodePreview(nodeID) { //const nodePreview = document.createElement("div"); //nodePreview.classList.add("node_preview"); //nodePreview.id = nodeID; - + error = ""; }catch(err){ - rows = `
-
-
-
NOT AVAILABLE
-
-
-
` + error = "NOT AVAILABLE"; + rows = `` last_rows = `` } return [`
${nodeID}
-
PREVIEW
+
PREVIEW ${error}
${rows} ${last_rows}
`,description];