diff --git a/build/litegraph.js b/build/litegraph.js index 37e454469..883837df2 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -7087,7 +7087,7 @@ if(typeof(LiteGraph) != "undefined") return gl.textures; } - //process the loading of a texture (overwrite if you have a Resources Manager) + //process the loading of a texture (overwrite it if you have a Resources Manager) LGraphTexture.loadTexture = function(name, options) { options = options || {}; @@ -7930,7 +7930,7 @@ if(typeof(LiteGraph) != "undefined") this.addInput("LUT","Texture"); this.addInput("Intensity","number"); this.addOutput("","Texture"); - this.properties = { intensity: 1, precision: LGraphTexture.DEFAULT }; + this.properties = { intensity: 1, precision: LGraphTexture.DEFAULT, texture: null }; if(!LGraphTextureLUT._shader) LGraphTextureLUT._shader = new GL.Shader( Shader.SCREEN_VERTEX_SHADER, LGraphTextureLUT.pixel_shader ); @@ -7942,6 +7942,7 @@ if(typeof(LiteGraph) != "undefined") LGraphTextureLUT.title = "LUT"; LGraphTextureLUT.desc = "Apply LUT to Texture"; + LGraphTextureLUT.widgets_info = {"texture": { widget:"texture"} }; LGraphTextureLUT.prototype.onExecute = function() { @@ -7956,11 +7957,16 @@ if(typeof(LiteGraph) != "undefined") if(!tex) return; var lut_tex = this.getInputData(1); + + if(!lut_tex) + lut_tex = LGraphTexture.getTexture( this.properties.texture ); + if(!lut_tex) { this.setOutputData(0,tex); return; } + lut_tex.bind(0); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR ); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE ); diff --git a/build/litegraph.min.js b/build/litegraph.min.js index c5d43fe60..7c5949528 100644 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -232,9 +232,9 @@ LGraphTextureAverage.desc="Compute the total average of a texture and stores it c=this.properties.low_precision?gl.UNSIGNED_BYTE:a.type;b&&b.type==c||(this._temp_texture=new GL.Texture(1,1,{type:c,format:gl.RGBA,filter:gl.NEAREST}));var d=LGraphTextureAverage._shader;this._temp_texture.drawTo(function(){a.toViewport(d,{u_texture:0})});this.setOutputData(0,this._temp_texture)}};LGraphTextureAverage.pixel_shader="precision highp float;\n\t\t\tprecision highp float;\n\t\t\tuniform mat4 u_samples_a;\n\t\t\tuniform mat4 u_samples_b;\n\t\t\tuniform sampler2D u_texture;\n\t\t\tvarying vec2 v_coord;\n\t\t\t\n\t\t\tvoid main() {\n\t\t\t\tvec4 color = vec4(0.0);\n\t\t\t\tfor(int i = 0; i < 4; ++i)\n\t\t\t\t\tfor(int j = 0; j < 4; ++j)\n\t\t\t\t\t{\n\t\t\t\t\t\tcolor += texture2D(u_texture, vec2( u_samples_a[i][j], u_samples_b[i][j] ) );\n\t\t\t\t\t\tcolor += texture2D(u_texture, vec2( 1.0 - u_samples_a[i][j], u_samples_b[i][j] ) );\n\t\t\t\t\t}\n\t\t\t gl_FragColor = color * 0.03125;\n\t\t\t}\n\t\t\t"; LiteGraph.registerNodeType("texture/average",LGraphTextureAverage);var LGraphImageToTexture=function(){this.addInput("Image","image");this.addOutput("","Texture");this.properties={}};LGraphImageToTexture.title="Image to Texture";LGraphImageToTexture.desc="Uploads an image to the GPU";LGraphImageToTexture.prototype.onExecute=function(){var a=this.getInputData(0);if(a){var b=a.videoWidth||a.width,c=a.videoHeight||a.height;if(a.gltexture)this.setOutputData(0,a.gltexture);else{var d=this._temp_texture; d&&d.width==b&&d.height==c||(this._temp_texture=new GL.Texture(b,c,{format:gl.RGBA,filter:gl.LINEAR}));try{this._temp_texture.uploadImage(a)}catch(e){console.error("image comes from an unsafe location, cannot be uploaded to webgl");return}this.setOutputData(0,this._temp_texture)}}};LiteGraph.registerNodeType("texture/imageToTexture",LGraphImageToTexture);var LGraphTextureLUT=function(){this.addInput("Texture","Texture");this.addInput("LUT","Texture");this.addInput("Intensity","number");this.addOutput("", -"Texture");this.properties={intensity:1,precision:LGraphTexture.DEFAULT};LGraphTextureLUT._shader||(LGraphTextureLUT._shader=new GL.Shader(Shader.SCREEN_VERTEX_SHADER,LGraphTextureLUT.pixel_shader))};LGraphTextureLUT.widgets_info={precision:{widget:"combo",values:LGraphTexture.MODE_VALUES}};LGraphTextureLUT.title="LUT";LGraphTextureLUT.desc="Apply LUT to Texture";LGraphTextureLUT.prototype.onExecute=function(){var a=this.getInputData(0);if(this.properties.precision===LGraphTexture.PASS_THROUGH)this.setOutputData(0, -a);else if(a){var b=this.getInputData(1);if(b){b.bind(0);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.bindTexture(gl.TEXTURE_2D,null);var c=this.properties.intensity;this.isInputConnected(2)&&(this.properties.intensity=c=this.getInputData(2));this._tex=LGraphTexture.getTargetTexture(a,this._tex,this.properties.precision);this._tex.drawTo(function(){b.bind(1); -a.toViewport(LGraphTextureLUT._shader,{u_texture:0,u_textureB:1,u_amount:c})});this.setOutputData(0,this._tex)}else this.setOutputData(0,a)}};LGraphTextureLUT.pixel_shader="precision highp float;\n\t\t\tprecision highp float;\n\t\t\tvarying vec2 v_coord;\n\t\t\tuniform sampler2D u_texture;\n\t\t\tuniform sampler2D u_textureB;\n\t\t\tuniform float u_amount;\n\t\t\t\n\t\t\tvoid main() {\n\t\t\t\t lowp vec4 textureColor = clamp( texture2D(u_texture, v_coord), vec4(0.0), vec4(1.0) );\n\t\t\t\t mediump float blueColor = textureColor.b * 63.0;\n\t\t\t\t mediump vec2 quad1;\n\t\t\t\t quad1.y = floor(floor(blueColor) / 8.0);\n\t\t\t\t quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\t\t\t\t mediump vec2 quad2;\n\t\t\t\t quad2.y = floor(ceil(blueColor) / 8.0);\n\t\t\t\t quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\t\t\t\t highp vec2 texPos1;\n\t\t\t\t texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\t\t\t\t texPos1.y = 1.0 - ((quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\t\t\t\t highp vec2 texPos2;\n\t\t\t\t texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\t\t\t\t texPos2.y = 1.0 - ((quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\t\t\t\t lowp vec4 newColor1 = texture2D(u_textureB, texPos1);\n\t\t\t\t lowp vec4 newColor2 = texture2D(u_textureB, texPos2);\n\t\t\t\t lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n\t\t\t\t gl_FragColor = vec4( mix( textureColor.rgb, newColor.rgb, u_amount), textureColor.w);\n\t\t\t}\n\t\t\t"; +"Texture");this.properties={intensity:1,precision:LGraphTexture.DEFAULT,texture:null};LGraphTextureLUT._shader||(LGraphTextureLUT._shader=new GL.Shader(Shader.SCREEN_VERTEX_SHADER,LGraphTextureLUT.pixel_shader))};LGraphTextureLUT.widgets_info={precision:{widget:"combo",values:LGraphTexture.MODE_VALUES}};LGraphTextureLUT.title="LUT";LGraphTextureLUT.desc="Apply LUT to Texture";LGraphTextureLUT.widgets_info={texture:{widget:"texture"}};LGraphTextureLUT.prototype.onExecute=function(){var a=this.getInputData(0); +if(this.properties.precision===LGraphTexture.PASS_THROUGH)this.setOutputData(0,a);else if(a){var b=this.getInputData(1);b||(b=LGraphTexture.getTexture(this.properties.texture));if(b){b.bind(0);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.bindTexture(gl.TEXTURE_2D,null);var c=this.properties.intensity;this.isInputConnected(2)&&(this.properties.intensity= +c=this.getInputData(2));this._tex=LGraphTexture.getTargetTexture(a,this._tex,this.properties.precision);this._tex.drawTo(function(){b.bind(1);a.toViewport(LGraphTextureLUT._shader,{u_texture:0,u_textureB:1,u_amount:c})});this.setOutputData(0,this._tex)}else this.setOutputData(0,a)}};LGraphTextureLUT.pixel_shader="precision highp float;\n\t\t\tprecision highp float;\n\t\t\tvarying vec2 v_coord;\n\t\t\tuniform sampler2D u_texture;\n\t\t\tuniform sampler2D u_textureB;\n\t\t\tuniform float u_amount;\n\t\t\t\n\t\t\tvoid main() {\n\t\t\t\t lowp vec4 textureColor = clamp( texture2D(u_texture, v_coord), vec4(0.0), vec4(1.0) );\n\t\t\t\t mediump float blueColor = textureColor.b * 63.0;\n\t\t\t\t mediump vec2 quad1;\n\t\t\t\t quad1.y = floor(floor(blueColor) / 8.0);\n\t\t\t\t quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\t\t\t\t mediump vec2 quad2;\n\t\t\t\t quad2.y = floor(ceil(blueColor) / 8.0);\n\t\t\t\t quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\t\t\t\t highp vec2 texPos1;\n\t\t\t\t texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\t\t\t\t texPos1.y = 1.0 - ((quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\t\t\t\t highp vec2 texPos2;\n\t\t\t\t texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\t\t\t\t texPos2.y = 1.0 - ((quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\t\t\t\t lowp vec4 newColor1 = texture2D(u_textureB, texPos1);\n\t\t\t\t lowp vec4 newColor2 = texture2D(u_textureB, texPos2);\n\t\t\t\t lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n\t\t\t\t gl_FragColor = vec4( mix( textureColor.rgb, newColor.rgb, u_amount), textureColor.w);\n\t\t\t}\n\t\t\t"; LiteGraph.registerNodeType("texture/LUT",LGraphTextureLUT);var LGraphTextureChannels=function(){this.addInput("Texture","Texture");this.addOutput("R","Texture");this.addOutput("G","Texture");this.addOutput("B","Texture");this.addOutput("A","Texture");this.properties={};LGraphTextureChannels._shader||(LGraphTextureChannels._shader=new GL.Shader(Shader.SCREEN_VERTEX_SHADER,LGraphTextureChannels.pixel_shader))};LGraphTextureChannels.title="Texture to Channels";LGraphTextureChannels.desc="Split texture channels"; LGraphTextureChannels.prototype.onExecute=function(){var a=this.getInputData(0);if(a){this._channels||(this._channels=Array(4));for(var b=0,c=0;4>c;c++)this.isOutputConnected(c)?(this._channels[c]&&this._channels[c].width==a.width&&this._channels[c].height==a.height&&this._channels[c].type==a.type||(this._channels[c]=new GL.Texture(a.width,a.height,{type:a.type,format:gl.RGBA,filter:gl.LINEAR})),b++):this._channels[c]=null;if(b){gl.disable(gl.BLEND);gl.disable(gl.DEPTH_TEST);for(var d=Mesh.getScreenQuad(), e=LGraphTextureChannels._shader,f=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],c=0;4>c;c++)this._channels[c]&&(this._channels[c].drawTo(function(){a.bind(0);e.uniforms({u_texture:0,u_mask:f[c]}).draw(d)}),this.setOutputData(c,this._channels[c]))}}};LGraphTextureChannels.pixel_shader="precision highp float;\n\t\t\tprecision highp float;\n\t\t\tvarying vec2 v_coord;\n\t\t\tuniform sampler2D u_texture;\n\t\t\tuniform vec4 u_mask;\n\t\t\t\n\t\t\tvoid main() {\n\t\t\t gl_FragColor = vec4( vec3( length( texture2D(u_texture, v_coord) * u_mask )), 1.0 );\n\t\t\t}\n\t\t\t"; diff --git a/doc/classes/LGraph.html b/doc/classes/LGraph.html index c29db6d13..2fecb1ec5 100644 --- a/doc/classes/LGraph.html +++ b/doc/classes/LGraph.html @@ -96,7 +96,7 @@
- Defined in: ../src/litegraph.js:231 + Defined in: ../src/litegraph.js:234
@@ -147,7 +147,7 @@ - ../src/litegraph.js:231 + ../src/litegraph.js:234

