Skip to content

Commit

Permalink
fix in onNodeDeselected
Browse files Browse the repository at this point in the history
  • Loading branch information
tamat committed Nov 11, 2019
1 parent 64a0109 commit a4352d5
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 163 deletions.
37 changes: 24 additions & 13 deletions build/litegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -6080,13 +6080,6 @@ LGraphNode.prototype.executeAction = function(action)
}
};

LGraphCanvas.prototype.processNodeDeselected = function(node) {
this.deselectNode(node);
if (this.onNodeDeselected) {
this.onNodeDeselected(node);
}
};

/**
* selects a given node (or adds it to the current selection)
* @method selectNode
Expand Down Expand Up @@ -6163,6 +6156,10 @@ LGraphNode.prototype.executeAction = function(action)
}
node.is_selected = false;

if (this.onNodeDeselected) {
this.onNodeDeselected(node);
}

//remove highlighted
if (node.inputs) {
for (var i = 0; i < node.inputs.length; ++i) {
Expand Down Expand Up @@ -6199,6 +6196,9 @@ LGraphNode.prototype.executeAction = function(action)
node.onDeselected();
}
node.is_selected = false;
if (this.onNodeDeselected) {
this.onNodeDeselected(node);
}
}
this.selected_nodes = {};
this.current_node = null;
Expand Down Expand Up @@ -17167,14 +17167,16 @@ if (typeof exports != "undefined") {
antialiasing: false,
filter: true,
disable_alpha: false,
gamma: 1.0
gamma: 1.0,
viewport: [0,0,1,1]
};
this.size[0] = 130;
}

LGraphTextureToViewport.title = "to Viewport";
LGraphTextureToViewport.desc = "Texture to viewport";

LGraphTextureToViewport._prev_viewport = new Float32Array(4);
LGraphTextureToViewport.prototype.onExecute = function() {
var tex = this.getInputData(0);
if (!tex) {
Expand Down Expand Up @@ -17203,6 +17205,12 @@ if (typeof exports != "undefined") {
this.properties.filter ? gl.LINEAR : gl.NEAREST
);

var old_viewport = LGraphTextureToViewport._prev_viewport;
old_viewport.set( gl.viewport_data );
var new_view = this.properties.viewport;
gl.viewport( old_viewport[0] + old_viewport[2] * new_view[0], old_viewport[1] + old_viewport[3] * new_view[1], old_viewport[2] * new_view[2], old_viewport[3] * new_view[3] );
var viewport = gl.getViewport(); //gl.getParameter(gl.VIEWPORT);

if (this.properties.antialiasing) {
if (!LGraphTextureToViewport._shader) {
LGraphTextureToViewport._shader = new GL.Shader(
Expand All @@ -17211,7 +17219,6 @@ if (typeof exports != "undefined") {
);
}

var viewport = gl.getViewport(); //gl.getParameter(gl.VIEWPORT);
var mesh = Mesh.getScreenQuad();
tex.bind(0);
LGraphTextureToViewport._shader
Expand All @@ -17238,6 +17245,8 @@ if (typeof exports != "undefined") {
tex.toViewport();
}
}

gl.viewport( old_viewport[0], old_viewport[1], old_viewport[2], old_viewport[3] );
};

LGraphTextureToViewport.prototype.onGetInputs = function() {
Expand Down Expand Up @@ -18639,7 +18648,7 @@ if (typeof exports != "undefined") {
this.addInput("Mixer", "Texture");

this.addOutput("Texture", "Texture");
this.properties = { factor: 0.5, precision: LGraphTexture.DEFAULT };
this.properties = { factor: 0.5, size_from_biggest: true, invert: false, precision: LGraphTexture.DEFAULT };
this._uniforms = {
u_textureA: 0,
u_textureB: 1,
Expand Down Expand Up @@ -18677,7 +18686,7 @@ if (typeof exports != "undefined") {
var factor = this.getInputData(3);

this._tex = LGraphTexture.getTargetTexture(
texA,
this.properties.size_from_biggest && texB.width > texA.width ? texB : texA,
this._tex,
this.properties.precision
);
Expand Down Expand Up @@ -18709,9 +18718,11 @@ if (typeof exports != "undefined") {
uniforms.u_mix.set([f, f, f, f]);
}

var invert = this.properties.invert;

this._tex.drawTo(function() {
texA.bind(0);
texB.bind(1);
texA.bind( invert ? 1 : 0 );
texB.bind( invert ? 0 : 1 );
if (texMix) {
texMix.bind(2);
}
Expand Down
Loading

0 comments on commit a4352d5

Please sign in to comment.