diff --git a/build/litegraph.js b/build/litegraph.js
index 823ad975f..a7deb33b9 100644
--- a/build/litegraph.js
+++ b/build/litegraph.js
@@ -3977,7 +3977,7 @@ LGraphCanvas.prototype.processMouseDown = function(e)
{
//double click node
if( node.onDblClick)
- node.onDblClick(e);
+ node.onDblClick(e,[e.canvasX - node.pos[0], e.canvasY - node.pos[1]],graphcanvas);
this.processNodeDblClicked( node );
block_drag_node = true;
}
@@ -5264,7 +5264,10 @@ LGraphCanvas.prototype.drawBackCanvas = function()
ctx.font = "40px Arial"
ctx.textAlign = "center";
ctx.fillStyle = subgraph_node.bgcolor;
- ctx.fillText( subgraph_node.getTitle(), canvas.width * 0.5, 40 );
+ var title = "";
+ for(var i = 1; i < this._graph_stack.length; ++i)
+ title += this._graph_stack[i]._subgraph_node.getTitle() + " >> ";
+ ctx.fillText( title + subgraph_node.getTitle(), canvas.width * 0.5, 40 );
ctx.restore();
}
@@ -6233,6 +6236,7 @@ LGraphCanvas.prototype.processNodeWidgets = function( node, pos, event, active_w
var y = pos[1] - node.pos[1];
var width = node.size[0];
var that = this;
+ var ref_window = this.getCanvasWindow();
for(var i = 0; i < node.widgets.length; ++i)
{
@@ -6268,6 +6272,10 @@ LGraphCanvas.prototype.processNodeWidgets = function( node, pos, event, active_w
}
else if( event.type == "mousedown" )
{
+ var values = w.options.values;
+ if(values && values.constructor === Function)
+ values = w.options.values( w, node );
+
var delta = ( x < 40 ? -1 : ( x > width - 40 ? 1 : 0) );
if (w.type == "number")
{
@@ -6279,12 +6287,22 @@ LGraphCanvas.prototype.processNodeWidgets = function( node, pos, event, active_w
}
else if(delta)
{
- var index = w.options.values.indexOf( w.value ) + delta;
- if( index >= w.options.values.length )
+ var index = values.indexOf( w.value ) + delta;
+ if( index >= values.length )
index = 0;
if( index < 0 )
- index = w.options.values.length - 1;
- w.value = w.options.values[ index ];
+ index = values.length - 1;
+ w.value = values[ index ];
+ }
+ else
+ {
+ var menu = new LiteGraph.ContextMenu( values, { event: event, className: "dark", callback: inner_clicked.bind(w) }, ref_window );
+ function inner_clicked( v, option, event )
+ {
+ this.value = v;
+ that.dirty_canvas = true;
+ return false;
+ }
}
}
if(w.callback)
@@ -7770,6 +7788,8 @@ function ContextMenu( values, options )
var root = document.createElement("div");
root.className = "litegraph litecontextmenu litemenubar-panel";
+ if( options.className)
+ root.className += " " + options.className;
root.style.minWidth = 100;
root.style.minHeight = 100;
root.style.pointerEvents = "none";
@@ -8192,6 +8212,13 @@ Subgraph.prototype.onDrawTitle = function(ctx)
ctx.fill();
}
+Subgraph.prototype.onDblClick = function(e,pos,graphcanvas)
+{
+ var that = this;
+ setTimeout(function(){ graphcanvas.openSubgraph( that.subgraph ); },10 );
+}
+
+
Subgraph.prototype.onMouseDown = function(e,pos,graphcanvas)
{
if( !this.flags.collapsed && pos[0] > this.size[0] - LiteGraph.NODE_TITLE_HEIGHT && pos[1] < 0 )
diff --git a/build/litegraph.min.js b/build/litegraph.min.js
index 865ebf421..7c58d1b2e 100755
--- a/build/litegraph.min.js
+++ b/build/litegraph.min.js
@@ -1,513 +1,514 @@
-(function(u){function f(a){k.debug&&console.log("Graph created");this.list_of_graphcanvas=null;this.clear();a&&this.configure(a)}function d(a){this._ctor(a)}function q(a){this._ctor(a)}function h(a,c,e){e=e||{};this.background_image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII=";
+(function(u){function h(a){k.debug&&console.log("Graph created");this.list_of_graphcanvas=null;this.clear();a&&this.configure(a)}function d(a){this._ctor(a)}function p(a){this._ctor(a)}function g(a,b,e){e=e||{};this.background_image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII=";
a&&a.constructor===String&&(a=document.querySelector(a));this.max_zoom=10;this.min_zoom=0.1;this.zoom_modify_alpha=!0;this.title_text_font="bold "+k.NODE_TEXT_SIZE+"px Arial";this.inner_text_font="normal "+k.NODE_SUBTEXT_SIZE+"px Arial";this.node_title_color=k.NODE_TITLE_COLOR;this.default_link_color=k.LINK_COLOR;this.default_connection_color={input_off:"#AAB",input_on:"#7F7",output_off:"#AAB",output_on:"#7F7"};this.highquality_render=!0;this.use_gradients=!1;this.editor_alpha=1;this.pause_rendering=
!1;this.render_only_selected=this.clear_background=this.render_shadows=!0;this.live_mode=!1;this.allow_searchbox=this.allow_interaction=this.allow_dragnodes=this.allow_dragcanvas=this.show_info=!0;this.drag_mode=this.allow_reconnect_links=!1;this.filter=this.dragging_rectangle=null;this.always_render_background=!1;this.render_canvas_border=!0;this.render_connections_shadows=!1;this.render_connection_arrows=this.render_curved_connections=this.render_connections_border=!0;this.render_execution_order=
-!1;this.canvas_mouse=[0,0];this.onDrawOverlay=this.onDrawForeground=this.onDrawBackground=this.onMouse=this.onSearchBoxSelection=this.onSearchBox=null;this.connections_width=3;this.round_radius=8;this.node_widget=this.current_node=null;this.last_mouse_position=[0,0];this.visible_area=new Float32Array(4);c&&c.attachCanvas(this);this.setCanvas(a);this.clear();e.skip_render||this.startRendering();this.autoresize=e.autoresize}function p(a,c){return Math.sqrt((c[0]-a[0])*(c[0]-a[0])+(c[1]-a[1])*(c[1]-
-a[1]))}function r(a,c,e,b,g,m){return ea&&b pixelcode must be vec3 uvcode must be vec2, is optional uv: tex. coords color: texture colorB: textureB time: scene time value: input value
uvcode must be vec2, is optional
\t\t\tuv: tex. coords
color: texture
colorB: textureB
time: scene time
value: input value
"; +this.properties={value:1,uvcode:"",pixelcode:"color + colorB * value",precision:d.DEFAULT}};q.widgets_info={uvcode:{widget:"textarea",height:100},pixelcode:{widget:"textarea",height:100},precision:{widget:"combo",values:d.MODE_VALUES}};q.title="Operation";q.desc="Texture shader operation";q.prototype.getExtraMenuOptions=function(a){var b=this;return[{content:b.properties.show?"Hide Texture":"Show Texture",callback:function(){b.properties.show=!b.properties.show}}]};q.prototype.onDrawBackground=function(a){this.flags.collapsed|| +20>=this.size[1]||!this.properties.show||!this._tex||this._tex.gl!=a||(a.save(),a.drawImage(this._tex,0,0,this.size[0],this.size[1]),a.restore())};q.prototype.onExecute=function(){var a=this.getInputData(0);if(this.isOutputConnected(0))if(this.properties.precision===d.PASS_THROUGH)this.setOutputData(0,a);else{var b=this.getInputData(1);if(this.properties.uvcode||this.properties.pixelcode){var c=512,e=512;a?(c=a.width,e=a.height):b&&(c=b.width,e=b.height);var f=d.getTextureType(this.properties.precision, +a);this._tex=a||this._tex?d.getTargetTexture(a||this._tex,this._tex,this.properties.precision):new GL.Texture(c,e,{type:f,format:gl.RGBA,filter:gl.LINEAR});f="";this.properties.uvcode&&(f="uv = "+this.properties.uvcode,-1!=this.properties.uvcode.indexOf(";")&&(f=this.properties.uvcode));var g="";this.properties.pixelcode&&(g="result = "+this.properties.pixelcode,-1!=this.properties.pixelcode.indexOf(";")&&(g=this.properties.pixelcode));var l=this._shader;if(!l||this._shader_code!=f+"|"+g){try{this._shader= +new GL.Shader(Shader.SCREEN_VERTEX_SHADER,q.pixel_shader,{UV_CODE:f,PIXEL_CODE:g}),this.boxcolor="#00FF00"}catch(h){console.log("Error compiling shader: ",h);this.boxcolor="#FF0000";return}this.boxcolor="#FF0000";this._shader_code=f+"|"+g;l=this._shader}if(l){this.boxcolor="green";var k=this.getInputData(2);null!=k?this.properties.value=k:k=parseFloat(this.properties.value);var m=this.graph.getTime();this._tex.drawTo(function(){gl.disable(gl.DEPTH_TEST);gl.disable(gl.CULL_FACE);gl.disable(gl.BLEND); +a&&a.bind(0);b&&b.bind(1);var d=Mesh.getScreenQuad();l.uniforms({u_texture:0,u_textureB:1,value:k,texSize:[c,e],time:m}).draw(d)});this.setOutputData(0,this._tex)}else this.boxcolor="red"}}};q.pixel_shader="precision highp float;\n\t\t\t\n\t\t\tuniform sampler2D u_texture;\n\t\t\tuniform sampler2D u_textureB;\n\t\t\tvarying vec2 v_coord;\n\t\t\tuniform vec2 texSize;\n\t\t\tuniform float time;\n\t\t\tuniform float value;\n\t\t\t\n\t\t\tvoid main() {\n\t\t\t\tvec2 uv = v_coord;\n\t\t\t\tUV_CODE;\n\t\t\t\tvec4 color4 = texture2D(u_texture, uv);\n\t\t\t\tvec3 color = color4.rgb;\n\t\t\t\tvec4 color4B = texture2D(u_textureB, uv);\n\t\t\t\tvec3 colorB = color4B.rgb;\n\t\t\t\tvec3 result = color;\n\t\t\t\tfloat alpha = 1.0;\n\t\t\t\tPIXEL_CODE;\n\t\t\t\tgl_FragColor = vec4(result, alpha);\n\t\t\t}\n\t\t\t"; +h.registerNodeType("texture/operation",q);var r=function(){this.addOutput("out","Texture");this.properties={code:"",width:512,height:512,precision:d.DEFAULT};this.properties.code="\nvoid main() {\n vec2 uv = v_coord;\n vec3 color = vec3(0.0);\n//your code here\n\ngl_FragColor = vec4(color, 1.0);\n}\n";this._uniforms={in_texture:0,texSize:vec2.create(),time:0}};r.title="Shader";r.desc="Texture shader";r.widgets_info={code:{type:"code"},precision:{widget:"combo",values:d.MODE_VALUES}};r.prototype.onPropertyChanged= +function(a,b){if("code"==a){var c=this.getShader();if(c){var d=c.uniformInfo;if(this.inputs)for(var e={},f=0;f