@@ -226,6 +226,13 @@ + + +
  • + findNodesByClass + + +
  • @@ -405,7 +412,7 @@ - ../src/litegraph.js:593 + ../src/litegraph.js:596

    @@ -494,7 +501,7 @@ - ../src/litegraph.js:300 + ../src/litegraph.js:303

    @@ -572,7 +579,7 @@ - ../src/litegraph.js:255 + ../src/litegraph.js:258

    @@ -637,7 +644,7 @@ - ../src/litegraph.js:1058 + ../src/litegraph.js:1076

    @@ -726,7 +733,7 @@ - ../src/litegraph.js:319 + ../src/litegraph.js:322

    @@ -769,6 +776,113 @@ + + + +
    +

    findNodesByClass

    + + +
    + (
      + +
    • + + classObject + +
    • + +
    ) +
    + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + ../src/litegraph.js:723 + +

    + + + + + +
    + +
    +

    Returns a list of nodes that matches a class

    + +
    + + +
    +

    Parameters:

    + +
      + +
    • + + classObject + Class + + + + +
      +

      the class itself (not an string)

      + +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Array: + +

    a list with all the nodes of this type

    + + +
    +
    + + +
    @@ -818,7 +932,7 @@ - ../src/litegraph.js:737 + ../src/litegraph.js:755

    @@ -925,7 +1039,7 @@ - ../src/litegraph.js:721 + ../src/litegraph.js:739

    @@ -1022,7 +1136,7 @@ - ../src/litegraph.js:546 + ../src/litegraph.js:549

    @@ -1096,7 +1210,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:535 + ../src/litegraph.js:538

    @@ -1175,7 +1289,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:708 + ../src/litegraph.js:711

    @@ -1279,7 +1393,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:753 + ../src/litegraph.js:771

    @@ -1408,7 +1522,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:524 + ../src/litegraph.js:527

    @@ -1477,7 +1591,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:992 + ../src/litegraph.js:1010

    @@ -1542,7 +1656,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:642 + ../src/litegraph.js:645

    @@ -1631,7 +1745,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:382 + ../src/litegraph.js:385

    @@ -1726,7 +1840,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:558 + ../src/litegraph.js:561

    @@ -1825,7 +1939,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:1025 + ../src/litegraph.js:1043

    @@ -1910,7 +2024,7 @@ if the nodes are using graphical actions

    - ../src/litegraph.js:940 + ../src/litegraph.js:958

    @@ -2020,7 +2134,7 @@ can be easily accesed from the outside of the graph

    - ../src/litegraph.js:955 + ../src/litegraph.js:973

    @@ -2123,7 +2237,7 @@ can be easily accesed from the outside of the graph

    - ../src/litegraph.js:333 + ../src/litegraph.js:336

    @@ -2202,7 +2316,7 @@ can be easily accesed from the outside of the graph

    - ../src/litegraph.js:360 + ../src/litegraph.js:363

    @@ -2257,7 +2371,7 @@ can be easily accesed from the outside of the graph

    - ../src/litegraph.js:426 + ../src/litegraph.js:429

    diff --git a/doc/classes/LGraphCanvas.html b/doc/classes/LGraphCanvas.html index 16eeb2934..5cfdb1acf 100644 --- a/doc/classes/LGraphCanvas.html +++ b/doc/classes/LGraphCanvas.html @@ -96,7 +96,7 @@
    - Defined in: ../src/litegraph.js:2374 + Defined in: ../src/litegraph.js:2397
    @@ -163,7 +163,7 @@ - ../src/litegraph.js:2374 + ../src/litegraph.js:2397

    @@ -353,7 +353,7 @@ - ../src/litegraph.js:2052 + ../src/litegraph.js:2075

    @@ -418,7 +418,7 @@ - ../src/litegraph.js:2161 + ../src/litegraph.js:2184

    @@ -501,7 +501,7 @@ - ../src/litegraph.js:2390 + ../src/litegraph.js:2413

    @@ -580,7 +580,7 @@ - ../src/litegraph.js:2134 + ../src/litegraph.js:2157

    @@ -668,7 +668,7 @@ - ../src/litegraph.js:2176 + ../src/litegraph.js:2199

    @@ -757,7 +757,7 @@ - ../src/litegraph.js:2106 + ../src/litegraph.js:2129

    @@ -835,7 +835,7 @@ - ../src/litegraph.js:2402 + ../src/litegraph.js:2425

    @@ -890,7 +890,7 @@ - ../src/litegraph.js:2425 + ../src/litegraph.js:2448

    diff --git a/doc/classes/LGraphNode.html b/doc/classes/LGraphNode.html index 862e41ea3..03e383242 100644 --- a/doc/classes/LGraphNode.html +++ b/doc/classes/LGraphNode.html @@ -96,7 +96,7 @@
    - Defined in: ../src/litegraph.js:1137 + Defined in: ../src/litegraph.js:1155
    @@ -415,7 +415,7 @@ - ../src/litegraph.js:1546 + ../src/litegraph.js:1569

    @@ -563,7 +563,7 @@ - ../src/litegraph.js:1486 + ../src/litegraph.js:1508

    @@ -608,7 +608,7 @@
    -

    string defining the input type ("vec3","number",...)

    +

    string defining the input type ("vec3","number",...), it its a generic one use 0

    @@ -683,7 +683,7 @@ - ../src/litegraph.js:1507 + ../src/litegraph.js:1530

    @@ -784,7 +784,7 @@ - ../src/litegraph.js:1426 + ../src/litegraph.js:1448

    @@ -845,7 +845,7 @@
    -

    this can be used to have special properties of an output (special color, position, etc)

    +

    this can be used to have special properties of an output (label, special color, position, etc)

    @@ -904,7 +904,7 @@ - ../src/litegraph.js:1447 + ../src/litegraph.js:1469

    @@ -983,7 +983,7 @@ - ../src/litegraph.js:1978 + ../src/litegraph.js:2001

    @@ -1052,7 +1052,7 @@ - ../src/litegraph.js:1559 + ../src/litegraph.js:1582

    @@ -1144,7 +1144,7 @@ - ../src/litegraph.js:1172 + ../src/litegraph.js:1190

    @@ -1225,7 +1225,7 @@ - ../src/litegraph.js:1639 + ../src/litegraph.js:1662

    @@ -1364,7 +1364,7 @@ - ../src/litegraph.js:1789 + ../src/litegraph.js:1812

    @@ -1477,7 +1477,7 @@ - ../src/litegraph.js:1722 + ../src/litegraph.js:1745

    @@ -1600,7 +1600,7 @@ - ../src/litegraph.js:1609 + ../src/litegraph.js:1632

    @@ -1707,7 +1707,7 @@ - ../src/litegraph.js:1624 + ../src/litegraph.js:1647

    @@ -1804,7 +1804,7 @@ - ../src/litegraph.js:1577 + ../src/litegraph.js:1600

    @@ -1893,7 +1893,7 @@ - ../src/litegraph.js:1846 + ../src/litegraph.js:1869

    @@ -2016,7 +2016,7 @@ - ../src/litegraph.js:1329 + ../src/litegraph.js:1349

    @@ -2027,7 +2027,7 @@
    -

    retrieves the input data from one slot

    +

    retrieves the input data (data traveling through the connection) from one slot

    @@ -2122,7 +2122,7 @@ - ../src/litegraph.js:1355 + ../src/litegraph.js:1377

    @@ -2226,7 +2226,7 @@ - ../src/litegraph.js:1370 + ../src/litegraph.js:1392

    @@ -2330,7 +2330,7 @@ - ../src/litegraph.js:1397 + ../src/litegraph.js:1419

    @@ -2420,7 +2420,7 @@ - ../src/litegraph.js:1297 + ../src/litegraph.js:1315

    @@ -2489,7 +2489,7 @@ - ../src/litegraph.js:1343 + ../src/litegraph.js:1364

    @@ -2593,7 +2593,7 @@ - ../src/litegraph.js:1385 + ../src/litegraph.js:1407

    @@ -2703,7 +2703,7 @@ - ../src/litegraph.js:1587 + ../src/litegraph.js:1610

    @@ -2808,7 +2808,7 @@ - ../src/litegraph.js:1991 + ../src/litegraph.js:2014

    @@ -2873,7 +2873,7 @@ - ../src/litegraph.js:1532 + ../src/litegraph.js:1555

    @@ -2961,7 +2961,7 @@ - ../src/litegraph.js:1472 + ../src/litegraph.js:1494

    @@ -3039,7 +3039,7 @@ - ../src/litegraph.js:1231 + ../src/litegraph.js:1249

    @@ -3110,7 +3110,7 @@ - ../src/litegraph.js:1310 + ../src/litegraph.js:1328

    @@ -3203,7 +3203,7 @@ - ../src/litegraph.js:1285 + ../src/litegraph.js:1303

    diff --git a/doc/classes/LiteGraph.html b/doc/classes/LiteGraph.html index aa6bb784c..23ec6c4fd 100644 --- a/doc/classes/LiteGraph.html +++ b/doc/classes/LiteGraph.html @@ -298,7 +298,7 @@ - ../src/litegraph.js:68 + ../src/litegraph.js:71

    @@ -423,7 +423,7 @@ - ../src/litegraph.js:109 + ../src/litegraph.js:112

    @@ -530,7 +530,7 @@ - ../src/litegraph.js:122 + ../src/litegraph.js:125

    @@ -627,7 +627,7 @@ - ../src/litegraph.js:144 + ../src/litegraph.js:147

    @@ -712,7 +712,7 @@ - ../src/litegraph.js:37 + ../src/litegraph.js:38

    diff --git a/doc/data.json b/doc/data.json index 96a98f800..ff262682c 100644 --- a/doc/data.json +++ b/doc/data.json @@ -38,7 +38,7 @@ "plugin_for": [], "extension_for": [], "file": "../src/litegraph.js", - "line": 231, + "line": 234, "description": "LGraph is the class that contain a full graph. We instantiate one and add nodes to it, and then we can run the execution loop.", "is_constructor": 1 }, @@ -51,7 +51,7 @@ "plugin_for": [], "extension_for": [], "file": "../src/litegraph.js", - "line": 1137, + "line": 1155, "description": "Base Class for all the node type classes", "params": [ { @@ -70,7 +70,7 @@ "plugin_for": [], "extension_for": [], "file": "../src/litegraph.js", - "line": 2374, + "line": 2397, "description": "marks as dirty the canvas, this way it will be rendered again", "is_constructor": 1, "params": [ @@ -91,7 +91,7 @@ "classitems": [ { "file": "../src/litegraph.js", - "line": 37, + "line": 38, "description": "Register a node class so it can be listed when the user wants to create a new one", "itemtype": "method", "name": "registerNodeType", @@ -111,7 +111,7 @@ }, { "file": "../src/litegraph.js", - "line": 68, + "line": 71, "description": "Create a node of a given type with a name. The node is not attached to any graph yet.", "itemtype": "method", "name": "createNode", @@ -136,7 +136,7 @@ }, { "file": "../src/litegraph.js", - "line": 109, + "line": 112, "description": "Returns a registered node type with a given name", "itemtype": "method", "name": "getNodeType", @@ -155,7 +155,7 @@ }, { "file": "../src/litegraph.js", - "line": 122, + "line": 125, "description": "Returns a list of node types matching one category", "itemtype": "method", "name": "getNodeType", @@ -174,7 +174,7 @@ }, { "file": "../src/litegraph.js", - "line": 144, + "line": 147, "description": "Returns a list with all the node type categories", "itemtype": "method", "name": "getNodeTypesCategories", @@ -186,7 +186,7 @@ }, { "file": "../src/litegraph.js", - "line": 255, + "line": 258, "description": "Removes all nodes from this graph", "itemtype": "method", "name": "clear", @@ -194,7 +194,7 @@ }, { "file": "../src/litegraph.js", - "line": 300, + "line": 303, "description": "Attach Canvas to this graph", "itemtype": "method", "name": "attachCanvas", @@ -209,7 +209,7 @@ }, { "file": "../src/litegraph.js", - "line": 319, + "line": 322, "description": "Detach Canvas from this graph", "itemtype": "method", "name": "detachCanvas", @@ -224,7 +224,7 @@ }, { "file": "../src/litegraph.js", - "line": 333, + "line": 336, "description": "Starts running this graph every interval milliseconds.", "itemtype": "method", "name": "start", @@ -239,7 +239,7 @@ }, { "file": "../src/litegraph.js", - "line": 360, + "line": 363, "description": "Stops the execution loop of the graph", "itemtype": "method", "name": "stop execution", @@ -247,7 +247,7 @@ }, { "file": "../src/litegraph.js", - "line": 382, + "line": 385, "description": "Run N steps (cycles) of the graph", "itemtype": "method", "name": "runStep", @@ -262,7 +262,7 @@ }, { "file": "../src/litegraph.js", - "line": 426, + "line": 429, "description": "Updates the graph execution order according to relevance of the nodes (nodes with only outputs have more relevance than\nnodes with only inputs.", "itemtype": "method", "name": "updateExecutionOrder", @@ -270,7 +270,7 @@ }, { "file": "../src/litegraph.js", - "line": 524, + "line": 527, "description": "Returns the amount of time the graph has been running in milliseconds", "itemtype": "method", "name": "getTime", @@ -282,7 +282,7 @@ }, { "file": "../src/litegraph.js", - "line": 535, + "line": 538, "description": "Returns the amount of time accumulated using the fixedtime_lapse var. This is used in context where the time increments should be constant", "itemtype": "method", "name": "getFixedTime", @@ -294,7 +294,7 @@ }, { "file": "../src/litegraph.js", - "line": 546, + "line": 549, "description": "Returns the amount of time it took to compute the latest iteration. Take into account that this number could be not correct\nif the nodes are using graphical actions", "itemtype": "method", "name": "getElapsedTime", @@ -306,7 +306,7 @@ }, { "file": "../src/litegraph.js", - "line": 558, + "line": 561, "description": "Sends an event to all the nodes, useful to trigger stuff", "itemtype": "method", "name": "sendEventToAllNodes", @@ -326,7 +326,7 @@ }, { "file": "../src/litegraph.js", - "line": 593, + "line": 596, "description": "Adds a new node instasnce to this graph", "itemtype": "method", "name": "add", @@ -341,7 +341,7 @@ }, { "file": "../src/litegraph.js", - "line": 642, + "line": 645, "description": "Removes a node from the graph", "itemtype": "method", "name": "remove", @@ -356,7 +356,7 @@ }, { "file": "../src/litegraph.js", - "line": 708, + "line": 711, "description": "Returns a node by its id.", "itemtype": "method", "name": "getNodeById", @@ -371,7 +371,26 @@ }, { "file": "../src/litegraph.js", - "line": 721, + "line": 723, + "description": "Returns a list of nodes that matches a class", + "itemtype": "method", + "name": "findNodesByClass", + "params": [ + { + "name": "classObject", + "description": "the class itself (not an string)", + "type": "Class" + } + ], + "return": { + "description": "a list with all the nodes of this type", + "type": "Array" + }, + "class": "LGraph" + }, + { + "file": "../src/litegraph.js", + "line": 739, "description": "Returns a list of nodes that matches a type", "itemtype": "method", "name": "findNodesByType", @@ -390,7 +409,7 @@ }, { "file": "../src/litegraph.js", - "line": 737, + "line": 755, "description": "Returns a list of nodes that matches a name", "itemtype": "method", "name": "findNodesByName", @@ -409,7 +428,7 @@ }, { "file": "../src/litegraph.js", - "line": 753, + "line": 771, "description": "Returns the top-most node in this position of the canvas", "itemtype": "method", "name": "getNodeOnPos", @@ -438,7 +457,7 @@ }, { "file": "../src/litegraph.js", - "line": 940, + "line": 958, "description": "Assigns a value to all the nodes that matches this name. This is used to create global variables of the node that\ncan be easily accesed from the outside of the graph", "itemtype": "method", "name": "setInputData", @@ -458,7 +477,7 @@ }, { "file": "../src/litegraph.js", - "line": 955, + "line": 973, "description": "Returns the value of the first node with this name. This is used to access global variables of the graph from the outside", "itemtype": "method", "name": "setInputData", @@ -477,7 +496,7 @@ }, { "file": "../src/litegraph.js", - "line": 992, + "line": 1010, "description": "returns if the graph is in live mode", "itemtype": "method", "name": "isLive", @@ -485,7 +504,7 @@ }, { "file": "../src/litegraph.js", - "line": 1025, + "line": 1043, "description": "Creates a Object containing all the info about this graph, it can be serialized", "itemtype": "method", "name": "serialize", @@ -497,7 +516,7 @@ }, { "file": "../src/litegraph.js", - "line": 1058, + "line": 1076, "description": "Configure a graph from a JSON string", "itemtype": "method", "name": "configure", @@ -512,7 +531,7 @@ }, { "file": "../src/litegraph.js", - "line": 1172, + "line": 1190, "description": "configure a node from an object containing the serialized info", "itemtype": "method", "name": "configure", @@ -520,7 +539,7 @@ }, { "file": "../src/litegraph.js", - "line": 1231, + "line": 1249, "description": "serialize the content", "itemtype": "method", "name": "serialize", @@ -528,7 +547,7 @@ }, { "file": "../src/litegraph.js", - "line": 1285, + "line": 1303, "description": "serialize and stringify", "itemtype": "method", "name": "toString", @@ -536,7 +555,7 @@ }, { "file": "../src/litegraph.js", - "line": 1297, + "line": 1315, "description": "get the title string", "itemtype": "method", "name": "getTitle", @@ -544,7 +563,7 @@ }, { "file": "../src/litegraph.js", - "line": 1310, + "line": 1328, "description": "sets the output data", "itemtype": "method", "name": "setOutputData", @@ -564,8 +583,8 @@ }, { "file": "../src/litegraph.js", - "line": 1329, - "description": "retrieves the input data from one slot", + "line": 1349, + "description": "retrieves the input data (data traveling through the connection) from one slot", "itemtype": "method", "name": "getInputData", "params": [ @@ -583,7 +602,7 @@ }, { "file": "../src/litegraph.js", - "line": 1343, + "line": 1364, "description": "tells you if there is a connection in one input slot", "itemtype": "method", "name": "isInputConnected", @@ -602,7 +621,7 @@ }, { "file": "../src/litegraph.js", - "line": 1355, + "line": 1377, "description": "tells you info about an input connection (which node, type, etc)", "itemtype": "method", "name": "getInputInfo", @@ -621,7 +640,7 @@ }, { "file": "../src/litegraph.js", - "line": 1370, + "line": 1392, "description": "tells you info about an output connection (which node, type, etc)", "itemtype": "method", "name": "getOutputInfo", @@ -640,7 +659,7 @@ }, { "file": "../src/litegraph.js", - "line": 1385, + "line": 1407, "description": "tells you if there is a connection in one output slot", "itemtype": "method", "name": "isOutputConnected", @@ -659,7 +678,7 @@ }, { "file": "../src/litegraph.js", - "line": 1397, + "line": 1419, "description": "retrieves all the nodes connected to this output slot", "itemtype": "method", "name": "getOutputNodes", @@ -678,7 +697,7 @@ }, { "file": "../src/litegraph.js", - "line": 1426, + "line": 1448, "description": "add a new output slot to use in this node", "itemtype": "method", "name": "addOutput", @@ -695,7 +714,7 @@ }, { "name": "extra_info", - "description": "this can be used to have special properties of an output (special color, position, etc)", + "description": "this can be used to have special properties of an output (label, special color, position, etc)", "type": "Object" } ], @@ -703,7 +722,7 @@ }, { "file": "../src/litegraph.js", - "line": 1447, + "line": 1469, "description": "add a new output slot to use in this node", "itemtype": "method", "name": "addOutputs", @@ -718,7 +737,7 @@ }, { "file": "../src/litegraph.js", - "line": 1472, + "line": 1494, "description": "remove an existing output slot", "itemtype": "method", "name": "removeOutput", @@ -733,7 +752,7 @@ }, { "file": "../src/litegraph.js", - "line": 1486, + "line": 1508, "description": "add a new input slot to use in this node", "itemtype": "method", "name": "addInput", @@ -745,7 +764,7 @@ }, { "name": "type", - "description": "string defining the input type (\"vec3\",\"number\",...)", + "description": "string defining the input type (\"vec3\",\"number\",...), it its a generic one use 0", "type": "String" }, { @@ -758,7 +777,7 @@ }, { "file": "../src/litegraph.js", - "line": 1507, + "line": 1530, "description": "add several new input slots in this node", "itemtype": "method", "name": "addInputs", @@ -773,7 +792,7 @@ }, { "file": "../src/litegraph.js", - "line": 1532, + "line": 1555, "description": "remove an existing input slot", "itemtype": "method", "name": "removeInput", @@ -788,7 +807,7 @@ }, { "file": "../src/litegraph.js", - "line": 1546, + "line": 1569, "description": "add an special connection to this node (used for special kinds of graphs)", "itemtype": "method", "name": "addConnection", @@ -818,7 +837,7 @@ }, { "file": "../src/litegraph.js", - "line": 1559, + "line": 1582, "description": "computes the size of a node according to its inputs and output slots", "itemtype": "method", "name": "computeSize", @@ -837,7 +856,7 @@ }, { "file": "../src/litegraph.js", - "line": 1577, + "line": 1600, "description": "returns the bounding of the object, used for rendering purposes", "itemtype": "method", "name": "getBounding", @@ -849,7 +868,7 @@ }, { "file": "../src/litegraph.js", - "line": 1587, + "line": 1610, "description": "checks if a point is inside the shape of a node", "itemtype": "method", "name": "isPointInsideNode", @@ -873,7 +892,7 @@ }, { "file": "../src/litegraph.js", - "line": 1609, + "line": 1632, "description": "returns the input slot with a given name (used for dynamic slots), -1 if not found", "itemtype": "method", "name": "findInputSlot", @@ -892,7 +911,7 @@ }, { "file": "../src/litegraph.js", - "line": 1624, + "line": 1647, "description": "returns the output slot with a given name (used for dynamic slots), -1 if not found", "itemtype": "method", "name": "findOutputSlot", @@ -911,7 +930,7 @@ }, { "file": "../src/litegraph.js", - "line": 1639, + "line": 1662, "description": "connect this node output to the input of another node", "itemtype": "method", "name": "connect", @@ -940,7 +959,7 @@ }, { "file": "../src/litegraph.js", - "line": 1722, + "line": 1745, "description": "disconnect one output to an specific node", "itemtype": "method", "name": "disconnectOutput", @@ -964,7 +983,7 @@ }, { "file": "../src/litegraph.js", - "line": 1789, + "line": 1812, "description": "disconnect one input", "itemtype": "method", "name": "disconnectInput", @@ -983,7 +1002,7 @@ }, { "file": "../src/litegraph.js", - "line": 1846, + "line": 1869, "description": "returns the center of a connection point in canvas coords", "itemtype": "method", "name": "getConnectionPos", @@ -1007,7 +1026,7 @@ }, { "file": "../src/litegraph.js", - "line": 1978, + "line": 2001, "description": "Collapse the node to make it smaller on the canvas", "itemtype": "method", "name": "collapse", @@ -1015,7 +1034,7 @@ }, { "file": "../src/litegraph.js", - "line": 1991, + "line": 2014, "description": "Forces the node to do not move or realign on Z", "itemtype": "method", "name": "pin", @@ -1023,7 +1042,7 @@ }, { "file": "../src/litegraph.js", - "line": 2052, + "line": 2075, "description": "clears all the data inside", "itemtype": "method", "name": "clear", @@ -1031,7 +1050,7 @@ }, { "file": "../src/litegraph.js", - "line": 2106, + "line": 2129, "description": "assigns a graph, you can reasign graphs to the same canvas", "itemtype": "method", "name": "setGraph", @@ -1046,7 +1065,7 @@ }, { "file": "../src/litegraph.js", - "line": 2134, + "line": 2157, "description": "opens a graph contained inside a node in the current graph", "itemtype": "method", "name": "openSubgraph", @@ -1061,7 +1080,7 @@ }, { "file": "../src/litegraph.js", - "line": 2161, + "line": 2184, "description": "closes a subgraph contained inside a node", "itemtype": "method", "name": "closeSubgraph", @@ -1076,7 +1095,7 @@ }, { "file": "../src/litegraph.js", - "line": 2176, + "line": 2199, "description": "assigns a canvas", "itemtype": "method", "name": "setCanvas", @@ -1091,7 +1110,7 @@ }, { "file": "../src/litegraph.js", - "line": 2390, + "line": 2413, "description": "Used to attach the canvas in a popup", "itemtype": "method", "name": "getCanvasWindow", @@ -1103,7 +1122,7 @@ }, { "file": "../src/litegraph.js", - "line": 2402, + "line": 2425, "description": "starts rendering the content of the canvas when needed", "itemtype": "method", "name": "startRendering", @@ -1111,7 +1130,7 @@ }, { "file": "../src/litegraph.js", - "line": 2425, + "line": 2448, "description": "stops rendering the content of the canvas (to save resources)", "itemtype": "method", "name": "stopRendering", diff --git a/doc/files/.._src_litegraph.js.html b/doc/files/.._src_litegraph.js.html index da2cbab93..8e88f542b 100644 --- a/doc/files/.._src_litegraph.js.html +++ b/doc/files/.._src_litegraph.js.html @@ -127,6 +127,7 @@ var LiteGraph = { debug: false, throw_errors: true, registered_node_types: {}, + Nodes: {}, /** * Register a node class so it can be listed when the user wants to create a new one @@ -157,6 +158,8 @@ var LiteGraph = { base_class.prototype[i] = LGraphNode.prototype[i]; this.registered_node_types[ type ] = base_class; + if(base_class.constructor.name) + this.Nodes[ base_class.constructor.name ] = base_class; }, /** @@ -811,6 +814,21 @@ LGraph.prototype.getNodeById = function(id) return this._nodes_by_id[id]; } +/** +* Returns a list of nodes that matches a class +* @method findNodesByClass +* @param {Class} classObject the class itself (not an string) +* @return {Array} a list with all the nodes of this type +*/ + +LGraph.prototype.findNodesByClass = function(classObject) +{ + var r = []; + for(var i in this._nodes) + if(this._nodes[i].constructor === classObject) + r.push(this._nodes[i]); + return r; +} /** * Returns a list of nodes that matches a type @@ -1409,7 +1427,9 @@ LGraphNode.prototype.getTitle = function() */ LGraphNode.prototype.setOutputData = function(slot,data) { - if(!this.outputs) return; + if(!this.outputs) + return; + if(slot > -1 && slot < this.outputs.length && this.outputs[slot] && this.outputs[slot].links != null) { for(var i = 0; i < this.outputs[slot].links.length; i++) @@ -1421,17 +1441,18 @@ LGraphNode.prototype.setOutputData = function(slot,data) } /** -* retrieves the input data from one slot +* retrieves the input data (data traveling through the connection) from one slot * @method getInputData * @param {number} slot * @return {*} data */ LGraphNode.prototype.getInputData = function(slot) { - if(!this.inputs) return null; + if(!this.inputs) + return; //undefined; if(slot < this.inputs.length && this.inputs[slot].link != null) return this.graph.links[ this.inputs[slot].link ].data; - return null; + return; //undefined; } /** @@ -1442,7 +1463,8 @@ LGraphNode.prototype.getInputData = function(slot) */ LGraphNode.prototype.isInputConnected = function(slot) { - if(!this.inputs) return null; + if(!this.inputs) + return false; return (slot < this.inputs.length && this.inputs[slot].link != null); } @@ -1522,7 +1544,7 @@ LGraphNode.prototype.triggerOutput = function(slot,param) * @method addOutput * @param {string} name * @param {string} type string defining the output type ("vec3","number",...) -* @param {Object} extra_info this can be used to have special properties of an output (special color, position, etc) +* @param {Object} extra_info this can be used to have special properties of an output (label, special color, position, etc) */ LGraphNode.prototype.addOutput = function(name,type,extra_info) { @@ -1581,11 +1603,12 @@ LGraphNode.prototype.removeOutput = function(slot) * add a new input slot to use in this node * @method addInput * @param {string} name -* @param {string} type string defining the input type ("vec3","number",...) +* @param {string} type string defining the input type ("vec3","number",...), it its a generic one use 0 * @param {Object} extra_info this can be used to have special properties of an input (label, color, position, etc) */ LGraphNode.prototype.addInput = function(name,type,extra_info) { + type = type || 0; var o = {name:name,type:type,link:null}; if(extra_info) for(var i in extra_info) @@ -2603,7 +2626,7 @@ LGraphCanvas.prototype.processMouseDown = function(e) var link_pos = n.getConnectionPos(true,i); if( isInsideRectangle(e.canvasX, e.canvasY, link_pos[0] - 10, link_pos[1] - 5, 20,10) ) { - if(input.link) + if(input.link !== null) { n.disconnectInput(i); this.dirty_bgcanvas = true; @@ -2981,6 +3004,7 @@ LGraphCanvas.prototype.processKeyDown = function(e) if(e.keyCode == 46 || e.keyCode == 8) { this.deleteSelectedNodes(); + block_default = true; } //collapse @@ -3277,8 +3301,8 @@ LGraphCanvas.prototype.drawFrontCanvas = function() if(!ctx) //maybe is using webgl... return; - if(ctx.start) - ctx.start(); + if(ctx.start2D) + ctx.start2D(); var canvas = this.canvas; @@ -3392,8 +3416,8 @@ LGraphCanvas.prototype.drawFrontCanvas = function() //this.dirty_area = null; } - if(ctx.finish) //this is a function I use in webgl renderer - ctx.finish(); + if(ctx.finish2D) //this is a function I use in webgl renderer + ctx.finish2D(); this.dirty_canvas = false; } @@ -4151,11 +4175,11 @@ LGraphCanvas.onMenuNodeInputs = function(node, e, prev_menu) var entries = []; for (var i in options) { - var option = options[i]; - var label = option[0]; - if(option[2] && option[2].label) - label = option[2].label; - entries.push({content: label, value: option}); + var entry = options[i]; + var label = entry[0]; + if(entry[2] && entry[2].label) + label = entry[2].label; + entries.push({content: label, value: entry}); } var menu = LiteGraph.createContextualMenu(entries, {event: e, callback: inner_clicked, from: prev_menu}); } @@ -4181,9 +4205,13 @@ LGraphCanvas.onMenuNodeOutputs = function(node, e, prev_menu) var entries = []; for (var i in options) { - if(node.findOutputSlot(options[i][0]) != -1) + var entry = options[i]; + if(node.findOutputSlot(entry[0]) != -1) continue; //skip the ones already on - entries.push({content: options[i][0], value: options[i]}); + var label = entry[0]; + if(entry[2] && entry[2].label) + label = entry[2].label; + entries.push({content: label, value: entry}); } if(entries.length) var menu = LiteGraph.createContextualMenu(entries, {event: e, callback: inner_clicked, from: prev_menu}); @@ -4191,7 +4219,8 @@ LGraphCanvas.onMenuNodeOutputs = function(node, e, prev_menu) function inner_clicked(v) { - if(!node) return; + if(!node) + return; var value = v.value[1]; @@ -4204,7 +4233,7 @@ LGraphCanvas.onMenuNodeOutputs = function(node, e, prev_menu) return false; } else - node.addOutput(v.value[0],v.value[1]); + node.addOutput(v.value[0], v.value[1], v.value[2]); } return false; @@ -4517,7 +4546,7 @@ LiteGraph.createContextualMenu = function(values,options, ref_window) LiteGraph.closeAllContextualMenus(); var root = ref_window.document.createElement("div"); - root.className = "litecontextualmenu litemenubar-panel"; + root.className = "graphcontextualmenu graphmenubar-panel"; this.root = root; var style = root.style; @@ -4539,11 +4568,11 @@ LiteGraph.createContextualMenu = function(values,options, ref_window) { var item = values[i]; var element = ref_window.document.createElement("div"); - element.className = "litemenu-entry"; + element.className = "graphmenu-entry"; if(item == null) { - element.className = "litemenu-entry separator"; + element.className = "graphmenu-entry separator"; root.appendChild(element); continue; } @@ -4626,7 +4655,7 @@ LiteGraph.createContextualMenu = function(values,options, ref_window) if(options.callback) { var ret = options.callback.call(root, this.data, e ); - if( ret != undefined ) close = ret; + if( ret !== undefined ) close = ret; } if(close) @@ -4651,7 +4680,7 @@ LiteGraph.createContextualMenu = function(values,options, ref_window) LiteGraph.closeAllContextualMenus = function() { - var elements = document.querySelectorAll(".litecontextualmenu"); + var elements = document.querySelectorAll(".graphcontextualmenu"); if(!elements.length) return; var result = []; diff --git a/src/nodes/gltextures.js b/src/nodes/gltextures.js index cf8f0facf..a8f8f9e19 100644 --- a/src/nodes/gltextures.js +++ b/src/nodes/gltextures.js @@ -39,7 +39,7 @@ if(typeof(LiteGraph) != "undefined") return gl.textures; } - //process the loading of a texture (overwrite if you have a Resources Manager) + //process the loading of a texture (overwrite it if you have a Resources Manager) LGraphTexture.loadTexture = function(name, options) { options = options || {}; @@ -882,7 +882,7 @@ if(typeof(LiteGraph) != "undefined") this.addInput("LUT","Texture"); this.addInput("Intensity","number"); this.addOutput("","Texture"); - this.properties = { intensity: 1, precision: LGraphTexture.DEFAULT }; + this.properties = { intensity: 1, precision: LGraphTexture.DEFAULT, texture: null }; if(!LGraphTextureLUT._shader) LGraphTextureLUT._shader = new GL.Shader( Shader.SCREEN_VERTEX_SHADER, LGraphTextureLUT.pixel_shader ); @@ -894,6 +894,7 @@ if(typeof(LiteGraph) != "undefined") LGraphTextureLUT.title = "LUT"; LGraphTextureLUT.desc = "Apply LUT to Texture"; + LGraphTextureLUT.widgets_info = {"texture": { widget:"texture"} }; LGraphTextureLUT.prototype.onExecute = function() { @@ -908,11 +909,16 @@ if(typeof(LiteGraph) != "undefined") if(!tex) return; var lut_tex = this.getInputData(1); + + if(!lut_tex) + lut_tex = LGraphTexture.getTexture( this.properties.texture ); + if(!lut_tex) { this.setOutputData(0,tex); return; } + lut_tex.bind(0); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR ); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );