fix in onNodeDeselected

This commit is contained in:
tamat
2019-11-11 16:30:04 +01:00
parent 64a0109d87
commit a4352d5624
5 changed files with 184 additions and 163 deletions

View File

@@ -6078,13 +6078,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
@@ -6161,6 +6154,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) {
@@ -6197,6 +6194,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;

View File

@@ -1192,7 +1192,8 @@
antialiasing: false,
filter: true,
disable_alpha: false,
gamma: 1.0
gamma: 1.0,
viewport: [0,0,1,1]
};
this.size[0] = 130;
}
@@ -1200,6 +1201,7 @@
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) {
@@ -1228,6 +1230,12 @@
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(
@@ -1236,7 +1244,6 @@
);
}
var viewport = gl.getViewport(); //gl.getParameter(gl.VIEWPORT);
var mesh = Mesh.getScreenQuad();
tex.bind(0);
LGraphTextureToViewport._shader
@@ -1263,6 +1270,8 @@
tex.toViewport();
}
}
gl.viewport( old_viewport[0], old_viewport[1], old_viewport[2], old_viewport[3] );
};
LGraphTextureToViewport.prototype.onGetInputs = function() {
@@ -2664,7 +2673,7 @@
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,
@@ -2702,7 +2711,7 @@
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
);
@@ -2734,9 +2743,11 @@
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);
}