diff --git a/build/litegraph.js b/build/litegraph.js index 87134fdde..aca2bb208 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -3596,7 +3596,14 @@ //allows nodes to block connection if (target_node.onConnectInput) { +<<<<<<< HEAD if ( target_node.onConnectInput(target_slot, output.type, output, this, slot) === false ) { +======= + if ( + target_node.onConnectInput(target_slot, output.type, output) === + false + ) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return null; } } @@ -5590,8 +5597,13 @@ LGraphNode.prototype.executeAction = function(action) widgets_height += 8; } +<<<<<<< HEAD if (this.resizing_node.size[1] < min_height) { var min_height = max_slots * LiteGraph.NODE_SLOT_HEIGHT + widgets_height; +======= + var min_height = max_slots * LiteGraph.NODE_SLOT_HEIGHT + widgets_height; + if (this.resizing_node.size[1] < min_height) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.resizing_node.size[1] = min_height; } @@ -10098,6 +10110,7 @@ LGraphNode.prototype.executeAction = function(action) if (slot) { //on slot menu_info = []; +<<<<<<< HEAD if (node.getSlotMenuOptions) { menu_info = node.getSlotMenuOptions(slot); } else { @@ -10122,6 +10135,27 @@ LGraphNode.prototype.executeAction = function(action) ); } +======= + if ( + slot && + slot.output && + slot.output.links && + slot.output.links.length + ) { + menu_info.push({ content: "Disconnect Links", slot: slot }); + } + var _slot = slot.input || slot.output; + menu_info.push( + _slot.locked + ? "Cannot remove" + : { content: "Remove Slot", slot: slot } + ); + menu_info.push( + _slot.nameLocked + ? "Cannot rename" + : { content: "Rename Slot", slot: slot } + ); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 options.title = (slot.input ? slot.input.type : slot.output.type) || "*"; if (slot.input && slot.input.type == LiteGraph.ACTION) { @@ -10559,6 +10593,7 @@ LGraphNode.prototype.executeAction = function(action) var body_rect = document.body.getBoundingClientRect(); var root_rect = root.getBoundingClientRect(); +<<<<<<< HEAD if(body_rect.height == 0) console.error("document.body height is 0. That is dangerous, set html,body { height: 100%; }"); @@ -10566,6 +10601,13 @@ LGraphNode.prototype.executeAction = function(action) left = body_rect.width - root_rect.width - 10; } if (body_rect.height && top > body_rect.height - root_rect.height - 10) { +======= + + if (left > body_rect.width - root_rect.width - 10) { + left = body_rect.width - root_rect.width - 10; + } + if (top > body_rect.height - root_rect.height - 10) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 top = body_rect.height - root_rect.height - 10; } } @@ -18154,8 +18196,13 @@ void main() {\n\ }; this._uniforms = { u_texture: 0, +<<<<<<< HEAD u_camera_planes: null, //filled later u_ires: vec2.create() +======= + u_near: 0.1, + u_far: 10000 +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; } @@ -18187,6 +18234,12 @@ void main() {\n\ } var uniforms = this._uniforms; +<<<<<<< HEAD +======= + + uniforms.u_near = tex.near_far_planes[0]; + uniforms.u_far = tex.near_far_planes[1]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 uniforms.u_invert = this.properties.invert ? 1 : 0; gl.disable(gl.BLEND); @@ -18206,8 +18259,11 @@ void main() {\n\ planes = [0.1, 1000]; } //hardcoded uniforms.u_camera_planes = planes; +<<<<<<< HEAD //uniforms.u_ires.set([1/tex.width, 1/tex.height]); uniforms.u_ires.set([0,0]); +======= +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._temp_texture.drawTo(function() { tex.bind(0); @@ -18223,6 +18279,7 @@ void main() {\n\ precision highp float;\n\ varying vec2 v_coord;\n\ uniform sampler2D u_texture;\n\ +<<<<<<< HEAD uniform vec2 u_camera_planes;\n\ uniform int u_invert;\n\ uniform vec2 u_ires;\n\ @@ -18231,6 +18288,17 @@ void main() {\n\ float zNear = u_camera_planes.x;\n\ float zFar = u_camera_planes.y;\n\ float depth = texture2D(u_texture, v_coord + u_ires*0.5).x * 2.0 - 1.0;\n\ +======= + uniform float u_near;\n\ + uniform float u_far;\n\ + uniform int u_invert;\n\ + \n\ + void main() {\n\ + float zNear = u_near;\n\ + float zFar = u_far;\n\ + float depth = texture2D(u_texture, v_coord).x;\n\ + depth = depth * 2.0 - 1.0;\n\ +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 float f = zNear * (depth + 1.0) / (zFar + zNear - depth * (zFar - zNear));\n\ if( u_invert == 1 )\n\ f = 1.0 - f;\n\ diff --git a/build/litegraph.min.js b/build/litegraph.min.js index c09008e3b..8803e9d69 100755 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -15,9 +15,15 @@ $jscomp.polyfill = function(v, c, q, m) { q = $jscomp.global; v = v.split("."); for (m = 0; m < v.length - 1; m++) { +<<<<<<< HEAD var h = v[m]; h in q || (q[h] = {}); q = q[h]; +======= + var g = v[m]; + g in q || (q[g] = {}); + q = q[g]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } v = v[v.length - 1]; m = q[v]; @@ -27,6 +33,7 @@ $jscomp.polyfill = function(v, c, q, m) { }; $jscomp.polyfill("Array.prototype.fill", function(v) { return v ? v : function(c, q, m) { +<<<<<<< HEAD var h = this.length || 0; 0 > q && (q = Math.max(0, h + q)); if (null == m || m > h) { @@ -34,6 +41,15 @@ $jscomp.polyfill("Array.prototype.fill", function(v) { } m = Number(m); 0 > m && (m = Math.max(0, h + m)); +======= + var g = this.length || 0; + 0 > q && (q = Math.max(0, g + q)); + if (null == m || m > g) { + m = g; + } + m = Number(m); + 0 > m && (m = Math.max(0, g + m)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 for (q = Number(q || 0); q < m; q++) { this[q] = c; } @@ -81,8 +97,13 @@ $jscomp.iteratorFromArray = function(v, c) { v instanceof String && (v += ""); var q = 0, m = {next:function() { if (q < v.length) { +<<<<<<< HEAD var h = q++; return {value:c(h, v[h]), done:!1}; +======= + var g = q++; + return {value:c(g, v[g]), done:!1}; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } m.next = function() { return {done:!0, value:void 0}; @@ -127,11 +148,19 @@ $jscomp.polyfill("Object.values", function(v) { this.clear(); a && this.configure(a); } +<<<<<<< HEAD function q(a, b, d, g, f, e) { this.id = a; this.type = b; this.origin_id = d; this.origin_slot = g; +======= + function q(a, b, d, h, f, e) { + this.id = a; + this.type = b; + this.origin_id = d; + this.origin_slot = h; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.target_id = f; this.target_slot = e; this._data = null; @@ -140,7 +169,11 @@ $jscomp.polyfill("Object.values", function(v) { function m(a) { this._ctor(a); } +<<<<<<< HEAD function h(a) { +======= + function g(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._ctor(a); } function r(a, b) { @@ -203,12 +236,21 @@ $jscomp.polyfill("Object.values", function(v) { function B(a, b) { return Math.sqrt((b[0] - a[0]) * (b[0] - a[0]) + (b[1] - a[1]) * (b[1] - a[1])); } +<<<<<<< HEAD function y(a, b, d, g, f, e) { return d < a && d + f > a && g < b && g + e > b ? !0 : !1; } function w(a, b) { var d = a[0] + a[2], g = a[1] + a[3], f = b[1] + b[3]; return a[0] > b[0] + b[2] || a[1] > f || d < b[0] || g < b[1] ? !1 : !0; +======= + function y(a, b, d, h, f, e) { + return d < a && d + f > a && h < b && h + e > b ? !0 : !1; + } + function w(a, b) { + var d = a[0] + a[2], h = a[1] + a[3], f = b[1] + b[3]; + return a[0] > b[0] + b[2] || a[1] > f || d < b[0] || h < b[1] ? !1 : !0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } function E(a, b) { function d(a) { @@ -218,7 +260,11 @@ $jscomp.polyfill("Object.values", function(v) { return !0; } this.options = b = b || {}; +<<<<<<< HEAD var g = this; +======= + var h = this; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b.parentMenu && (b.parentMenu.constructor !== this.constructor ? (console.error("parentMenu must be of class ContextMenu, ignoring it"), b.parentMenu = null) : (this.parentMenu = b.parentMenu, this.parentMenu.lock = !0, this.parentMenu.current_submenu = this)); var f = null; b.event && (f = b.event.constructor.name); @@ -245,7 +291,11 @@ $jscomp.polyfill("Object.values", function(v) { }, !0); e.addEventListener("mousedown", function(a) { if (2 == a.button) { +<<<<<<< HEAD return g.close(), a.preventDefault(), !0; +======= + return h.close(), a.preventDefault(), !0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } }, !0); b.scroll_speed || (b.scroll_speed = 0.1); @@ -261,7 +311,11 @@ $jscomp.polyfill("Object.values", function(v) { f++; } e.addEventListener("mouseleave", function(a) { +<<<<<<< HEAD g.lock || (e.closing_timer && clearTimeout(e.closing_timer), e.closing_timer = setTimeout(g.close.bind(g, a), 500)); +======= + h.lock || (e.closing_timer && clearTimeout(e.closing_timer), e.closing_timer = setTimeout(h.close.bind(h, a), 500)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); e.addEventListener("mouseenter", function(a) { e.closing_timer && clearTimeout(e.closing_timer); @@ -272,13 +326,21 @@ $jscomp.polyfill("Object.values", function(v) { a.fullscreenElement ? a.fullscreenElement.appendChild(e) : a.body.appendChild(e); c = b.left || 0; a = b.top || 0; +<<<<<<< HEAD b.event && (c = b.event.clientX - 10, a = b.event.clientY - 10, b.title && (a -= 20), b.parentMenu && (c = b.parentMenu.root.getBoundingClientRect(), c = c.left + c.width), f = document.body.getBoundingClientRect(), k = e.getBoundingClientRect(), 0 == f.height && console.error("document.body height is 0. That is dangerous, set html,body { height: 100%; }"), f.width && c > f.width - k.width - 10 && (c = f.width - k.width - 10), f.height && a > f.height - k.height - 10 && (a = f.height - k.height - 10)); +======= + b.event && (c = b.event.clientX - 10, a = b.event.clientY - 10, b.title && (a -= 20), b.parentMenu && (c = b.parentMenu.root.getBoundingClientRect(), c = c.left + c.width), f = document.body.getBoundingClientRect(), k = e.getBoundingClientRect(), c > f.width - k.width - 10 && (c = f.width - k.width - 10), a > f.height - k.height - 10 && (a = f.height - k.height - 10)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e.style.left = c + "px"; e.style.top = a + "px"; b.scale && (e.style.transform = "scale(" + b.scale + ")"); } +<<<<<<< HEAD function A(a) { +======= + function z(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.points = a; this.nearest = this.selected = -1; this.size = null; @@ -294,15 +356,24 @@ $jscomp.polyfill("Object.values", function(v) { b.type = a; e.debug && console.log("Node registered: " + a); a.split("/"); +<<<<<<< HEAD var d = b.name, g = a.lastIndexOf("/"); b.category = a.substr(0, g); +======= + var d = b.name, h = a.lastIndexOf("/"); + b.category = a.substr(0, h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b.title || (b.title = d); if (b.prototype) { for (var f in m.prototype) { b.prototype[f] || (b.prototype[f] = m.prototype[f]); } } +<<<<<<< HEAD if (g = this.registered_node_types[a]) { +======= + if (h = this.registered_node_types[a]) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 console.log("replacing node type: " + a); } else { if (Object.hasOwnProperty(b.prototype, "shape") || Object.defineProperty(b.prototype, "shape", {set:function(a) { @@ -339,8 +410,13 @@ $jscomp.polyfill("Object.values", function(v) { if (e.onNodeTypeRegistered) { e.onNodeTypeRegistered(a, b); } +<<<<<<< HEAD if (g && e.onNodeTypeReplaced) { e.onNodeTypeReplaced(a, b, g); +======= + if (h && e.onNodeTypeReplaced) { + e.onNodeTypeReplaced(a, b, h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } }, unregisterNodeType:function(a) { var b = a.constructor === String ? this.registered_node_types[a] : a; @@ -349,11 +425,19 @@ $jscomp.polyfill("Object.values", function(v) { } delete this.registered_node_types[b.type]; b.constructor.name && delete this.Nodes[b.constructor.name]; +<<<<<<< HEAD }, wrapFunctionAsNode:function(a, b, d, g, f) { for (var x = Array(b.length), c = "", k = e.getParameterNames(b), n = 0; n < k.length; ++n) { c += "this.addInput('" + k[n] + "'," + (d && d[n] ? "'" + d[n] + "'" : "0") + ");\n"; } c += "this.addOutput('out'," + (g ? "'" + g + "'" : 0) + ");\n"; +======= + }, wrapFunctionAsNode:function(a, b, d, h, f) { + for (var x = Array(b.length), c = "", k = e.getParameterNames(b), n = 0; n < k.length; ++n) { + c += "this.addInput('" + k[n] + "'," + (d && d[n] ? "'" + d[n] + "'" : "0") + ");\n"; + } + c += "this.addOutput('out'," + (h ? "'" + h + "'" : 0) + ");\n"; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 f && (c += "this.properties = " + JSON.stringify(f) + ";\n"); d = Function(c); d.title = a.split("/").pop(); @@ -369,6 +453,7 @@ $jscomp.polyfill("Object.values", function(v) { }, addNodeMethod:function(a, b) { m.prototype[a] = b; for (var d in this.registered_node_types) { +<<<<<<< HEAD var g = this.registered_node_types[d]; g.prototype[a] && (g.prototype["_" + a] = g.prototype[a]); g.prototype[a] = b; @@ -388,6 +473,27 @@ $jscomp.polyfill("Object.values", function(v) { } } else { f = new g(b); +======= + var h = this.registered_node_types[d]; + h.prototype[a] && (h.prototype["_" + a] = h.prototype[a]); + h.prototype[a] = b; + } + }, createNode:function(a, b, d) { + var h = this.registered_node_types[a]; + if (!h) { + return e.debug && console.log('GraphNode type "' + a + '" not registered.'), null; + } + b = b || h.title || a; + var f = null; + if (e.catch_exceptions) { + try { + f = new h(b); + } catch (H) { + return console.error(H), null; + } + } else { + f = new h(b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } f.type = a; !f.title && b && (f.title = b); @@ -406,17 +512,28 @@ $jscomp.polyfill("Object.values", function(v) { }, getNodeType:function(a) { return this.registered_node_types[a]; }, getNodeTypesInCategory:function(a, b) { +<<<<<<< HEAD var d = [], g; for (g in this.registered_node_types) { var f = this.registered_node_types[g]; +======= + var d = [], h; + for (h in this.registered_node_types) { + var f = this.registered_node_types[h]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b && f.filter && f.filter != b || ("" == a ? null == f.category && d.push(f) : f.category == a && d.push(f)); } return d; }, getNodeTypesCategories:function(a) { var b = {"":1}, d; for (d in this.registered_node_types) { +<<<<<<< HEAD var g = this.registered_node_types[d]; !g.category || g.skip_list || a && g.filter != a || (b[g.category] = 1); +======= + var h = this.registered_node_types[d]; + !h.category || h.skip_list || a && h.filter != a || (b[h.category] = 1); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } a = []; for (d in b) { @@ -424,6 +541,7 @@ $jscomp.polyfill("Object.values", function(v) { } return a; }, reloadNodes:function(a) { +<<<<<<< HEAD var b = document.getElementsByTagName("script"), d = [], g; for (g in b) { d.push(b[g]); @@ -432,6 +550,16 @@ $jscomp.polyfill("Object.values", function(v) { a = document.location.href + a; for (g in d) { var f = d[g].src; +======= + var b = document.getElementsByTagName("script"), d = [], h; + for (h in b) { + d.push(b[h]); + } + b = document.getElementsByTagName("head")[0]; + a = document.location.href + a; + for (h in d) { + var f = d[h].src; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (f && f.substr(0, a.length) == a) { try { e.debug && console.log("Reloading: " + f); @@ -439,10 +567,17 @@ $jscomp.polyfill("Object.values", function(v) { x.type = "text/javascript"; x.src = f; b.appendChild(x); +<<<<<<< HEAD b.removeChild(d[g]); } catch (G) { if (e.throw_errors) { throw G; +======= + b.removeChild(d[h]); + } catch (H) { + if (e.throw_errors) { + throw H; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } e.debug && console.log("Error while reloading " + f); } @@ -475,8 +610,13 @@ $jscomp.polyfill("Object.values", function(v) { a = a.split(","); b = b.split(","); for (var d = 0; d < a.length; ++d) { +<<<<<<< HEAD for (var g = 0; g < b.length; ++g) { if (a[d] == b[g]) { +======= + for (var h = 0; h < b.length; ++h) { + if (a[d] == b[h]) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return !0; } } @@ -484,7 +624,11 @@ $jscomp.polyfill("Object.values", function(v) { return !1; }, registerSearchboxExtra:function(a, b, d) { this.searchbox_extras[b.toLowerCase()] = {type:a, desc:b, data:d}; +<<<<<<< HEAD }, fetchFile:function(a, b, d, g) { +======= + }, fetchFile:function(a, b, d, h) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (!a) { return null; } @@ -510,7 +654,11 @@ $jscomp.polyfill("Object.values", function(v) { d && d(a); }).catch(function(b) { console.error("error fetching file:", a); +<<<<<<< HEAD g && g(b); +======= + h && h(b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); } if (a.constructor === File || a.constructor === Blob) { @@ -641,8 +789,13 @@ $jscomp.polyfill("Object.values", function(v) { }; c.prototype.runStep = function(a, b, d) { a = a || 1; +<<<<<<< HEAD var g = e.getTime(); this.globaltime = 0.001 * (g - this.starttime); +======= + var h = e.getTime(); + this.globaltime = 0.001 * (h - this.starttime); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var f = this._nodes_executable ? this._nodes_executable : this._nodes; if (f) { d = d || f.length; @@ -689,10 +842,17 @@ $jscomp.polyfill("Object.values", function(v) { } } a = e.getTime(); +<<<<<<< HEAD g = a - g; 0 == g && (g = 1); this.execution_time = 0.001 * g; this.globaltime += 0.001 * g; +======= + h = a - h; + 0 == h && (h = 1); + this.execution_time = 0.001 * h; + this.globaltime += 0.001 * h; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.iteration += 1; this.elapsed_time = 0.001 * (a - this.last_update_time); this.last_update_time = a; @@ -706,12 +866,17 @@ $jscomp.polyfill("Object.values", function(v) { } }; c.prototype.computeExecutionOrder = function(a, b) { +<<<<<<< HEAD for (var d = [], g = [], f = {}, x = {}, c = {}, k = 0, n = this._nodes.length; k < n; ++k) { +======= + for (var d = [], h = [], f = {}, x = {}, c = {}, k = 0, n = this._nodes.length; k < n; ++k) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var p = this._nodes[k]; if (!a || p.onExecute) { f[p.id] = p; var l = 0; if (p.inputs) { +<<<<<<< HEAD for (var t = 0, h = p.inputs.length; t < h; t++) { p.inputs[t] && null != p.inputs[t].link && (l += 1); } @@ -725,6 +890,21 @@ $jscomp.polyfill("Object.values", function(v) { if (a = p.outputs[k], null != a && null != a.links && 0 != a.links.length) { for (t = 0; t < a.links.length; t++) { (n = this.links[a.links[t]]) && !x[n.id] && (l = this.getNodeById(n.target_id), null == l ? x[n.id] = !0 : (b && (!l._level || l._level <= p._level) && (l._level = p._level + 1), x[n.id] = !0, --c[l.id], 0 == c[l.id] && g.push(l))); +======= + for (var t = 0, g = p.inputs.length; t < g; t++) { + p.inputs[t] && null != p.inputs[t].link && (l += 1); + } + } + 0 == l ? (h.push(p), b && (p._level = 1)) : (b && (p._level = 0), c[p.id] = l); + } + } + for (; 0 != h.length;) { + if (p = h.shift(), d.push(p), delete f[p.id], p.outputs) { + for (k = 0; k < p.outputs.length; k++) { + if (a = p.outputs[k], null != a && null != a.links && 0 != a.links.length) { + for (t = 0; t < a.links.length; t++) { + (n = this.links[a.links[t]]) && !x[n.id] && (l = this.getNodeById(n.target_id), null == l ? x[n.id] = !0 : (b && (!l._level || l._level <= p._level) && (l._level = p._level + 1), x[n.id] = !0, --c[l.id], 0 == c[l.id] && h.push(l))); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -748,10 +928,17 @@ $jscomp.polyfill("Object.values", function(v) { return d; }; c.prototype.getAncestors = function(a) { +<<<<<<< HEAD for (var b = [], d = [a], g = {}; d.length;) { var f = d.shift(); if (f.inputs) { g[f.id] || f == a || (g[f.id] = !0, b.push(f)); +======= + for (var b = [], d = [a], h = {}; d.length;) { + var f = d.shift(); + if (f.inputs) { + h[f.id] || f == a || (h[f.id] = !0, b.push(f)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 for (var e = 0; e < f.inputs.length; ++e) { var c = f.getInputNode(e); c && -1 == b.indexOf(c) && d.push(c); @@ -765,14 +952,24 @@ $jscomp.polyfill("Object.values", function(v) { }; c.prototype.arrange = function(a) { a = a || 100; +<<<<<<< HEAD for (var b = this.computeExecutionOrder(!1, !0), d = [], g = 0; g < b.length; ++g) { var f = b[g], x = f._level || 1; +======= + for (var b = this.computeExecutionOrder(!1, !0), d = [], h = 0; h < b.length; ++h) { + var f = b[h], x = f._level || 1; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 d[x] || (d[x] = []); d[x].push(f); } b = a; +<<<<<<< HEAD for (g = 0; g < d.length; ++g) { if (x = d[g]) { +======= + for (h = 0; h < d.length; ++h) { + if (x = d[h]) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 for (var c = 100, k = a + e.NODE_TITLE_HEIGHT, n = 0; n < x.length; ++n) { f = x[n], f.pos[0] = b, f.pos[1] = k, f.size[0] > c && (c = f.size[0]), k += f.size[1] + a + e.NODE_TITLE_HEIGHT; } @@ -792,10 +989,17 @@ $jscomp.polyfill("Object.values", function(v) { }; c.prototype.sendEventToAllNodes = function(a, b, d) { d = d || e.ALWAYS; +<<<<<<< HEAD var g = this._nodes_in_order ? this._nodes_in_order : this._nodes; if (g) { for (var f = 0, x = g.length; f < x; ++f) { var c = g[f]; +======= + var h = this._nodes_in_order ? this._nodes_in_order : this._nodes; + if (h) { + for (var f = 0, x = h.length; f < x; ++f) { + var c = h[f]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (c.constructor === e.Subgraph && "onExecute" != a) { c.mode == d && c.sendEventToAllNodes(a, b, d); } else { @@ -817,14 +1021,23 @@ $jscomp.polyfill("Object.values", function(v) { c.prototype.sendActionToCanvas = function(a, b) { if (this.list_of_graphcanvas) { for (var d = 0; d < this.list_of_graphcanvas.length; ++d) { +<<<<<<< HEAD var g = this.list_of_graphcanvas[d]; g[a] && g[a].apply(g, b); +======= + var h = this.list_of_graphcanvas[d]; + h[a] && h[a].apply(h, b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } }; c.prototype.add = function(a, b) { if (a) { +<<<<<<< HEAD if (a.constructor === h) { +======= + if (a.constructor === g) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._groups.push(a), this.setDirtyCanvas(!0), this.change(), a.graph = this, this._version++; } else { -1 != a.id && null != this._nodes_by_id[a.id] && (console.warn("LiteGraph: there is already a node with this ID, changing it"), a.id = ++this.last_node_id); @@ -898,7 +1111,11 @@ $jscomp.polyfill("Object.values", function(v) { }; c.prototype.findNodesByClass = function(a, b) { b = b || []; +<<<<<<< HEAD for (var d = b.length = 0, g = this._nodes.length; d < g; ++d) { +======= + for (var d = b.length = 0, h = this._nodes.length; d < h; ++d) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._nodes[d].constructor === a && b.push(this._nodes[d]); } return b; @@ -906,7 +1123,11 @@ $jscomp.polyfill("Object.values", function(v) { c.prototype.findNodesByType = function(a, b) { a = a.toLowerCase(); b = b || []; +<<<<<<< HEAD for (var d = b.length = 0, g = this._nodes.length; d < g; ++d) { +======= + for (var d = b.length = 0, h = this._nodes.length; d < h; ++d) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._nodes[d].type.toLowerCase() == a && b.push(this._nodes[d]); } return b; @@ -920,16 +1141,28 @@ $jscomp.polyfill("Object.values", function(v) { return null; }; c.prototype.findNodesByTitle = function(a) { +<<<<<<< HEAD for (var b = [], d = 0, g = this._nodes.length; d < g; ++d) { +======= + for (var b = [], d = 0, h = this._nodes.length; d < h; ++d) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._nodes[d].title == a && b.push(this._nodes[d]); } return b; }; +<<<<<<< HEAD c.prototype.getNodeOnPos = function(a, b, d, g) { d = d || this._nodes; for (var f = d.length - 1; 0 <= f; f--) { var e = d[f]; if (e.isPointInside(a, b, g)) { +======= + c.prototype.getNodeOnPos = function(a, b, d, h) { + d = d || this._nodes; + for (var f = d.length - 1; 0 <= f; f--) { + var e = d[f]; + if (e.isPointInside(a, b, h)) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return e; } } @@ -937,9 +1170,15 @@ $jscomp.polyfill("Object.values", function(v) { }; c.prototype.getGroupOnPos = function(a, b) { for (var d = this._groups.length - 1; 0 <= d; d--) { +<<<<<<< HEAD var g = this._groups[d]; if (g.isPointInside(a, b, 2, !0)) { return g; +======= + var h = this._groups[d]; + if (h.isPointInside(a, b, 2, !0)) { + return h; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } return null; @@ -963,9 +1202,15 @@ $jscomp.polyfill("Object.values", function(v) { c.prototype.onAction = function(a, b) { this._input_nodes = this.findNodesByClass(e.GraphInput, this._input_nodes); for (var d = 0; d < this._input_nodes.length; ++d) { +<<<<<<< HEAD var g = this._input_nodes[d]; if (g.properties.name == a) { g.onAction(a, b); +======= + var h = this._input_nodes[d]; + if (h.properties.name == a) { + h.onAction(a, b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; } } @@ -1156,6 +1401,7 @@ $jscomp.polyfill("Object.values", function(v) { } d = []; for (b in this.links) { +<<<<<<< HEAD var g = this.links[b]; if (!g.serialize) { console.warn("weird LLink bug, link info is not a LLink but a regular object"); @@ -1172,14 +1418,37 @@ $jscomp.polyfill("Object.values", function(v) { g.push(this._groups[b].serialize()); } return {last_node_id:this.last_node_id, last_link_id:this.last_link_id, nodes:a, links:d, groups:g, config:this.config, version:e.VERSION}; +======= + var h = this.links[b]; + if (!h.serialize) { + console.warn("weird LLink bug, link info is not a LLink but a regular object"); + var f = new q; + for (b in h) { + f[b] = h[b]; + } + h = this.links[b] = f; + } + d.push(h.serialize()); + } + h = []; + for (b = 0; b < this._groups.length; ++b) { + h.push(this._groups[b].serialize()); + } + return {last_node_id:this.last_node_id, last_link_id:this.last_link_id, nodes:a, links:d, groups:h, config:this.config, version:e.VERSION}; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; c.prototype.configure = function(a, b) { if (a) { b || this.clear(); b = a.nodes; if (a.links && a.links.constructor === Array) { +<<<<<<< HEAD for (var d = [], g = 0; g < a.links.length; ++g) { var f = a.links[g]; +======= + for (var d = [], h = 0; h < a.links.length; ++h) { + var f = a.links[h]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (f) { var c = new q; c.configure(f); @@ -1190,29 +1459,51 @@ $jscomp.polyfill("Object.values", function(v) { } a.links = d; } +<<<<<<< HEAD for (g in a) { "nodes" != g && "groups" != g && (this[g] = a[g]); +======= + for (h in a) { + "nodes" != h && "groups" != h && (this[h] = a[h]); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } d = !1; this._nodes = []; if (b) { +<<<<<<< HEAD g = 0; for (f = b.length; g < f; ++g) { c = b[g]; +======= + h = 0; + for (f = b.length; h < f; ++h) { + c = b[h]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var k = e.createNode(c.type, c.title); k || (e.debug && console.log("Node not found or has errors: " + c.type), k = new m, k.last_serialization = c, d = k.has_errors = !0); k.id = c.id; this.add(k, !0); } +<<<<<<< HEAD g = 0; for (f = b.length; g < f; ++g) { c = b[g], (k = this.getNodeById(c.id)) && k.configure(c); +======= + h = 0; + for (f = b.length; h < f; ++h) { + c = b[h], (k = this.getNodeById(c.id)) && k.configure(c); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } this._groups.length = 0; if (a.groups) { +<<<<<<< HEAD for (g = 0; g < a.groups.length; ++g) { b = new e.LGraphGroup, b.configure(a.groups[g]), this.add(b); +======= + for (h = 0; h < a.groups.length; ++h) { + b = new e.LGraphGroup, b.configure(a.groups[h]), this.add(b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } this.updateExecutionOrder(); @@ -1279,8 +1570,13 @@ $jscomp.polyfill("Object.values", function(v) { if (this.inputs) { for (d = 0; d < this.inputs.length; ++d) { b = this.inputs[d]; +<<<<<<< HEAD var g = this.graph ? this.graph.links[b.link] : null; this.onConnectionsChange(e.INPUT, d, !0, g, b); +======= + var h = this.graph ? this.graph.links[b.link] : null; + this.onConnectionsChange(e.INPUT, d, !0, h, b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } if (this.outputs) { @@ -1288,7 +1584,11 @@ $jscomp.polyfill("Object.values", function(v) { var f = this.outputs[d]; if (f.links) { for (b = 0; b < f.links.length; ++b) { +<<<<<<< HEAD g = this.graph ? this.graph.links[f.links[b]] : null, this.onConnectionsChange(e.OUTPUT, d, !0, g, f); +======= + h = this.graph ? this.graph.links[f.links[b]] : null, this.onConnectionsChange(e.OUTPUT, d, !0, h, f); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -1369,9 +1669,15 @@ $jscomp.polyfill("Object.values", function(v) { this.onPropertyChanged && !1 === this.onPropertyChanged(a, b, d) && (this.properties[a] = d); if (this.widgets) { for (d = 0; d < this.widgets.length; ++d) { +<<<<<<< HEAD var g = this.widgets[d]; if (g && g.options.property == a) { g.value = b; +======= + var h = this.widgets[d]; + if (h && h.options.property == a) { + h.value = b; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; } } @@ -1383,8 +1689,13 @@ $jscomp.polyfill("Object.values", function(v) { var d = this.outputs[a]; if (d && (d._data = b, this.outputs[a].links)) { for (d = 0; d < this.outputs[a].links.length; d++) { +<<<<<<< HEAD var g = this.graph.links[this.outputs[a].links[d]]; g && (g.data = b); +======= + var h = this.graph.links[this.outputs[a].links[d]]; + h && (h.data = b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -1455,9 +1766,15 @@ $jscomp.polyfill("Object.values", function(v) { return this.properties ? this.properties[a] : null; } for (var b = 0, d = this.inputs.length; b < d; ++b) { +<<<<<<< HEAD var g = this.inputs[b]; if (a == g.name && null != g.link && (g = this.graph.links[g.link])) { return g.data; +======= + var h = this.inputs[b]; + if (a == h.name && null != h.link && (h = this.graph.links[h.link])) { + return h.data; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } return this.properties[a]; @@ -1491,8 +1808,13 @@ $jscomp.polyfill("Object.values", function(v) { return null; } for (var b = [], d = 0; d < a.links.length; d++) { +<<<<<<< HEAD var g = this.graph.links[a.links[d]]; g && (g = this.graph.getNodeById(g.target_id)) && b.push(g); +======= + var h = this.graph.links[a.links[d]]; + h && (h = this.graph.getNodeById(h.target_id)) && b.push(h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } return b; }; @@ -1500,18 +1822,30 @@ $jscomp.polyfill("Object.values", function(v) { if (this.outputs && this.outputs.length) { this.graph && (this.graph._last_trigger_time = e.getTime()); for (var d = 0; d < this.outputs.length; ++d) { +<<<<<<< HEAD var g = this.outputs[d]; !g || g.type !== e.EVENT || a && g.name != a || this.triggerSlot(d, b); +======= + var h = this.outputs[d]; + !h || h.type !== e.EVENT || a && h.name != a || this.triggerSlot(d, b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } }; m.prototype.triggerSlot = function(a, b, d) { if (this.outputs && (a = this.outputs[a]) && (a = a.links) && a.length) { this.graph && (this.graph._last_trigger_time = e.getTime()); +<<<<<<< HEAD for (var g = 0; g < a.length; ++g) { var f = a[g]; if (null == d || d == f) { var c = this.graph.links[a[g]]; +======= + for (var h = 0; h < a.length; ++h) { + var f = a[h]; + if (null == d || d == f) { + var c = this.graph.links[a[h]]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (c && (c._last_time = e.getTime(), f = this.graph.getNodeById(c.target_id))) { if (c = f.inputs[c.target_slot], f.onAction) { f.onAction(c.name, b); @@ -1528,20 +1862,35 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.clearTriggeredSlot = function(a, b) { if (this.outputs && (a = this.outputs[a]) && (a = a.links) && a.length) { for (var d = 0; d < a.length; ++d) { +<<<<<<< HEAD var g = a[d]; if (null == b || b == g) { if (g = this.graph.links[a[d]]) { g._last_time = 0; +======= + var h = a[d]; + if (null == b || b == h) { + if (h = this.graph.links[a[d]]) { + h._last_time = 0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } } }; +<<<<<<< HEAD m.prototype.addProperty = function(a, b, d, g) { d = {name:a, type:d, default_value:b}; if (g) { for (var f in g) { d[f] = g[f]; +======= + m.prototype.addProperty = function(a, b, d, h) { + d = {name:a, type:d, default_value:b}; + if (h) { + for (var f in h) { + d[f] = h[f]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } this.properties_info || (this.properties_info = []); @@ -1553,8 +1902,13 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.addOutput = function(a, b, d) { a = {name:a, type:b, links:null}; if (d) { +<<<<<<< HEAD for (var g in d) { a[g] = d[g]; +======= + for (var h in d) { + a[h] = d[h]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } this.outputs || (this.outputs = []); @@ -1568,6 +1922,7 @@ $jscomp.polyfill("Object.values", function(v) { }; m.prototype.addOutputs = function(a) { for (var b = 0; b < a.length; ++b) { +<<<<<<< HEAD var d = a[b], g = {name:d[0], type:d[1], link:null}; if (a[2]) { for (var f in d[2]) { @@ -1578,6 +1933,18 @@ $jscomp.polyfill("Object.values", function(v) { this.outputs.push(g); if (this.onOutputAdded) { this.onOutputAdded(g); +======= + var d = a[b], h = {name:d[0], type:d[1], link:null}; + if (a[2]) { + for (var f in d[2]) { + h[f] = d[2][f]; + } + } + this.outputs || (this.outputs = []); + this.outputs.push(h); + if (this.onOutputAdded) { + this.onOutputAdded(h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } this.size = this.computeSize(); @@ -1588,8 +1955,13 @@ $jscomp.polyfill("Object.values", function(v) { this.outputs.splice(a, 1); for (var b = a; b < this.outputs.length; ++b) { if (this.outputs[b] && this.outputs[b].links) { +<<<<<<< HEAD for (var d = this.outputs[b].links, g = 0; g < d.length; ++g) { var f = this.graph.links[d[g]]; +======= + for (var d = this.outputs[b].links, h = 0; h < d.length; ++h) { + var f = this.graph.links[d[h]]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 f && --f.origin_slot; } } @@ -1603,8 +1975,13 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.addInput = function(a, b, d) { a = {name:a, type:b || 0, link:null}; if (d) { +<<<<<<< HEAD for (var g in d) { a[g] = d[g]; +======= + for (var h in d) { + a[h] = d[h]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } this.inputs || (this.inputs = []); @@ -1618,6 +1995,7 @@ $jscomp.polyfill("Object.values", function(v) { }; m.prototype.addInputs = function(a) { for (var b = 0; b < a.length; ++b) { +<<<<<<< HEAD var d = a[b], g = {name:d[0], type:d[1], link:null}; if (a[2]) { for (var f in d[2]) { @@ -1628,6 +2006,18 @@ $jscomp.polyfill("Object.values", function(v) { this.inputs.push(g); if (this.onInputAdded) { this.onInputAdded(g); +======= + var d = a[b], h = {name:d[0], type:d[1], link:null}; + if (a[2]) { + for (var f in d[2]) { + h[f] = d[2][f]; + } + } + this.inputs || (this.inputs = []); + this.inputs.push(h); + if (this.onInputAdded) { + this.onInputAdded(h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } this.size = this.computeSize(); @@ -1648,14 +2038,23 @@ $jscomp.polyfill("Object.values", function(v) { } this.setDirtyCanvas(!0, !0); }; +<<<<<<< HEAD m.prototype.addConnection = function(a, b, d, g) { a = {name:a, type:b, pos:d, direction:g, links:null}; +======= + m.prototype.addConnection = function(a, b, d, h) { + a = {name:a, type:b, pos:d, direction:h, links:null}; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.connections.push(a); return a; }; m.prototype.computeSize = function(a, b) { function d(a) { +<<<<<<< HEAD return a ? g * a.length * 0.6 : 0; +======= + return a ? h * a.length * 0.6 : 0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } if (this.constructor.size) { return this.constructor.size.concat(); @@ -1663,7 +2062,11 @@ $jscomp.polyfill("Object.values", function(v) { a = Math.max(this.inputs ? this.inputs.length : 1, this.outputs ? this.outputs.length : 1); b = b || new Float32Array([0, 0]); a = Math.max(a, 1); +<<<<<<< HEAD var g = e.NODE_TEXT_SIZE, f = d(this.title), c = 0, k = 0; +======= + var h = e.NODE_TEXT_SIZE, f = d(this.title), c = 0, k = 0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.inputs) { for (var n = 0, p = this.inputs.length; n < p; ++n) { var l = this.inputs[n]; @@ -1713,6 +2116,7 @@ $jscomp.polyfill("Object.values", function(v) { b.type || (b.type = typeof this.properties[a]); return b; }; +<<<<<<< HEAD m.prototype.addWidget = function(a, b, d, g, f) { this.widgets || (this.widgets = []); !f && g && g.constructor === Object && (f = g, g = null); @@ -1722,6 +2126,17 @@ $jscomp.polyfill("Object.values", function(v) { b = {type:a.toLowerCase(), name:b, value:d, callback:g, options:f || {}}; void 0 !== b.options.y && (b.y = b.options.y); g || b.options.callback || b.options.property || console.warn("LiteGraph addWidget(...) without a callback or property assigned"); +======= + m.prototype.addWidget = function(a, b, d, h, f) { + this.widgets || (this.widgets = []); + !f && h && h.constructor === Object && (f = h, h = null); + f && f.constructor === String && (f = {property:f}); + h && h.constructor === String && (f || (f = {}), f.property = h, h = null); + h && h.constructor !== Function && (console.warn("addWidget: callback must be a function"), h = null); + b = {type:a.toLowerCase(), name:b, value:d, callback:h, options:f || {}}; + void 0 !== b.options.y && (b.y = b.options.y); + h || b.options.callback || b.options.property || console.warn("LiteGraph addWidget(...) without a callback or property assigned"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if ("combo" == a && !b.options.values) { throw "LiteGraph addWidget('combo',...) requires to pass values in options: { values:['red','blue'] }"; } @@ -1745,10 +2160,17 @@ $jscomp.polyfill("Object.values", function(v) { } return a; }; +<<<<<<< HEAD m.prototype.isPointInside = function(a, b, d, g) { d = d || 0; var f = this.graph && this.graph.isLive() ? 0 : e.NODE_TITLE_HEIGHT; g && (f = 0); +======= + m.prototype.isPointInside = function(a, b, d, h) { + d = d || 0; + var f = this.graph && this.graph.isLive() ? 0 : e.NODE_TITLE_HEIGHT; + h && (f = 0); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.flags && this.flags.collapsed) { if (y(a, b, this.pos[0] - d, this.pos[1] - e.NODE_TITLE_HEIGHT - d, (this._collapsed_width || e.NODE_COLLAPSED_WIDTH) + 2 * d, e.NODE_TITLE_HEIGHT + 2 * d)) { return !0; @@ -1763,18 +2185,32 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.getSlotInPosition = function(a, b) { var d = new Float32Array(2); if (this.inputs) { +<<<<<<< HEAD for (var g = 0, f = this.inputs.length; g < f; ++g) { var e = this.inputs[g]; this.getConnectionPos(!0, g, d); if (y(a, b, d[0] - 10, d[1] - 5, 20, 10)) { return {input:e, slot:g, link_pos:d}; +======= + for (var h = 0, f = this.inputs.length; h < f; ++h) { + var e = this.inputs[h]; + this.getConnectionPos(!0, h, d); + if (y(a, b, d[0] - 10, d[1] - 5, 20, 10)) { + return {input:e, slot:h, link_pos:d}; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } if (this.outputs) { +<<<<<<< HEAD for (g = 0, f = this.outputs.length; g < f; ++g) { if (e = this.outputs[g], this.getConnectionPos(!1, g, d), y(a, b, d[0] - 10, d[1] - 5, 20, 10)) { return {output:e, slot:g, link_pos:d}; +======= + for (h = 0, f = this.outputs.length; h < f; ++h) { + if (e = this.outputs[h], this.getConnectionPos(!1, h, d), y(a, b, d[0] - 10, d[1] - 5, 20, 10)) { + return {output:e, slot:h, link_pos:d}; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -1836,6 +2272,7 @@ $jscomp.polyfill("Object.values", function(v) { } } null != b.inputs[d].link && b.disconnectInput(d); +<<<<<<< HEAD var g = this.outputs[a]; if (b.onConnectInput && !1 === b.onConnectInput(d, g.type, g, this, a)) { return null; @@ -1850,6 +2287,22 @@ $jscomp.polyfill("Object.values", function(v) { this.graph && this.graph._version++; if (this.onConnectionsChange) { this.onConnectionsChange(e.OUTPUT, a, !0, c, g); +======= + var h = this.outputs[a]; + if (b.onConnectInput && !1 === b.onConnectInput(d, h.type, h)) { + return null; + } + var f = b.inputs[d], c = null; + if (e.isValidConnection(h.type, f.type)) { + c = new q(++this.graph.last_link_id, f.type, this.id, a, b.id, d); + this.graph.links[c.id] = c; + null == h.links && (h.links = []); + h.links.push(c.id); + b.inputs[d].link = c.id; + this.graph && this.graph._version++; + if (this.onConnectionsChange) { + this.onConnectionsChange(e.OUTPUT, a, !0, c, h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } if (b.onConnectionsChange) { b.onConnectionsChange(e.INPUT, d, !0, c, f); @@ -1879,10 +2332,17 @@ $jscomp.polyfill("Object.values", function(v) { if (!b) { throw "Target Node not found"; } +<<<<<<< HEAD for (var g = 0, f = d.links.length; g < f; g++) { var c = d.links[g], k = this.graph.links[c]; if (k.target_id == b.id) { d.links.splice(g, 1); +======= + for (var h = 0, f = d.links.length; h < f; h++) { + var c = d.links[h], k = this.graph.links[c]; + if (k.target_id == b.id) { + d.links.splice(h, 1); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var n = b.inputs[k.target_slot]; n.link = null; delete this.graph.links[c]; @@ -1901,9 +2361,15 @@ $jscomp.polyfill("Object.values", function(v) { } } } else { +<<<<<<< HEAD g = 0; for (f = d.links.length; g < f; g++) { if (c = d.links[g], k = this.graph.links[c]) { +======= + h = 0; + for (f = d.links.length; h < f; h++) { + if (c = d.links[h], k = this.graph.links[c]) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b = this.graph.getNodeById(k.target_id); this.graph && this.graph._version++; if (b) { @@ -1945,6 +2411,7 @@ $jscomp.polyfill("Object.values", function(v) { } var d = this.inputs[a].link; this.inputs[a].link = null; +<<<<<<< HEAD var g = this.graph.links[d]; if (g) { var f = this.graph.getNodeById(g.origin_id); @@ -1952,6 +2419,15 @@ $jscomp.polyfill("Object.values", function(v) { return !1; } var c = f.outputs[g.origin_slot]; +======= + var h = this.graph.links[d]; + if (h) { + var f = this.graph.getNodeById(h.origin_id); + if (!f) { + return !1; + } + var c = f.outputs[h.origin_slot]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (!c || !c.links || 0 == c.links.length) { return !1; } @@ -1964,10 +2440,17 @@ $jscomp.polyfill("Object.values", function(v) { delete this.graph.links[d]; this.graph && this.graph._version++; if (this.onConnectionsChange) { +<<<<<<< HEAD this.onConnectionsChange(e.INPUT, a, !1, g, b); } if (f.onConnectionsChange) { f.onConnectionsChange(e.OUTPUT, k, !1, g, c); +======= + this.onConnectionsChange(e.INPUT, a, !1, h, b); + } + if (f.onConnectionsChange) { + f.onConnectionsChange(e.OUTPUT, k, !1, h, c); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } this.graph && this.graph.onNodeConnectionChange && (this.graph.onNodeConnectionChange(e.OUTPUT, f, k), this.graph.onNodeConnectionChange(e.INPUT, this, a)); } @@ -1977,9 +2460,15 @@ $jscomp.polyfill("Object.values", function(v) { }; m.prototype.getConnectionPos = function(a, b, d) { d = d || new Float32Array(2); +<<<<<<< HEAD var g = 0; a && this.inputs && (g = this.inputs.length); !a && this.outputs && (g = this.outputs.length); +======= + var h = 0; + a && this.inputs && (h = this.inputs.length); + !a && this.outputs && (h = this.outputs.length); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var f = 0.5 * e.NODE_SLOT_HEIGHT; if (this.flags.collapsed) { return b = this._collapsed_width || e.NODE_COLLAPSED_WIDTH, this.horizontal ? (d[0] = this.pos[0] + 0.5 * b, d[1] = a ? this.pos[1] - e.NODE_TITLE_HEIGHT : this.pos[1]) : (d[0] = a ? this.pos[0] : this.pos[0] + b, d[1] = this.pos[1] - 0.5 * e.NODE_TITLE_HEIGHT), d; @@ -1987,6 +2476,7 @@ $jscomp.polyfill("Object.values", function(v) { if (a && -1 == b) { return d[0] = this.pos[0] + 0.5 * e.NODE_TITLE_HEIGHT, d[1] = this.pos[1] + 0.5 * e.NODE_TITLE_HEIGHT, d; } +<<<<<<< HEAD if (a && g > b && this.inputs[b].pos) { return d[0] = this.pos[0] + this.inputs[b].pos[0], d[1] = this.pos[1] + this.inputs[b].pos[1], d; } @@ -1995,6 +2485,16 @@ $jscomp.polyfill("Object.values", function(v) { } if (this.horizontal) { return d[0] = this.pos[0] + this.size[0] / g * (b + 0.5), d[1] = a ? this.pos[1] - e.NODE_TITLE_HEIGHT : this.pos[1] + this.size[1], d; +======= + if (a && h > b && this.inputs[b].pos) { + return d[0] = this.pos[0] + this.inputs[b].pos[0], d[1] = this.pos[1] + this.inputs[b].pos[1], d; + } + if (!a && h > b && this.outputs[b].pos) { + return d[0] = this.pos[0] + this.outputs[b].pos[0], d[1] = this.pos[1] + this.outputs[b].pos[1], d; + } + if (this.horizontal) { + return d[0] = this.pos[0] + this.size[0] / h * (b + 0.5), d[1] = a ? this.pos[1] - e.NODE_TITLE_HEIGHT : this.pos[1] + this.size[1], d; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } d[0] = a ? this.pos[0] + f : this.pos[0] + this.size[0] + 1 - f; d[1] = this.pos[1] + (b + 0.7) * e.NODE_SLOT_HEIGHT + (this.constructor.slot_start_y || 0); @@ -2027,9 +2527,15 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.captureInput = function(a) { if (this.graph && this.graph.list_of_graphcanvas) { for (var b = this.graph.list_of_graphcanvas, d = 0; d < b.length; ++d) { +<<<<<<< HEAD var g = b[d]; if (a || g.node_capturing_input == this) { g.node_capturing_input = a ? this : null; +======= + var h = b[d]; + if (a || h.node_capturing_input == this) { + h.node_capturing_input = a ? this : null; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -2047,8 +2553,13 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.localToScreen = function(a, b, d) { return [(a + this.pos[0]) * d.scale + d.offset[0], (b + this.pos[1]) * d.scale + d.offset[1]]; }; +<<<<<<< HEAD v.LGraphGroup = e.LGraphGroup = h; h.prototype._ctor = function(a) { +======= + v.LGraphGroup = e.LGraphGroup = g; + g.prototype._ctor = function(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.title = a || "Group"; this.font_size = 24; this.color = l.node_colors.pale_blue ? l.node_colors.pale_blue.groupcolor : "#AAA"; @@ -2068,21 +2579,34 @@ $jscomp.polyfill("Object.values", function(v) { return this._size; }, enumerable:!0}); }; +<<<<<<< HEAD h.prototype.configure = function(a) { +======= + g.prototype.configure = function(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.title = a.title; this._bounding.set(a.bounding); this.color = a.color; this.font = a.font; }; +<<<<<<< HEAD h.prototype.serialize = function() { var a = this._bounding; return {title:this.title, bounding:[Math.round(a[0]), Math.round(a[1]), Math.round(a[2]), Math.round(a[3])], color:this.color, font:this.font}; }; h.prototype.move = function(a, b, d) { +======= + g.prototype.serialize = function() { + var a = this._bounding; + return {title:this.title, bounding:[Math.round(a[0]), Math.round(a[1]), Math.round(a[2]), Math.round(a[3])], color:this.color, font:this.font}; + }; + g.prototype.move = function(a, b, d) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._pos[0] += a; this._pos[1] += b; if (!d) { for (d = 0; d < this._nodes.length; ++d) { +<<<<<<< HEAD var g = this._nodes[d]; g.pos[0] += a; g.pos[1] += b; @@ -2099,6 +2623,24 @@ $jscomp.polyfill("Object.values", function(v) { }; h.prototype.isPointInside = m.prototype.isPointInside; h.prototype.setDirtyCanvas = m.prototype.setDirtyCanvas; +======= + var h = this._nodes[d]; + h.pos[0] += a; + h.pos[1] += b; + } + } + }; + g.prototype.recomputeInsideNodes = function() { + this._nodes.length = 0; + for (var a = this.graph._nodes, b = new Float32Array(4), d = 0; d < a.length; ++d) { + var h = a[d]; + h.getBounding(b); + w(this._bounding, b) && this._nodes.push(h); + } + }; + g.prototype.isPointInside = m.prototype.isPointInside; + g.prototype.setDirtyCanvas = m.prototype.setDirtyCanvas; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e.DragAndScale = r; r.prototype.bindEvents = function(a) { this.last_mouse = new Float32Array(2); @@ -2110,20 +2652,34 @@ $jscomp.polyfill("Object.values", function(v) { }; r.prototype.computeVisibleArea = function() { if (this.element) { +<<<<<<< HEAD var a = -this.offset[0], b = -this.offset[1], d = a + this.element.width / this.scale, g = b + this.element.height / this.scale; this.visible_area[0] = a; this.visible_area[1] = b; this.visible_area[2] = d - a; this.visible_area[3] = g - b; +======= + var a = -this.offset[0], b = -this.offset[1], d = a + this.element.width / this.scale, h = b + this.element.height / this.scale; + this.visible_area[0] = a; + this.visible_area[1] = b; + this.visible_area[2] = d - a; + this.visible_area[3] = h - b; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } else { this.visible_area[0] = this.visible_area[1] = this.visible_area[2] = this.visible_area[3] = 0; } }; r.prototype.onMouse = function(a) { if (this.enabled) { +<<<<<<< HEAD var b = this.element, d = b.getBoundingClientRect(), g = a.clientX - d.left; d = a.clientY - d.top; a.canvasx = g; +======= + var b = this.element, d = b.getBoundingClientRect(), h = a.clientX - d.left; + d = a.clientY - d.top; + a.canvasx = h; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.canvasy = d; a.dragging = this.dragging; var f = !1; @@ -2132,7 +2688,11 @@ $jscomp.polyfill("Object.values", function(v) { this.dragging = !0, b.removeEventListener("mousemove", this._binded_mouse_callback), document.body.addEventListener("mousemove", this._binded_mouse_callback), document.body.addEventListener("mouseup", this._binded_mouse_callback); } else { if ("mousemove" == a.type) { +<<<<<<< HEAD f || (b = g - this.last_mouse[0], f = d - this.last_mouse[1], this.dragging && this.mouseDrag(b, f)); +======= + f || (b = h - this.last_mouse[0], f = d - this.last_mouse[1], this.dragging && this.mouseDrag(b, f)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } else { if ("mouseup" == a.type) { this.dragging = !1, document.body.removeEventListener("mousemove", this._binded_mouse_callback), document.body.removeEventListener("mouseup", this._binded_mouse_callback), b.addEventListener("mousemove", this._binded_mouse_callback); @@ -2143,7 +2703,11 @@ $jscomp.polyfill("Object.values", function(v) { } } } +<<<<<<< HEAD this.last_mouse[0] = g; +======= + this.last_mouse[0] = h; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.last_mouse[1] = d; a.preventDefault(); a.stopPropagation(); @@ -2356,13 +2920,18 @@ $jscomp.polyfill("Object.values", function(v) { this.canvas.removeEventListener("mousemove", this._mousemove_callback); b.document.addEventListener("mousemove", this._mousemove_callback, !0); b.document.addEventListener("mouseup", this._mouseup_callback, !0); +<<<<<<< HEAD var d = this.graph.getNodeOnPos(a.canvasX, a.canvasY, this.visible_nodes, 5), g = !1, f = 300 > e.getTime() - this.last_mouseclick; +======= + var d = this.graph.getNodeOnPos(a.canvasX, a.canvasY, this.visible_nodes, 5), h = !1, f = 300 > e.getTime() - this.last_mouseclick; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.canvas_mouse[0] = a.canvasX; this.canvas_mouse[1] = a.canvasY; this.canvas.focus(); e.closeAllContextMenus(b); if (!this.onMouse || 1 != this.onMouse(a)) { if (1 == a.which) { +<<<<<<< HEAD a.ctrlKey && (this.dragging_rectangle = new Float32Array(4), this.dragging_rectangle[0] = a.canvasX, this.dragging_rectangle[1] = a.canvasY, this.dragging_rectangle[2] = 1, this.dragging_rectangle[3] = 1, g = !0); var c = !1; if (d && this.allow_interaction && !g && !this.read_only) { @@ -2375,6 +2944,20 @@ $jscomp.polyfill("Object.values", function(v) { for (var k = 0, n = d.outputs.length; k < n; ++k) { var p = d.outputs[k], h = d.getConnectionPos(!1, k); if (y(a.canvasX, a.canvasY, h[0] - 15, h[1] - 10, 30, 20)) { +======= + a.ctrlKey && (this.dragging_rectangle = new Float32Array(4), this.dragging_rectangle[0] = a.canvasX, this.dragging_rectangle[1] = a.canvasY, this.dragging_rectangle[2] = 1, this.dragging_rectangle[3] = 1, h = !0); + var c = !1; + if (d && this.allow_interaction && !h && !this.read_only) { + this.live_mode || d.flags.pinned || this.bringToFront(d); + if (!this.connecting_node && !d.flags.collapsed && !this.live_mode) { + if (!h && !1 !== d.resizable && y(a.canvasX, a.canvasY, d.pos[0] + d.size[0] - 5, d.pos[1] + d.size[1] - 5, 10, 10)) { + this.resizing_node = d, this.canvas.style.cursor = "se-resize", h = !0; + } else { + if (d.outputs) { + for (var k = 0, n = d.outputs.length; k < n; ++k) { + var p = d.outputs[k], g = d.getConnectionPos(!1, k); + if (y(a.canvasX, a.canvasY, g[0] - 15, g[1] - 10, 30, 20)) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.connecting_node = d; this.connecting_output = p; this.connecting_pos = d.getConnectionPos(!1, k); @@ -2389,14 +2972,22 @@ $jscomp.polyfill("Object.values", function(v) { d.onOutputClick(k, a); } } +<<<<<<< HEAD g = !0; +======= + h = !0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; } } } if (d.inputs) { for (k = 0, n = d.inputs.length; k < n; ++k) { +<<<<<<< HEAD if (p = d.inputs[k], h = d.getConnectionPos(!0, k), y(a.canvasX, a.canvasY, h[0] - 15, h[1] - 10, 30, 20)) { +======= + if (p = d.inputs[k], g = d.getConnectionPos(!0, k), y(a.canvasX, a.canvasY, g[0] - 15, g[1] - 10, 30, 20)) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (f) { if (d.onInputDblClick) { d.onInputDblClick(k, a); @@ -2407,19 +2998,32 @@ $jscomp.polyfill("Object.values", function(v) { } } if (null !== p.link) { +<<<<<<< HEAD g = this.graph.links[p.link]; d.disconnectInput(k); if (this.allow_reconnect_links || a.shiftKey) { this.connecting_node = this.graph._nodes_by_id[g.origin_id], this.connecting_slot = g.origin_slot, this.connecting_output = this.connecting_node.outputs[this.connecting_slot], this.connecting_pos = this.connecting_node.getConnectionPos(!1, this.connecting_slot); } g = this.dirty_bgcanvas = !0; +======= + h = this.graph.links[p.link]; + d.disconnectInput(k); + if (this.allow_reconnect_links || a.shiftKey) { + this.connecting_node = this.graph._nodes_by_id[h.origin_id], this.connecting_slot = h.origin_slot, this.connecting_output = this.connecting_node.outputs[this.connecting_slot], this.connecting_pos = this.connecting_node.getConnectionPos(!1, this.connecting_slot); + } + h = this.dirty_bgcanvas = !0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } } } } +<<<<<<< HEAD if (!g) { +======= + if (!h) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 k = !1; if (n = this.processNodeWidgets(d, this.canvas_mouse, a)) { k = !0, this.node_widget = [d, n]; @@ -2451,7 +3055,11 @@ $jscomp.polyfill("Object.values", function(v) { f && !this.read_only && this.allow_searchbox && this.showSearchBox(a); c = !0; } +<<<<<<< HEAD !g && c && this.allow_dragcanvas && (this.dragging_canvas = !0); +======= + !h && c && this.allow_dragcanvas && (this.dragging_canvas = !0); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } else { 2 != a.which && 3 == a.which && (this.read_only || this.processContextMenu(d, a)); } @@ -2491,10 +3099,17 @@ $jscomp.polyfill("Object.values", function(v) { } else { if (this.allow_interaction && !this.read_only) { this.connecting_node && (this.dirty_canvas = !0); +<<<<<<< HEAD var g = this.graph.getNodeOnPos(a.canvasX, a.canvasY, this.visible_nodes); b = 0; for (var f = this.graph._nodes.length; b < f; ++b) { if (this.graph._nodes[b].mouseOver && g != this.graph._nodes[b]) { +======= + var h = this.graph.getNodeOnPos(a.canvasX, a.canvasY, this.visible_nodes); + b = 0; + for (var f = this.graph._nodes.length; b < f; ++b) { + if (this.graph._nodes[b].mouseOver && h != this.graph._nodes[b]) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.graph._nodes[b].mouseOver = !1; if (this.node_over && this.node_over.onMouseLeave) { this.node_over.onMouseLeave(a); @@ -2503,6 +3118,7 @@ $jscomp.polyfill("Object.values", function(v) { this.dirty_canvas = !0; } } +<<<<<<< HEAD if (g) { if (!g.mouseOver && (g.mouseOver = !0, this.node_over = g, this.dirty_canvas = !0, g.onMouseEnter)) { g.onMouseEnter(a); @@ -2515,6 +3131,20 @@ $jscomp.polyfill("Object.values", function(v) { -1 != c && g.inputs[c] ? e.isValidConnection(this.connecting_output.type, g.inputs[c].type) && (this._highlight_input = f) : this._highlight_input = null; } this.canvas && (y(a.canvasX, a.canvasY, g.pos[0] + g.size[0] - 5, g.pos[1] + g.size[1] - 5, 5, 5) ? this.canvas.style.cursor = "se-resize" : this.canvas.style.cursor = "crosshair"); +======= + if (h) { + if (!h.mouseOver && (h.mouseOver = !0, this.node_over = h, this.dirty_canvas = !0, h.onMouseEnter)) { + h.onMouseEnter(a); + } + if (h.onMouseMove) { + h.onMouseMove(a, [a.canvasX - h.pos[0], a.canvasY - h.pos[1]], this); + } + if (this.connecting_node && (f = this._highlight_input || [0, 0], !this.isOverNodeBox(h, a.canvasX, a.canvasY))) { + var c = this.isOverNodeInput(h, a.canvasX, a.canvasY, f); + -1 != c && h.inputs[c] ? e.isValidConnection(this.connecting_output.type, h.inputs[c].type) && (this._highlight_input = f) : this._highlight_input = null; + } + this.canvas && (y(a.canvasX, a.canvasY, h.pos[0] + h.size[0] - 5, h.pos[1] + h.size[1] - 5, 5, 5) ? this.canvas.style.cursor = "se-resize" : this.canvas.style.cursor = "crosshair"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } else { f = null; for (b = 0; b < this.visible_links.length; ++b) { @@ -2528,12 +3158,20 @@ $jscomp.polyfill("Object.values", function(v) { f != this.over_link_center && (this.over_link_center = f, this.dirty_canvas = !0); this.canvas && (this.canvas.style.cursor = ""); } +<<<<<<< HEAD if (this.node_capturing_input && this.node_capturing_input != g && this.node_capturing_input.onMouseMove) { +======= + if (this.node_capturing_input && this.node_capturing_input != h && this.node_capturing_input.onMouseMove) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.node_capturing_input.onMouseMove(a, [a.canvasX - this.node_capturing_input.pos[0], a.canvasY - this.node_capturing_input.pos[1]], this); } if (this.node_dragged && !this.live_mode) { for (b in this.selected_nodes) { +<<<<<<< HEAD g = this.selected_nodes[b], g.pos[0] += d[0] / this.ds.scale, g.pos[1] += d[1] / this.ds.scale; +======= + h = this.selected_nodes[b], h.pos[0] += d[0] / this.ds.scale, h.pos[1] += d[1] / this.ds.scale; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } this.dirty_bgcanvas = this.dirty_canvas = !0; } @@ -2542,6 +3180,7 @@ $jscomp.polyfill("Object.values", function(v) { this.resizing_node.size[1] = a.canvasY - this.resizing_node.pos[1]; d = Math.max(this.resizing_node.inputs ? this.resizing_node.inputs.length : 0, this.resizing_node.outputs ? this.resizing_node.outputs.length : 0); this.resizing_node.size[0] < e.NODE_MIN_WIDTH && (this.resizing_node.size[0] = e.NODE_MIN_WIDTH); +<<<<<<< HEAD g = this.resizing_node.widgets; c = 0; if (g && g.length) { @@ -2555,6 +3194,19 @@ $jscomp.polyfill("Object.values", function(v) { var n = d * e.NODE_SLOT_HEIGHT + c; this.resizing_node.size[1] = n; } +======= + h = this.resizing_node.widgets; + c = 0; + if (h && h.length) { + b = 0; + for (f = h.length; b < f; ++b) { + c = h[b].computeSize ? c + (h[b].computeSize(this.resizing_node.size[0])[1] + 4) : c + (e.NODE_WIDGET_HEIGHT + 4); + } + c += 8; + } + b = d * e.NODE_SLOT_HEIGHT + c; + this.resizing_node.size[1] < b && (this.resizing_node.size[1] = b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.canvas.style.cursor = "se-resize"; this.dirty_bgcanvas = this.dirty_canvas = !0; } @@ -2584,6 +3236,7 @@ $jscomp.polyfill("Object.values", function(v) { b = this.graph._nodes; var d = new Float32Array(4); this.deselectAllNodes(); +<<<<<<< HEAD var g = Math.abs(this.dragging_rectangle[2]), f = Math.abs(this.dragging_rectangle[3]), c = 0 > this.dragging_rectangle[3] ? this.dragging_rectangle[1] - f : this.dragging_rectangle[1]; this.dragging_rectangle[0] = 0 > this.dragging_rectangle[2] ? this.dragging_rectangle[0] - g : this.dragging_rectangle[0]; this.dragging_rectangle[1] = c; @@ -2592,6 +3245,16 @@ $jscomp.polyfill("Object.values", function(v) { f = []; for (c = 0; c < b.length; ++c) { g = b[c], g.getBounding(d), w(this.dragging_rectangle, d) && f.push(g); +======= + var h = Math.abs(this.dragging_rectangle[2]), f = Math.abs(this.dragging_rectangle[3]), c = 0 > this.dragging_rectangle[3] ? this.dragging_rectangle[1] - f : this.dragging_rectangle[1]; + this.dragging_rectangle[0] = 0 > this.dragging_rectangle[2] ? this.dragging_rectangle[0] - h : this.dragging_rectangle[0]; + this.dragging_rectangle[1] = c; + this.dragging_rectangle[2] = h; + this.dragging_rectangle[3] = f; + f = []; + for (c = 0; c < b.length; ++c) { + h = b[c], h.getBounding(d), w(this.dragging_rectangle, d) && f.push(h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } f.length && this.selectNodes(f); } @@ -2599,9 +3262,15 @@ $jscomp.polyfill("Object.values", function(v) { } else { if (this.connecting_node) { this.dirty_bgcanvas = this.dirty_canvas = !0; +<<<<<<< HEAD if (g = this.graph.getNodeOnPos(a.canvasX, a.canvasY, this.visible_nodes)) { this.connecting_output.type == e.EVENT && this.isOverNodeBox(g, a.canvasX, a.canvasY) ? this.connecting_node.connect(this.connecting_slot, g, e.EVENT) : (b = this.isOverNodeInput(g, a.canvasX, a.canvasY), -1 != b ? this.connecting_node.connect(this.connecting_slot, g, b) : (b = g.getInputInfo(0), this.connecting_output.type == e.EVENT ? this.connecting_node.connect(this.connecting_slot, g, e.EVENT) : b && !b.link && e.isValidConnection(b.type && this.connecting_output.type) && this.connecting_node.connect(this.connecting_slot, g, 0))); +======= + if (h = this.graph.getNodeOnPos(a.canvasX, a.canvasY, this.visible_nodes)) { + this.connecting_output.type == e.EVENT && this.isOverNodeBox(h, a.canvasX, a.canvasY) ? this.connecting_node.connect(this.connecting_slot, h, e.EVENT) : (b = this.isOverNodeInput(h, a.canvasX, a.canvasY), -1 != b ? this.connecting_node.connect(this.connecting_slot, h, b) : (b = h.getInputInfo(0), this.connecting_output.type == e.EVENT ? this.connecting_node.connect(this.connecting_slot, h, e.EVENT) : b && !b.link && e.isValidConnection(b.type && this.connecting_output.type) && this.connecting_node.connect(this.connecting_slot, + h, 0))); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } this.connecting_node = this.connecting_pos = this.connecting_output = null; this.connecting_slot = -1; @@ -2610,7 +3279,11 @@ $jscomp.polyfill("Object.values", function(v) { this.dirty_bgcanvas = this.dirty_canvas = !0, this.resizing_node = null; } else { if (this.node_dragged) { +<<<<<<< HEAD (g = this.node_dragged) && 300 > a.click_time && y(a.canvasX, a.canvasY, g.pos[0], g.pos[1] - e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT) && g.collapse(); +======= + (h = this.node_dragged) && 300 > a.click_time && y(a.canvasX, a.canvasY, h.pos[0], h.pos[1] - e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT) && h.collapse(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.dirty_bgcanvas = this.dirty_canvas = !0; this.node_dragged.pos[0] = Math.round(this.node_dragged.pos[0]); this.node_dragged.pos[1] = Math.round(this.node_dragged.pos[1]); @@ -2620,8 +3293,13 @@ $jscomp.polyfill("Object.values", function(v) { } this.node_dragged = null; } else { +<<<<<<< HEAD g = this.graph.getNodeOnPos(a.canvasX, a.canvasY, this.visible_nodes); !g && 300 > a.click_time && this.deselectAllNodes(); +======= + h = this.graph.getNodeOnPos(a.canvasX, a.canvasY, this.visible_nodes); + !h && 300 > a.click_time && this.deselectAllNodes(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.dirty_canvas = !0; this.dragging_canvas = !1; if (this.node_over && this.node_over.onMouseUp) { @@ -2656,15 +3334,26 @@ $jscomp.polyfill("Object.values", function(v) { } }; l.prototype.isOverNodeBox = function(a, b, d) { +<<<<<<< HEAD var g = e.NODE_TITLE_HEIGHT; return y(b, d, a.pos[0] + 2, a.pos[1] + 2 - g, g - 4, g - 4) ? !0 : !1; }; l.prototype.isOverNodeInput = function(a, b, d, g) { +======= + var h = e.NODE_TITLE_HEIGHT; + return y(b, d, a.pos[0] + 2, a.pos[1] + 2 - h, h - 4, h - 4) ? !0 : !1; + }; + l.prototype.isOverNodeInput = function(a, b, d, h) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (a.inputs) { for (var f = 0, e = a.inputs.length; f < e; ++f) { var c = a.getConnectionPos(!0, f); if (a.horizontal ? y(b, d, c[0] - 5, c[1] - 10, 10, 20) : y(b, d, c[0] - 10, c[1] - 5, 40, 10)) { +<<<<<<< HEAD return g && (g[0] = c[0], g[1] = c[1]), f; +======= + return h && (h[0] = c[0], h[1] = c[1]), f; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -2699,15 +3388,26 @@ $jscomp.polyfill("Object.values", function(v) { } }; l.prototype.copyToClipboard = function() { +<<<<<<< HEAD var a = {nodes:[], links:[]}, b = 0, d = [], g; for (g in this.selected_nodes) { var f = this.selected_nodes[g]; +======= + var a = {nodes:[], links:[]}, b = 0, d = [], h; + for (h in this.selected_nodes) { + var f = this.selected_nodes[h]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 f._relative_id = b; d.push(f); b += 1; } +<<<<<<< HEAD for (g = 0; g < d.length; ++g) { if (f = d[g], b = f.clone()) { +======= + for (h = 0; h < d.length; ++h) { + if (f = d[h], b = f.clone()) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (a.nodes.push(b.serialize()), f.inputs && f.inputs.length) { for (b = 0; b < f.inputs.length; ++b) { var e = f.inputs[b]; @@ -2728,6 +3428,7 @@ $jscomp.polyfill("Object.values", function(v) { if (a) { a = JSON.parse(a); for (var b = [], d = 0; d < a.nodes.length; ++d) { +<<<<<<< HEAD var g = a.nodes[d], f = e.createNode(g.type); f && (f.configure(g), f.pos[0] += 5, f.pos[1] += 5, this.graph.add(f), b.push(f)); } @@ -2736,6 +3437,16 @@ $jscomp.polyfill("Object.values", function(v) { f = b[g[0]]; var c = b[g[2]]; f && c ? f.connect(g[1], c, g[3]) : console.warn("Warning, nodes missing on pasting"); +======= + var h = a.nodes[d], f = e.createNode(h.type); + f && (f.configure(h), f.pos[0] += 5, f.pos[1] += 5, this.graph.add(f), b.push(f)); + } + for (d = 0; d < a.links.length; ++d) { + h = a.links[d]; + f = b[h[0]]; + var c = b[h[2]]; + f && c ? f.connect(h[1], c, h[3]) : console.warn("Warning, nodes missing on pasting"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } this.selectNodes(b); } @@ -2746,7 +3457,11 @@ $jscomp.polyfill("Object.values", function(v) { var b = [a.canvasX, a.canvasY], d = this.graph.getNodeOnPos(b[0], b[1]); if (d) { if ((d.onDropFile || d.onDropData) && (b = a.dataTransfer.files) && b.length) { +<<<<<<< HEAD for (var g = 0; g < b.length; g++) { +======= + for (var h = 0; h < b.length; h++) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var f = a.dataTransfer.files[0], e = f.name; l.getFileExtension(e); if (d.onDropFile) { @@ -2808,6 +3523,7 @@ $jscomp.polyfill("Object.values", function(v) { d.is_selected = !0; this.selected_nodes[d.id] = d; if (d.inputs) { +<<<<<<< HEAD for (var g = 0; g < d.inputs.length; ++g) { this.highlighted_links[d.inputs[g].link] = !0; } @@ -2815,6 +3531,15 @@ $jscomp.polyfill("Object.values", function(v) { if (d.outputs) { for (g = 0; g < d.outputs.length; ++g) { var f = d.outputs[g]; +======= + for (var h = 0; h < d.inputs.length; ++h) { + this.highlighted_links[d.inputs[h].link] = !0; + } + } + if (d.outputs) { + for (h = 0; h < d.outputs.length; ++h) { + var f = d.outputs[h]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (f.links) { for (var e = 0; e < f.links.length; ++e) { this.highlighted_links[f.links[e]] = !0; @@ -2847,8 +3572,13 @@ $jscomp.polyfill("Object.values", function(v) { for (b = 0; b < a.outputs.length; ++b) { var d = a.outputs[b]; if (d.links) { +<<<<<<< HEAD for (var g = 0; g < d.links.length; ++g) { delete this.highlighted_links[d.links[g]]; +======= + for (var h = 0; h < d.links.length; ++h) { + delete this.highlighted_links[d.links[h]]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -2858,6 +3588,7 @@ $jscomp.polyfill("Object.values", function(v) { l.prototype.deselectAllNodes = function() { if (this.graph) { for (var a = this.graph._nodes, b = 0, d = a.length; b < d; ++b) { +<<<<<<< HEAD var g = a[b]; if (g.is_selected) { if (g.onDeselected) { @@ -2866,6 +3597,16 @@ $jscomp.polyfill("Object.values", function(v) { g.is_selected = !1; if (this.onNodeDeselected) { this.onNodeDeselected(g); +======= + var h = a[b]; + if (h.is_selected) { + if (h.onDeselected) { + h.onDeselected(); + } + h.is_selected = !1; + if (this.onNodeDeselected) { + this.onNodeDeselected(h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -2882,8 +3623,13 @@ $jscomp.polyfill("Object.values", function(v) { for (var a in this.selected_nodes) { var b = this.selected_nodes[a]; if (b.inputs && b.inputs.length && b.outputs && b.outputs.length && e.isValidConnection(b.inputs[0].type, b.outputs[0].type) && b.inputs[0].link && b.outputs[0].links && b.outputs[0].links.length) { +<<<<<<< HEAD var d = b.graph.links[b.inputs[0].link], g = b.graph.links[b.outputs[0].links[0]], f = b.getInputNode(0), c = b.getOutputNodes(0)[0]; f && c && f.connect(d.origin_slot, c, g.target_slot); +======= + var d = b.graph.links[b.inputs[0].link], h = b.graph.links[b.outputs[0].links[0]], f = b.getInputNode(0), c = b.getOutputNodes(0)[0]; + f && c && f.connect(d.origin_slot, c, h.target_slot); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } this.graph.remove(b); if (this.onNodeDeselected) { @@ -2942,7 +3688,11 @@ $jscomp.polyfill("Object.values", function(v) { b = b || []; b.length = 0; a = a || this.graph._nodes; +<<<<<<< HEAD for (var d = 0, g = a.length; d < g; ++d) { +======= + for (var d = 0, h = a.length; d < h; ++d) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var f = a[d]; (!this.live_mode || f.onDrawBackground || f.onDrawForeground) && w(this.visible_area, f.getBounding(C)) && b.push(f); } @@ -2981,10 +3731,17 @@ $jscomp.polyfill("Object.values", function(v) { this.ds.toCanvasContext(a); b = this.computeVisibleNodes(null, this.visible_nodes); for (var d = 0; d < b.length; ++d) { +<<<<<<< HEAD var g = b[d]; a.save(); a.translate(g.pos[0], g.pos[1]); this.drawNode(g, a); +======= + var h = b[d]; + a.save(); + a.translate(h.pos[0], h.pos[1]); + this.drawNode(h, a); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.restore(); } this.render_execution_order && this.drawExecutionOrder(a); @@ -3054,10 +3811,17 @@ $jscomp.polyfill("Object.values", function(v) { b.font = "40px Arial"; b.textAlign = "center"; b.fillStyle = d.bgcolor || "#AAA"; +<<<<<<< HEAD for (var g = "", f = 1; f < this._graph_stack.length; ++f) { g += this._graph_stack[f]._subgraph_node.getTitle() + " >> "; } b.fillText(g + d.getTitle(), 0.5 * a.width, 40); +======= + for (var h = "", f = 1; f < this._graph_stack.length; ++f) { + h += this._graph_stack[f]._subgraph_node.getTitle() + " >> "; + } + b.fillText(h + d.getTitle(), 0.5 * a.width, 40); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b.restore(); } d = !1; @@ -3104,7 +3868,11 @@ $jscomp.polyfill("Object.values", function(v) { var D = new Float32Array(2); l.prototype.drawNode = function(a, b) { this.current_node = a; +<<<<<<< HEAD var d = a.color || a.constructor.color || e.NODE_DEFAULT_COLOR, g = a.bgcolor || a.constructor.bgcolor || e.NODE_DEFAULT_BGCOLOR, f = 0.6 > this.ds.scale; +======= + var d = a.color || a.constructor.color || e.NODE_DEFAULT_COLOR, h = a.bgcolor || a.constructor.bgcolor || e.NODE_DEFAULT_BGCOLOR, f = 0.6 > this.ds.scale; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.live_mode) { if (!a.flags.collapsed && (b.shadowColor = "transparent", a.onDrawForeground)) { a.onDrawForeground(b, this, this.canvas); @@ -3123,15 +3891,24 @@ $jscomp.polyfill("Object.values", function(v) { null != p && (a._collapsed_width = Math.min(a.size[0], b.measureText(p).width + 2 * e.NODE_TITLE_HEIGHT), D[0] = a._collapsed_width, D[1] = 0); } a.clip_area && (b.save(), b.beginPath(), k == e.BOX_SHAPE ? b.rect(0, 0, D[0], D[1]) : k == e.ROUND_SHAPE ? b.roundRect(0, 0, D[0], D[1], 10) : k == e.CIRCLE_SHAPE && b.arc(0.5 * D[0], 0.5 * D[1], 0.5 * D[0], 0, 2 * Math.PI), b.clip()); +<<<<<<< HEAD a.has_errors && (g = "red"); this.drawNodeShape(a, b, D, d, g, a.is_selected, a.mouseOver); +======= + a.has_errors && (h = "red"); + this.drawNodeShape(a, b, D, d, h, a.is_selected, a.mouseOver); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b.shadowColor = "transparent"; if (a.onDrawForeground) { a.onDrawForeground(b, this, this.canvas); } b.textAlign = n ? "center" : "left"; b.font = this.inner_text_font; +<<<<<<< HEAD g = !f; +======= + h = !f; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 k = this.connecting_output; b.lineWidth = 1; p = 0; @@ -3139,20 +3916,35 @@ $jscomp.polyfill("Object.values", function(v) { if (!a.flags.collapsed) { if (a.inputs) { for (d = 0; d < a.inputs.length; d++) { +<<<<<<< HEAD var h = a.inputs[d]; b.globalAlpha = c; this.connecting_node && !e.isValidConnection(h.type, k.type) && (b.globalAlpha = 0.4 * c); b.fillStyle = null != h.link ? h.color_on || this.default_connection_color.input_on : h.color_off || this.default_connection_color.input_off; +======= + var g = a.inputs[d]; + b.globalAlpha = c; + this.connecting_node && !e.isValidConnection(g.type, k.type) && (b.globalAlpha = 0.4 * c); + b.fillStyle = null != g.link ? g.color_on || this.default_connection_color.input_on : g.color_off || this.default_connection_color.input_off; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var t = a.getConnectionPos(!0, d, l); t[0] -= a.pos[0]; t[1] -= a.pos[1]; p < t[1] + 0.5 * e.NODE_SLOT_HEIGHT && (p = t[1] + 0.5 * e.NODE_SLOT_HEIGHT); b.beginPath(); +<<<<<<< HEAD h.type === e.EVENT || h.shape === e.BOX_SHAPE ? n ? b.rect(t[0] - 5 + 0.5, t[1] - 8 + 0.5, 10, 14) : b.rect(t[0] - 6 + 0.5, t[1] - 5 + 0.5, 14, 10) : h.shape === e.ARROW_SHAPE ? (b.moveTo(t[0] + 8, t[1] + 0.5), b.lineTo(t[0] - 4, t[1] + 6 + 0.5), b.lineTo(t[0] - 4, t[1] - 6 + 0.5), b.closePath()) : f ? b.rect(t[0] - 4, t[1] - 4, 8, 8) : b.arc(t[0], t[1], 4, 0, 2 * Math.PI); b.fill(); if (g) { var m = null != h.label ? h.label : h.name; m && (b.fillStyle = e.NODE_TEXT_COLOR, n || h.dir == e.UP ? b.fillText(m, t[0], t[1] - 10) : b.fillText(m, t[0] + 10, t[1] + 5)); +======= + g.type === e.EVENT || g.shape === e.BOX_SHAPE ? n ? b.rect(t[0] - 5 + 0.5, t[1] - 8 + 0.5, 10, 14) : b.rect(t[0] - 6 + 0.5, t[1] - 5 + 0.5, 14, 10) : g.shape === e.ARROW_SHAPE ? (b.moveTo(t[0] + 8, t[1] + 0.5), b.lineTo(t[0] - 4, t[1] + 6 + 0.5), b.lineTo(t[0] - 4, t[1] - 6 + 0.5), b.closePath()) : f ? b.rect(t[0] - 4, t[1] - 4, 8, 8) : b.arc(t[0], t[1], 4, 0, 2 * Math.PI); + b.fill(); + if (h) { + var m = null != g.label ? g.label : g.name; + m && (b.fillStyle = e.NODE_TEXT_COLOR, n || g.dir == e.UP ? b.fillText(m, t[0], t[1] - 10) : b.fillText(m, t[0] + 10, t[1] + 5)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -3161,40 +3953,68 @@ $jscomp.polyfill("Object.values", function(v) { b.strokeStyle = "black"; if (a.outputs) { for (d = 0; d < a.outputs.length; d++) { +<<<<<<< HEAD if (h = a.outputs[d], t = a.getConnectionPos(!1, d, l), t[0] -= a.pos[0], t[1] -= a.pos[1], p < t[1] + 0.5 * e.NODE_SLOT_HEIGHT && (p = t[1] + 0.5 * e.NODE_SLOT_HEIGHT), b.fillStyle = h.links && h.links.length ? h.color_on || this.default_connection_color.output_on : h.color_off || this.default_connection_color.output_off, b.beginPath(), h.type === e.EVENT || h.shape === e.BOX_SHAPE ? n ? b.rect(t[0] - 5 + 0.5, t[1] - 8 + 0.5, 10, 14) : b.rect(t[0] - 6 + 0.5, t[1] - 5 + 0.5, 14, 10) : h.shape === e.ARROW_SHAPE ? (b.moveTo(t[0] + 8, t[1] + 0.5), b.lineTo(t[0] - 4, t[1] + 6 + 0.5), b.lineTo(t[0] - 4, t[1] - 6 + 0.5), b.closePath()) : f ? b.rect(t[0] - 4, t[1] - 4, 8, 8) : b.arc(t[0], t[1], 4, 0, 2 * Math.PI), b.fill(), f || b.stroke(), g && (m = null != h.label ? h.label : h.name)) { b.fillStyle = e.NODE_TEXT_COLOR, n || h.dir == e.DOWN ? b.fillText(m, t[0], t[1] - 8) : b.fillText(m, t[0] - 10, t[1] + 5); +======= + if (g = a.outputs[d], t = a.getConnectionPos(!1, d, l), t[0] -= a.pos[0], t[1] -= a.pos[1], p < t[1] + 0.5 * e.NODE_SLOT_HEIGHT && (p = t[1] + 0.5 * e.NODE_SLOT_HEIGHT), b.fillStyle = g.links && g.links.length ? g.color_on || this.default_connection_color.output_on : g.color_off || this.default_connection_color.output_off, b.beginPath(), g.type === e.EVENT || g.shape === e.BOX_SHAPE ? n ? b.rect(t[0] - 5 + 0.5, t[1] - 8 + 0.5, 10, 14) : b.rect(t[0] - 6 + 0.5, t[1] - 5 + 0.5, 14, 10) : + g.shape === e.ARROW_SHAPE ? (b.moveTo(t[0] + 8, t[1] + 0.5), b.lineTo(t[0] - 4, t[1] + 6 + 0.5), b.lineTo(t[0] - 4, t[1] - 6 + 0.5), b.closePath()) : f ? b.rect(t[0] - 4, t[1] - 4, 8, 8) : b.arc(t[0], t[1], 4, 0, 2 * Math.PI), b.fill(), f || b.stroke(), h && (m = null != g.label ? g.label : g.name)) { + b.fillStyle = e.NODE_TEXT_COLOR, n || g.dir == e.DOWN ? b.fillText(m, t[0], t[1] - 8) : b.fillText(m, t[0] - 10, t[1] + 5); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } b.textAlign = "left"; b.globalAlpha = 1; if (a.widgets) { +<<<<<<< HEAD h = p; if (n || a.widgets_up) { h = 2; } null != a.widgets_start_y && (h = a.widgets_start_y); this.drawNodeWidgets(a, h, b, this.node_widget && this.node_widget[0] == a ? this.node_widget[1] : null); +======= + g = p; + if (n || a.widgets_up) { + g = 2; + } + null != a.widgets_start_y && (g = a.widgets_start_y); + this.drawNodeWidgets(a, g, b, this.node_widget && this.node_widget[0] == a ? this.node_widget[1] : null); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } else { if (this.render_collapsed_slots) { f = c = null; if (a.inputs) { for (d = 0; d < a.inputs.length; d++) { +<<<<<<< HEAD if (h = a.inputs[d], null != h.link) { c = h; +======= + if (g = a.inputs[d], null != g.link) { + c = g; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; } } } if (a.outputs) { for (d = 0; d < a.outputs.length; d++) { +<<<<<<< HEAD h = a.outputs[d], h.links && h.links.length && (f = h); } } c && (c = 0, d = -0.5 * e.NODE_TITLE_HEIGHT, n && (c = 0.5 * a._collapsed_width, d = -e.NODE_TITLE_HEIGHT), b.fillStyle = "#686", b.beginPath(), h.type === e.EVENT || h.shape === e.BOX_SHAPE ? b.rect(c - 7 + 0.5, d - 4, 14, 8) : h.shape === e.ARROW_SHAPE ? (b.moveTo(c + 8, d), b.lineTo(c + -4, d - 4), b.lineTo(c + -4, d + 4), b.closePath()) : b.arc(c, d, 4, 0, 2 * Math.PI), b.fill()); f && (c = a._collapsed_width, d = -0.5 * e.NODE_TITLE_HEIGHT, n && (c = 0.5 * a._collapsed_width, d = 0), b.fillStyle = "#686", b.strokeStyle = "black", b.beginPath(), h.type === e.EVENT || h.shape === e.BOX_SHAPE ? b.rect(c - 7 + 0.5, d - 4, 14, 8) : h.shape === e.ARROW_SHAPE ? (b.moveTo(c + 6, d), b.lineTo(c - 6, d - 4), b.lineTo(c - 6, d + 4), b.closePath()) : b.arc(c, d, 4, 0, 2 * Math.PI), b.fill()); +======= + g = a.outputs[d], g.links && g.links.length && (f = g); + } + } + c && (c = 0, d = -0.5 * e.NODE_TITLE_HEIGHT, n && (c = 0.5 * a._collapsed_width, d = -e.NODE_TITLE_HEIGHT), b.fillStyle = "#686", b.beginPath(), g.type === e.EVENT || g.shape === e.BOX_SHAPE ? b.rect(c - 7 + 0.5, d - 4, 14, 8) : g.shape === e.ARROW_SHAPE ? (b.moveTo(c + 8, d), b.lineTo(c + -4, d - 4), b.lineTo(c + -4, d + 4), b.closePath()) : b.arc(c, d, 4, 0, 2 * Math.PI), b.fill()); + f && (c = a._collapsed_width, d = -0.5 * e.NODE_TITLE_HEIGHT, n && (c = 0.5 * a._collapsed_width, d = 0), b.fillStyle = "#686", b.strokeStyle = "black", b.beginPath(), g.type === e.EVENT || g.shape === e.BOX_SHAPE ? b.rect(c - 7 + 0.5, d - 4, 14, 8) : g.shape === e.ARROW_SHAPE ? (b.moveTo(c + 6, d), b.lineTo(c - 6, d - 4), b.lineTo(c - 6, d + 4), b.closePath()) : b.arc(c, d, 4, 0, 2 * Math.PI), b.fill()); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } a.clip_area && b.restore(); @@ -3211,14 +4031,22 @@ $jscomp.polyfill("Object.values", function(v) { if (null != b.data && (!this.onDrawLinkTooltip || 1 != this.onDrawLinkTooltip(a, b, this)) && (b = b.data, b = b.constructor === Number ? b.toFixed(2) : b.constructor === String ? '"' + b + '"' : b.constructor === Boolean ? String(b) : b.toToolTip ? b.toToolTip() : "[" + b.constructor.name + "]", null != b)) { b = b.substr(0, 30); a.font = "14px Courier New"; +<<<<<<< HEAD var g = a.measureText(b).width + 20; +======= + var h = a.measureText(b).width + 20; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.shadowColor = "black"; a.shadowOffsetX = 2; a.shadowOffsetY = 2; a.shadowBlur = 3; a.fillStyle = "#454"; a.beginPath(); +<<<<<<< HEAD a.roundRect(d[0] - 0.5 * g, d[1] - 15 - 24, g, 24, 3, 3); +======= + a.roundRect(d[0] - 0.5 * h, d[1] - 15 - 24, h, 24, 3, 3); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.moveTo(d[0] - 10, d[1] - 15); a.lineTo(d[0] + 10, d[1] - 15); a.lineTo(d[0], d[1] - 5); @@ -3230,6 +4058,7 @@ $jscomp.polyfill("Object.values", function(v) { } }; var u = new Float32Array(4); +<<<<<<< HEAD l.prototype.drawNodeShape = function(a, b, d, g, f, c, k) { b.strokeStyle = g; b.fillStyle = f; @@ -3240,6 +4069,18 @@ $jscomp.polyfill("Object.values", function(v) { u[1] = h ? -f : 0; u[2] = d[0] + 1; u[3] = h ? d[1] + f : d[1]; +======= + l.prototype.drawNodeShape = function(a, b, d, h, f, c, k) { + b.strokeStyle = h; + b.fillStyle = f; + f = e.NODE_TITLE_HEIGHT; + var n = 0.5 > this.ds.scale, p = a._shape || a.constructor.shape || e.ROUND_SHAPE, x = a.constructor.title_mode, g = !0; + x == e.TRANSPARENT_TITLE ? g = !1 : x == e.AUTOHIDE_TITLE && k && (g = !0); + u[0] = 0; + u[1] = g ? -f : 0; + u[2] = d[0] + 1; + u[3] = g ? d[1] + f : d[1]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 k = b.globalAlpha; b.beginPath(); p == e.BOX_SHAPE || n ? b.fillRect(u[0], u[1], u[2], u[3]) : p == e.ROUND_SHAPE || p == e.CARD_SHAPE ? b.roundRect(u[0], u[1], u[2], u[3], this.round_radius, p == e.CARD_SHAPE ? 0 : this.round_radius) : p == e.CIRCLE_SHAPE && b.arc(0.5 * d[0], 0.5 * d[1], 0.5 * d[0], 0, 2 * Math.PI); @@ -3249,6 +4090,7 @@ $jscomp.polyfill("Object.values", function(v) { if (a.onDrawBackground) { a.onDrawBackground(b, this, this.canvas); } +<<<<<<< HEAD if (h || x == e.TRANSPARENT_TITLE) { if (a.onDrawTitleBar) { a.onDrawTitleBar(b, f, d, this.ds.scale, g); @@ -3262,6 +4104,21 @@ $jscomp.polyfill("Object.values", function(v) { b.fillStyle = t; } else { b.fillStyle = h; +======= + if (g || x == e.TRANSPARENT_TITLE) { + if (a.onDrawTitleBar) { + a.onDrawTitleBar(b, f, d, this.ds.scale, h); + } else { + if (x != e.TRANSPARENT_TITLE && (a.constructor.title_color || this.render_title_colored)) { + g = a.constructor.title_color || h; + a.flags.collapsed && (b.shadowColor = e.DEFAULT_SHADOW_COLOR); + if (this.use_gradients) { + var t = l.gradients[g]; + t || (t = l.gradients[g] = b.createLinearGradient(0, 0, 400, 0), t.addColorStop(0, g), t.addColorStop(1, "#000")); + b.fillStyle = t; + } else { + b.fillStyle = g; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } b.beginPath(); p == e.BOX_SHAPE || n ? b.rect(0, -f, d[0] + 1, f) : (p == e.ROUND_SHAPE || p == e.CARD_SHAPE) && b.roundRect(0, -f, d[0] + 1, f, this.round_radius, a.flags.collapsed ? this.round_radius : 0); @@ -3295,6 +4152,7 @@ $jscomp.polyfill("Object.values", function(v) { p == e.BOX_SHAPE ? b.rect(-6 + u[0], -6 + u[1], 12 + u[2], 12 + u[3]) : p == e.ROUND_SHAPE || p == e.CARD_SHAPE && a.flags.collapsed ? b.roundRect(-6 + u[0], -6 + u[1], 12 + u[2], 12 + u[3], 2 * this.round_radius) : p == e.CARD_SHAPE ? b.roundRect(-6 + u[0], -6 + u[1], 12 + u[2], 12 + u[3], 2 * this.round_radius, 2) : p == e.CIRCLE_SHAPE && b.arc(0.5 * d[0], 0.5 * d[1], 0.5 * d[0] + 6, 0, 2 * Math.PI); b.strokeStyle = "#FFF"; b.stroke(); +<<<<<<< HEAD b.strokeStyle = g; b.globalAlpha = 1; } @@ -3306,11 +4164,25 @@ $jscomp.polyfill("Object.values", function(v) { H[1] = d[1] - 20; H[2] = d[2] + 40; H[3] = d[3] + 40; +======= + b.strokeStyle = h; + b.globalAlpha = 1; + } + }; + var G = new Float32Array(4), n = new Float32Array(4), p = new Float32Array(2), k = new Float32Array(2); + l.prototype.drawConnections = function(a) { + var b = e.getTime(), d = this.visible_area; + G[0] = d[0] - 20; + G[1] = d[1] - 20; + G[2] = d[2] + 40; + G[3] = d[3] + 40; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.lineWidth = this.connections_width; a.fillStyle = "#AAA"; a.strokeStyle = "#AAA"; a.globalAlpha = this.editor_alpha; d = this.graph._nodes; +<<<<<<< HEAD for (var g = 0, f = d.length; g < f; ++g) { var c = d[g]; if (c.inputs && c.inputs.length) { @@ -3336,6 +4208,33 @@ $jscomp.polyfill("Object.values", function(v) { var M = a.globalAlpha; a.globalAlpha = M * q; this.renderLink(a, z, t, h, !0, q, "white", m, r); +======= + for (var h = 0, f = d.length; h < f; ++h) { + var c = d[h]; + if (c.inputs && c.inputs.length) { + for (var l = 0; l < c.inputs.length; ++l) { + var g = c.inputs[l]; + if (g && null != g.link && (g = this.graph.links[g.link])) { + var m = this.graph.getNodeById(g.origin_id); + if (null != m) { + var r = g.origin_slot; + var A = -1 == r ? [m.pos[0] + 10, m.pos[1] + 10] : m.getConnectionPos(!1, r, p); + var t = c.getConnectionPos(!0, l, k); + n[0] = A[0]; + n[1] = A[1]; + n[2] = t[0] - A[0]; + n[3] = t[1] - A[1]; + 0 > n[2] && (n[0] += n[2], n[2] = Math.abs(n[2])); + 0 > n[3] && (n[1] += n[3], n[3] = Math.abs(n[3])); + if (w(n, G)) { + var q = m.outputs[r]; + r = c.inputs[l]; + if (q && r && (m = q.dir || (m.horizontal ? e.DOWN : e.RIGHT), r = r.dir || (c.horizontal ? e.UP : e.LEFT), this.renderLink(a, A, t, g, !1, 0, null, m, r), g && g._last_time && 1000 > b - g._last_time)) { + q = 2.0 - 0.002 * (b - g._last_time); + var M = a.globalAlpha; + a.globalAlpha = M * q; + this.renderLink(a, A, t, g, !0, q, "white", m, r); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.globalAlpha = M; } } @@ -3346,16 +4245,25 @@ $jscomp.polyfill("Object.values", function(v) { } a.globalAlpha = 1; }; +<<<<<<< HEAD l.prototype.renderLink = function(a, b, d, g, f, c, k, n, p, h) { g && this.visible_links.push(g); !k && g && (k = g.color || l.link_type_colors[g.type]); k || (k = this.default_link_color); null != g && this.highlighted_links[g.id] && (k = "#FFF"); +======= + l.prototype.renderLink = function(a, b, d, h, f, c, k, n, p, g) { + h && this.visible_links.push(h); + !k && h && (k = h.color || l.link_type_colors[h.type]); + k || (k = this.default_link_color); + null != h && this.highlighted_links[h.id] && (k = "#FFF"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 n = n || e.RIGHT; p = p || e.LEFT; var x = B(b, d); this.render_connections_border && 0.6 < this.ds.scale && (a.lineWidth = this.connections_width + 4); a.lineJoin = "round"; +<<<<<<< HEAD h = h || 1; 1 < h && (a.lineWidth = 0.5); a.beginPath(); @@ -3370,6 +4278,22 @@ $jscomp.polyfill("Object.values", function(v) { break; case e.RIGHT: m = 0.25 * x; +======= + g = g || 1; + 1 < g && (a.lineWidth = 0.5); + a.beginPath(); + for (var t = 0; t < g; t += 1) { + var m = 5 * (t - 0.5 * (g - 1)); + if (this.links_render_mode == e.SPLINE_LINK) { + a.moveTo(b[0], b[1] + m); + var H = 0, r = 0, q = 0, I = 0; + switch(n) { + case e.LEFT: + H = -0.25 * x; + break; + case e.RIGHT: + H = 0.25 * x; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; case e.UP: r = -0.25 * x; @@ -3390,6 +4314,7 @@ $jscomp.polyfill("Object.values", function(v) { case e.DOWN: I = 0.25 * x; } +<<<<<<< HEAD a.bezierCurveTo(b[0] + m, b[1] + r + G, d[0] + q, d[1] + I + G, d[0], d[1] + G); } else { if (this.links_render_mode == e.LINEAR_LINK) { @@ -3401,6 +4326,19 @@ $jscomp.polyfill("Object.values", function(v) { break; case e.RIGHT: m = 1; +======= + a.bezierCurveTo(b[0] + H, b[1] + r + m, d[0] + q, d[1] + I + m, d[0], d[1] + m); + } else { + if (this.links_render_mode == e.LINEAR_LINK) { + a.moveTo(b[0], b[1] + m); + I = q = r = H = 0; + switch(n) { + case e.LEFT: + H = -1; + break; + case e.RIGHT: + H = 1; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; case e.UP: r = -1; @@ -3421,12 +4359,21 @@ $jscomp.polyfill("Object.values", function(v) { case e.DOWN: I = 1; } +<<<<<<< HEAD a.lineTo(b[0] + 15 * m, b[1] + 15 * r + G); a.lineTo(d[0] + 15 * q, d[1] + 15 * I + G); a.lineTo(d[0], d[1] + G); } else { if (this.links_render_mode == e.STRAIGHT_LINK) { a.moveTo(b[0], b[1]), G = b[0], m = b[1], r = d[0], q = d[1], n == e.RIGHT ? G += 10 : m += 10, p == e.LEFT ? r -= 10 : q -= 10, a.lineTo(G, m), a.lineTo(0.5 * (G + r), m), a.lineTo(0.5 * (G + r), q), a.lineTo(r, q), a.lineTo(d[0], d[1]); +======= + a.lineTo(b[0] + 15 * H, b[1] + 15 * r + m); + a.lineTo(d[0] + 15 * q, d[1] + 15 * I + m); + a.lineTo(d[0], d[1] + m); + } else { + if (this.links_render_mode == e.STRAIGHT_LINK) { + a.moveTo(b[0], b[1]), m = b[0], H = b[1], r = d[0], q = d[1], n == e.RIGHT ? m += 10 : H += 10, p == e.LEFT ? r -= 10 : q -= 10, a.lineTo(m, H), a.lineTo(0.5 * (m + r), H), a.lineTo(0.5 * (m + r), q), a.lineTo(r, q), a.lineTo(d[0], d[1]); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } else { return; } @@ -3438,20 +4385,34 @@ $jscomp.polyfill("Object.values", function(v) { a.fillStyle = a.strokeStyle = k; a.stroke(); f = this.computeConnectionPoint(b, d, 0.5, n, p); +<<<<<<< HEAD g && g._pos && (g._pos[0] = f[0], g._pos[1] = f[1]); 0.6 <= this.ds.scale && this.highquality_render && p != e.CENTER && (this.render_connection_arrows && (t = this.computeConnectionPoint(b, d, 0.25, n, p), x = this.computeConnectionPoint(b, d, 0.26, n, p), g = this.computeConnectionPoint(b, d, 0.75, n, p), h = this.computeConnectionPoint(b, d, 0.76, n, p), this.render_curved_connections ? (x = -Math.atan2(x[0] - t[0], x[1] - t[1]), h = -Math.atan2(h[0] - g[0], h[1] - g[1])) : h = x = d[1] > b[1] ? 0 : Math.PI, a.save(), a.translate(t[0], t[1]), a.rotate(x), a.beginPath(), a.moveTo(-5, -3), a.lineTo(0, 7), a.lineTo(5, -3), a.fill(), a.restore(), a.save(), a.translate(g[0], g[1]), a.rotate(h), a.beginPath(), a.moveTo(-5, -3), a.lineTo(0, 7), a.lineTo(5, -3), a.fill(), a.restore()), a.beginPath(), a.arc(f[0], f[1], 5, 0, 2 * Math.PI), a.fill()); +======= + h && h._pos && (h._pos[0] = f[0], h._pos[1] = f[1]); + 0.6 <= this.ds.scale && this.highquality_render && p != e.CENTER && (this.render_connection_arrows && (t = this.computeConnectionPoint(b, d, 0.25, n, p), x = this.computeConnectionPoint(b, d, 0.26, n, p), h = this.computeConnectionPoint(b, d, 0.75, n, p), g = this.computeConnectionPoint(b, d, 0.76, n, p), this.render_curved_connections ? (x = -Math.atan2(x[0] - t[0], x[1] - t[1]), g = -Math.atan2(g[0] - h[0], g[1] - h[1])) : g = x = d[1] > b[1] ? 0 : Math.PI, a.save(), a.translate(t[0], t[1]), + a.rotate(x), a.beginPath(), a.moveTo(-5, -3), a.lineTo(0, 7), a.lineTo(5, -3), a.fill(), a.restore(), a.save(), a.translate(h[0], h[1]), a.rotate(g), a.beginPath(), a.moveTo(-5, -3), a.lineTo(0, 7), a.lineTo(5, -3), a.fill(), a.restore()), a.beginPath(), a.arc(f[0], f[1], 5, 0, 2 * Math.PI), a.fill()); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (c) { for (a.fillStyle = k, t = 0; 5 > t; ++t) { c = (0.001 * e.getTime() + 0.2 * t) % 1, f = this.computeConnectionPoint(b, d, c, n, p), a.beginPath(), a.arc(f[0], f[1], 5, 0, 2 * Math.PI), a.fill(); } } }; +<<<<<<< HEAD l.prototype.computeConnectionPoint = function(a, b, d, g, f) { g = g || e.RIGHT; f = f || e.LEFT; var c = B(a, b), k = [a[0], a[1]], n = [b[0], b[1]]; switch(g) { +======= + l.prototype.computeConnectionPoint = function(a, b, d, h, f) { + h = h || e.RIGHT; + f = f || e.LEFT; + var c = B(a, b), k = [a[0], a[1]], n = [b[0], b[1]]; + switch(h) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 case e.LEFT: k[0] += -0.25 * c; break; @@ -3477,11 +4438,19 @@ $jscomp.polyfill("Object.values", function(v) { case e.DOWN: n[1] += 0.25 * c; } +<<<<<<< HEAD g = (1 - d) * (1 - d) * (1 - d); f = 3 * (1 - d) * (1 - d) * d; c = 3 * (1 - d) * d * d; d *= d * d; return [g * a[0] + f * k[0] + c * n[0] + d * b[0], g * a[1] + f * k[1] + c * n[1] + d * b[1]]; +======= + h = (1 - d) * (1 - d) * (1 - d); + f = 3 * (1 - d) * (1 - d) * d; + c = 3 * (1 - d) * d * d; + d *= d * d; + return [h * a[0] + f * k[0] + c * n[0] + d * b[0], h * a[1] + f * k[1] + c * n[1] + d * b[1]]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; l.prototype.drawExecutionOrder = function(a) { a.shadowColor = "transparent"; @@ -3490,6 +4459,7 @@ $jscomp.polyfill("Object.values", function(v) { a.strokeStyle = "white"; a.globalAlpha = 0.75; for (var b = this.visible_nodes, d = 0; d < b.length; ++d) { +<<<<<<< HEAD var g = b[d]; a.fillStyle = "black"; a.fillRect(g.pos[0] - e.NODE_TITLE_HEIGHT, g.pos[1] - e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT); @@ -3500,6 +4470,18 @@ $jscomp.polyfill("Object.values", function(v) { a.globalAlpha = 1; }; l.prototype.drawNodeWidgets = function(a, b, d, g) { +======= + var h = b[d]; + a.fillStyle = "black"; + a.fillRect(h.pos[0] - e.NODE_TITLE_HEIGHT, h.pos[1] - e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT); + 0 == h.order && a.strokeRect(h.pos[0] - e.NODE_TITLE_HEIGHT + 0.5, h.pos[1] - e.NODE_TITLE_HEIGHT + 0.5, e.NODE_TITLE_HEIGHT, e.NODE_TITLE_HEIGHT); + a.fillStyle = "#FFF"; + a.fillText(h.order, h.pos[0] + -0.5 * e.NODE_TITLE_HEIGHT, h.pos[1] - 6); + } + a.globalAlpha = 1; + }; + l.prototype.drawNodeWidgets = function(a, b, d, h) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (!a.widgets || !a.widgets.length) { return 0; } @@ -3508,7 +4490,11 @@ $jscomp.polyfill("Object.values", function(v) { var k = e.NODE_WIDGET_HEIGHT, n = 0.5 < this.ds.scale; d.save(); d.globalAlpha = this.editor_alpha; +<<<<<<< HEAD for (var p = e.WIDGET_OUTLINE_COLOR, h = e.WIDGET_BGCOLOR, l = e.WIDGET_TEXT_COLOR, t = e.WIDGET_SECONDARY_TEXT_COLOR, m = 0; m < c.length; ++m) { +======= + for (var p = e.WIDGET_OUTLINE_COLOR, l = e.WIDGET_BGCOLOR, g = e.WIDGET_TEXT_COLOR, t = e.WIDGET_SECONDARY_TEXT_COLOR, m = 0; m < c.length; ++m) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var r = c[m], q = b; r.y && (q = r.y); r.last_y = q; @@ -3521,12 +4507,20 @@ $jscomp.polyfill("Object.values", function(v) { r.clicked && (d.fillStyle = "#AAA", r.clicked = !1, this.dirty_canvas = !0); d.fillRect(15, q, f - 30, k); n && d.strokeRect(15, q, f - 30, k); +<<<<<<< HEAD n && (d.textAlign = "center", d.fillStyle = l, d.fillText(r.name, 0.5 * f, q + 0.7 * k)); +======= + n && (d.textAlign = "center", d.fillStyle = g, d.fillText(r.name, 0.5 * f, q + 0.7 * k)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; case "toggle": d.textAlign = "left"; d.strokeStyle = p; +<<<<<<< HEAD d.fillStyle = h; +======= + d.fillStyle = l; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 d.beginPath(); n ? d.roundRect(15, b, f - 30, k, 0.5 * k) : d.rect(15, b, f - 30, k); d.fill(); @@ -3535,6 +4529,7 @@ $jscomp.polyfill("Object.values", function(v) { d.beginPath(); d.arc(f - 30, q + 0.5 * k, 0.36 * k, 0, 2 * Math.PI); d.fill(); +<<<<<<< HEAD n && (d.fillStyle = t, null != r.name && d.fillText(r.name, 30, q + 0.7 * k), d.fillStyle = r.value ? l : t, d.textAlign = "right", d.fillText(r.value ? r.options.on || "true" : r.options.off || "false", f - 40, q + 0.7 * k)); break; case "slider": @@ -3546,27 +4541,56 @@ $jscomp.polyfill("Object.values", function(v) { n && d.strokeRect(15, q, f - 30, k); r.marker && (u = (r.marker - r.options.min) / u, d.fillStyle = "#AA9", d.fillRect(15 + u * (f - 30), q, 2, k)); n && (d.textAlign = "center", d.fillStyle = l, d.fillText(r.name + " " + Number(r.value).toFixed(3), 0.5 * f, q + 0.7 * k)); +======= + n && (d.fillStyle = t, null != r.name && d.fillText(r.name, 30, q + 0.7 * k), d.fillStyle = r.value ? g : t, d.textAlign = "right", d.fillText(r.value ? r.options.on || "true" : r.options.off || "false", f - 40, q + 0.7 * k)); + break; + case "slider": + d.fillStyle = l; + d.fillRect(15, q, f - 30, k); + var u = r.options.max - r.options.min, C = (r.value - r.options.min) / u; + d.fillStyle = h == r ? "#89A" : "#678"; + d.fillRect(15, q, C * (f - 30), k); + n && d.strokeRect(15, q, f - 30, k); + r.marker && (u = (r.marker - r.options.min) / u, d.fillStyle = "#AA9", d.fillRect(15 + u * (f - 30), q, 2, k)); + n && (d.textAlign = "center", d.fillStyle = g, d.fillText(r.name + " " + Number(r.value).toFixed(3), 0.5 * f, q + 0.7 * k)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; case "number": case "combo": d.textAlign = "left"; d.strokeStyle = p; +<<<<<<< HEAD d.fillStyle = h; d.beginPath(); n ? d.roundRect(15, b, f - 30, k, 0.5 * k) : d.rect(15, b, f - 30, k); d.fill(); n && (d.stroke(), d.fillStyle = l, d.beginPath(), d.moveTo(31, b + 5), d.lineTo(21, b + 0.5 * k), d.lineTo(31, b + k - 5), d.fill(), d.beginPath(), d.moveTo(f - 15 - 16, b + 5), d.lineTo(f - 15 - 6, b + 0.5 * k), d.lineTo(f - 15 - 16, b + k - 5), d.fill(), d.fillStyle = t, d.fillText(r.name, 35, q + 0.7 * k), d.fillStyle = l, d.textAlign = "right", "number" == r.type ? d.fillText(Number(r.value).toFixed(void 0 !== r.options.precision ? r.options.precision : 3), f - 30 - 20, q + 0.7 * k) : +======= + d.fillStyle = l; + d.beginPath(); + n ? d.roundRect(15, b, f - 30, k, 0.5 * k) : d.rect(15, b, f - 30, k); + d.fill(); + n && (d.stroke(), d.fillStyle = g, d.beginPath(), d.moveTo(31, b + 5), d.lineTo(21, b + 0.5 * k), d.lineTo(31, b + k - 5), d.fill(), d.beginPath(), d.moveTo(f - 15 - 16, b + 5), d.lineTo(f - 15 - 6, b + 0.5 * k), d.lineTo(f - 15 - 16, b + k - 5), d.fill(), d.fillStyle = t, d.fillText(r.name, 35, q + 0.7 * k), d.fillStyle = g, d.textAlign = "right", "number" == r.type ? d.fillText(Number(r.value).toFixed(void 0 !== r.options.precision ? r.options.precision : 3), f - 30 - 20, q + 0.7 * k) : +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 (u = r.value, r.options.values && (C = r.options.values, C.constructor === Function && (C = C()), C && C.constructor !== Array && (u = C[r.value])), d.fillText(u, f - 30 - 20, q + 0.7 * k))); break; case "string": case "text": d.textAlign = "left"; d.strokeStyle = p; +<<<<<<< HEAD d.fillStyle = h; d.beginPath(); n ? d.roundRect(15, b, f - 30, k, 0.5 * k) : d.rect(15, b, f - 30, k); d.fill(); n && (d.save(), d.beginPath(), d.rect(15, b, f - 30, k), d.clip(), d.stroke(), d.fillStyle = t, null != r.name && d.fillText(r.name, 30, q + 0.7 * k), d.fillStyle = l, d.textAlign = "right", d.fillText(String(r.value).substr(0, 30), f - 30, q + 0.7 * k), d.restore()); +======= + d.fillStyle = l; + d.beginPath(); + n ? d.roundRect(15, b, f - 30, k, 0.5 * k) : d.rect(15, b, f - 30, k); + d.fill(); + n && (d.save(), d.beginPath(), d.rect(15, b, f - 30, k), d.clip(), d.stroke(), d.fillStyle = t, null != r.name && d.fillText(r.name, 30, q + 0.7 * k), d.fillStyle = g, d.textAlign = "right", d.fillText(String(r.value).substr(0, 30), f - 30, q + 0.7 * k), d.restore()); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; default: r.draw && r.draw(d, a, f, q, k); @@ -3578,19 +4602,33 @@ $jscomp.polyfill("Object.values", function(v) { d.textAlign = "left"; }; l.prototype.processNodeWidgets = function(a, b, d, c) { +<<<<<<< HEAD function f(f, g) { f.value = g; f.options && f.options.property && void 0 !== a.properties[f.options.property] && a.setProperty(f.options.property, g); +======= + function f(f, h) { + f.value = h; + f.options && f.options.property && void 0 !== a.properties[f.options.property] && a.setProperty(f.options.property, h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 f.callback && f.callback(f.value, p, a, b, d); } if (!a.widgets || !a.widgets.length) { return null; } +<<<<<<< HEAD for (var g = b[0] - a.pos[0], k = b[1] - a.pos[1], n = a.size[0], p = this, l = this.getCanvasWindow(), h = 0; h < a.widgets.length; ++h) { var t = a.widgets[h]; if (t && !t.disabled) { var m = t.computeSize ? t.computeSize(n)[1] : e.NODE_WIDGET_HEIGHT; if (t == c || 6 < g && g < n - 12 && k > t.last_y && k < t.last_y + m) { +======= + for (var h = b[0] - a.pos[0], k = b[1] - a.pos[1], n = a.size[0], p = this, l = this.getCanvasWindow(), g = 0; g < a.widgets.length; ++g) { + var t = a.widgets[g]; + if (t && !t.disabled) { + var m = t.computeSize ? t.computeSize(n)[1] : e.NODE_WIDGET_HEIGHT; + if (t == c || 6 < h && h < n - 12 && k > t.last_y && k < t.last_y + m) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 switch(t.type) { case "button": if ("mousemove" === d.type) { @@ -3602,7 +4640,11 @@ $jscomp.polyfill("Object.values", function(v) { this.dirty_canvas = t.clicked = !0; break; case "slider": +<<<<<<< HEAD l = Math.clamp((g - 10) / (n - 20), 0, 1); +======= + l = Math.clamp((h - 10) / (n - 20), 0, 1); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 t.value = t.options.min + (t.options.max - t.options.min) * l; t.callback && setTimeout(function() { f(t, t.value); @@ -3620,12 +4662,21 @@ $jscomp.polyfill("Object.values", function(v) { r && r.constructor === Function && (r = t.options.values(t, a)); var q = null; "number" != t.type && (q = r.constructor === Array ? r : Object.keys(r)); +<<<<<<< HEAD g = 40 > g ? -1 : g > n - 40 ? 1 : 0; if ("number" == t.type) { t.value += 0.1 * g * (t.options.step || 1), null != t.options.min && t.value < t.options.min && (t.value = t.options.min), null != t.options.max && t.value > t.options.max && (t.value = t.options.max); } else { if (g) { l = -1, l = r.constructor === Object ? q.indexOf(String(t.value)) + g : q.indexOf(t.value) + g, l >= q.length && (l = q.length - 1), 0 > l && (l = 0), t.value = r.constructor === Array ? r[l] : l; +======= + h = 40 > h ? -1 : h > n - 40 ? 1 : 0; + if ("number" == t.type) { + t.value += 0.1 * h * (t.options.step || 1), null != t.options.min && t.value < t.options.min && (t.value = t.options.min), null != t.options.max && t.value > t.options.max && (t.value = t.options.max); + } else { + if (h) { + l = -1, l = r.constructor === Object ? q.indexOf(String(t.value)) + h : q.indexOf(t.value) + h, l >= q.length && (l = q.length - 1), 0 > l && (l = 0), t.value = r.constructor === Array ? r[l] : l; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } else { var u = r != q ? Object.values(r) : r; new e.ContextMenu(u, {scale:Math.max(1, this.ds.scale), event:d, className:"dark", callback:function(a, b, d) { @@ -3638,7 +4689,11 @@ $jscomp.polyfill("Object.values", function(v) { } } } else { +<<<<<<< HEAD "mouseup" == d.type && "number" == t.type && (g = 40 > g ? -1 : g > n - 40 ? 1 : 0, 200 > d.click_time && 0 == g && this.prompt("Value", t.value, function(a) { +======= + "mouseup" == d.type && "number" == t.type && (h = 40 > h ? -1 : h > n - 40 ? 1 : 0, 200 > d.click_time && 0 == h && this.prompt("Value", t.value, function(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.value = Number(a); f(this, this.value); }.bind(t), d)); @@ -3662,7 +4717,11 @@ $jscomp.polyfill("Object.values", function(v) { }.bind(t), d); break; default: +<<<<<<< HEAD t.mouse && (this.dirty_canvas = t.mouse(d, [g, k], a)); +======= + t.mouse && (this.dirty_canvas = t.mouse(d, [h, k], a)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } return t; } @@ -3676,11 +4735,19 @@ $jscomp.polyfill("Object.values", function(v) { b.save(); b.globalAlpha = 0.5 * this.editor_alpha; for (var d = 0; d < a.length; ++d) { +<<<<<<< HEAD var g = a[d]; if (w(this.visible_area, g._bounding)) { b.fillStyle = g.color || "#335"; b.strokeStyle = g.color || "#335"; var f = g._pos, c = g._size; +======= + var h = a[d]; + if (w(this.visible_area, h._bounding)) { + b.fillStyle = h.color || "#335"; + b.strokeStyle = h.color || "#335"; + var f = h._pos, c = h._size; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b.globalAlpha = 0.25 * this.editor_alpha; b.beginPath(); b.rect(f[0] + 0.5, f[1] + 0.5, c[0], c[1]); @@ -3692,9 +4759,15 @@ $jscomp.polyfill("Object.values", function(v) { b.lineTo(f[0] + c[0] - 10, f[1] + c[1]); b.lineTo(f[0] + c[0], f[1] + c[1] - 10); b.fill(); +<<<<<<< HEAD c = g.font_size || e.DEFAULT_GROUP_FONT_SIZE; b.font = c + "px Arial"; b.fillText(g.title, f[0] + 4, f[1] + c); +======= + c = h.font_size || e.DEFAULT_GROUP_FONT_SIZE; + b.font = c + "px Arial"; + b.fillText(h.title, f[0] + 4, f[1] + c); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } b.restore(); @@ -3757,7 +4830,11 @@ $jscomp.polyfill("Object.values", function(v) { a.graph.add(b); }; l.onMenuAdd = function(a, b, d, c, f) { +<<<<<<< HEAD function g(a, b) { +======= + function h(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b = c.getFirstEvent(); if (a = e.createNode(a.value)) { a.pos = k.convertEventToCanvasOffset(b), k.graph.add(a); @@ -3770,13 +4847,21 @@ $jscomp.polyfill("Object.values", function(v) { for (var p in a) { a[p] && b.push({value:a[p], content:a[p], has_submenu:!0}); } +<<<<<<< HEAD var h = new e.ContextMenu(b, {event:d, callback:function(a, b, d) { +======= + var g = new e.ContextMenu(b, {event:d, callback:function(a, b, d) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a = e.getNodeTypesInCategory(a.value, k.filter); b = []; for (var f in a) { a[f].skip_list || b.push({content:a[f].title, value:a[f].type}); } +<<<<<<< HEAD new e.ContextMenu(b, {event:d, callback:g, parentMenu:h}, n); +======= + new e.ContextMenu(b, {event:d, callback:h, parentMenu:g}, n); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return !1; }, parentMenu:c}, n); return !1; @@ -3787,7 +4872,11 @@ $jscomp.polyfill("Object.values", function(v) { }; l.showMenuNodeOptionalInputs = function(a, b, d, c, f) { if (f) { +<<<<<<< HEAD var g = this; +======= + var h = this; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a = l.active_canvas.getCanvasWindow(); b = f.optional_inputs; f.onGetInputs && (b = f.onGetInputs()); @@ -3796,11 +4885,19 @@ $jscomp.polyfill("Object.values", function(v) { for (var n in b) { var p = b[n]; if (p) { +<<<<<<< HEAD var h = p[0]; p[2] && p[2].label && (h = p[2].label); h = {content:h, value:p}; p[1] == e.ACTION && (h.className = "event"); k.push(h); +======= + var g = p[0]; + p[2] && p[2].label && (g = p[2].label); + g = {content:g, value:p}; + p[1] == e.ACTION && (g.className = "event"); + k.push(g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } else { k.push(null); } @@ -3809,13 +4906,21 @@ $jscomp.polyfill("Object.values", function(v) { this.onMenuNodeInputs && (k = this.onMenuNodeInputs(k)); if (k.length) { return new e.ContextMenu(k, {event:d, callback:function(a, b, d) { +<<<<<<< HEAD f && (a.callback && a.callback.call(g, f, a, b, d), a.value && (f.addInput(a.value[0], a.value[1], a.value[2]), f.setDirtyCanvas(!0, !0))); +======= + f && (a.callback && a.callback.call(h, f, a, b, d), a.value && (f.addInput(a.value[0], a.value[1], a.value[2]), f.setDirtyCanvas(!0, !0))); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }, parentMenu:c, node:f}, a), !1; } } }; l.showMenuNodeOptionalOutputs = function(a, b, d, c, f) { +<<<<<<< HEAD function g(a, b, d) { +======= + function h(a, b, d) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (f && (a.callback && a.callback.call(k, f, a, b, d), a.value)) { if (d = a.value[1], !d || d.constructor !== Object && d.constructor !== Array) { f.addOutput(a.value[0], a.value[1], a.value[2]), f.setDirtyCanvas(!0, !0); @@ -3824,7 +4929,11 @@ $jscomp.polyfill("Object.values", function(v) { for (var n in d) { a.push({content:n, value:d[n]}); } +<<<<<<< HEAD new e.ContextMenu(a, {event:b, callback:g, parentMenu:c, node:f}); +======= + new e.ContextMenu(a, {event:b, callback:h, parentMenu:c, node:f}); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return !1; } } @@ -3837,6 +4946,7 @@ $jscomp.polyfill("Object.values", function(v) { var n = []; if (b) { for (var p in b) { +<<<<<<< HEAD var h = b[p]; if (!h) { n.push(null); @@ -3846,6 +4956,17 @@ $jscomp.polyfill("Object.values", function(v) { h[2] && h[2].label && (m = h[2].label); m = {content:m, value:h}; h[1] == e.EVENT && (m.className = "event"); +======= + var g = b[p]; + if (!g) { + n.push(null); + } else { + if (!f.flags || !f.flags.skip_repeated_outputs || -1 == f.findOutputSlot(g[0])) { + var m = g[0]; + g[2] && g[2].label && (m = g[2].label); + m = {content:m, value:g}; + g[1] == e.EVENT && (m.className = "event"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 n.push(m); } } @@ -3853,21 +4974,34 @@ $jscomp.polyfill("Object.values", function(v) { } this.onMenuNodeOutputs && (n = this.onMenuNodeOutputs(n)); if (n.length) { +<<<<<<< HEAD return new e.ContextMenu(n, {event:d, callback:g, parentMenu:c, node:f}, a), !1; +======= + return new e.ContextMenu(n, {event:d, callback:h, parentMenu:c, node:f}, a), !1; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } }; l.onShowMenuNodeProperties = function(a, b, d, c, f) { if (f && f.properties) { +<<<<<<< HEAD var g = l.active_canvas; b = g.getCanvasWindow(); +======= + var h = l.active_canvas; + b = h.getCanvasWindow(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var k = [], n; for (n in f.properties) { a = void 0 !== f.properties[n] ? f.properties[n] : " ", "object" == typeof a && (a = JSON.stringify(a)), a = l.decodeHTML(a), k.push({content:"" + n + "" + a + "", value:n}); } if (k.length) { return new e.ContextMenu(k, {event:d, callback:function(a, b, d, c) { +<<<<<<< HEAD f && (b = this.getBoundingClientRect(), g.showEditPropertyValue(f, a.value, {position:[b.left, b.top]})); +======= + f && (b = this.getBoundingClientRect(), h.showEditPropertyValue(f, a.value, {position:[b.left, b.top]})); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }, parentMenu:c, allow_html:!0, node:f}, b), !1; } } @@ -3883,7 +5017,11 @@ $jscomp.polyfill("Object.values", function(v) { l.prototype.showLinkMenu = function(a, b) { var d = this; console.log(a); +<<<<<<< HEAD var c = new e.ContextMenu(["Add Node", null, "Delete"], {event:b, title:null != a.data ? a.data.constructor.name : null, callback:function(b, g, e) { +======= + var c = new e.ContextMenu(["Add Node", null, "Delete"], {event:b, title:null != a.data ? a.data.constructor.name : null, callback:function(b, h, e) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 switch(b) { case "Add Node": l.onMenuAdd(null, null, e, c, function(b) { @@ -3899,7 +5037,11 @@ $jscomp.polyfill("Object.values", function(v) { return !1; }; l.onShowPropertyEditor = function(a, b, d, c, f) { +<<<<<<< HEAD function g() { +======= + function h() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var b = n.value; "Number" == a.type ? b = Number(b) : "Boolean" == a.type && (b = !!b); f[e] = b; @@ -3916,20 +5058,32 @@ $jscomp.polyfill("Object.values", function(v) { n && (n.value = b, n.addEventListener("blur", function(a) { this.focus(); }), n.addEventListener("keydown", function(a) { +<<<<<<< HEAD 13 == a.keyCode && (g(), a.preventDefault(), a.stopPropagation()); +======= + 13 == a.keyCode && (h(), a.preventDefault(), a.stopPropagation()); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 })); b = l.active_canvas.canvas; d = b.getBoundingClientRect(); var p = c = -20; d && (c -= d.left, p -= d.top); event ? (k.style.left = event.clientX + c + "px", k.style.top = event.clientY + p + "px") : (k.style.left = 0.5 * b.width + c + "px", k.style.top = 0.5 * b.height + p + "px"); +<<<<<<< HEAD k.querySelector("button").addEventListener("click", g); +======= + k.querySelector("button").addEventListener("click", h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b.parentNode.appendChild(k); }; l.prototype.prompt = function(a, b, d, c) { var f = this; a = a || ""; +<<<<<<< HEAD var g = !1, e = document.createElement("div"); +======= + var h = !1, e = document.createElement("div"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e.className = "graphdialog rounded"; e.innerHTML = " "; e.close = function() { @@ -3938,7 +5092,11 @@ $jscomp.polyfill("Object.values", function(v) { }; 1 < this.ds.scale && (e.style.transform = "scale(" + this.ds.scale + ")"); e.addEventListener("mouseleave", function(a) { +<<<<<<< HEAD g || e.close(); +======= + h || e.close(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); f.prompt_box && f.prompt_box.close(); f.prompt_box = e; @@ -3946,7 +5104,11 @@ $jscomp.polyfill("Object.values", function(v) { e.querySelector(".value").value = b; var k = e.querySelector("input"); k.addEventListener("keydown", function(a) { +<<<<<<< HEAD g = !0; +======= + h = !0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (27 == a.keyCode) { e.close(); } else { @@ -4008,7 +5170,11 @@ $jscomp.polyfill("Object.values", function(v) { } } } +<<<<<<< HEAD h.close(); +======= + g.close(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } function d(a) { var b = u; @@ -4037,8 +5203,13 @@ $jscomp.polyfill("Object.values", function(v) { if (f.onSearchBox) { var c = f.onSearchBox(r, d, k); if (c) { +<<<<<<< HEAD for (var g = 0; g < c.length; ++g) { a(c[g]); +======= + for (var h = 0; h < c.length; ++h) { + a(c[h]); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } else { @@ -4049,17 +5220,27 @@ $jscomp.polyfill("Object.values", function(v) { var n = 0; d = d.toLowerCase(); var p = k.filter || k.graph.filter; +<<<<<<< HEAD for (g in e.searchbox_extras) { var h = e.searchbox_extras[g]; if (-1 !== h.desc.toLowerCase().indexOf(d)) { var x = e.registered_node_types[h.type]; if (!x || !x.filter || x.filter == p) { if (a(h.desc, "searchbox_extra"), -1 !== l.search_limit && n++ > l.search_limit) { +======= + for (h in e.searchbox_extras) { + var g = e.searchbox_extras[h]; + if (-1 !== g.desc.toLowerCase().indexOf(d)) { + var x = e.registered_node_types[g.type]; + if (!x || !x.filter || x.filter == p) { + if (a(g.desc, "searchbox_extra"), -1 !== l.search_limit && n++ > l.search_limit) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 break; } } } } +<<<<<<< HEAD h = null; if (Array.prototype.filter) { h = Object.keys(e.registered_node_types).filter(c); @@ -4069,20 +5250,39 @@ $jscomp.polyfill("Object.values", function(v) { } } for (g = 0; g < h.length && !(a(h[g]), -1 !== l.search_limit && n++ > l.search_limit); g++) { +======= + g = null; + if (Array.prototype.filter) { + g = Object.keys(e.registered_node_types).filter(c); + } else { + for (h in g = [], e.registered_node_types) { + c(h) && g.push(h); + } + } + for (h = 0; h < g.length && !(a(g[h]), -1 !== l.search_limit && n++ > l.search_limit); h++) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } } +<<<<<<< HEAD var f = this, k = l.active_canvas, n = k.canvas, p = n.ownerDocument || document, h = document.createElement("div"); h.className = "litegraph litesearchbox graphdialog rounded"; h.innerHTML = "Search
"; h.close = function() { +======= + var f = this, k = l.active_canvas, n = k.canvas, p = n.ownerDocument || document, g = document.createElement("div"); + g.className = "litegraph litesearchbox graphdialog rounded"; + g.innerHTML = "Search
"; + g.close = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 f.search_box = null; p.body.focus(); p.body.style.overflow = ""; setTimeout(function() { f.canvas.focus(); }, 20); +<<<<<<< HEAD h.parentNode && h.parentNode.removeChild(h); }; var m = null; @@ -4098,6 +5298,23 @@ $jscomp.polyfill("Object.values", function(v) { f.search_box && f.search_box.close(); f.search_box = h; var r = h.querySelector(".helper"), t = null, q = null, u = null, C = h.querySelector("input"); +======= + g.parentNode && g.parentNode.removeChild(g); + }; + var m = null; + 1 < this.ds.scale && (g.style.transform = "scale(" + this.ds.scale + ")"); + g.addEventListener("mouseenter", function(a) { + m && (clearTimeout(m), m = null); + }); + g.addEventListener("mouseleave", function(a) { + m = setTimeout(function() { + g.close(); + }, 500); + }); + f.search_box && f.search_box.close(); + f.search_box = g; + var r = g.querySelector(".helper"), t = null, q = null, u = null, C = g.querySelector("input"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 C && (C.addEventListener("blur", function(a) { this.focus(); }), C.addEventListener("keydown", function(a) { @@ -4108,10 +5325,17 @@ $jscomp.polyfill("Object.values", function(v) { d(!0); } else { if (27 == a.keyCode) { +<<<<<<< HEAD h.close(); } else { if (13 == a.keyCode) { u ? b(u.innerHTML) : t ? b(t) : h.close(); +======= + g.close(); + } else { + if (13 == a.keyCode) { + u ? b(u.innerHTML) : t ? b(t) : g.close(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } else { q && clearInterval(q); q = setTimeout(c, 10); @@ -4125,6 +5349,7 @@ $jscomp.polyfill("Object.values", function(v) { a.stopImmediatePropagation(); return !0; })); +<<<<<<< HEAD p.fullscreenElement ? p.fullscreenElement.appendChild(h) : (p.body.appendChild(h), p.body.style.overflow = "hidden"); n = n.getBoundingClientRect(); var w = (a ? a.clientY : n.top + 0.5 * n.height) - 20; @@ -4133,6 +5358,16 @@ $jscomp.polyfill("Object.values", function(v) { a.layerY > n.height - 200 && (r.style.maxHeight = n.height - a.layerY - 20 + "px"); C.focus(); return h; +======= + p.fullscreenElement ? p.fullscreenElement.appendChild(g) : (p.body.appendChild(g), p.body.style.overflow = "hidden"); + n = n.getBoundingClientRect(); + var w = (a ? a.clientY : n.top + 0.5 * n.height) - 20; + g.style.left = (a ? a.clientX : n.left + 0.5 * n.width) - 80 + "px"; + g.style.top = w + "px"; + a.layerY > n.height - 200 && (r.style.maxHeight = n.height - a.layerY - 20 + "px"); + C.focus(); + return g; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; l.prototype.showEditPropertyValue = function(a, b, d) { function c() { @@ -4163,8 +5398,13 @@ $jscomp.polyfill("Object.values", function(v) { if ("enum" == k && e.values) { n = ""; } else { @@ -4191,7 +5431,11 @@ $jscomp.polyfill("Object.values", function(v) { if (t = l.querySelector("input")) { t.addEventListener("blur", function(a) { this.focus(); +<<<<<<< HEAD }), h = void 0 !== a.properties[b] ? a.properties[b] : "", h = JSON.stringify(h), t.value = h, t.addEventListener("keydown", function(a) { +======= + }), g = void 0 !== a.properties[b] ? a.properties[b] : "", g = JSON.stringify(g), t.value = g, t.addEventListener("keydown", function(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 13 == a.keyCode && (c(), a.preventDefault(), a.stopPropagation()); }); } @@ -4250,8 +5494,13 @@ $jscomp.polyfill("Object.values", function(v) { } b = []; b.push({value:null, content:"No color"}); +<<<<<<< HEAD for (var g in l.node_colors) { a = l.node_colors[g], a = {value:g, content:"" + g + ""}, b.push(a); +======= + for (var h in l.node_colors) { + a = l.node_colors[h], a = {value:h, content:"" + h + ""}, b.push(a); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } new e.ContextMenu(b, {event:d, callback:function(a) { f && ((a = a.value ? l.node_colors[a.value] : null) ? f.constructor === e.LGraphGroup ? f.color = a.groupcolor : (f.color = a.color, f.bgcolor = a.bgcolor) : (delete f.color, delete f.bgcolor), f.setDirtyCanvas(!0, !0)); @@ -4320,11 +5569,19 @@ $jscomp.polyfill("Object.values", function(v) { } else { if ("Rename Slot" == b.content) { b = b.slot; +<<<<<<< HEAD var e = b.input ? a.getInputInfo(b.slot) : a.getOutputInfo(b.slot), g = d.createDialog("Name", f), k = g.querySelector("input"); k && e && (k.value = e.label || ""); g.querySelector("button").addEventListener("click", function(a) { k.value && (e && (e.label = k.value), d.setDirty(!0)); g.close(); +======= + var e = b.input ? a.getInputInfo(b.slot) : a.getOutputInfo(b.slot), h = d.createDialog("Name", f), k = h.querySelector("input"); + k && e && (k.value = e.label || ""); + h.querySelector("button").addEventListener("click", function(a) { + k.value && (e && (e.label = k.value), d.setDirty(!0)); + h.close(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); } } @@ -4334,8 +5591,13 @@ $jscomp.polyfill("Object.values", function(v) { a && (k.title = a.type); var n = null; a && (n = a.getSlotInPosition(b.canvasX, b.canvasY), l.active_node = a); +<<<<<<< HEAD n ? (f = [], a.getSlotMenuOptions ? f = a.getSlotMenuOptions(n) : (n && n.output && n.output.links && n.output.links.length && f.push({content:"Disconnect Links", slot:n}), b = n.input || n.output, f.push(b.locked ? "Cannot remove" : {content:"Remove Slot", slot:n}), f.push(b.nameLocked ? "Cannot rename" : {content:"Rename Slot", slot:n})), k.title = (n.input ? n.input.type : n.output.type) || "*", n.input && n.input.type == e.ACTION && (k.title = "Action"), n.output && n.output.type == e.EVENT && (k.title = "Event")) : a ? f = this.getNodeMenuOptions(a) : (f = this.getCanvasMenuOptions(), (n = this.graph.getGroupOnPos(b.canvasX, b.canvasY)) && f.push(null, {content:"Edit Group", has_submenu:!0, submenu:{title:"Group", extra:n, options:this.getGroupMenuOptions(n)}})); +======= + n ? (f = [], n && n.output && n.output.links && n.output.links.length && f.push({content:"Disconnect Links", slot:n}), b = n.input || n.output, f.push(b.locked ? "Cannot remove" : {content:"Remove Slot", slot:n}), f.push(b.nameLocked ? "Cannot rename" : {content:"Rename Slot", slot:n}), k.title = (n.input ? n.input.type : n.output.type) || "*", n.input && n.input.type == e.ACTION && (k.title = "Action"), n.output && n.output.type == e.EVENT && (k.title = "Event")) : a ? f = this.getNodeMenuOptions(a) : + (f = this.getCanvasMenuOptions(), (n = this.graph.getGroupOnPos(b.canvasX, b.canvasY)) && f.push(null, {content:"Edit Group", has_submenu:!0, submenu:{title:"Group", extra:n, options:this.getGroupMenuOptions(n)}})); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 f && new e.ContextMenu(f, k, c); }; "undefined" != typeof window && window.CanvasRenderingContext2D && (window.CanvasRenderingContext2D.prototype.roundRect = function(a, b, d, c, f, e) { @@ -4474,7 +5736,11 @@ $jscomp.polyfill("Object.values", function(v) { } } }; +<<<<<<< HEAD A.sampleCurve = function(a, b) { +======= + z.sampleCurve = function(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (b) { for (var d = 0; d < b.length - 1; ++d) { var c = b[d], f = b[d + 1]; @@ -4490,7 +5756,11 @@ $jscomp.polyfill("Object.values", function(v) { return 0; } }; +<<<<<<< HEAD A.prototype.draw = function(a, b, d, c, f, e) { +======= + z.prototype.draw = function(a, b, d, c, f, e) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (d = this.points) { this.size = b; var k = b[0] - 2 * this.margin; @@ -4515,7 +5785,11 @@ $jscomp.polyfill("Object.values", function(v) { a.restore(); } }; +<<<<<<< HEAD A.prototype.onMouseDown = function(a, b) { +======= + z.prototype.onMouseDown = function(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var d = this.points; if (d && !(0 > a[1])) { var c = this.size[0] - 2 * this.margin, f = this.size[1] - 2 * this.margin, e = a[0] - this.margin; @@ -4529,7 +5803,11 @@ $jscomp.polyfill("Object.values", function(v) { } } }; +<<<<<<< HEAD A.prototype.onMouseMove = function(a, b) { +======= + z.prototype.onMouseMove = function(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var d = this.points; if (d) { var c = this.selected; @@ -4545,16 +5823,25 @@ $jscomp.polyfill("Object.values", function(v) { } } }; +<<<<<<< HEAD A.prototype.onMouseUp = function(a, b) { this.selected = -1; return !1; }; A.prototype.getCloserPoint = function(a, b) { +======= + z.prototype.onMouseUp = function(a, b) { + this.selected = -1; + return !1; + }; + z.prototype.getCloserPoint = function(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var d = this.points; if (!d) { return -1; } b = b || 30; +<<<<<<< HEAD for (var c = this.size[0] - 2 * this.margin, f = this.size[1] - 2 * this.margin, e = d.length, k = [0, 0], n = 1000000, p = -1, h = 0; h < e; ++h) { var l = d[h]; k[0] = l[0] * c; @@ -4565,6 +5852,18 @@ $jscomp.polyfill("Object.values", function(v) { return p; }; e.CurveEditor = A; +======= + for (var c = this.size[0] - 2 * this.margin, f = this.size[1] - 2 * this.margin, e = d.length, k = [0, 0], n = 1000000, p = -1, g = 0; g < e; ++g) { + var l = d[g]; + k[0] = l[0] * c; + k[1] = (1.0 - l[1]) * f; + l = vec2.distance(a, k); + l > n || l > b || (p = g, n = l); + } + return p; + }; + e.CurveEditor = z; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e.getParameterNames = function(a) { return (a + "").replace(/[/][/].*$/gm, "").replace(/\s+/g, "").replace(/[/][*][^/*]*[*][/]/g, "").split("){", 1)[0].replace(/^[^(]*[(]/, "").replace(/=[^,]+/g, "").split(",").filter(Boolean); }; @@ -4585,7 +5884,11 @@ $jscomp.polyfill("Object.values", function(v) { this.size = [140, 80]; this.properties = {enabled:!0}; this.enabled = !0; +<<<<<<< HEAD this.subgraph = new g.LGraph; +======= + this.subgraph = new h.LGraph; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.subgraph._subgraph_node = this; this.subgraph._is_subgraph = !0; this.subgraph.onTrigger = this.onSubgraphTrigger.bind(this); @@ -4615,7 +5918,11 @@ $jscomp.polyfill("Object.values", function(v) { this.widgets_up = !0; this.size = [180, 90]; } +<<<<<<< HEAD function h() { +======= + function g() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("", ""); this.name_in_graph = ""; this.properties = {}; @@ -4629,7 +5936,11 @@ $jscomp.polyfill("Object.values", function(v) { return a.inputs[0].type; }, set:function(b) { if ("action" == b || "event" == b) { +<<<<<<< HEAD b = g.ACTION; +======= + b = h.ACTION; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } a.inputs[0].type = b; a.name_in_graph && a.graph.changeOutputType(a.name_in_graph, a.inputs[0].type); @@ -4686,7 +5997,11 @@ $jscomp.polyfill("Object.values", function(v) { this.size = [140, 30]; this._value = null; } +<<<<<<< HEAD function A() { +======= + function z() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("array", "array,table,string"); this.addInput("index", "number"); this.addOutput("value", ""); @@ -4725,7 +6040,11 @@ $jscomp.polyfill("Object.values", function(v) { }); this.size = this.computeSize(); } +<<<<<<< HEAD function H() { +======= + function G() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.size = [60, 30]; this.addInput("in"); this.addOutput("out"); @@ -4735,7 +6054,11 @@ $jscomp.polyfill("Object.values", function(v) { function n() { this.size = [60, 30]; this.addInput("data", 0); +<<<<<<< HEAD this.addInput("download", g.ACTION); +======= + this.addInput("download", h.ACTION); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.properties = {filename:"data.json"}; this.value = null; var a = this; @@ -4754,6 +6077,7 @@ $jscomp.polyfill("Object.values", function(v) { this.size = [40, 30]; } function a() { +<<<<<<< HEAD this.mode = g.ON_EVENT; this.size = [80, 30]; this.addProperty("msg", ""); @@ -4764,6 +6088,18 @@ $jscomp.polyfill("Object.values", function(v) { this.mode = g.ON_EVENT; this.addProperty("msg", ""); this.addInput("", g.EVENT); +======= + this.mode = h.ON_EVENT; + this.size = [80, 30]; + this.addProperty("msg", ""); + this.addInput("log", h.EVENT); + this.addInput("msg", 0); + } + function b() { + this.mode = h.ON_EVENT; + this.addProperty("msg", ""); + this.addInput("", h.EVENT); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this; this.widget = this.addWidget("text", "Text", "", function(b) { a.properties.msg = b; @@ -4780,14 +6116,22 @@ $jscomp.polyfill("Object.values", function(v) { this._func = null; this.data = {}; } +<<<<<<< HEAD var g = v.LiteGraph; +======= + var h = v.LiteGraph; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.title = "Time"; c.desc = "Time"; c.prototype.onExecute = function() { this.setOutputData(0, 1000 * this.graph.globaltime); this.setOutputData(1, this.graph.globaltime); }; +<<<<<<< HEAD g.registerNodeType("basic/time", c); +======= + h.registerNodeType("basic/time", c); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 q.title = "Subgraph"; q.desc = "Graph inside a node"; q.title_color = "#334"; @@ -4797,7 +6141,11 @@ $jscomp.polyfill("Object.values", function(v) { q.prototype.onDrawTitle = function(a) { if (!this.flags.collapsed) { a.fillStyle = "#555"; +<<<<<<< HEAD var b = g.NODE_TITLE_HEIGHT, d = this.size[0] - b; +======= + var b = h.NODE_TITLE_HEIGHT, d = this.size[0] - b; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.fillRect(d, -b, b, b); a.fillStyle = "#333"; a.beginPath(); @@ -4814,7 +6162,11 @@ $jscomp.polyfill("Object.values", function(v) { }, 10); }; q.prototype.onMouseDown = function(a, b, d) { +<<<<<<< HEAD if (!this.flags.collapsed && b[0] > this.size[0] - g.NODE_TITLE_HEIGHT && 0 > b[1]) { +======= + if (!this.flags.collapsed && b[0] > this.size[0] - h.NODE_TITLE_HEIGHT && 0 > b[1]) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var f = this; setTimeout(function() { d.openSubgraph(f.subgraph); @@ -4887,20 +6239,33 @@ $jscomp.polyfill("Object.values", function(v) { a[1] += 20; }; q.prototype.serialize = function() { +<<<<<<< HEAD var a = g.LGraphNode.prototype.serialize.call(this); +======= + var a = h.LGraphNode.prototype.serialize.call(this); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.subgraph = this.subgraph.serialize(); return a; }; q.prototype.clone = function() { +<<<<<<< HEAD var a = g.createNode(this.type), b = this.serialize(); +======= + var a = h.createNode(this.type), b = this.serialize(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 delete b.id; delete b.inputs; delete b.outputs; a.configure(b); return a; }; +<<<<<<< HEAD g.Subgraph = q; g.registerNodeType("graph/subgraph", q); +======= + h.Subgraph = q; + h.registerNodeType("graph/subgraph", q); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 m.title = "Input"; m.desc = "Input of the graph"; m.prototype.onConfigure = function() { @@ -4928,7 +6293,11 @@ $jscomp.polyfill("Object.values", function(v) { return this.flags.collapsed ? this.properties.name : this.title; }; m.prototype.onAction = function(a, b) { +<<<<<<< HEAD this.properties.type == g.EVENT && this.triggerSlot(0, b); +======= + this.properties.type == h.EVENT && this.triggerSlot(0, b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; m.prototype.onExecute = function() { var a = this.graph.inputs[this.properties.name]; @@ -4937,6 +6306,7 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.onRemoved = function() { this.name_in_graph && this.graph.removeInput(this.name_in_graph); }; +<<<<<<< HEAD g.GraphInput = m; g.registerNodeType("graph/input", m); h.title = "Output"; @@ -4956,6 +6326,27 @@ $jscomp.polyfill("Object.values", function(v) { }; g.GraphOutput = h; g.registerNodeType("graph/output", h); +======= + h.GraphInput = m; + h.registerNodeType("graph/input", m); + g.title = "Output"; + g.desc = "Output of the graph"; + g.prototype.onExecute = function() { + this._value = this.getInputData(0); + this.graph.setOutputData(this.properties.name, this._value); + }; + g.prototype.onAction = function(a, b) { + this.properties.type == h.ACTION && this.graph.trigger(this.properties.name, b); + }; + g.prototype.onRemoved = function() { + this.name_in_graph && this.graph.removeOutput(this.name_in_graph); + }; + g.prototype.getTitle = function() { + return this.flags.collapsed ? this.properties.name : this.title; + }; + h.GraphOutput = g; + h.registerNodeType("graph/output", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 r.title = "Const Number"; r.desc = "Constant number"; r.prototype.onExecute = function() { @@ -4970,7 +6361,11 @@ $jscomp.polyfill("Object.values", function(v) { r.prototype.onDrawBackground = function(a) { this.outputs[0].label = this.properties.value.toFixed(3); }; +<<<<<<< HEAD g.registerNodeType("basic/const", r); +======= + h.registerNodeType("basic/const", r); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 l.title = "Const Boolean"; l.desc = "Constant boolean"; l.prototype.getTitle = r.prototype.getTitle; @@ -4979,12 +6374,20 @@ $jscomp.polyfill("Object.values", function(v) { }; l.prototype.setValue = r.prototype.setValue; l.prototype.onGetInputs = function() { +<<<<<<< HEAD return [["toggle", g.ACTION]]; +======= + return [["toggle", h.ACTION]]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; l.prototype.onAction = function(a) { this.setValue(!this.properties.value); }; +<<<<<<< HEAD g.registerNodeType("basic/boolean", l); +======= + h.registerNodeType("basic/boolean", l); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 B.title = "Const String"; B.desc = "Constant string"; B.prototype.getTitle = r.prototype.getTitle; @@ -4999,7 +6402,11 @@ $jscomp.polyfill("Object.values", function(v) { }; d.readAsText(a); }; +<<<<<<< HEAD g.registerNodeType("basic/string", B); +======= + h.registerNodeType("basic/string", B); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 y.title = "Const File"; y.desc = "Fetches a file from an url"; y["@type"] = {type:"enum", values:["text", "arraybuffer", "blob", "json"]}; @@ -5014,7 +6421,11 @@ $jscomp.polyfill("Object.values", function(v) { y.prototype.setValue = r.prototype.setValue; y.prototype.fetchFile = function(a) { var b = this; +<<<<<<< HEAD a && a.constructor === String ? (this._url = a, this._type = this.properties.type, "http" == a.substr(0, 4) && g.proxy && (a = g.proxy + a.substr(a.indexOf(":") + 3)), fetch(a).then(function(a) { +======= + a && a.constructor === String ? (this._url = a, this._type = this.properties.type, "http" == a.substr(0, 4) && h.proxy && (a = h.proxy + a.substr(a.indexOf(":") + 3)), fetch(a).then(function(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (!a.ok) { throw Error("File not found"); } @@ -5063,7 +6474,11 @@ $jscomp.polyfill("Object.values", function(v) { } } }; +<<<<<<< HEAD g.registerNodeType("basic/file", y); +======= + h.registerNodeType("basic/file", y); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 w.title = "Const Data"; w.desc = "Constant Data"; w.prototype.onPropertyChanged = function(a, b) { @@ -5071,7 +6486,11 @@ $jscomp.polyfill("Object.values", function(v) { if (null != b && "" != b) { try { this._value = JSON.parse(b), this.boxcolor = "#AEA"; +<<<<<<< HEAD } catch (G) { +======= + } catch (H) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.boxcolor = "red"; } } @@ -5080,7 +6499,11 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, this._value); }; w.prototype.setValue = r.prototype.setValue; +<<<<<<< HEAD g.registerNodeType("basic/data", w); +======= + h.registerNodeType("basic/data", w); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 E.title = "Const Array"; E.desc = "Constant Array"; E.prototype.onPropertyChanged = function(a, b) { @@ -5088,7 +6511,11 @@ $jscomp.polyfill("Object.values", function(v) { if (null != b && "" != b) { try { this._value = JSON.parse(b), this.boxcolor = "#AEA"; +<<<<<<< HEAD } catch (G) { +======= + } catch (H) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.boxcolor = "red"; } } @@ -5105,15 +6532,26 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, this._value); }; E.prototype.setValue = r.prototype.setValue; +<<<<<<< HEAD g.registerNodeType("basic/array", E); A.title = "Array[i]"; A.desc = "Returns an element from an array"; A.prototype.onExecute = function() { +======= + h.registerNodeType("basic/array", E); + z.title = "Array[i]"; + z.desc = "Returns an element from an array"; + z.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0), b = this.getInputData(1); null == b && (b = this.properties.index); null != a && null != b && this.setOutputData(0, a[Math.floor(Number(b))]); }; +<<<<<<< HEAD g.registerNodeType("basic/array[]", A); +======= + h.registerNodeType("basic/array[]", z); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e.title = "Table[row][col]"; e.desc = "Returns an element from a table"; e.prototype.onExecute = function() { @@ -5122,7 +6560,11 @@ $jscomp.polyfill("Object.values", function(v) { null == d && (d = this.properties.column); null != a && null != b && null != d && ((b = a[Math.floor(Number(b))]) ? this.setOutputData(0, b[Math.floor(Number(d))]) : this.setOutputData(0, null)); }; +<<<<<<< HEAD g.registerNodeType("basic/table[][]", e); +======= + h.registerNodeType("basic/table[][]", e); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 C.title = "Object property"; C.desc = "Outputs the property of an object"; C.prototype.setValue = function(a) { @@ -5139,14 +6581,22 @@ $jscomp.polyfill("Object.values", function(v) { var a = this.getInputData(0); null != a && this.setOutputData(0, a[this.properties.value]); }; +<<<<<<< HEAD g.registerNodeType("basic/object_property", C); +======= + h.registerNodeType("basic/object_property", C); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 D.title = "Object keys"; D.desc = "Outputs an array with the keys of an object"; D.prototype.onExecute = function() { var a = this.getInputData(0); null != a && this.setOutputData(0, Object.keys(a)); }; +<<<<<<< HEAD g.registerNodeType("basic/object_keys", D); +======= + h.registerNodeType("basic/object_keys", D); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 u.title = "Merge Objects"; u.desc = "Creates an object copying properties from others"; u.prototype.onExecute = function() { @@ -5163,20 +6613,35 @@ $jscomp.polyfill("Object.values", function(v) { } this.setOutputData(0, d); }; +<<<<<<< HEAD g.registerNodeType("basic/merge_objects", u); H.title = "Variable"; H.desc = "store/read variable value"; H.prototype.onExecute = function() { +======= + h.registerNodeType("basic/merge_objects", u); + G.title = "Variable"; + G.desc = "store/read variable value"; + G.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.value = this.getInputData(0); this.graph && (this.graph.vars[this.properties.varname] = this.value); this.properties.global && (v[this.properties.varname] = this.value); this.setOutputData(0, this.value); }; +<<<<<<< HEAD H.prototype.getTitle = function() { return this.properties.varname; }; g.registerNodeType("basic/variable", H); g.wrapFunctionAsNode("basic/length", function(a) { +======= + G.prototype.getTitle = function() { + return this.properties.varname; + }; + h.registerNodeType("basic/variable", G); + h.wrapFunctionAsNode("basic/length", function(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return a && null != a.length ? Number(a.length) : 0; }, ["*"], "number"); n.title = "Download"; @@ -5211,7 +6676,11 @@ $jscomp.polyfill("Object.values", function(v) { n.prototype.getTitle = function() { return this.flags.collapsed ? this.properties.filename : this.title; }; +<<<<<<< HEAD g.registerNodeType("basic/download", n); +======= + h.registerNodeType("basic/download", n); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 p.title = "Watch"; p.desc = "Show value of input"; p.prototype.onExecute = function() { @@ -5238,13 +6707,21 @@ $jscomp.polyfill("Object.values", function(v) { p.prototype.onDrawBackground = function(a) { this.inputs[0].label = p.toString(this.value); }; +<<<<<<< HEAD g.registerNodeType("basic/watch", p); +======= + h.registerNodeType("basic/watch", p); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 k.title = "Cast"; k.desc = "Allows to connect different types"; k.prototype.onExecute = function() { this.setOutputData(0, this.getInputData(0)); }; +<<<<<<< HEAD g.registerNodeType("basic/cast", k); +======= + h.registerNodeType("basic/cast", k); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.title = "Console"; a.desc = "Show value inside the console"; a.prototype.onAction = function(a, b) { @@ -5256,9 +6733,15 @@ $jscomp.polyfill("Object.values", function(v) { console.log(a); }; a.prototype.onGetInputs = function() { +<<<<<<< HEAD return [["log", g.ACTION], ["warn", g.ACTION], ["error", g.ACTION]]; }; g.registerNodeType("basic/console", a); +======= + return [["log", h.ACTION], ["warn", h.ACTION], ["error", h.ACTION]]; + }; + h.registerNodeType("basic/console", a); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b.title = "Alert"; b.desc = "Show an alert window"; b.color = "#510"; @@ -5271,15 +6754,25 @@ $jscomp.polyfill("Object.values", function(v) { alert(d); }, 10); }; +<<<<<<< HEAD g.registerNodeType("basic/alert", b); d.prototype.onConfigure = function(a) { a.properties.onExecute && g.allow_scripts ? this.compileCode(a.properties.onExecute) : console.warn("Script not compiled, LiteGraph.allow_scripts is false"); +======= + h.registerNodeType("basic/alert", b); + d.prototype.onConfigure = function(a) { + a.properties.onExecute && h.allow_scripts ? this.compileCode(a.properties.onExecute) : console.warn("Script not compiled, LiteGraph.allow_scripts is false"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; d.title = "Script"; d.desc = "executes a code (max 100 characters)"; d.widgets_info = {onExecute:{type:"code"}}; d.prototype.onPropertyChanged = function(a, b) { +<<<<<<< HEAD "onExecute" == a && g.allow_scripts ? this.compileCode(b) : console.warn("Script not compiled, LiteGraph.allow_scripts is false"); +======= + "onExecute" == a && h.allow_scripts ? this.compileCode(b) : console.warn("Script not compiled, LiteGraph.allow_scripts is false"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; d.prototype.compileCode = function(a) { this._func = null; @@ -5312,7 +6805,11 @@ $jscomp.polyfill("Object.values", function(v) { d.prototype.onGetOutputs = function() { return [["C", ""]]; }; +<<<<<<< HEAD g.registerNodeType("basic/script", d); +======= + h.registerNodeType("basic/script", d); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 })(this); (function(v) { function c() { @@ -5344,7 +6841,11 @@ $jscomp.polyfill("Object.values", function(v) { this.size = [120, 30]; this.flags = {horizontal:!0, render_box:!1}; } +<<<<<<< HEAD function h() { +======= + function g() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.size = [60, 30]; this.addInput("event", w.ACTION); this.addOutput("event", w.EVENT); @@ -5387,20 +6888,35 @@ $jscomp.polyfill("Object.values", function(v) { var w = v.LiteGraph; c.title = "Log Event"; c.desc = "Log event in console"; +<<<<<<< HEAD c.prototype.onAction = function(c, h) { console.log(c, h); +======= + c.prototype.onAction = function(c, g) { + console.log(c, g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; w.registerNodeType("events/log", c); q.title = "TriggerEvent"; q.desc = "Triggers event if input evaluates to true"; +<<<<<<< HEAD q.prototype.onExecute = function(c, h) { +======= + q.prototype.onExecute = function(c, g) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c = this.getInputData(0); var e = c != this.prev; 0 === this.prev && (e = !1); var l = e && this.properties.only_on_change || !e && !this.properties.only_on_change; +<<<<<<< HEAD c && l && this.triggerSlot(0, h); !c && l && this.triggerSlot(2, h); e && this.triggerSlot(1, h); +======= + c && l && this.triggerSlot(0, g); + !c && l && this.triggerSlot(2, g); + e && this.triggerSlot(1, g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.prev = c; }; w.registerNodeType("events/trigger", q); @@ -5409,14 +6925,22 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.getTitle = function() { return ""; }; +<<<<<<< HEAD m.prototype.onAction = function(c, h) { if (this.outputs) { for (c = 0; c < this.outputs.length; ++c) { this.triggerSlot(c, h); +======= + m.prototype.onAction = function(c, g) { + if (this.outputs) { + for (c = 0; c < this.outputs.length; ++c) { + this.triggerSlot(c, g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } }; w.registerNodeType("events/sequencer", m); +<<<<<<< HEAD h.title = "Filter Event"; h.desc = "Blocks events that do not match the filter"; h.prototype.onAction = function(c, h) { @@ -5428,15 +6952,35 @@ $jscomp.polyfill("Object.values", function(v) { } }; w.registerNodeType("events/filter", h); +======= + g.title = "Filter Event"; + g.desc = "Blocks events that do not match the filter"; + g.prototype.onAction = function(c, g) { + if (null != g && (!this.properties.equal_to || this.properties.equal_to == g)) { + if (this.properties.has_property && (c = g[this.properties.has_property], null == c || this.properties.property_equal_to && this.properties.property_equal_to != c)) { + return; + } + this.triggerSlot(0, g); + } + }; + w.registerNodeType("events/filter", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 r.title = "Counter"; r.desc = "Counts events"; r.prototype.getTitle = function() { return this.flags.collapsed ? String(this.num) : this.title; }; +<<<<<<< HEAD r.prototype.onAction = function(c, h) { h = this.num; "inc" == c ? this.num += 1 : "dec" == c ? --this.num : "reset" == c && (this.num = 0); this.num != h && this.trigger("change", this.num); +======= + r.prototype.onAction = function(c, g) { + g = this.num; + "inc" == c ? this.num += 1 : "dec" == c ? --this.num : "reset" == c && (this.num = 0); + this.num != g && this.trigger("change", this.num); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; r.prototype.onDrawBackground = function(c) { this.flags.collapsed || (c.fillStyle = "#AAA", c.font = "20px Arial", c.textAlign = "center", c.fillText(this.num, 0.5 * this.size[0], 0.5 * this.size[1])); @@ -5447,17 +6991,30 @@ $jscomp.polyfill("Object.values", function(v) { w.registerNodeType("events/counter", r); l.title = "Delay"; l.desc = "Delays one event"; +<<<<<<< HEAD l.prototype.onAction = function(c, h) { c = this.properties.time_in_ms; 0 >= c ? this.trigger(null, h) : this._pending.push([c, h]); +======= + l.prototype.onAction = function(c, g) { + c = this.properties.time_in_ms; + 0 >= c ? this.trigger(null, g) : this._pending.push([c, g]); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; l.prototype.onExecute = function() { var c = 1000 * this.graph.elapsed_time; this.isInputConnected(1) && (this.properties.time_in_ms = this.getInputData(1)); +<<<<<<< HEAD for (var h = 0; h < this._pending.length; ++h) { var e = this._pending[h]; e[0] -= c; 0 < e[0] || (this._pending.splice(h, 1), --h, this.trigger(null, e[1])); +======= + for (var g = 0; g < this._pending.length; ++g) { + var e = this._pending[g]; + e[0] -= c; + 0 < e[0] || (this._pending.splice(g, 1), --g, this.trigger(null, e[1])); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } }; l.prototype.onGetInputs = function() { @@ -5497,7 +7054,11 @@ $jscomp.polyfill("Object.values", function(v) { this._last_value = this.getInputData(0); this.setOutputData(0, this.properties.data); }; +<<<<<<< HEAD y.prototype.onAction = function(c, h) { +======= + y.prototype.onAction = function(c, g) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.properties.data = this._last_value; }; y.prototype.onSerialize = function(c) { @@ -5507,7 +7068,11 @@ $jscomp.polyfill("Object.values", function(v) { })(this); (function(v) { function c() { +<<<<<<< HEAD this.addOutput("", A.EVENT); +======= + this.addOutput("", z.EVENT); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addOutput("", "boolean"); this.addProperty("text", "click me"); this.addProperty("font_size", 30); @@ -5517,9 +7082,15 @@ $jscomp.polyfill("Object.values", function(v) { } function q() { this.addInput("", "boolean"); +<<<<<<< HEAD this.addInput("e", A.ACTION); this.addOutput("v", "boolean"); this.addOutput("e", A.EVENT); +======= + this.addInput("e", z.ACTION); + this.addOutput("v", "boolean"); + this.addOutput("e", z.EVENT); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.properties = {font:"", value:!1}; this.size = [160, 44]; } @@ -5531,9 +7102,15 @@ $jscomp.polyfill("Object.values", function(v) { this._precision = this._remainder = 0; this.mouse_captured = !1; } +<<<<<<< HEAD function h() { this.addOutput("", "string"); this.addOutput("change", A.EVENT); +======= + function g() { + this.addOutput("", "string"); + this.addOutput("change", z.EVENT); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.size = [80, 60]; this.properties = {value:"A", values:"A;B;C"}; this.old_y = -1; @@ -5581,12 +7158,17 @@ $jscomp.polyfill("Object.values", function(v) { this.size = [200, 100]; this.properties = {borderColor:"#ffffff", bgcolorTop:"#f0f0f0", bgcolorBottom:"#e0e0e0", shadowSize:2, borderRadius:3}; } +<<<<<<< HEAD var A = v.LiteGraph; +======= + var z = v.LiteGraph; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.title = "Button"; c.desc = "Triggers an event"; c.font = "Arial"; c.prototype.onDrawForeground = function(e) { if (!this.flags.collapsed && (e.fillStyle = "black", e.fillRect(11, 11, this.size[0] - 20, this.size[1] - 20), e.fillStyle = "#AAF", e.fillRect(9, 9, this.size[0] - 20, this.size[1] - 20), e.fillStyle = this.clicked ? "white" : this.mouseOver ? "#668" : "#334", e.fillRect(10, 10, this.size[0] - 20, this.size[1] - 20), this.properties.text || 0 === this.properties.text)) { +<<<<<<< HEAD var h = this.properties.font_size || 30; e.textAlign = "center"; e.fillStyle = this.clicked ? "black" : "white"; @@ -5597,6 +7179,18 @@ $jscomp.polyfill("Object.values", function(v) { }; c.prototype.onMouseDown = function(c, h) { if (1 < h[0] && 1 < h[1] && h[0] < this.size[0] - 2 && h[1] < this.size[1] - 2) { +======= + var g = this.properties.font_size || 30; + e.textAlign = "center"; + e.fillStyle = this.clicked ? "black" : "white"; + e.font = g + "px " + c.font; + e.fillText(this.properties.text, 0.5 * this.size[0], 0.5 * this.size[1] + 0.3 * g); + e.textAlign = "left"; + } + }; + c.prototype.onMouseDown = function(c, g) { + if (1 < g[0] && 1 < g[1] && g[0] < this.size[0] - 2 && g[1] < this.size[1] - 2) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return this.clicked = !0, this.triggerSlot(0, this.properties.message), !0; } }; @@ -5606,22 +7200,39 @@ $jscomp.polyfill("Object.values", function(v) { c.prototype.onMouseUp = function(c) { this.clicked = !1; }; +<<<<<<< HEAD A.registerNodeType("widget/button", c); +======= + z.registerNodeType("widget/button", c); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 q.title = "Toggle"; q.desc = "Toggles between true or false"; q.prototype.onDrawForeground = function(c) { if (!this.flags.collapsed) { +<<<<<<< HEAD var e = 0.5 * this.size[1], h = 0.8 * this.size[1]; +======= + var e = 0.5 * this.size[1], g = 0.8 * this.size[1]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.font = this.properties.font || (0.8 * e).toFixed(0) + "px Arial"; var l = c.measureText(this.title).width; l = 0.5 * (this.size[0] - (l + e)); c.fillStyle = "#AAA"; +<<<<<<< HEAD c.fillRect(l, h - e, e, e); c.fillStyle = this.properties.value ? "#AEF" : "#000"; c.fillRect(l + 0.25 * e, h - e + 0.25 * e, .5 * e, .5 * e); c.textAlign = "left"; c.fillStyle = "#AAA"; c.fillText(this.title, 1.2 * e + l, 0.85 * h); +======= + c.fillRect(l, g - e, e, e); + c.fillStyle = this.properties.value ? "#AEF" : "#000"; + c.fillRect(l + 0.25 * e, g - e + 0.25 * e, .5 * e, .5 * e); + c.textAlign = "left"; + c.fillStyle = "#AAA"; + c.fillText(this.title, 1.2 * e + l, 0.85 * g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.textAlign = "left"; } }; @@ -5634,33 +7245,60 @@ $jscomp.polyfill("Object.values", function(v) { null != c && (this.properties.value = c); this.setOutputData(0, this.properties.value); }; +<<<<<<< HEAD q.prototype.onMouseDown = function(c, h) { if (1 < h[0] && 1 < h[1] && h[0] < this.size[0] - 2 && h[1] < this.size[1] - 2) { return this.properties.value = !this.properties.value, this.graph._version++, this.trigger("e", this.properties.value), !0; } }; A.registerNodeType("widget/toggle", q); +======= + q.prototype.onMouseDown = function(c, g) { + if (1 < g[0] && 1 < g[1] && g[0] < this.size[0] - 2 && g[1] < this.size[1] - 2) { + return this.properties.value = !this.properties.value, this.graph._version++, this.trigger("e", this.properties.value), !0; + } + }; + z.registerNodeType("widget/toggle", q); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 m.title = "Number"; m.desc = "Widget to select number value"; m.pixels_threshold = 10; m.markers_color = "#666"; m.prototype.onDrawForeground = function(c) { +<<<<<<< HEAD var e = 0.5 * this.size[0], h = this.size[1]; 30 < h ? (c.fillStyle = m.markers_color, c.beginPath(), c.moveTo(e, 0.1 * h), c.lineTo(e + 0.1 * h, 0.2 * h), c.lineTo(e + -0.1 * h, 0.2 * h), c.fill(), c.beginPath(), c.moveTo(e, 0.9 * h), c.lineTo(e + 0.1 * h, 0.8 * h), c.lineTo(e + -0.1 * h, 0.8 * h), c.fill(), c.font = (0.7 * h).toFixed(1) + "px Arial") : c.font = (0.8 * h).toFixed(1) + "px Arial"; c.textAlign = "center"; c.font = (0.7 * h).toFixed(1) + "px Arial"; c.fillStyle = "#EEE"; c.fillText(this.properties.value.toFixed(this._precision), e, 0.75 * h); +======= + var e = 0.5 * this.size[0], g = this.size[1]; + 30 < g ? (c.fillStyle = m.markers_color, c.beginPath(), c.moveTo(e, 0.1 * g), c.lineTo(e + 0.1 * g, 0.2 * g), c.lineTo(e + -0.1 * g, 0.2 * g), c.fill(), c.beginPath(), c.moveTo(e, 0.9 * g), c.lineTo(e + 0.1 * g, 0.8 * g), c.lineTo(e + -0.1 * g, 0.8 * g), c.fill(), c.font = (0.7 * g).toFixed(1) + "px Arial") : c.font = (0.8 * g).toFixed(1) + "px Arial"; + c.textAlign = "center"; + c.font = (0.7 * g).toFixed(1) + "px Arial"; + c.fillStyle = "#EEE"; + c.fillText(this.properties.value.toFixed(this._precision), e, 0.75 * g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; m.prototype.onExecute = function() { this.setOutputData(0, this.properties.value); }; +<<<<<<< HEAD m.prototype.onPropertyChanged = function(c, h) { c = (this.properties.step + "").split("."); this._precision = 1 < c.length ? c[1].length : 0; }; m.prototype.onMouseDown = function(c, h) { if (!(0 > h[1])) { +======= + m.prototype.onPropertyChanged = function(c, g) { + c = (this.properties.step + "").split("."); + this._precision = 1 < c.length ? c[1].length : 0; + }; + m.prototype.onMouseDown = function(c, g) { + if (!(0 > g[1])) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return this.old_y = c.canvasY, this.captureInput(!0), this.mouse_captured = !0; } }; @@ -5680,6 +7318,7 @@ $jscomp.polyfill("Object.values", function(v) { this.setDirtyCanvas(!0); } }; +<<<<<<< HEAD m.prototype.onMouseUp = function(c, h) { 200 > c.click_time && (this.properties.value = Math.clamp(this.properties.value + (h[1] > 0.5 * this.size[1] ? -1 : 1) * this.properties.step, this.properties.min, this.properties.max), this.graph._version++, this.setDirtyCanvas(!0)); this.mouse_captured && (this.mouse_captured = !1, this.captureInput(!1)); @@ -5694,16 +7333,39 @@ $jscomp.polyfill("Object.values", function(v) { "values" == c ? (this._values = h.split(";"), this.widget.options.values = this._values) : "value" == c && (this.widget.value = h); }; A.registerNodeType("widget/combo", h); +======= + m.prototype.onMouseUp = function(c, g) { + 200 > c.click_time && (this.properties.value = Math.clamp(this.properties.value + (g[1] > 0.5 * this.size[1] ? -1 : 1) * this.properties.step, this.properties.min, this.properties.max), this.graph._version++, this.setDirtyCanvas(!0)); + this.mouse_captured && (this.mouse_captured = !1, this.captureInput(!1)); + }; + z.registerNodeType("widget/number", m); + g.title = "Combo"; + g.desc = "Widget to select from a list"; + g.prototype.onExecute = function() { + this.setOutputData(0, this.properties.value); + }; + g.prototype.onPropertyChanged = function(c, g) { + "values" == c ? (this._values = g.split(";"), this.widget.options.values = this._values) : "value" == c && (this.widget.value = g); + }; + z.registerNodeType("widget/combo", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 r.title = "Knob"; r.desc = "Circular controller"; r.size = [80, 100]; r.prototype.onDrawForeground = function(c) { if (!this.flags.collapsed) { -1 == this.value && (this.value = (this.properties.value - this.properties.min) / (this.properties.max - this.properties.min)); +<<<<<<< HEAD var e = 0.5 * this.size[0], h = 0.5 * this.size[1], l = 0.5 * Math.min(this.size[0], this.size[1]) - 5; c.globalAlpha = 1; c.save(); c.translate(e, h); +======= + var e = 0.5 * this.size[0], g = 0.5 * this.size[1], l = 0.5 * Math.min(this.size[0], this.size[1]) - 5; + c.globalAlpha = 1; + c.save(); + c.translate(e, g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.rotate(0.75 * Math.PI); c.fillStyle = "rgba(0,0,0,0.5)"; c.beginPath(); @@ -5723,27 +7385,47 @@ $jscomp.polyfill("Object.values", function(v) { c.restore(); c.fillStyle = "black"; c.beginPath(); +<<<<<<< HEAD c.arc(e, h, 0.75 * l, 0, 2 * Math.PI, !0); +======= + c.arc(e, g, 0.75 * l, 0, 2 * Math.PI, !0); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.fill(); c.fillStyle = this.mouseOver ? "white" : this.properties.color; c.beginPath(); var m = this.value * Math.PI * 1.5 + 0.75 * Math.PI; +<<<<<<< HEAD c.arc(e + Math.cos(m) * l * 0.65, h + Math.sin(m) * l * 0.65, 0.05 * l, 0, 2 * Math.PI, !0); +======= + c.arc(e + Math.cos(m) * l * 0.65, g + Math.sin(m) * l * 0.65, 0.05 * l, 0, 2 * Math.PI, !0); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.fill(); c.fillStyle = this.mouseOver ? "white" : "#AAA"; c.font = Math.floor(0.5 * l) + "px Arial"; c.textAlign = "center"; +<<<<<<< HEAD c.fillText(this.properties.value.toFixed(this.properties.precision), e, h + 0.15 * l); +======= + c.fillText(this.properties.value.toFixed(this.properties.precision), e, g + 0.15 * l); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } }; r.prototype.onExecute = function() { this.setOutputData(0, this.properties.value); +<<<<<<< HEAD this.boxcolor = A.colorToString([this.value, this.value, this.value]); +======= + this.boxcolor = z.colorToString([this.value, this.value, this.value]); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; r.prototype.onMouseDown = function(c) { this.center = [0.5 * this.size[0], 0.5 * this.size[1] + 20]; this.radius = 0.5 * this.size[0]; +<<<<<<< HEAD if (20 > c.canvasY - this.pos[1] || A.distance([c.canvasX, c.canvasY], [this.pos[0] + this.center[0], this.pos[1] + this.center[1]]) > this.radius) { +======= + if (20 > c.canvasY - this.pos[1] || z.distance([c.canvasX, c.canvasY], [this.pos[0] + this.center[0], this.pos[1] + this.center[1]]) > this.radius) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return !1; } this.oldmouse = [c.canvasX - this.pos[0], c.canvasY - this.pos[1]]; @@ -5765,6 +7447,7 @@ $jscomp.polyfill("Object.values", function(v) { r.prototype.onMouseUp = function(c) { this.oldmouse && (this.oldmouse = null, this.captureInput(!1)); }; +<<<<<<< HEAD r.prototype.onPropertyChanged = function(c, h) { if ("min" == c || "max" == c || "value" == c) { return this.properties[c] = parseFloat(h), !0; @@ -5774,11 +7457,26 @@ $jscomp.polyfill("Object.values", function(v) { l.title = "Inner Slider"; l.prototype.onPropertyChanged = function(c, h) { "value" == c && (this.slider.value = h); +======= + r.prototype.onPropertyChanged = function(c, g) { + if ("min" == c || "max" == c || "value" == c) { + return this.properties[c] = parseFloat(g), !0; + } + }; + z.registerNodeType("widget/knob", r); + l.title = "Inner Slider"; + l.prototype.onPropertyChanged = function(c, g) { + "value" == c && (this.slider.value = g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; l.prototype.onExecute = function() { this.setOutputData(0, this.properties.value); }; +<<<<<<< HEAD A.registerNodeType("widget/internal_slider", l); +======= + z.registerNodeType("widget/internal_slider", l); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 B.title = "H.Slider"; B.desc = "Linear slider controller"; B.prototype.onDrawForeground = function(c) { @@ -5795,7 +7493,11 @@ $jscomp.polyfill("Object.values", function(v) { B.prototype.onExecute = function() { this.properties.value = this.properties.min + (this.properties.max - this.properties.min) * this.value; this.setOutputData(0, this.properties.value); +<<<<<<< HEAD this.boxcolor = A.colorToString([this.value, this.value, this.value]); +======= + this.boxcolor = z.colorToString([this.value, this.value, this.value]); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; B.prototype.onMouseDown = function(c) { if (0 > c.canvasY - this.pos[1]) { @@ -5822,7 +7524,11 @@ $jscomp.polyfill("Object.values", function(v) { }; B.prototype.onMouseLeave = function(c) { }; +<<<<<<< HEAD A.registerNodeType("widget/hslider", B); +======= + z.registerNodeType("widget/hslider", B); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 y.title = "Progress"; y.desc = "Shows data in linear progress"; y.prototype.onExecute = function() { @@ -5837,7 +7543,11 @@ $jscomp.polyfill("Object.values", function(v) { e = Math.max(0, e); c.fillRect(2, 2, (this.size[0] - 4) * e, this.size[1] - 4); }; +<<<<<<< HEAD A.registerNodeType("widget/progress", y); +======= + z.registerNodeType("widget/progress", y); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 w.title = "Text"; w.desc = "Shows the input value"; w.widgets = [{name:"resize", text:"Resize box", type:"button"}, {name:"led_text", text:"LED", type:"minibutton"}, {name:"normal_text", text:"Normal", type:"minibutton"}]; @@ -5845,14 +7555,24 @@ $jscomp.polyfill("Object.values", function(v) { c.fillStyle = this.properties.color; var e = this.properties.value; this.properties.glowSize ? (c.shadowColor = this.properties.color, c.shadowOffsetX = 0, c.shadowOffsetY = 0, c.shadowBlur = this.properties.glowSize) : c.shadowColor = "transparent"; +<<<<<<< HEAD var h = this.properties.fontsize; c.textAlign = this.properties.align; c.font = h.toString() + "px " + this.properties.font; +======= + var g = this.properties.fontsize; + c.textAlign = this.properties.align; + c.font = g.toString() + "px " + this.properties.font; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.str = "number" == typeof e ? e.toFixed(this.properties.decimals) : e; if ("string" == typeof this.str) { e = this.str.split("\\n"); for (var l in e) { +<<<<<<< HEAD c.fillText(e[l], "left" == this.properties.align ? 15 : this.size[0] - 15, -0.15 * h + h * (parseInt(l) + 1)); +======= + c.fillText(e[l], "left" == this.properties.align ? 15 : this.size[0] - 15, -0.15 * g + g * (parseInt(l) + 1)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } c.shadowColor = "transparent"; @@ -5867,22 +7587,40 @@ $jscomp.polyfill("Object.values", function(v) { if (this.last_ctx) { var c = this.str.split("\\n"); this.last_ctx.font = this.properties.fontsize + "px " + this.properties.font; +<<<<<<< HEAD var h = 0, l; for (l in c) { var m = this.last_ctx.measureText(c[l]).width; h < m && (h = m); } this.size[0] = h + 20; +======= + var g = 0, l; + for (l in c) { + var m = this.last_ctx.measureText(c[l]).width; + g < m && (g = m); + } + this.size[0] = g + 20; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.size[1] = 4 + c.length * this.properties.fontsize; this.setDirtyCanvas(!0); } }; +<<<<<<< HEAD w.prototype.onPropertyChanged = function(c, h) { this.properties[c] = h; this.str = "number" == typeof h ? h.toFixed(3) : h; return !0; }; A.registerNodeType("widget/text", w); +======= + w.prototype.onPropertyChanged = function(c, g) { + this.properties[c] = g; + this.str = "number" == typeof g ? g.toFixed(3) : g; + return !0; + }; + z.registerNodeType("widget/text", w); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 E.title = "Panel"; E.desc = "Non interactive panel"; E.widgets = [{name:"update", text:"Update", type:"button"}]; @@ -5893,7 +7631,11 @@ $jscomp.polyfill("Object.values", function(v) { this.flags.collapsed || (null == this.lineargradient && this.createGradient(c), this.lineargradient && (c.lineWidth = 1, c.strokeStyle = this.properties.borderColor, c.fillStyle = this.lineargradient, this.properties.shadowSize ? (c.shadowColor = "#000", c.shadowOffsetX = 0, c.shadowOffsetY = 0, c.shadowBlur = this.properties.shadowSize) : c.shadowColor = "transparent", c.roundRect(0, 0, this.size[0] - 1, this.size[1] - 1, this.properties.shadowSize), c.fill(), c.shadowColor = "transparent", c.stroke())); }; +<<<<<<< HEAD A.registerNodeType("widget/panel", E); +======= + z.registerNodeType("widget/panel", E); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 })(this); (function(v) { function c() { @@ -5918,11 +7660,19 @@ $jscomp.polyfill("Object.values", function(v) { c.zero = new Float32Array(2); c.buttons = "a b x y lb rb lt rt back start ls rs home".split(" "); c.prototype.onExecute = function() { +<<<<<<< HEAD var m = this.getGamepad(), h = this.properties.threshold || 0.0; m && (this._left_axis[0] = Math.abs(m.xbox.axes.lx) > h ? m.xbox.axes.lx : 0, this._left_axis[1] = Math.abs(m.xbox.axes.ly) > h ? m.xbox.axes.ly : 0, this._right_axis[0] = Math.abs(m.xbox.axes.rx) > h ? m.xbox.axes.rx : 0, this._right_axis[1] = Math.abs(m.xbox.axes.ry) > h ? m.xbox.axes.ry : 0, this._triggers[0] = Math.abs(m.xbox.axes.ltrigger) > h ? m.xbox.axes.ltrigger : 0, this._triggers[1] = Math.abs(m.xbox.axes.rtrigger) > h ? m.xbox.axes.rtrigger : 0); if (this.outputs) { for (h = 0; h < this.outputs.length; h++) { var r = this.outputs[h]; +======= + var m = this.getGamepad(), g = this.properties.threshold || 0.0; + m && (this._left_axis[0] = Math.abs(m.xbox.axes.lx) > g ? m.xbox.axes.lx : 0, this._left_axis[1] = Math.abs(m.xbox.axes.ly) > g ? m.xbox.axes.ly : 0, this._right_axis[0] = Math.abs(m.xbox.axes.rx) > g ? m.xbox.axes.rx : 0, this._right_axis[1] = Math.abs(m.xbox.axes.ry) > g ? m.xbox.axes.ry : 0, this._triggers[0] = Math.abs(m.xbox.axes.ltrigger) > g ? m.xbox.axes.ltrigger : 0, this._triggers[1] = Math.abs(m.xbox.axes.rtrigger) > g ? m.xbox.axes.rtrigger : 0); + if (this.outputs) { + for (g = 0; g < this.outputs.length; g++) { + var r = this.outputs[g]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (r.links && r.links.length) { var l = null; if (m) { @@ -5998,7 +7748,11 @@ $jscomp.polyfill("Object.values", function(v) { break; case "button_pressed": for (r = 0; r < this._current_buttons.length; ++r) { +<<<<<<< HEAD this._current_buttons[r] && !this._previous_buttons[r] && this.triggerSlot(h, c.buttons[r]); +======= + this._current_buttons[r] && !this._previous_buttons[r] && this.triggerSlot(g, c.buttons[r]); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } else { @@ -6013,7 +7767,11 @@ $jscomp.polyfill("Object.values", function(v) { l = 0; } } +<<<<<<< HEAD this.setOutputData(h, l); +======= + this.setOutputData(g, l); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -6027,6 +7785,7 @@ $jscomp.polyfill("Object.values", function(v) { } m = m.call(navigator); this._previous_buttons.set(this._current_buttons); +<<<<<<< HEAD for (var h = this.properties.gamepad_index; 4 > h; h++) { if (m[h]) { m = m[h]; @@ -6063,12 +7822,51 @@ $jscomp.polyfill("Object.values", function(v) { } } m.xbox = h; +======= + for (var g = this.properties.gamepad_index; 4 > g; g++) { + if (m[g]) { + m = m[g]; + g = this.xbox_mapping; + g || (g = this.xbox_mapping = {axes:[], buttons:{}, hat:"", hatmap:c.CENTER}); + g.axes.lx = m.axes[0]; + g.axes.ly = m.axes[1]; + g.axes.rx = m.axes[2]; + g.axes.ry = m.axes[3]; + g.axes.ltrigger = m.buttons[6].value; + g.axes.rtrigger = m.buttons[7].value; + g.hat = ""; + g.hatmap = c.CENTER; + for (var r = 0; r < m.buttons.length; r++) { + if (this._current_buttons[r] = m.buttons[r].pressed, 12 > r) { + g.buttons[c.mapping_array[r]] = m.buttons[r].pressed, m.buttons[r].was_pressed && this.trigger(c.mapping_array[r] + "_button_event"); + } else { + switch(r) { + case 12: + m.buttons[r].pressed && (g.hat += "up", g.hatmap |= c.UP); + break; + case 13: + m.buttons[r].pressed && (g.hat += "down", g.hatmap |= c.DOWN); + break; + case 14: + m.buttons[r].pressed && (g.hat += "left", g.hatmap |= c.LEFT); + break; + case 15: + m.buttons[r].pressed && (g.hat += "right", g.hatmap |= c.RIGHT); + break; + case 16: + g.buttons.home = m.buttons[r].pressed; + } + } + } + m.xbox = g; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return m; } } }; c.prototype.onDrawBackground = function(c) { if (!this.flags.collapsed) { +<<<<<<< HEAD var h = this._left_axis, m = this._right_axis; c.strokeStyle = "#88A"; c.strokeRect(0.5 * (h[0] + 1) * this.size[0] - 4, 0.5 * (h[1] + 1) * this.size[1] - 4, 8, 8); @@ -6078,6 +7876,17 @@ $jscomp.polyfill("Object.values", function(v) { c.fillStyle = "#AEB"; for (m = 0; m < this._current_buttons.length; ++m) { this._current_buttons[m] && c.fillRect(0, h * m, 6, h); +======= + var g = this._left_axis, m = this._right_axis; + c.strokeStyle = "#88A"; + c.strokeRect(0.5 * (g[0] + 1) * this.size[0] - 4, 0.5 * (g[1] + 1) * this.size[1] - 4, 8, 8); + c.strokeStyle = "#8A8"; + c.strokeRect(0.5 * (m[0] + 1) * this.size[0] - 4, 0.5 * (m[1] + 1) * this.size[1] - 4, 8, 8); + g = this.size[1] / this._current_buttons.length; + c.fillStyle = "#AEB"; + for (m = 0; m < this._current_buttons.length; ++m) { + this._current_buttons[m] && c.fillRect(0, g * m, 6, g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } }; @@ -6101,7 +7910,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addInput("in"); this.addOutput("out"); } +<<<<<<< HEAD function h() { +======= + function g() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("in", "number", {locked:!0}); this.addOutput("out", "number", {locked:!0}); this.addOutput("clamped", "number", {locked:!0}); @@ -6152,7 +7965,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addOutput("out", "number"); this.size = [80, 30]; } +<<<<<<< HEAD function A() { +======= + function z() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("in", "number"); this.addOutput("out", "number"); this.size = [80, 30]; @@ -6180,7 +7997,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addInput("B"); this.addOutput("out"); } +<<<<<<< HEAD function H() { +======= + function G() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("in", "number"); this.addOutput("out", "number"); this.size = [80, 30]; @@ -6234,7 +8055,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addProperty("offset", 0); this.bgImageUrl = "nodes/imgs/icon-sin.png"; } +<<<<<<< HEAD function g() { +======= + function h() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("x", "number"); this.addInput("y", "number"); this.addOutput("", "number"); @@ -6242,8 +8067,13 @@ $jscomp.polyfill("Object.values", function(v) { this.code_widget = this.addWidget("text", "F(x,y)", this.properties.formula, function(a, b, d) { d.properties.formula = a; }); +<<<<<<< HEAD this.addWidget("toggle", "allow", z.allow_scripts, function(a) { z.allow_scripts = a; +======= + this.addWidget("toggle", "allow", A.allow_scripts, function(a) { + A.allow_scripts = a; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this._func = null; } @@ -6258,7 +8088,11 @@ $jscomp.polyfill("Object.values", function(v) { this.properties = {x:0, y:0}; this._data = new Float32Array(2); } +<<<<<<< HEAD function G() { +======= + function H() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("vec3", "vec3"); this.addOutput("x", "number"); this.addOutput("y", "number"); @@ -6283,7 +8117,11 @@ $jscomp.polyfill("Object.values", function(v) { this.properties = {x:0, y:0, z:0, w:0}; this._data = new Float32Array(4); } +<<<<<<< HEAD var z = v.LiteGraph; +======= + var A = v.LiteGraph; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.title = "Converter"; c.desc = "type A to type B"; c.prototype.onExecute = function() { @@ -6327,20 +8165,29 @@ $jscomp.polyfill("Object.values", function(v) { c.prototype.onGetOutputs = function() { return [["number", "number"], ["vec2", "vec2"], ["vec3", "vec3"], ["vec4", "vec4"]]; }; +<<<<<<< HEAD z.registerNodeType("math/converter", c); +======= + A.registerNodeType("math/converter", c); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 q.title = "Bypass"; q.desc = "removes the type"; q.prototype.onExecute = function() { var a = this.getInputData(0); this.setOutputData(0, a); }; +<<<<<<< HEAD z.registerNodeType("math/bypass", q); +======= + A.registerNodeType("math/bypass", q); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 m.title = "to Number"; m.desc = "Cast to number"; m.prototype.onExecute = function() { var a = this.getInputData(0); this.setOutputData(0, Number(a)); }; +<<<<<<< HEAD z.registerNodeType("math/to_number", m); h.title = "Range"; h.desc = "Convert a number from one range to another"; @@ -6348,6 +8195,15 @@ $jscomp.polyfill("Object.values", function(v) { return this.flags.collapsed ? (this._last_v || 0).toFixed(2) : this.title; }; h.prototype.onExecute = function() { +======= + A.registerNodeType("math/to_number", m); + g.title = "Range"; + g.desc = "Convert a number from one range to another"; + g.prototype.getTitle = function() { + return this.flags.collapsed ? (this._last_v || 0).toFixed(2) : this.title; + }; + g.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.inputs) { for (var a = 0; a < this.inputs.length; a++) { var b = this.inputs[a], d = this.getInputData(a); @@ -6365,6 +8221,7 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, this._last_v); this.setOutputData(1, Math.clamp(this._last_v, b, c)); }; +<<<<<<< HEAD h.prototype.onDrawBackground = function(a) { this.outputs[0].label = this._last_v ? this._last_v.toFixed(3) : "?"; }; @@ -6372,6 +8229,15 @@ $jscomp.polyfill("Object.values", function(v) { return [["in_min", "number"], ["in_max", "number"], ["out_min", "number"], ["out_max", "number"]]; }; z.registerNodeType("math/range", h); +======= + g.prototype.onDrawBackground = function(a) { + this.outputs[0].label = this._last_v ? this._last_v.toFixed(3) : "?"; + }; + g.prototype.onGetInputs = function() { + return [["in_min", "number"], ["in_max", "number"], ["out_min", "number"], ["out_max", "number"]]; + }; + A.registerNodeType("math/range", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 r.title = "Rand"; r.desc = "Random number"; r.prototype.onExecute = function() { @@ -6391,7 +8257,11 @@ $jscomp.polyfill("Object.values", function(v) { r.prototype.onGetInputs = function() { return [["min", "number"], ["max", "number"]]; }; +<<<<<<< HEAD z.registerNodeType("math/rand", r); +======= + A.registerNodeType("math/rand", r); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 l.title = "Noise"; l.desc = "Random number with temporal continuity"; l.data = null; @@ -6421,7 +8291,11 @@ $jscomp.polyfill("Object.values", function(v) { l.prototype.onDrawBackground = function(a) { this.outputs[0].label = (this._last_v || 0).toFixed(3); }; +<<<<<<< HEAD z.registerNodeType("math/noise", l); +======= + A.registerNodeType("math/noise", l); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 B.title = "Spikes"; B.desc = "spike every random time"; B.prototype.onExecute = function() { @@ -6433,7 +8307,11 @@ $jscomp.polyfill("Object.values", function(v) { 0 > this._remaining_time ? (this._remaining_time = Math.random() * (this.properties.max_time - this.properties.min_time) + this.properties.min_time, this._blink_time = this.properties.duration, this.boxcolor = "#FFF") : this.boxcolor = "#000"; this.setOutputData(0, a); }; +<<<<<<< HEAD z.registerNodeType("math/spikes", B); +======= + A.registerNodeType("math/spikes", B); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 y.title = "Clamp"; y.desc = "Clamp number between min and max"; y.prototype.onExecute = function() { @@ -6445,7 +8323,11 @@ $jscomp.polyfill("Object.values", function(v) { this.isInputConnected(0) && (a += "clamp({{0}}," + this.properties.min + "," + this.properties.max + ")"); return a; }; +<<<<<<< HEAD z.registerNodeType("math/clamp", y); +======= + A.registerNodeType("math/clamp", y); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 w.title = "Lerp"; w.desc = "Linear Interpolation"; w.prototype.onExecute = function() { @@ -6460,13 +8342,18 @@ $jscomp.polyfill("Object.values", function(v) { w.prototype.onGetInputs = function() { return [["f", "number"]]; }; +<<<<<<< HEAD z.registerNodeType("math/lerp", w); +======= + A.registerNodeType("math/lerp", w); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 E.title = "Abs"; E.desc = "Absolute"; E.prototype.onExecute = function() { var a = this.getInputData(0); null != a && this.setOutputData(0, Math.abs(a)); }; +<<<<<<< HEAD z.registerNodeType("math/abs", E); A.title = "Floor"; A.desc = "Floor number to remove fractional part"; @@ -6475,13 +8362,27 @@ $jscomp.polyfill("Object.values", function(v) { null != a && this.setOutputData(0, Math.floor(a)); }; z.registerNodeType("math/floor", A); +======= + A.registerNodeType("math/abs", E); + z.title = "Floor"; + z.desc = "Floor number to remove fractional part"; + z.prototype.onExecute = function() { + var a = this.getInputData(0); + null != a && this.setOutputData(0, Math.floor(a)); + }; + A.registerNodeType("math/floor", z); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e.title = "Frac"; e.desc = "Returns fractional part"; e.prototype.onExecute = function() { var a = this.getInputData(0); null != a && this.setOutputData(0, a % 1); }; +<<<<<<< HEAD z.registerNodeType("math/frac", e); +======= + A.registerNodeType("math/frac", e); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 C.title = "Smoothstep"; C.desc = "Smoothstep"; C.prototype.onExecute = function() { @@ -6492,24 +8393,39 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, a * a * (3 - 2 * a)); } }; +<<<<<<< HEAD z.registerNodeType("math/smoothstep", C); +======= + A.registerNodeType("math/smoothstep", C); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 D.title = "Scale"; D.desc = "v * factor"; D.prototype.onExecute = function() { var a = this.getInputData(0); null != a && this.setOutputData(0, a * this.properties.factor); }; +<<<<<<< HEAD z.registerNodeType("math/scale", D); +======= + A.registerNodeType("math/scale", D); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 u.title = "Gate"; u.desc = "if v is true, then outputs A, otherwise B"; u.prototype.onExecute = function() { var a = this.getInputData(0); this.setOutputData(0, this.getInputData(a ? 1 : 2)); }; +<<<<<<< HEAD z.registerNodeType("math/gate", u); H.title = "Average"; H.desc = "Average Filter"; H.prototype.onExecute = function() { +======= + A.registerNodeType("math/gate", u); + G.title = "Average"; + G.desc = "Average Filter"; + G.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); null == a && (a = 0); var b = this._values.length; @@ -6521,14 +8437,22 @@ $jscomp.polyfill("Object.values", function(v) { } this.setOutputData(0, a / b); }; +<<<<<<< HEAD H.prototype.onPropertyChanged = function(a, b) { +======= + G.prototype.onPropertyChanged = function(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 1 > b && (b = 1); this.properties.samples = Math.round(b); a = this._values; this._values = new Float32Array(this.properties.samples); a.length <= this._values.length ? this._values.set(a) : this._values.set(a.subarray(0, this._values.length)); }; +<<<<<<< HEAD z.registerNodeType("math/average", H); +======= + A.registerNodeType("math/average", G); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 n.title = "TendTo"; n.desc = "moves the output value always closer to the input"; n.prototype.onExecute = function() { @@ -6538,7 +8462,11 @@ $jscomp.polyfill("Object.values", function(v) { this._value = null == this._value ? a : this._value * (1 - b) + a * b; this.setOutputData(0, this._value); }; +<<<<<<< HEAD z.registerNodeType("math/tendTo", n); +======= + A.registerNodeType("math/tendTo", n); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 p.values = "+ - * / % ^ max min".split(" "); p.title = "Operation"; p.desc = "Easy math operators"; @@ -6589,11 +8517,19 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, d); }; p.prototype.onDrawBackground = function(a) { +<<<<<<< HEAD this.flags.collapsed || (a.font = "40px Arial", a.fillStyle = "#666", a.textAlign = "center", a.fillText(this.properties.OP, 0.5 * this.size[0], 0.5 * (this.size[1] + z.NODE_TITLE_HEIGHT)), a.textAlign = "left"); }; z.registerNodeType("math/operation", p); z.registerSearchboxExtra("math/operation", "MAX", {properties:{OP:"max"}, title:"MAX()"}); z.registerSearchboxExtra("math/operation", "MIN", {properties:{OP:"min"}, title:"MIN()"}); +======= + this.flags.collapsed || (a.font = "40px Arial", a.fillStyle = "#666", a.textAlign = "center", a.fillText(this.properties.OP, 0.5 * this.size[0], 0.5 * (this.size[1] + A.NODE_TITLE_HEIGHT)), a.textAlign = "left"); + }; + A.registerNodeType("math/operation", p); + A.registerSearchboxExtra("math/operation", "MAX", {properties:{OP:"max"}, title:"MAX()"}); + A.registerSearchboxExtra("math/operation", "MIN", {properties:{OP:"min"}, title:"MIN()"}); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 k.title = "Compare"; k.desc = "compares between two values"; k.prototype.onExecute = function() { @@ -6629,6 +8565,7 @@ $jscomp.polyfill("Object.values", function(v) { k.prototype.onGetOutputs = function() { return [["A==B", "boolean"], ["A!=B", "boolean"], ["A>B", "boolean"], ["A=B", "boolean"], ["A<=B", "boolean"]]; }; +<<<<<<< HEAD z.registerNodeType("math/compare", k); z.registerSearchboxExtra("math/compare", "==", {outputs:[["A==B", "boolean"]], title:"A==B"}); z.registerSearchboxExtra("math/compare", "!=", {outputs:[["A!=B", "boolean"]], title:"A!=B"}); @@ -6636,6 +8573,15 @@ $jscomp.polyfill("Object.values", function(v) { z.registerSearchboxExtra("math/compare", "<", {outputs:[["A=", {outputs:[["A>=B", "boolean"]], title:"A>=B"}); z.registerSearchboxExtra("math/compare", "<=", {outputs:[["A<=B", "boolean"]], title:"A<=B"}); +======= + A.registerNodeType("math/compare", k); + A.registerSearchboxExtra("math/compare", "==", {outputs:[["A==B", "boolean"]], title:"A==B"}); + A.registerSearchboxExtra("math/compare", "!=", {outputs:[["A!=B", "boolean"]], title:"A!=B"}); + A.registerSearchboxExtra("math/compare", ">", {outputs:[["A>B", "boolean"]], title:"A>B"}); + A.registerSearchboxExtra("math/compare", "<", {outputs:[["A=", {outputs:[["A>=B", "boolean"]], title:"A>=B"}); + A.registerSearchboxExtra("math/compare", "<=", {outputs:[["A<=B", "boolean"]], title:"A<=B"}); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.values = "> < == != <= >= || &&".split(" "); a["@OP"] = {type:"enum", title:"operation", values:a.values}; a.title = "Condition"; @@ -6677,7 +8623,11 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, d); this.setOutputData(1, !d); }; +<<<<<<< HEAD z.registerNodeType("math/condition", a); +======= + A.registerNodeType("math/condition", a); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b.title = "Accumulate"; b.desc = "Increments a value every time"; b.prototype.onExecute = function() { @@ -6686,7 +8636,11 @@ $jscomp.polyfill("Object.values", function(v) { this.properties.value = null !== a ? this.properties.value + a : this.properties.value + this.properties.increment; this.setOutputData(0, this.properties.value); }; +<<<<<<< HEAD z.registerNodeType("math/accumulate", b); +======= + A.registerNodeType("math/accumulate", b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 d.title = "Trigonometry"; d.desc = "Sin Cos Tan"; d.prototype.onExecute = function() { @@ -6727,6 +8681,7 @@ $jscomp.polyfill("Object.values", function(v) { d.prototype.onGetOutputs = function() { return [["sin", "number"], ["cos", "number"], ["tan", "number"], ["asin", "number"], ["acos", "number"], ["atan", "number"]]; }; +<<<<<<< HEAD z.registerNodeType("math/trigonometry", d); z.registerSearchboxExtra("math/trigonometry", "SIN()", {outputs:[["sin", "number"]], title:"SIN()"}); z.registerSearchboxExtra("math/trigonometry", "COS()", {outputs:[["cos", "number"]], title:"COS()"}); @@ -6739,6 +8694,20 @@ $jscomp.polyfill("Object.values", function(v) { }; g.prototype.onExecute = function() { if (z.allow_scripts) { +======= + A.registerNodeType("math/trigonometry", d); + A.registerSearchboxExtra("math/trigonometry", "SIN()", {outputs:[["sin", "number"]], title:"SIN()"}); + A.registerSearchboxExtra("math/trigonometry", "COS()", {outputs:[["cos", "number"]], title:"COS()"}); + A.registerSearchboxExtra("math/trigonometry", "TAN()", {outputs:[["tan", "number"]], title:"TAN()"}); + h.title = "Formula"; + h.desc = "Compute formula"; + h.size = [160, 100]; + G.prototype.onPropertyChanged = function(a, b) { + "formula" == a && (this.code_widget.value = b); + }; + h.prototype.onExecute = function() { + if (A.allow_scripts) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0), b = this.getInputData(1); null != a ? this.properties.x = a : a = this.properties.x; null != b ? this.properties.y = b : b = this.properties.y; @@ -6752,6 +8721,7 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, d); } }; +<<<<<<< HEAD g.prototype.getTitle = function() { return this._func_code || "Formula"; }; @@ -6760,13 +8730,27 @@ $jscomp.polyfill("Object.values", function(v) { this.outputs && this.outputs.length && (this.outputs[0].label = a); }; z.registerNodeType("math/formula", g); +======= + h.prototype.getTitle = function() { + return this._func_code || "Formula"; + }; + h.prototype.onDrawBackground = function() { + var a = this.properties.formula; + this.outputs && this.outputs.length && (this.outputs[0].label = a); + }; + A.registerNodeType("math/formula", h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 f.title = "Vec2->XY"; f.desc = "vector 2 to components"; f.prototype.onExecute = function() { var a = this.getInputData(0); null != a && (this.setOutputData(0, a[0]), this.setOutputData(1, a[1])); }; +<<<<<<< HEAD z.registerNodeType("math3d/vec2-to-xy", f); +======= + A.registerNodeType("math3d/vec2-to-xy", f); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 x.title = "XY->Vec2"; x.desc = "components to vector2"; x.prototype.onExecute = function() { @@ -6779,6 +8763,7 @@ $jscomp.polyfill("Object.values", function(v) { d[1] = b; this.setOutputData(0, d); }; +<<<<<<< HEAD z.registerNodeType("math3d/xy-to-vec2", x); G.title = "Vec3->XYZ"; G.desc = "vector 3 to components"; @@ -6787,6 +8772,16 @@ $jscomp.polyfill("Object.values", function(v) { null != a && (this.setOutputData(0, a[0]), this.setOutputData(1, a[1]), this.setOutputData(2, a[2])); }; z.registerNodeType("math3d/vec3-to-xyz", G); +======= + A.registerNodeType("math3d/xy-to-vec2", x); + H.title = "Vec3->XYZ"; + H.desc = "vector 3 to components"; + H.prototype.onExecute = function() { + var a = this.getInputData(0); + null != a && (this.setOutputData(0, a[0]), this.setOutputData(1, a[1]), this.setOutputData(2, a[2])); + }; + A.registerNodeType("math3d/vec3-to-xyz", H); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 I.title = "XYZ->Vec3"; I.desc = "components to vector3"; I.prototype.onExecute = function() { @@ -6802,14 +8797,22 @@ $jscomp.polyfill("Object.values", function(v) { c[2] = d; this.setOutputData(0, c); }; +<<<<<<< HEAD z.registerNodeType("math3d/xyz-to-vec3", I); +======= + A.registerNodeType("math3d/xyz-to-vec3", I); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 J.title = "Vec4->XYZW"; J.desc = "vector 4 to components"; J.prototype.onExecute = function() { var a = this.getInputData(0); null != a && (this.setOutputData(0, a[0]), this.setOutputData(1, a[1]), this.setOutputData(2, a[2]), this.setOutputData(3, a[3])); }; +<<<<<<< HEAD z.registerNodeType("math3d/vec4-to-xyzw", J); +======= + A.registerNodeType("math3d/vec4-to-xyzw", J); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 K.title = "XYZW->Vec4"; K.desc = "components to vector4"; K.prototype.onExecute = function() { @@ -6828,7 +8831,11 @@ $jscomp.polyfill("Object.values", function(v) { k[3] = c; this.setOutputData(0, k); }; +<<<<<<< HEAD z.registerNodeType("math3d/xyzw-to-vec4", K); +======= + A.registerNodeType("math3d/xyzw-to-vec4", K); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 })(this); (function(v) { function c() { @@ -6854,11 +8861,19 @@ $jscomp.polyfill("Object.values", function(v) { c.prototype.onDrawBackground = function(c) { if (!this.flags.collapsed) { c.fillStyle = "#AFB"; +<<<<<<< HEAD var h = (this.selected + 1) * m.NODE_SLOT_HEIGHT + 6; c.beginPath(); c.moveTo(50, h); c.lineTo(50, h + m.NODE_SLOT_HEIGHT); c.lineTo(34, h + 0.5 * m.NODE_SLOT_HEIGHT); +======= + var g = (this.selected + 1) * m.NODE_SLOT_HEIGHT + 6; + c.beginPath(); + c.moveTo(50, g); + c.lineTo(50, g + m.NODE_SLOT_HEIGHT); + c.lineTo(34, g + 0.5 * m.NODE_SLOT_HEIGHT); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 c.fill(); } }; @@ -6908,7 +8923,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addOutput("name", "string"); this.properties = {name:"", generate_mipmaps:!1}; } +<<<<<<< HEAD function h() { +======= + function g() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("Texture", "Texture"); this.addInput("TextureB", "Texture"); this.addInput("value", "number"); @@ -6953,7 +8972,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addOutput("", "Texture"); this.properties = {iterations:1, generate_mipmaps:!1, precision:c.DEFAULT}; } +<<<<<<< HEAD function A() { +======= + function z() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("Texture", "Texture"); this.addOutput("tex", "Texture"); this.addOutput("avg", "vec4"); @@ -6990,13 +9013,21 @@ $jscomp.polyfill("Object.values", function(v) { this.properties = {enabled:!0, intensity:1, precision:c.DEFAULT, texture:null}; u._shader || (u._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, u.pixel_shader)); } +<<<<<<< HEAD function H() { +======= + function G() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("Texture", "Texture"); this.addOutput("R", "Texture"); this.addOutput("G", "Texture"); this.addOutput("B", "Texture"); this.addOutput("A", "Texture"); +<<<<<<< HEAD H._shader || (H._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, H.pixel_shader)); +======= + G._shader || (G._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, G.pixel_shader)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } function n() { this.addInput("R", "Texture"); @@ -7043,11 +9074,19 @@ $jscomp.polyfill("Object.values", function(v) { this.properties = {distance:100, range:50, only_depth:!1, high_precision:!1}; this._uniforms = {u_texture:0, u_distance:100, u_range:50, u_camera_planes:null}; } +<<<<<<< HEAD function g() { this.addInput("Texture", "Texture"); this.addOutput("Texture", "Texture"); this.properties = {precision:c.DEFAULT, invert:!1}; this._uniforms = {u_texture:0, u_camera_planes:null, u_ires:vec2.create()}; +======= + function h() { + this.addInput("Texture", "Texture"); + this.addOutput("Texture", "Texture"); + this.properties = {precision:c.DEFAULT, invert:!1}; + this._uniforms = {u_texture:0, u_near:0.1, u_far:10000}; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } function f() { this.addInput("Texture", "Texture"); @@ -7065,7 +9104,11 @@ $jscomp.polyfill("Object.values", function(v) { this._textures = []; this._uniforms = {u_intensity:1, u_texture:0, u_glow_texture:1, u_threshold:0, u_texel_size:vec2.create()}; } +<<<<<<< HEAD function G() { +======= + function H() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("Texture", "Texture"); this.addOutput("Filtered", "Texture"); this.properties = {intensity:1, radius:5}; @@ -7088,7 +9131,11 @@ $jscomp.polyfill("Object.values", function(v) { this.properties = {enabled:!0, factor:1, precision:c.LOW}; this._uniforms = {u_texture:0, u_factor:1}; } +<<<<<<< HEAD function z() { +======= + function A() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("in", "Texture"); this.addOutput("out", "Texture"); this.properties = {precision:c.LOW, split_channels:!1}; @@ -7143,9 +9190,15 @@ $jscomp.polyfill("Object.values", function(v) { this.addOutput("out", "texture"); this.properties = {yaw:0}; } +<<<<<<< HEAD var F = v.LiteGraph, R = v.LGraphCanvas; v.LGraphTexture = null; "undefined" != typeof GL && (R.link_type_colors.Texture = "#987", v.LGraphTexture = c, c.title = "Texture", c.desc = "Texture", c.widgets_info = {name:{widget:"texture"}, filter:{widget:"checkbox"}}, c.loadTextureCallback = null, c.image_preview_size = 256, c.PASS_THROUGH = 1, c.COPY = 2, c.LOW = 3, c.HIGH = 4, c.REUSE = 5, c.DEFAULT = 2, c.MODE_VALUES = {"pass through":c.PASS_THROUGH, copy:c.COPY, low:c.LOW, high:c.HIGH, reuse:c.REUSE, default:c.DEFAULT}, c.getTexturesContainer = function() { +======= + var F = v.LiteGraph; + v.LGraphTexture = null; + "undefined" != typeof GL && (LGraphCanvas.link_type_colors.Texture = "#987", v.LGraphTexture = c, c.title = "Texture", c.desc = "Texture", c.widgets_info = {name:{widget:"texture"}, filter:{widget:"checkbox"}}, c.loadTextureCallback = null, c.image_preview_size = 256, c.PASS_THROUGH = 1, c.COPY = 2, c.LOW = 3, c.HIGH = 4, c.REUSE = 5, c.DEFAULT = 2, c.MODE_VALUES = {"pass through":c.PASS_THROUGH, copy:c.COPY, low:c.LOW, high:c.HIGH, reuse:c.REUSE, default:c.DEFAULT}, c.getTexturesContainer = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return gl.textures; }, c.loadTexture = function(a, b) { b = b || {}; @@ -7287,16 +9340,28 @@ $jscomp.polyfill("Object.values", function(v) { }, m.prototype.onExecute = function() { var a = this.getInputData(0); a && (this.properties.generate_mipmaps && (a.bind(0), a.setParameter(gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR), gl.generateMipmap(a.texture_type), a.unbind(0)), this.properties.name && (c.storeTexture ? c.storeTexture(this.properties.name, a) : c.getTexturesContainer()[this.properties.name] = a), this._texture = a, this.setOutputData(0, a), this.setOutputData(1, this.properties.name)); +<<<<<<< HEAD }, F.registerNodeType("texture/save", m), h.widgets_info = {uvcode:{widget:"code"}, pixelcode:{widget:"code"}, precision:{widget:"combo", values:c.MODE_VALUES}}, h.title = "Operation", h.desc = "Texture shader operation", h.presets = {}, h.prototype.getExtraMenuOptions = function(a) { +======= + }, F.registerNodeType("texture/save", m), g.widgets_info = {uvcode:{widget:"code"}, pixelcode:{widget:"code"}, precision:{widget:"combo", values:c.MODE_VALUES}}, g.title = "Operation", g.desc = "Texture shader operation", g.presets = {}, g.prototype.getExtraMenuOptions = function(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var b = this; return [{content:b.properties.show ? "Hide Texture" : "Show Texture", callback:function() { b.properties.show = !b.properties.show; }}]; +<<<<<<< HEAD }, h.prototype.onPropertyChanged = function() { this.has_error = !1; }, h.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()); }, h.prototype.onExecute = function() { +======= + }, g.prototype.onPropertyChanged = function() { + this.has_error = !1; + }, g.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()); + }, g.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); if (this.isOutputConnected(0)) { if (this.properties.precision === c.PASS_THROUGH) { @@ -7311,6 +9376,7 @@ $jscomp.polyfill("Object.values", function(v) { this._tex = a || this._tex ? c.getTargetTexture(a || this._tex, this._tex, this.properties.precision) : new GL.Texture(d, k, {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)); +<<<<<<< HEAD var g = ""; this.properties.pixelcode && (g = "result = " + this.properties.pixelcode, -1 != this.properties.pixelcode.indexOf(";") && (g = this.properties.pixelcode)); var e = this._shader; @@ -7320,12 +9386,27 @@ $jscomp.polyfill("Object.values", function(v) { e = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, n), this.boxcolor = "#00FF00"; } catch (U) { GL.Shader.dumpErrorToConsole(U, Shader.SCREEN_VERTEX_SHADER, n); +======= + var h = ""; + this.properties.pixelcode && (h = "result = " + this.properties.pixelcode, -1 != this.properties.pixelcode.indexOf(";") && (h = this.properties.pixelcode)); + var e = this._shader; + if (!(this.has_error || e && this._shader_code == f + "|" + h)) { + var n = c.replaceCode(g.pixel_shader, {UV_CODE:f, PIXEL_CODE:h}); + try { + e = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, n), this.boxcolor = "#00FF00"; + } catch (T) { + GL.Shader.dumpErrorToConsole(T, Shader.SCREEN_VERTEX_SHADER, n); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.boxcolor = "#FF0000"; this.has_error = !0; return; } this._shader = e; +<<<<<<< HEAD this._shader_code = f + "|" + g; +======= + this._shader_code = f + "|" + h; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } if (this._shader) { var p = this.getInputData(2); @@ -7345,6 +9426,7 @@ $jscomp.polyfill("Object.values", function(v) { } } } +<<<<<<< HEAD }, h.pixel_shader = "precision highp float;\n\r\n\t\t\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform sampler2D u_textureB;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform vec2 texSize;\n\r\n\t\tuniform float time;\n\r\n\t\tuniform float value;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec2 uv = v_coord;\n\r\n\t\t\t{{UV_CODE}};\n\r\n\t\t\tvec4 color4 = texture2D(u_texture, uv);\n\r\n\t\t\tvec3 color = color4.rgb;\n\r\n\t\t\tvec4 color4B = texture2D(u_textureB, uv);\n\r\n\t\t\tvec3 colorB = color4B.rgb;\n\r\n\t\t\tvec3 result = color;\n\r\n\t\t\tfloat alpha = 1.0;\n\r\n\t\t\t{{PIXEL_CODE}};\n\r\n\t\t\tgl_FragColor = vec4(result, alpha);\n\r\n\t\t}\n\r\n\t\t", h.registerPreset = function(a, b) { h.presets[a] = b; @@ -7357,6 +9439,20 @@ $jscomp.polyfill("Object.values", function(v) { c && (b.setProperty("pixelcode", c), b.title = d, a.refresh()); }}); }, F.registerNodeType("texture/operation", h), r.title = "Shader", r.desc = "Texture shader", r.widgets_info = {code:{type:"code", lang:"glsl"}, precision:{widget:"combo", values:c.MODE_VALUES}}, r.prototype.onPropertyChanged = function(a, b) { +======= + }, g.pixel_shader = "precision highp float;\n\r\n\t\t\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform sampler2D u_textureB;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform vec2 texSize;\n\r\n\t\tuniform float time;\n\r\n\t\tuniform float value;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec2 uv = v_coord;\n\r\n\t\t\t{{UV_CODE}};\n\r\n\t\t\tvec4 color4 = texture2D(u_texture, uv);\n\r\n\t\t\tvec3 color = color4.rgb;\n\r\n\t\t\tvec4 color4B = texture2D(u_textureB, uv);\n\r\n\t\t\tvec3 colorB = color4B.rgb;\n\r\n\t\t\tvec3 result = color;\n\r\n\t\t\tfloat alpha = 1.0;\n\r\n\t\t\t{{PIXEL_CODE}};\n\r\n\t\t\tgl_FragColor = vec4(result, alpha);\n\r\n\t\t}\n\r\n\t\t", + g.registerPreset = function(a, b) { + g.presets[a] = b; + }, g.registerPreset("", ""), g.registerPreset("bypass", "color"), g.registerPreset("add", "color + colorB * value"), g.registerPreset("substract", "(color - colorB) * value"), g.registerPreset("mate", "mix( color, colorB, color4B.a * value)"), g.registerPreset("invert", "vec3(1.0) - color"), g.registerPreset("multiply", "color * colorB * value"), g.registerPreset("divide", "(color / colorB) / value"), g.registerPreset("difference", "abs(color - colorB) * value"), g.registerPreset("max", "max(color, colorB) * value"), + g.registerPreset("min", "min(color, colorB) * value"), g.registerPreset("displace", "texture2D(u_texture, uv + (colorB.xy - vec2(0.5)) * value).xyz"), g.registerPreset("grayscale", "vec3(color.x + color.y + color.z) * value / 3.0"), g.registerPreset("saturation", "mix( vec3(color.x + color.y + color.z) / 3.0, color, value )"), g.registerPreset("threshold", "vec3(color.x > colorB.x * value ? 1.0 : 0.0,color.y > colorB.y * value ? 1.0 : 0.0,color.z > colorB.z * value ? 1.0 : 0.0)"), g.prototype.onInspect = + function(a) { + var b = this; + a.addCombo("Presets", "", {values:Object.keys(g.presets), callback:function(d) { + var c = g.presets[d]; + c && (b.setProperty("pixelcode", c), b.title = d, a.refresh()); + }}); + }, F.registerNodeType("texture/operation", g), r.title = "Shader", r.desc = "Texture shader", r.widgets_info = {code:{type:"code", lang:"glsl"}, precision:{widget:"combo", values:c.MODE_VALUES}}, r.prototype.onPropertyChanged = function(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if ("code" == a && (a = this.getShader())) { b = a.uniformInfo; if (this.inputs) { @@ -7418,8 +9514,13 @@ $jscomp.polyfill("Object.values", function(v) { var b = 0, d = null; if (this.inputs) { for (var k = 0; k < this.inputs.length; ++k) { +<<<<<<< HEAD var f = this.getInputInfo(k), g = this.getInputData(k); null != g && (g.constructor === GL.Texture && (g.bind(b), d || (d = g), g = b, b++), a.setUniform(f.name, g)); +======= + var f = this.getInputInfo(k), h = this.getInputData(k); + null != h && (h.constructor === GL.Texture && (h.bind(b), d || (d = h), h = b, b++), a.setUniform(f.name, h)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } var e = this._uniforms; @@ -7452,8 +9553,13 @@ $jscomp.polyfill("Object.values", function(v) { this._tex && this._tex.width == b && this._tex.height == d && this._tex.type == k || (this._tex = new GL.Texture(b, d, {type:k, format:gl.RGBA, filter:gl.LINEAR})); var f = this._shader; f || (f = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, l.pixel_shader)); +<<<<<<< HEAD var g = this.getInputData(1); g ? (this.properties.scale[0] = g[0], this.properties.scale[1] = g[1]) : g = this.properties.scale; +======= + var h = this.getInputData(1); + h ? (this.properties.scale[0] = h[0], this.properties.scale[1] = h[1]) : h = this.properties.scale; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var e = this.getInputData(2); e ? (this.properties.offset[0] = e[0], this.properties.offset[1] = e[1]) : e = this.properties.offset; this._tex.drawTo(function() { @@ -7462,7 +9568,11 @@ $jscomp.polyfill("Object.values", function(v) { gl.disable(gl.BLEND); a.bind(0); var b = Mesh.getScreenQuad(); +<<<<<<< HEAD f.uniforms({u_texture:0, u_scale:g, u_offset:e}).draw(b); +======= + f.uniforms({u_texture:0, u_scale:h, u_offset:e}).draw(b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._tex); } @@ -7481,10 +9591,17 @@ $jscomp.polyfill("Object.values", function(v) { f || (f = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, B.pixel_shader)); d = this.getInputData(2); null != d ? this.properties.factor = d : d = parseFloat(this.properties.factor); +<<<<<<< HEAD var g = this._uniforms; g.u_factor = d; g.u_scale.set(this.properties.scale); g.u_offset.set(this.properties.offset); +======= + var h = this._uniforms; + h.u_factor = d; + h.u_scale.set(this.properties.scale); + h.u_offset.set(this.properties.offset); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._tex.drawTo(function() { gl.disable(gl.DEPTH_TEST); gl.disable(gl.CULL_FACE); @@ -7492,7 +9609,11 @@ $jscomp.polyfill("Object.values", function(v) { a && a.bind(0); b && b.bind(1); var d = Mesh.getScreenQuad(); +<<<<<<< HEAD f.uniforms(g).draw(d); +======= + f.uniforms(h).draw(d); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._tex); } @@ -7542,6 +9663,7 @@ $jscomp.polyfill("Object.values", function(v) { b || (E._shader = b = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, E.pixel_shader)); var d = a.width | 0, k = a.height | 0, f = a.type; this.properties.precision === c.LOW ? f = gl.UNSIGNED_BYTE : this.properties.precision === c.HIGH && (f = gl.HIGH_PRECISION_FORMAT); +<<<<<<< HEAD var g = this.properties.iterations || 1, e = a, n = []; f = {type:f, format:a.format}; var h = vec2.create(), p = {u_offset:h}; @@ -7549,6 +9671,15 @@ $jscomp.polyfill("Object.values", function(v) { for (var l = 0; l < g; ++l) { h[0] = 1 / d; h[1] = 1 / k; +======= + var h = this.properties.iterations || 1, e = a, n = []; + f = {type:f, format:a.format}; + var g = vec2.create(), p = {u_offset:g}; + this._texture && GL.Texture.releaseTemporary(this._texture); + for (var l = 0; l < h; ++l) { + g[0] = 1 / d; + g[1] = 1 / k; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 d = d >> 1 || 0; k = k >> 1 || 0; a = GL.Texture.getTemporary(d, k, f); @@ -7569,12 +9700,17 @@ $jscomp.polyfill("Object.values", function(v) { } } }, E.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform vec2 u_offset;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec4 color = texture2D(u_texture, v_coord );\n\r\n\t\t\tcolor += texture2D(u_texture, v_coord + vec2( u_offset.x, 0.0 ) );\n\r\n\t\t\tcolor += texture2D(u_texture, v_coord + vec2( 0.0, u_offset.y ) );\n\r\n\t\t\tcolor += texture2D(u_texture, v_coord + vec2( u_offset.x, u_offset.y ) );\n\r\n\t\t gl_FragColor = color * 0.25;\n\r\n\t\t}\n\r\n\t\t", +<<<<<<< HEAD F.registerNodeType("texture/downsample", E), A.title = "Average", A.desc = "Compute a partial average (32 random samples) of a texture and stores it as a 1x1 pixel texture.\n If high_quality is true, then it generates the mipmaps first and reads from the lower one.", A.prototype.onExecute = function() { +======= + F.registerNodeType("texture/downsample", E), z.title = "Average", z.desc = "Compute a partial average (32 random samples) of a texture and stores it as a 1x1 pixel texture.\n If high_quality is true, then it generates the mipmaps first and reads from the lower one.", z.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.properties.use_previous_frame || this.updateAverage(); var a = this._luminance; this.setOutputData(0, this._temp_texture); this.setOutputData(1, a); this.setOutputData(2, (a[0] + a[1] + a[2]) / 3); +<<<<<<< HEAD }, A.prototype.onPreRenderExecute = function() { this.updateAverage(); }, A.prototype.updateAverage = function() { @@ -7586,6 +9722,19 @@ $jscomp.polyfill("Object.values", function(v) { b[d] = Math.random(); } A._shader.uniforms({u_samples_a:b.subarray(0, 16), u_samples_b:b.subarray(16, 32)}); +======= + }, z.prototype.onPreRenderExecute = function() { + this.updateAverage(); + }, z.prototype.updateAverage = function() { + var a = this.getInputData(0); + if (a && (this.isOutputConnected(0) || this.isOutputConnected(1) || this.isOutputConnected(2))) { + if (!z._shader) { + z._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, z.pixel_shader); + for (var b = new Float32Array(16), d = 0; d < b.length; ++d) { + b[d] = Math.random(); + } + z._shader.uniforms({u_samples_a:b.subarray(0, 16), u_samples_b:b.subarray(16, 32)}); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } d = this._temp_texture; b = gl.UNSIGNED_BYTE; @@ -7593,7 +9742,11 @@ $jscomp.polyfill("Object.values", function(v) { d && d.type == b || (this._temp_texture = new GL.Texture(1, 1, {type:b, format:gl.RGBA, filter:gl.NEAREST})); this._uniforms.u_mipmap_offset = 0; this.properties.high_quality && (this._temp_pot2_texture && this._temp_pot2_texture.type == b || (this._temp_pot2_texture = new GL.Texture(512, 512, {type:b, format:gl.RGBA, minFilter:gl.LINEAR_MIPMAP_LINEAR, magFilter:gl.LINEAR})), a.copyTo(this._temp_pot2_texture), a = this._temp_pot2_texture, a.bind(0), gl.generateMipmap(GL.TEXTURE_2D), this._uniforms.u_mipmap_offset = 9); +<<<<<<< HEAD var c = A._shader, k = this._uniforms; +======= + var c = z._shader, k = this._uniforms; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 k.u_mipmap_offset = this.properties.mipmap_offset; gl.disable(gl.DEPTH_TEST); gl.disable(gl.BLEND); @@ -7609,8 +9762,13 @@ $jscomp.polyfill("Object.values", function(v) { } } } +<<<<<<< HEAD }, A.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tuniform mat4 u_samples_a;\n\r\n\t\tuniform mat4 u_samples_b;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform float u_mipmap_offset;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec4 color = vec4(0.0);\n\r\n\t\t\t//random average\n\r\n\t\t\tfor(int i = 0; i < 4; ++i)\n\r\n\t\t\t\tfor(int j = 0; j < 4; ++j)\n\r\n\t\t\t\t{\n\r\n\t\t\t\t\tcolor += texture2D(u_texture, vec2( u_samples_a[i][j], u_samples_b[i][j] ), u_mipmap_offset );\n\r\n\t\t\t\t\tcolor += texture2D(u_texture, vec2( 1.0 - u_samples_a[i][j], 1.0 - u_samples_b[i][j] ), u_mipmap_offset );\n\r\n\t\t\t\t}\n\r\n\t\t gl_FragColor = color * 0.03125;\n\r\n\t\t}\n\r\n\t\t", F.registerNodeType("texture/average", A), e.title = "Smooth", e.desc = "Smooth texture over time", e.prototype.onExecute = function() { +======= + }, z.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tuniform mat4 u_samples_a;\n\r\n\t\tuniform mat4 u_samples_b;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform float u_mipmap_offset;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec4 color = vec4(0.0);\n\r\n\t\t\t//random average\n\r\n\t\t\tfor(int i = 0; i < 4; ++i)\n\r\n\t\t\t\tfor(int j = 0; j < 4; ++j)\n\r\n\t\t\t\t{\n\r\n\t\t\t\t\tcolor += texture2D(u_texture, vec2( u_samples_a[i][j], u_samples_b[i][j] ), u_mipmap_offset );\n\r\n\t\t\t\t\tcolor += texture2D(u_texture, vec2( 1.0 - u_samples_a[i][j], 1.0 - u_samples_b[i][j] ), u_mipmap_offset );\n\r\n\t\t\t\t}\n\r\n\t\t gl_FragColor = color * 0.03125;\n\r\n\t\t}\n\r\n\t\t", + F.registerNodeType("texture/average", z), e.title = "Smooth", e.desc = "Smooth texture over time", e.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); if (a && this.isOutputConnected(0)) { e._shader || (e._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, e.pixel_shader)); @@ -7640,14 +9798,22 @@ $jscomp.polyfill("Object.values", function(v) { if (0 == c || 0 == d % c) { d = this._temp_texture; d && d.type == a.type && d.width == b || (d = {type:a.type, format:gl.RGBA, filter:gl.NEAREST}, this._temp_texture = new GL.Texture(b, 1, d), this._temp_texture2 = new GL.Texture(b, 1, d), this._temp_texture_out = new GL.Texture(1, 1, d)); +<<<<<<< HEAD var k = this._temp_texture, f = this._temp_texture2, g = C._shader_copy, e = C._shader_avg, n = this._uniforms; +======= + var k = this._temp_texture, f = this._temp_texture2, h = C._shader_copy, e = C._shader_avg, n = this._uniforms; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 n.u_samples = b; n.u_isamples = 1.0 / b; gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); k.drawTo(function() { f.bind(1); +<<<<<<< HEAD a.toViewport(g, n); +======= + a.toViewport(h, n); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this._temp_texture_out.drawTo(function() { k.toViewport(e, n); @@ -7674,8 +9840,13 @@ $jscomp.polyfill("Object.values", function(v) { c && c.width == b && c.height == d || (this._temp_texture = new GL.Texture(b, d, {format:gl.RGBA, filter:gl.LINEAR})); try { this._temp_texture.uploadImage(a); +<<<<<<< HEAD } catch (T) { console.error("image comes from an unsafe location, cannot be uploaded to webgl: " + T); +======= + } catch (S) { + console.error("image comes from an unsafe location, cannot be uploaded to webgl: " + S); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return; } this.setOutputData(0, this._temp_texture); @@ -7711,7 +9882,11 @@ $jscomp.polyfill("Object.values", function(v) { } } }, u.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform sampler2D u_textureB;\n\r\n\t\tuniform float u_amount;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\t lowp vec4 textureColor = clamp( texture2D(u_texture, v_coord), vec4(0.0), vec4(1.0) );\n\r\n\t\t\t mediump float blueColor = textureColor.b * 63.0;\n\r\n\t\t\t mediump vec2 quad1;\n\r\n\t\t\t quad1.y = floor(floor(blueColor) / 8.0);\n\r\n\t\t\t quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\r\n\t\t\t mediump vec2 quad2;\n\r\n\t\t\t quad2.y = floor(ceil(blueColor) / 8.0);\n\r\n\t\t\t quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\r\n\t\t\t highp vec2 texPos1;\n\r\n\t\t\t texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\r\n\t\t\t texPos1.y = 1.0 - ((quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\r\n\t\t\t highp vec2 texPos2;\n\r\n\t\t\t texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\n\r\n\t\t\t texPos2.y = 1.0 - ((quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g));\n\r\n\t\t\t lowp vec4 newColor1 = texture2D(u_textureB, texPos1);\n\r\n\t\t\t lowp vec4 newColor2 = texture2D(u_textureB, texPos2);\n\r\n\t\t\t lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n\r\n\t\t\t gl_FragColor = vec4( mix( textureColor.rgb, newColor.rgb, u_amount), textureColor.w);\n\r\n\t\t}\n\r\n\t\t", +<<<<<<< HEAD F.registerNodeType("texture/LUT", u), H.title = "Texture to Channels", H.desc = "Split texture channels", H.prototype.onExecute = function() { +======= + F.registerNodeType("texture/LUT", u), G.title = "Texture to Channels", G.desc = "Split texture channels", G.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); if (a) { this._channels || (this._channels = Array(4)); @@ -7721,26 +9896,47 @@ $jscomp.polyfill("Object.values", function(v) { if (d) { gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); +<<<<<<< HEAD var k = Mesh.getScreenQuad(), f = H._shader, g = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]; for (c = 0; 4 > c; c++) { this._channels[c] && (this._channels[c].drawTo(function() { a.bind(0); f.uniforms({u_texture:0, u_mask:g[c]}).draw(k); +======= + var k = Mesh.getScreenQuad(), f = G._shader, h = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]; + for (c = 0; 4 > c; c++) { + this._channels[c] && (this._channels[c].drawTo(function() { + a.bind(0); + f.uniforms({u_texture:0, u_mask:h[c]}).draw(k); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }), this.setOutputData(c, this._channels[c])); } } } +<<<<<<< HEAD }, H.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform vec4 u_mask;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t gl_FragColor = vec4( vec3( length( texture2D(u_texture, v_coord) * u_mask )), 1.0 );\n\r\n\t\t}\n\r\n\t\t", F.registerNodeType("texture/textureChannels", H), n.title = "Channels to Texture", n.desc = "Split texture channels", n.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, +======= + }, G.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform vec4 u_mask;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t gl_FragColor = vec4( vec3( length( texture2D(u_texture, v_coord) * u_mask )), 1.0 );\n\r\n\t\t}\n\r\n\t\t", F.registerNodeType("texture/textureChannels", G), n.title = "Channels to Texture", n.desc = "Split texture channels", n.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 n.prototype.onExecute = function() { var a = c.getWhiteTexture(), b = this.getInputData(0) || a, d = this.getInputData(1) || a, k = this.getInputData(2) || a, f = this.getInputData(3) || a; gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); +<<<<<<< HEAD var g = Mesh.getScreenQuad(); n._shader || (n._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, n.pixel_shader)); var e = n._shader; a = Math.max(b.width, d.width, k.width, f.width); var h = Math.max(b.height, d.height, k.height, f.height), p = this.properties.precision == c.HIGH ? c.HIGH_PRECISION_FORMAT : gl.UNSIGNED_BYTE; this._texture && this._texture.width == a && this._texture.height == h && this._texture.type == p || (this._texture = new GL.Texture(a, h, {type:p, format:gl.RGBA, filter:gl.LINEAR})); +======= + var h = Mesh.getScreenQuad(); + n._shader || (n._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, n.pixel_shader)); + var e = n._shader; + a = Math.max(b.width, d.width, k.width, f.width); + var g = Math.max(b.height, d.height, k.height, f.height), p = this.properties.precision == c.HIGH ? c.HIGH_PRECISION_FORMAT : gl.UNSIGNED_BYTE; + this._texture && this._texture.width == a && this._texture.height == g && this._texture.type == p || (this._texture = new GL.Texture(a, g, {type:p, format:gl.RGBA, filter:gl.LINEAR})); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a = this._color; a[0] = this.properties.R; a[1] = this.properties.G; @@ -7752,7 +9948,11 @@ $jscomp.polyfill("Object.values", function(v) { d.bind(1); k.bind(2); f.bind(3); +<<<<<<< HEAD e.uniforms(l).draw(g); +======= + e.uniforms(l).draw(h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._texture); }, n.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_textureR;\n\r\n\t\tuniform sampler2D u_textureG;\n\r\n\t\tuniform sampler2D u_textureB;\n\r\n\t\tuniform sampler2D u_textureA;\n\r\n\t\tuniform vec4 u_color;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t gl_FragColor = u_color * vec4( \r\n\t\t\t\t\ttexture2D(u_textureR, v_coord).r,\r\n\t\t\t\t\ttexture2D(u_textureG, v_coord).r,\r\n\t\t\t\t\ttexture2D(u_textureB, v_coord).r,\r\n\t\t\t\t\ttexture2D(u_textureA, v_coord).r);\n\r\n\t\t}\n\r\n\t\t", @@ -7800,8 +10000,13 @@ $jscomp.polyfill("Object.values", function(v) { var c = this.getInputData(1); c || (c = this.properties.B); for (var f = 2; f < this.inputs.length; f++) { +<<<<<<< HEAD var g = this.inputs[f], e = this.getInputData(f); void 0 !== e && (this.properties[g.name] = e); +======= + var h = this.inputs[f], e = this.getInputData(f); + void 0 !== e && (this.properties[h.name] = e); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } var n = this._uniforms; this._uniforms.u_angle = this.properties.angle * DEG2RAD; @@ -7829,6 +10034,7 @@ $jscomp.polyfill("Object.values", function(v) { this._tex = c.getTargetTexture(this.properties.size_from_biggest && d.width > b.width ? d : b, this._tex, this.properties.precision); gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); +<<<<<<< HEAD var g = Mesh.getScreenQuad(), e = null, n = this._uniforms; k ? (e = a._shader_tex, e || (e = a._shader_tex = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, a.pixel_shader, {MIX_TEX:""}))) : (e = a._shader_factor, e || (e = a._shader_factor = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, a.pixel_shader)), f = null == f ? this.properties.factor : f, n.u_mix.set([f, f, f, f])); var h = this.properties.invert; @@ -7837,6 +10043,16 @@ $jscomp.polyfill("Object.values", function(v) { d.bind(h ? 0 : 1); k && k.bind(2); e.uniforms(n).draw(g); +======= + var h = Mesh.getScreenQuad(), e = null, n = this._uniforms; + k ? (e = a._shader_tex, e || (e = a._shader_tex = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, a.pixel_shader, {MIX_TEX:""}))) : (e = a._shader_factor, e || (e = a._shader_factor = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, a.pixel_shader)), f = null == f ? this.properties.factor : f, n.u_mix.set([f, f, f, f])); + var g = this.properties.invert; + this._tex.drawTo(function() { + b.bind(g ? 1 : 0); + d.bind(g ? 0 : 1); + k && k.bind(2); + e.uniforms(n).draw(h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._tex); } @@ -7855,10 +10071,17 @@ $jscomp.polyfill("Object.values", function(v) { this._tex = c.getTargetTexture(a, this._tex, this.properties.precision); gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); +<<<<<<< HEAD var d = Mesh.getScreenQuad(), k = b._shader, f = this.properties.invert, g = this.properties.factor, e = this.properties.threshold ? 1 : 0; this._tex.drawTo(function() { a.bind(0); k.uniforms({u_texture:0, u_isize:[1 / a.width, 1 / a.height], u_factor:g, u_threshold:e, u_invert:f ? 1 : 0}).draw(d); +======= + var d = Mesh.getScreenQuad(), k = b._shader, f = this.properties.invert, h = this.properties.factor, e = this.properties.threshold ? 1 : 0; + this._tex.drawTo(function() { + a.bind(0); + k.uniforms({u_texture:0, u_isize:[1 / a.width, 1 / a.height], u_factor:h, u_threshold:e, u_invert:f ? 1 : 0}).draw(d); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._tex); } @@ -7883,36 +10106,61 @@ $jscomp.polyfill("Object.values", function(v) { gl.disable(gl.DEPTH_TEST); var f = Mesh.getScreenQuad(); d._shader || (d._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, d.pixel_shader), d._shader_onlydepth = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, d.pixel_shader, {ONLY_DEPTH:""})); +<<<<<<< HEAD var g = this.properties.only_depth ? d._shader_onlydepth : d._shader; +======= + var h = this.properties.only_depth ? d._shader_onlydepth : d._shader; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 b = null; b = a.near_far_planes ? a.near_far_planes : window.LS && LS.Renderer._main_camera ? LS.Renderer._main_camera._uniforms.u_camera_planes : [0.1, 1000]; c.u_camera_planes = b; this._temp_texture.drawTo(function() { a.bind(0); +<<<<<<< HEAD g.uniforms(c).draw(f); +======= + h.uniforms(c).draw(f); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this._temp_texture.near_far_planes = b; this.setOutputData(0, this._temp_texture); } } }, d.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform vec2 u_camera_planes;\n\r\n\t\tuniform float u_distance;\n\r\n\t\tuniform float u_range;\n\r\n\t\t\n\r\n\t\tfloat LinearDepth()\n\r\n\t\t{\n\r\n\t\t\tfloat zNear = u_camera_planes.x;\n\r\n\t\t\tfloat zFar = u_camera_planes.y;\n\r\n\t\t\tfloat depth = texture2D(u_texture, v_coord).x;\n\r\n\t\t\tdepth = depth * 2.0 - 1.0;\n\r\n\t\t\treturn zNear * (depth + 1.0) / (zFar + zNear - depth * (zFar - zNear));\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tfloat depth = LinearDepth();\n\r\n\t\t\t#ifdef ONLY_DEPTH\n\r\n\t\t\t gl_FragColor = vec4(depth);\n\r\n\t\t\t#else\n\r\n\t\t\t\tfloat diff = abs(depth * u_camera_planes.y - u_distance);\n\r\n\t\t\t\tfloat dof = 1.0;\n\r\n\t\t\t\tif(diff <= u_range)\n\r\n\t\t\t\t\tdof = diff / u_range;\n\r\n\t\t\t gl_FragColor = vec4(dof);\n\r\n\t\t\t#endif\n\r\n\t\t}\n\r\n\t\t", +<<<<<<< HEAD F.registerNodeType("texture/depth_range", d), g.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, g.title = "Linear Depth", g.desc = "Creates a color texture with linear depth", g.prototype.onExecute = function() { +======= + F.registerNodeType("texture/depth_range", d), h.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, h.title = "Linear Depth", h.desc = "Creates a color texture with linear depth", h.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.isOutputConnected(0)) { var a = this.getInputData(0); if (a && (a.format == gl.DEPTH_COMPONENT || a.format == gl.DEPTH_STENCIL)) { var b = this.properties.precision == c.HIGH ? gl.HIGH_PRECISION_FORMAT : gl.UNSIGNED_BYTE; this._temp_texture && this._temp_texture.type == b && this._temp_texture.width == a.width && this._temp_texture.height == a.height || (this._temp_texture = new GL.Texture(a.width, a.height, {type:b, format:gl.RGB, filter:gl.LINEAR})); var d = this._uniforms; +<<<<<<< HEAD +======= + d.u_near = a.near_far_planes[0]; + d.u_far = a.near_far_planes[1]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 d.u_invert = this.properties.invert ? 1 : 0; gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); var k = Mesh.getScreenQuad(); +<<<<<<< HEAD g._shader || (g._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, g.pixel_shader)); var f = g._shader; b = null; b = a.near_far_planes ? a.near_far_planes : window.LS && LS.Renderer._main_camera ? LS.Renderer._main_camera._uniforms.u_camera_planes : [0.1, 1000]; d.u_camera_planes = b; d.u_ires.set([0, 0]); +======= + h._shader || (h._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, h.pixel_shader)); + var f = h._shader; + b = null; + b = a.near_far_planes ? a.near_far_planes : window.LS && LS.Renderer._main_camera ? LS.Renderer._main_camera._uniforms.u_camera_planes : [0.1, 1000]; + d.u_camera_planes = b; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._temp_texture.drawTo(function() { a.bind(0); f.uniforms(d).draw(k); @@ -7921,8 +10169,13 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, this._temp_texture); } } +<<<<<<< HEAD }, g.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform vec2 u_camera_planes;\n\r\n\t\tuniform int u_invert;\n\r\n\t\tuniform vec2 u_ires;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tfloat zNear = u_camera_planes.x;\n\r\n\t\t\tfloat zFar = u_camera_planes.y;\n\r\n\t\t\tfloat depth = texture2D(u_texture, v_coord + u_ires*0.5).x * 2.0 - 1.0;\n\r\n\t\t\tfloat f = zNear * (depth + 1.0) / (zFar + zNear - depth * (zFar - zNear));\n\r\n\t\t\tif( u_invert == 1 )\n\r\n\t\t\t\tf = 1.0 - f;\n\r\n\t\t\tgl_FragColor = vec4(vec3(f),1.0);\n\r\n\t\t}\n\r\n\t\t", F.registerNodeType("texture/linear_depth", g), f.title = "Blur", f.desc = "Blur a texture", f.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, f.max_iterations = 20, f.prototype.onExecute = function() { +======= + }, h.pixel_shader = "precision highp float;\n\r\n\t\tprecision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform float u_near;\n\r\n\t\tuniform float u_far;\n\r\n\t\tuniform int u_invert;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tfloat zNear = u_near;\n\r\n\t\t\tfloat zFar = u_far;\n\r\n\t\t\tfloat depth = texture2D(u_texture, v_coord).x;\n\r\n\t\t\tdepth = depth * 2.0 - 1.0;\n\r\n\t\t\tfloat f = zNear * (depth + 1.0) / (zFar + zNear - depth * (zFar - zNear));\n\r\n\t\t\tif( u_invert == 1 )\n\r\n\t\t\t\tf = 1.0 - f;\n\r\n\t\t\tgl_FragColor = vec4(vec3(f),1.0);\n\r\n\t\t}\n\r\n\t\t", + F.registerNodeType("texture/linear_depth", h), f.title = "Blur", f.desc = "Blur a texture", f.widgets_info = {precision:{widget:"combo", values:c.MODE_VALUES}}, f.max_iterations = 20, f.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); if (a && this.isOutputConnected(0)) { var b = this._final_texture; @@ -7939,10 +10192,17 @@ $jscomp.polyfill("Object.values", function(v) { k || void 0 === window.gl || (k = gl.canvas.height / gl.canvas.width); k || (k = 1); k = this.properties.preserve_aspect ? k : 1; +<<<<<<< HEAD var g = this.properties.scale || [1, 1]; a.applyBlur(k * g[0], g[1], c, b); for (a = 1; a < d; ++a) { b.applyBlur(k * g[0] * (a + 1), g[1] * (a + 1), c); +======= + var h = this.properties.scale || [1, 1]; + a.applyBlur(k * h[0], h[1], c, b); + for (a = 1; a < d; ++a) { + b.applyBlur(k * h[0] * (a + 1), h[1] * (a + 1), c); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } this.setOutputData(0, b); } @@ -7957,6 +10217,7 @@ $jscomp.polyfill("Object.values", function(v) { if (this.properties.precision === c.PASS_THROUGH || !1 === this.getInputOrProperty("enabled")) { this.setOutputData(0, a); } else { +<<<<<<< HEAD var b = a.width, d = a.height, k = {format:a.format, type:a.type, minFilter:GL.LINEAR, magFilter:GL.LINEAR, wrap:gl.CLAMP_TO_EDGE}, f = c.getTextureType(this.properties.precision, a), g = this._uniforms, e = this._textures, n = x._cut_shader; n || (n = x._cut_shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.cut_pixel_shader)); gl.disable(gl.DEPTH_TEST); @@ -7969,6 +10230,20 @@ $jscomp.polyfill("Object.values", function(v) { var m = g.u_texel_size, r = this.getInputOrProperty("intensity"); g.u_intensity = 1; g.u_delta = this.properties.scale; +======= + var b = a.width, d = a.height, k = {format:a.format, type:a.type, minFilter:GL.LINEAR, magFilter:GL.LINEAR, wrap:gl.CLAMP_TO_EDGE}, f = c.getTextureType(this.properties.precision, a), h = this._uniforms, e = this._textures, n = x._cut_shader; + n || (n = x._cut_shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.cut_pixel_shader)); + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.BLEND); + h.u_threshold = this.getInputOrProperty("threshold"); + var g = e[0] = GL.Texture.getTemporary(b, d, k); + a.blit(g, n.uniforms(h)); + var p = g, l = this.getInputOrProperty("iterations"); + l = Math.clamp(l, 1, 16) | 0; + var m = h.u_texel_size, r = this.getInputOrProperty("intensity"); + h.u_intensity = 1; + h.u_delta = this.properties.scale; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 n = x._shader; n || (n = x._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.scale_pixel_shader)); for (var q = 1; q < l; q++) { @@ -7977,6 +10252,7 @@ $jscomp.polyfill("Object.values", function(v) { if (2 > b) { break; } +<<<<<<< HEAD h = e[q] = GL.Texture.getTemporary(b, d, k); m[0] = 1 / p.width; m[1] = 1 / p.height; @@ -7990,6 +10266,21 @@ $jscomp.polyfill("Object.values", function(v) { g.u_delta = 0.5; for (q -= 2; 0 <= q; q--) { h = e[q], e[q] = null, m[0] = 1 / p.width, m[1] = 1 / p.height, p.blit(h, n.uniforms(g)), GL.Texture.releaseTemporary(p), p = h; +======= + g = e[q] = GL.Texture.getTemporary(b, d, k); + m[0] = 1 / p.width; + m[1] = 1 / p.height; + p.blit(g, n.uniforms(h)); + p = g; + } + this.isOutputConnected(2) && (b = this._average_texture, b && b.type == a.type && b.format == a.format || (b = this._average_texture = new GL.Texture(1, 1, {type:a.type, format:a.format, filter:gl.LINEAR})), m[0] = 1 / p.width, m[1] = 1 / p.height, h.u_intensity = r, h.u_delta = 1, p.blit(b, n.uniforms(h)), this.setOutputData(2, b)); + gl.enable(gl.BLEND); + gl.blendFunc(gl.ONE, gl.ONE); + h.u_intensity = this.getInputOrProperty("persistence"); + h.u_delta = 0.5; + for (q -= 2; 0 <= q; q--) { + g = e[q], e[q] = null, m[0] = 1 / p.width, m[1] = 1 / p.height, p.blit(g, n.uniforms(h)), GL.Texture.releaseTemporary(p), p = g; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } gl.disable(gl.BLEND); this.isOutputConnected(1) && (e = this._glow_texture, e && e.width == a.width && e.height == a.height && e.type == f && e.format == a.format || (e = this._glow_texture = new GL.Texture(a.width, a.height, {type:f, format:a.format, filter:gl.LINEAR})), p.blit(e), this.setOutputData(1, e)); @@ -7997,14 +10288,22 @@ $jscomp.polyfill("Object.values", function(v) { e = this._final_texture; e && e.width == a.width && e.height == a.height && e.type == f && e.format == a.format || (e = this._final_texture = new GL.Texture(a.width, a.height, {type:f, format:a.format, filter:gl.LINEAR})); var t = this.getInputData(1), u = this.getInputOrProperty("dirt_factor"); +<<<<<<< HEAD g.u_intensity = r; +======= + h.u_intensity = r; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 n = t ? x._dirt_final_shader : x._final_shader; n || (n = t ? x._dirt_final_shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.final_pixel_shader, {USE_DIRT:""}) : x._final_shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, x.final_pixel_shader)); e.drawTo(function() { a.bind(0); p.bind(1); t && (n.setUniform("u_dirt_factor", u), n.setUniform("u_dirt_texture", t.bind(2))); +<<<<<<< HEAD n.toViewport(g); +======= + n.toViewport(h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, e); } @@ -8013,13 +10312,21 @@ $jscomp.polyfill("Object.values", function(v) { } }, x.cut_pixel_shader = "precision highp float;\n\r\n\tvarying vec2 v_coord;\n\r\n\tuniform sampler2D u_texture;\n\r\n\tuniform float u_threshold;\n\r\n\tvoid main() {\n\r\n\t\tgl_FragColor = max( texture2D( u_texture, v_coord ) - vec4( u_threshold ), vec4(0.0) );\n\r\n\t}", x.scale_pixel_shader = "precision highp float;\n\r\n\tvarying vec2 v_coord;\n\r\n\tuniform sampler2D u_texture;\n\r\n\tuniform vec2 u_texel_size;\n\r\n\tuniform float u_delta;\n\r\n\tuniform float u_intensity;\n\r\n\t\n\r\n\tvec4 sampleBox(vec2 uv) {\n\r\n\t\tvec4 o = u_texel_size.xyxy * vec2(-u_delta, u_delta).xxyy;\n\r\n\t\tvec4 s = texture2D( u_texture, uv + o.xy ) + texture2D( u_texture, uv + o.zy) + texture2D( u_texture, uv + o.xw) + texture2D( u_texture, uv + o.zw);\n\r\n\t\treturn s * 0.25;\n\r\n\t}\n\r\n\tvoid main() {\n\r\n\t\tgl_FragColor = u_intensity * sampleBox( v_coord );\n\r\n\t}", x.final_pixel_shader = "precision highp float;\n\r\n\tvarying vec2 v_coord;\n\r\n\tuniform sampler2D u_texture;\n\r\n\tuniform sampler2D u_glow_texture;\n\r\n\t#ifdef USE_DIRT\n\r\n\t\tuniform sampler2D u_dirt_texture;\n\r\n\t#endif\n\r\n\tuniform vec2 u_texel_size;\n\r\n\tuniform float u_delta;\n\r\n\tuniform float u_intensity;\n\r\n\tuniform float u_dirt_factor;\n\r\n\t\n\r\n\tvec4 sampleBox(vec2 uv) {\n\r\n\t\tvec4 o = u_texel_size.xyxy * vec2(-u_delta, u_delta).xxyy;\n\r\n\t\tvec4 s = texture2D( u_glow_texture, uv + o.xy ) + texture2D( u_glow_texture, uv + o.zy) + texture2D( u_glow_texture, uv + o.xw) + texture2D( u_glow_texture, uv + o.zw);\n\r\n\t\treturn s * 0.25;\n\r\n\t}\n\r\n\tvoid main() {\n\r\n\t\tvec4 glow = sampleBox( v_coord );\n\r\n\t\t#ifdef USE_DIRT\n\r\n\t\t\tglow = mix( glow, glow * texture2D( u_dirt_texture, v_coord ), u_dirt_factor );\n\r\n\t\t#endif\n\r\n\t\tgl_FragColor = texture2D( u_texture, v_coord ) + u_intensity * glow;\n\r\n\t}", +<<<<<<< HEAD F.registerNodeType("texture/glow", x), G.title = "Kuwahara Filter", G.desc = "Filters a texture giving an artistic oil canvas painting", G.max_radius = 10, G._shaders = [], G.prototype.onExecute = function() { +======= + F.registerNodeType("texture/glow", x), H.title = "Kuwahara Filter", H.desc = "Filters a texture giving an artistic oil canvas painting", H.max_radius = 10, H._shaders = [], H.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); if (a && this.isOutputConnected(0)) { var b = this._temp_texture; b && b.width == a.width && b.height == a.height && b.type == a.type || (this._temp_texture = new GL.Texture(a.width, a.height, {type:a.type, format:gl.RGBA, filter:gl.LINEAR})); b = this.properties.radius; +<<<<<<< HEAD b = Math.min(Math.floor(b), G.max_radius); +======= + b = Math.min(Math.floor(b), H.max_radius); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (0 == b) { this.setOutputData(0, a); } else { @@ -8027,8 +10334,13 @@ $jscomp.polyfill("Object.values", function(v) { c || void 0 === window.gl || (c = gl.canvas.height / gl.canvas.width); c || (c = 1); c = this.properties.preserve_aspect ? c : 1; +<<<<<<< HEAD G._shaders[b] || (G._shaders[b] = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, G.pixel_shader, {RADIUS:b.toFixed(0)})); var k = G._shaders[b], f = GL.Mesh.getScreenQuad(); +======= + H._shaders[b] || (H._shaders[b] = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, H.pixel_shader, {RADIUS:b.toFixed(0)})); + var k = H._shaders[b], f = GL.Mesh.getScreenQuad(); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 a.bind(0); this._temp_texture.drawTo(function() { k.uniforms({u_texture:0, u_intensity:d, u_resolution:[a.width, a.height], u_iResolution:[1 / a.width, 1 / a.height]}).draw(f); @@ -8036,17 +10348,29 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, this._temp_texture); } } +<<<<<<< HEAD }, G.pixel_shader = "\n\r\nprecision highp float;\n\r\nvarying vec2 v_coord;\n\r\nuniform sampler2D u_texture;\n\r\nuniform float u_intensity;\n\r\nuniform vec2 u_resolution;\n\r\nuniform vec2 u_iResolution;\n\r\n#ifndef RADIUS\n\r\n\t#define RADIUS 7\n\r\n#endif\n\r\nvoid main() {\n\r\n\n\r\n\tconst int radius = RADIUS;\n\r\n\tvec2 fragCoord = v_coord;\n\r\n\tvec2 src_size = u_iResolution;\n\r\n\tvec2 uv = v_coord;\n\r\n\tfloat n = float((radius + 1) * (radius + 1));\n\r\n\tint i;\n\r\n\tint j;\n\r\n\tvec3 m0 = vec3(0.0); vec3 m1 = vec3(0.0); vec3 m2 = vec3(0.0); vec3 m3 = vec3(0.0);\n\r\n\tvec3 s0 = vec3(0.0); vec3 s1 = vec3(0.0); vec3 s2 = vec3(0.0); vec3 s3 = vec3(0.0);\n\r\n\tvec3 c;\n\r\n\t\n\r\n\tfor (int j = -radius; j <= 0; ++j) {\n\r\n\t\tfor (int i = -radius; i <= 0; ++i) {\n\r\n\t\t\tc = texture2D(u_texture, uv + vec2(i,j) * src_size).rgb;\n\r\n\t\t\tm0 += c;\n\r\n\t\t\ts0 += c * c;\n\r\n\t\t}\n\r\n\t}\n\r\n\t\n\r\n\tfor (int j = -radius; j <= 0; ++j) {\n\r\n\t\tfor (int i = 0; i <= radius; ++i) {\n\r\n\t\t\tc = texture2D(u_texture, uv + vec2(i,j) * src_size).rgb;\n\r\n\t\t\tm1 += c;\n\r\n\t\t\ts1 += c * c;\n\r\n\t\t}\n\r\n\t}\n\r\n\t\n\r\n\tfor (int j = 0; j <= radius; ++j) {\n\r\n\t\tfor (int i = 0; i <= radius; ++i) {\n\r\n\t\t\tc = texture2D(u_texture, uv + vec2(i,j) * src_size).rgb;\n\r\n\t\t\tm2 += c;\n\r\n\t\t\ts2 += c * c;\n\r\n\t\t}\n\r\n\t}\n\r\n\t\n\r\n\tfor (int j = 0; j <= radius; ++j) {\n\r\n\t\tfor (int i = -radius; i <= 0; ++i) {\n\r\n\t\t\tc = texture2D(u_texture, uv + vec2(i,j) * src_size).rgb;\n\r\n\t\t\tm3 += c;\n\r\n\t\t\ts3 += c * c;\n\r\n\t\t}\n\r\n\t}\n\r\n\t\n\r\n\tfloat min_sigma2 = 1e+2;\n\r\n\tm0 /= n;\n\r\n\ts0 = abs(s0 / n - m0 * m0);\n\r\n\t\n\r\n\tfloat sigma2 = s0.r + s0.g + s0.b;\n\r\n\tif (sigma2 < min_sigma2) {\n\r\n\t\tmin_sigma2 = sigma2;\n\r\n\t\tgl_FragColor = vec4(m0, 1.0);\n\r\n\t}\n\r\n\t\n\r\n\tm1 /= n;\n\r\n\ts1 = abs(s1 / n - m1 * m1);\n\r\n\t\n\r\n\tsigma2 = s1.r + s1.g + s1.b;\n\r\n\tif (sigma2 < min_sigma2) {\n\r\n\t\tmin_sigma2 = sigma2;\n\r\n\t\tgl_FragColor = vec4(m1, 1.0);\n\r\n\t}\n\r\n\t\n\r\n\tm2 /= n;\n\r\n\ts2 = abs(s2 / n - m2 * m2);\n\r\n\t\n\r\n\tsigma2 = s2.r + s2.g + s2.b;\n\r\n\tif (sigma2 < min_sigma2) {\n\r\n\t\tmin_sigma2 = sigma2;\n\r\n\t\tgl_FragColor = vec4(m2, 1.0);\n\r\n\t}\n\r\n\t\n\r\n\tm3 /= n;\n\r\n\ts3 = abs(s3 / n - m3 * m3);\n\r\n\t\n\r\n\tsigma2 = s3.r + s3.g + s3.b;\n\r\n\tif (sigma2 < min_sigma2) {\n\r\n\t\tmin_sigma2 = sigma2;\n\r\n\t\tgl_FragColor = vec4(m3, 1.0);\n\r\n\t}\n\r\n}\n\r\n", F.registerNodeType("texture/kuwahara", G), I.title = "XDoG Filter", I.desc = "Filters a texture giving an artistic ink style", I.max_radius = 10, I._shaders = [], I.prototype.onExecute = function() { +======= + }, H.pixel_shader = "\n\r\nprecision highp float;\n\r\nvarying vec2 v_coord;\n\r\nuniform sampler2D u_texture;\n\r\nuniform float u_intensity;\n\r\nuniform vec2 u_resolution;\n\r\nuniform vec2 u_iResolution;\n\r\n#ifndef RADIUS\n\r\n\t#define RADIUS 7\n\r\n#endif\n\r\nvoid main() {\n\r\n\n\r\n\tconst int radius = RADIUS;\n\r\n\tvec2 fragCoord = v_coord;\n\r\n\tvec2 src_size = u_iResolution;\n\r\n\tvec2 uv = v_coord;\n\r\n\tfloat n = float((radius + 1) * (radius + 1));\n\r\n\tint i;\n\r\n\tint j;\n\r\n\tvec3 m0 = vec3(0.0); vec3 m1 = vec3(0.0); vec3 m2 = vec3(0.0); vec3 m3 = vec3(0.0);\n\r\n\tvec3 s0 = vec3(0.0); vec3 s1 = vec3(0.0); vec3 s2 = vec3(0.0); vec3 s3 = vec3(0.0);\n\r\n\tvec3 c;\n\r\n\t\n\r\n\tfor (int j = -radius; j <= 0; ++j) {\n\r\n\t\tfor (int i = -radius; i <= 0; ++i) {\n\r\n\t\t\tc = texture2D(u_texture, uv + vec2(i,j) * src_size).rgb;\n\r\n\t\t\tm0 += c;\n\r\n\t\t\ts0 += c * c;\n\r\n\t\t}\n\r\n\t}\n\r\n\t\n\r\n\tfor (int j = -radius; j <= 0; ++j) {\n\r\n\t\tfor (int i = 0; i <= radius; ++i) {\n\r\n\t\t\tc = texture2D(u_texture, uv + vec2(i,j) * src_size).rgb;\n\r\n\t\t\tm1 += c;\n\r\n\t\t\ts1 += c * c;\n\r\n\t\t}\n\r\n\t}\n\r\n\t\n\r\n\tfor (int j = 0; j <= radius; ++j) {\n\r\n\t\tfor (int i = 0; i <= radius; ++i) {\n\r\n\t\t\tc = texture2D(u_texture, uv + vec2(i,j) * src_size).rgb;\n\r\n\t\t\tm2 += c;\n\r\n\t\t\ts2 += c * c;\n\r\n\t\t}\n\r\n\t}\n\r\n\t\n\r\n\tfor (int j = 0; j <= radius; ++j) {\n\r\n\t\tfor (int i = -radius; i <= 0; ++i) {\n\r\n\t\t\tc = texture2D(u_texture, uv + vec2(i,j) * src_size).rgb;\n\r\n\t\t\tm3 += c;\n\r\n\t\t\ts3 += c * c;\n\r\n\t\t}\n\r\n\t}\n\r\n\t\n\r\n\tfloat min_sigma2 = 1e+2;\n\r\n\tm0 /= n;\n\r\n\ts0 = abs(s0 / n - m0 * m0);\n\r\n\t\n\r\n\tfloat sigma2 = s0.r + s0.g + s0.b;\n\r\n\tif (sigma2 < min_sigma2) {\n\r\n\t\tmin_sigma2 = sigma2;\n\r\n\t\tgl_FragColor = vec4(m0, 1.0);\n\r\n\t}\n\r\n\t\n\r\n\tm1 /= n;\n\r\n\ts1 = abs(s1 / n - m1 * m1);\n\r\n\t\n\r\n\tsigma2 = s1.r + s1.g + s1.b;\n\r\n\tif (sigma2 < min_sigma2) {\n\r\n\t\tmin_sigma2 = sigma2;\n\r\n\t\tgl_FragColor = vec4(m1, 1.0);\n\r\n\t}\n\r\n\t\n\r\n\tm2 /= n;\n\r\n\ts2 = abs(s2 / n - m2 * m2);\n\r\n\t\n\r\n\tsigma2 = s2.r + s2.g + s2.b;\n\r\n\tif (sigma2 < min_sigma2) {\n\r\n\t\tmin_sigma2 = sigma2;\n\r\n\t\tgl_FragColor = vec4(m2, 1.0);\n\r\n\t}\n\r\n\t\n\r\n\tm3 /= n;\n\r\n\ts3 = abs(s3 / n - m3 * m3);\n\r\n\t\n\r\n\tsigma2 = s3.r + s3.g + s3.b;\n\r\n\tif (sigma2 < min_sigma2) {\n\r\n\t\tmin_sigma2 = sigma2;\n\r\n\t\tgl_FragColor = vec4(m3, 1.0);\n\r\n\t}\n\r\n}\n\r\n", + F.registerNodeType("texture/kuwahara", H), I.title = "XDoG Filter", I.desc = "Filters a texture giving an artistic ink style", I.max_radius = 10, I._shaders = [], I.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); if (a && this.isOutputConnected(0)) { var b = this._temp_texture; b && b.width == a.width && b.height == a.height && b.type == a.type || (this._temp_texture = new GL.Texture(a.width, a.height, {type:a.type, format:gl.RGBA, filter:gl.LINEAR})); I._xdog_shader || (I._xdog_shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, I.xdog_pixel_shader)); +<<<<<<< HEAD var d = I._xdog_shader, c = GL.Mesh.getScreenQuad(), k = this.properties.sigma, f = this.properties.k, g = this.properties.p, e = this.properties.epsilon, n = this.properties.phi; a.bind(0); this._temp_texture.drawTo(function() { d.uniforms({src:0, sigma:k, k:f, p:g, epsilon:e, phi:n, cvsWidth:a.width, cvsHeight:a.height}).draw(c); +======= + var d = I._xdog_shader, c = GL.Mesh.getScreenQuad(), k = this.properties.sigma, f = this.properties.k, h = this.properties.p, e = this.properties.epsilon, n = this.properties.phi; + a.bind(0); + this._temp_texture.drawTo(function() { + d.uniforms({src:0, sigma:k, k:f, p:h, epsilon:e, phi:n, cvsWidth:a.width, cvsHeight:a.height}).draw(c); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._temp_texture); } @@ -8147,13 +10471,22 @@ $jscomp.polyfill("Object.values", function(v) { } } }, K.pixel_shader = "precision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform float u_factor;\n\r\n\t\tvec2 barrelDistortion(vec2 coord, float amt) {\n\r\n\t\t\tvec2 cc = coord - 0.5;\n\r\n\t\t\tfloat dist = dot(cc, cc);\n\r\n\t\t\treturn coord + cc * dist * amt;\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tfloat sat( float t )\n\r\n\t\t{\n\r\n\t\t\treturn clamp( t, 0.0, 1.0 );\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tfloat linterp( float t ) {\n\r\n\t\t\treturn sat( 1.0 - abs( 2.0*t - 1.0 ) );\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tfloat remap( float t, float a, float b ) {\n\r\n\t\t\treturn sat( (t - a) / (b - a) );\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tvec4 spectrum_offset( float t ) {\n\r\n\t\t\tvec4 ret;\n\r\n\t\t\tfloat lo = step(t,0.5);\n\r\n\t\t\tfloat hi = 1.0-lo;\n\r\n\t\t\tfloat w = linterp( remap( t, 1.0/6.0, 5.0/6.0 ) );\n\r\n\t\t\tret = vec4(lo,1.0,hi, 1.) * vec4(1.0-w, w, 1.0-w, 1.);\n\r\n\t\t\n\r\n\t\t\treturn pow( ret, vec4(1.0/2.2) );\n\r\n\t\t}\n\r\n\t\t\n\r\n\t\tconst float max_distort = 2.2;\n\r\n\t\tconst int num_iter = 12;\n\r\n\t\tconst float reci_num_iter_f = 1.0 / float(num_iter);\n\r\n\t\t\n\r\n\t\tvoid main()\n\r\n\t\t{\t\n\r\n\t\t\tvec2 uv=v_coord;\n\r\n\t\t\tvec4 sumcol = vec4(0.0);\n\r\n\t\t\tvec4 sumw = vec4(0.0);\t\n\r\n\t\t\tfor ( int i=0; i>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); if (a && this.isOutputConnected(0)) { var b = this._temp_texture; b && b.width == a.width && b.height == a.height && b.type == a.type || (b = this._temp_texture = new GL.Texture(a.width, a.height, {type:a.type, format:gl.RGBA, filter:gl.LINEAR})); +<<<<<<< HEAD var d = z._shader; d || (d = z._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, z.pixel_shader)); +======= + var d = A._shader; + d || (d = A._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, A.pixel_shader)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 !this._must_update && this._curve_texture || this.updateCurve(); var c = this._uniforms, k = this._curve_texture; b.drawTo(function() { @@ -8164,7 +10497,11 @@ $jscomp.polyfill("Object.values", function(v) { }); this.setOutputData(0, b); } +<<<<<<< HEAD }, z.prototype.sampleCurve = function(a, b) { +======= + }, A.prototype.sampleCurve = function(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (b = b || this._points.RGB) { for (var d = 0; d < b.length - 1; ++d) { var c = b[d], k = b[d + 1]; @@ -8179,7 +10516,11 @@ $jscomp.polyfill("Object.values", function(v) { } return 0; } +<<<<<<< HEAD }, z.prototype.updateCurve = function() { +======= + }, A.prototype.updateCurve = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 for (var a = this._values, b = a.length / 4, d = this.properties.split_channels, c = 0; c < b; ++c) { if (d) { a[4 * c] = Math.clamp(255 * this.sampleCurve(c / b, this._points.R), 0, 255), a[4 * c + 1] = Math.clamp(255 * this.sampleCurve(c / b, this._points.G), 0, 255), a[4 * c + 2] = Math.clamp(255 * this.sampleCurve(c / b, this._points.B), 0, 255); @@ -8191,12 +10532,17 @@ $jscomp.polyfill("Object.values", function(v) { } this._curve_texture || (this._curve_texture = new GL.Texture(256, 1, {format:gl.RGBA, magFilter:gl.LINEAR, wrap:gl.CLAMP_TO_EDGE})); this._curve_texture.uploadData(a, null, !0); +<<<<<<< HEAD }, z.prototype.onSerialize = function(a) { +======= + }, A.prototype.onSerialize = function(a) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var b = {}, d; for (d in this._points) { b[d] = this._points[d].concat(); } a.curves = b; +<<<<<<< HEAD }, z.prototype.onConfigure = function(a) { this._points = a.curves; this.curve_editor && (curve_editor.points = this._points); @@ -8210,16 +10556,36 @@ $jscomp.polyfill("Object.values", function(v) { return this.curve_editor.onMouseMove([b[0], b[1] - this.curve_offset], d); } }, z.prototype.onMouseUp = function(a, b, d) { +======= + }, A.prototype.onConfigure = function(a) { + this._points = a.curves; + this.curve_editor && (curve_editor.points = this._points); + this._must_update = !0; + }, A.prototype.onMouseDown = function(a, b, d) { + if (this.curve_editor) { + return (a = this.curve_editor.onMouseDown([b[0], b[1] - this.curve_offset], d)) && this.captureInput(!0), a; + } + }, A.prototype.onMouseMove = function(a, b, d) { + if (this.curve_editor) { + return this.curve_editor.onMouseMove([b[0], b[1] - this.curve_offset], d); + } + }, A.prototype.onMouseUp = function(a, b, d) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.curve_editor) { return this.curve_editor.onMouseUp([b[0], b[1] - this.curve_offset], d); } this.captureInput(!1); +<<<<<<< HEAD }, z.channel_line_colors = {RGB:"#666", R:"#F33", G:"#3F3", B:"#33F"}, z.prototype.onDrawBackground = function(a, b) { +======= + }, A.channel_line_colors = {RGB:"#666", R:"#F33", G:"#3F3", B:"#33F"}, A.prototype.onDrawBackground = function(a, b) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (!this.flags.collapsed) { this.curve_editor || (this.curve_editor = new F.CurveEditor(this._points.R)); a.save(); a.translate(0, this.curve_offset); var d = this.widgets[1].value; +<<<<<<< HEAD this.properties.split_channels ? ("RGB" == d && (this.widgets[1].value = d = "R", this.widgets[1].disabled = !1), this.curve_editor.points = this._points.R, this.curve_editor.draw(a, [this.size[0], this.size[1] - this.curve_offset], b, "#111", z.channel_line_colors.R, !0), a.globalCompositeOperation = "lighten", this.curve_editor.points = this._points.G, this.curve_editor.draw(a, [this.size[0], this.size[1] - this.curve_offset], b, null, z.channel_line_colors.G, !0), this.curve_editor.points = this._points.B, this.curve_editor.draw(a, [this.size[0], this.size[1] - this.curve_offset], b, null, z.channel_line_colors.B, !0), a.globalCompositeOperation = "source-over") : (this.widgets[1].value = d = "RGB", this.widgets[1].disabled = !0); this.curve_editor.points = this._points[d]; @@ -8228,6 +10594,16 @@ $jscomp.polyfill("Object.values", function(v) { } }, z.pixel_shader = "precision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform sampler2D u_curve;\n\r\n\t\tuniform float u_range;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec4 color = texture2D( u_texture, v_coord ) * u_range;\n\r\n\t\t\tcolor.x = texture2D( u_curve, vec2( color.x, 0.5 ) ).x;\n\r\n\t\t\tcolor.y = texture2D( u_curve, vec2( color.y, 0.5 ) ).y;\n\r\n\t\t\tcolor.z = texture2D( u_curve, vec2( color.z, 0.5 ) ).z;\n\r\n\t\t\t//color.w = texture2D( u_curve, vec2( color.w, 0.5 ) ).w;\n\r\n\t\t\tgl_FragColor = color;\n\r\n\t\t}", F.registerNodeType("texture/curve", z), t.title = "Exposition", t.desc = "Controls texture exposition", t.widgets_info = {exposition:{widget:"slider", min:0, max:3}, precision:{widget:"combo", values:c.MODE_VALUES}}, t.prototype.onExecute = function() { +======= + this.properties.split_channels ? ("RGB" == d && (this.widgets[1].value = d = "R", this.widgets[1].disabled = !1), this.curve_editor.points = this._points.R, this.curve_editor.draw(a, [this.size[0], this.size[1] - this.curve_offset], b, "#111", A.channel_line_colors.R, !0), a.globalCompositeOperation = "lighten", this.curve_editor.points = this._points.G, this.curve_editor.draw(a, [this.size[0], this.size[1] - this.curve_offset], b, null, A.channel_line_colors.G, !0), this.curve_editor.points = + this._points.B, this.curve_editor.draw(a, [this.size[0], this.size[1] - this.curve_offset], b, null, A.channel_line_colors.B, !0), a.globalCompositeOperation = "source-over") : (this.widgets[1].value = d = "RGB", this.widgets[1].disabled = !0); + this.curve_editor.points = this._points[d]; + this.curve_editor.draw(a, [this.size[0], this.size[1] - this.curve_offset], b, this.properties.split_channels ? null : "#111", A.channel_line_colors[d]); + a.restore(); + } + }, A.pixel_shader = "precision highp float;\n\r\n\t\tvarying vec2 v_coord;\n\r\n\t\tuniform sampler2D u_texture;\n\r\n\t\tuniform sampler2D u_curve;\n\r\n\t\tuniform float u_range;\n\r\n\t\t\n\r\n\t\tvoid main() {\n\r\n\t\t\tvec4 color = texture2D( u_texture, v_coord ) * u_range;\n\r\n\t\t\tcolor.x = texture2D( u_curve, vec2( color.x, 0.5 ) ).x;\n\r\n\t\t\tcolor.y = texture2D( u_curve, vec2( color.y, 0.5 ) ).y;\n\r\n\t\t\tcolor.z = texture2D( u_curve, vec2( color.z, 0.5 ) ).z;\n\r\n\t\t\t//color.w = texture2D( u_curve, vec2( color.w, 0.5 ) ).w;\n\r\n\t\t\tgl_FragColor = color;\n\r\n\t\t}", + F.registerNodeType("texture/curve", A), t.title = "Exposition", t.desc = "Controls texture exposition", t.widgets_info = {exposition:{widget:"slider", min:0, max:3}, precision:{widget:"combo", values:c.MODE_VALUES}}, t.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 var a = this.getInputData(0); if (a && this.isOutputConnected(0)) { var b = this._temp_texture; @@ -8280,16 +10656,28 @@ $jscomp.polyfill("Object.values", function(v) { 0 == b && (b = gl.viewport_data[3]); var d = c.getTextureType(this.properties.precision), k = this._texture; k && k.width == a && k.height == b && k.type == d || (k = this._texture = new GL.Texture(a, b, {type:d, format:gl.RGB, filter:gl.LINEAR})); +<<<<<<< HEAD var f = this.getInputOrProperty("persistence"), g = this.getInputOrProperty("octaves"), e = this.getInputOrProperty("offset"), n = this.getInputOrProperty("scale"), h = this.getInputOrProperty("amplitude"), p = this.getInputOrProperty("seed"); d = "" + a + b + d + f + g + n + p + e[0] + e[1] + h; +======= + var f = this.getInputOrProperty("persistence"), h = this.getInputOrProperty("octaves"), e = this.getInputOrProperty("offset"), n = this.getInputOrProperty("scale"), g = this.getInputOrProperty("amplitude"), p = this.getInputOrProperty("seed"); + d = "" + a + b + d + f + h + n + p + e[0] + e[1] + g; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (d != this._key) { this._key = d; var l = this._uniforms; l.u_persistence = f; +<<<<<<< HEAD l.u_octaves = g; l.u_offset.set(e); l.u_scale = n; l.u_amplitude = h; +======= + l.u_octaves = h; + l.u_offset.set(e); + l.u_scale = n; + l.u_amplitude = g; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 l.u_seed = 128 * p; l.u_viewport[0] = a; l.u_viewport[1] = b; @@ -8312,8 +10700,13 @@ $jscomp.polyfill("Object.values", function(v) { if (F.allow_scripts) { try { this._func = new Function("canvas", "ctx", "time", "script", "v", a), this.boxcolor = "#00FF00"; +<<<<<<< HEAD } catch (S) { this.boxcolor = "#FF0000", console.error("Error parsing script"), console.error(S); +======= + } catch (R) { + this.boxcolor = "#FF0000", console.error("Error parsing script"), console.error(R); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } }, N.prototype.onExecute = function() { @@ -8322,7 +10715,11 @@ $jscomp.polyfill("Object.values", function(v) { }, N.prototype.executeDraw = function(a) { var b = this.properties.width || gl.canvas.width, d = this.properties.height || gl.canvas.height, k = this._temp_texture, f = c.getTextureType(this.properties.precision); k && k.width == b && k.height == d && k.type == f || (k = this._temp_texture = new GL.Texture(b, d, {format:gl.RGBA, filter:gl.LINEAR, type:f})); +<<<<<<< HEAD var g = this.getInputData(0), e = this.properties, n = this, h = this.graph.getTime(), p = gl, l = gl.canvas; +======= + var h = this.getInputData(0), e = this.properties, n = this, g = this.graph.getTime(), p = gl, l = gl.canvas; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.properties.use_html_canvas || !v.enableWebGLCanvas) { this._canvas ? (l = this._canvas, p = this._ctx) : (l = this._canvas = createCanvas(b.height), p = this._ctx = l.getContext("2d")), l.width = b, l.height = d; } @@ -8331,7 +10728,11 @@ $jscomp.polyfill("Object.values", function(v) { gl.start2D(); e.clear && (gl.clearColor(0, 0, 0, 0), gl.clear(gl.COLOR_BUFFER_BIT)); try { +<<<<<<< HEAD a.draw ? a.draw.call(n, l, p, h, a, g) : a.call(n, l, p, h, a, g), n.boxcolor = "#00FF00"; +======= + a.draw ? a.draw.call(n, l, p, g, a, h) : a.call(n, l, p, g, a, h), n.boxcolor = "#00FF00"; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } catch (Q) { n.boxcolor = "#FF0000", console.error("Error executing script"), console.error(Q); } @@ -8340,7 +10741,11 @@ $jscomp.polyfill("Object.values", function(v) { } else { e.clear && p.clearRect(0, 0, l.width, l.height); try { +<<<<<<< HEAD a.draw ? a.draw.call(this, l, p, h, a, g) : a.call(this, l, p, h, a, g), this.boxcolor = "#00FF00"; +======= + a.draw ? a.draw.call(this, l, p, g, a, h) : a.call(this, l, p, g, a, h), this.boxcolor = "#00FF00"; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } catch (Q) { this.boxcolor = "#FF0000", console.error("Error executing script"), console.error(Q); } @@ -8385,6 +10790,7 @@ $jscomp.polyfill("Object.values", function(v) { }, F.registerNodeType("texture/cubemapToTexture2D", P)); })(this); (function(v) { +<<<<<<< HEAD var c = v.LiteGraph, q = v.LGraphTexture; if ("undefined" != typeof GL) { var m = function() { @@ -8394,24 +10800,45 @@ $jscomp.polyfill("Object.values", function(v) { this.properties = {intensity:1, invert:!1, precision:q.DEFAULT}; m._shader || (m._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, m.pixel_shader)); }, h = function() { +======= + var c = v.LiteGraph; + if ("undefined" != typeof GL) { + var q = function() { + this.addInput("Tex.", "Texture"); + this.addInput("intensity", "number"); + this.addOutput("Texture", "Texture"); + this.properties = {intensity:1, invert:!1, precision:LGraphTexture.DEFAULT}; + q._shader || (q._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, q.pixel_shader)); + }, m = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("Texture", "Texture"); this.addInput("value1", "number"); this.addInput("value2", "number"); this.addOutput("Texture", "Texture"); +<<<<<<< HEAD this.properties = {fx:"halftone", value1:1, value2:1, precision:q.DEFAULT}; }, r = function() { +======= + this.properties = {fx:"halftone", value1:1, value2:1, precision:LGraphTexture.DEFAULT}; + }, g = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("Texture", "Texture"); this.addInput("Blurred", "Texture"); this.addInput("Mask", "Texture"); this.addInput("Threshold", "number"); this.addOutput("Texture", "Texture"); this.properties = {shape:"", size:10, alpha:1.0, threshold:1.0, high_precision:!1}; +<<<<<<< HEAD }, l = function() { +======= + }, r = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("Texture", "Texture"); this.addInput("Aberration", "number"); this.addInput("Distortion", "number"); this.addInput("Blur", "number"); this.addOutput("Texture", "Texture"); +<<<<<<< HEAD this.properties = {aberration:1.0, distortion:1.0, blur:1.0, precision:q.DEFAULT}; l._shader || (l._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, l.pixel_shader), l._texture = new GL.Texture(3, 1, {format:gl.RGB, wrap:gl.CLAMP_TO_EDGE, magFilter:gl.LINEAR, minFilter:gl.LINEAR, pixel_data:[255, 0, 0, 0, 255, 0, 0, 0, 255]})); }; @@ -8437,11 +10864,39 @@ $jscomp.polyfill("Object.values", function(v) { this._tex.drawTo(function() { c.bind(0); e.uniforms({u_texture:0, u_aberration:h, u_distortion:m, u_blur:r}).draw(v); +======= + this.properties = {aberration:1.0, distortion:1.0, blur:1.0, precision:LGraphTexture.DEFAULT}; + r._shader || (r._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, r.pixel_shader), r._texture = new GL.Texture(3, 1, {format:gl.RGB, wrap:gl.CLAMP_TO_EDGE, magFilter:gl.LINEAR, minFilter:gl.LINEAR, pixel_data:[255, 0, 0, 0, 255, 0, 0, 0, 255]})); + }; + r.title = "Lens"; + r.desc = "Camera Lens distortion"; + r.widgets_info = {precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; + r.prototype.onExecute = function() { + var c = this.getInputData(0); + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { + this.setOutputData(0, c); + } else { + if (c) { + this._tex = LGraphTexture.getTargetTexture(c, this._tex, this.properties.precision); + var g = this.properties.aberration; + this.isInputConnected(1) && (g = this.getInputData(1), this.properties.aberration = g); + var m = this.properties.distortion; + this.isInputConnected(2) && (m = this.getInputData(2), this.properties.distortion = m); + var q = this.properties.blur; + this.isInputConnected(3) && (q = this.getInputData(3), this.properties.blur = q); + gl.disable(gl.BLEND); + gl.disable(gl.DEPTH_TEST); + var v = Mesh.getScreenQuad(), z = r._shader; + this._tex.drawTo(function() { + c.bind(0); + z.uniforms({u_texture:0, u_aberration:g, u_distortion:m, u_blur:q}).draw(v); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._tex); } } }; +<<<<<<< HEAD l.pixel_shader = "precision highp float;\n\r\n\t\t\tprecision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform vec2 u_camera_planes;\n\r\n\t\t\tuniform float u_aberration;\n\r\n\t\t\tuniform float u_distortion;\n\r\n\t\t\tuniform float u_blur;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec2 coord = v_coord;\n\r\n\t\t\t\tfloat dist = distance(vec2(0.5), coord);\n\r\n\t\t\t\tvec2 dist_coord = coord - vec2(0.5);\n\r\n\t\t\t\tfloat percent = 1.0 + ((0.5 - dist) / 0.5) * u_distortion;\n\r\n\t\t\t\tdist_coord *= percent;\n\r\n\t\t\t\tcoord = dist_coord + vec2(0.5);\n\r\n\t\t\t\tvec4 color = texture2D(u_texture,coord, u_blur * dist);\n\r\n\t\t\t\tcolor.r = texture2D(u_texture,vec2(0.5) + dist_coord * (1.0+0.01*u_aberration), u_blur * dist ).r;\n\r\n\t\t\t\tcolor.b = texture2D(u_texture,vec2(0.5) + dist_coord * (1.0-0.01*u_aberration), u_blur * dist ).b;\n\r\n\t\t\t\tgl_FragColor = color;\n\r\n\t\t\t}\n\r\n\t\t\t"; c.registerNodeType("fx/lens", l); v.LGraphFXLens = l; @@ -8466,20 +10921,57 @@ $jscomp.polyfill("Object.values", function(v) { var u = this._points_mesh; u && u._width == c.width && u._height == c.height && 2 == u._spacing || (u = this.createPointsMesh(c.width, c.height, 2)); var H = Mesh.getScreenQuad(), n = this.properties.size, p = this.properties.alpha; +======= + r.pixel_shader = "precision highp float;\n\r\n\t\t\tprecision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform vec2 u_camera_planes;\n\r\n\t\t\tuniform float u_aberration;\n\r\n\t\t\tuniform float u_distortion;\n\r\n\t\t\tuniform float u_blur;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec2 coord = v_coord;\n\r\n\t\t\t\tfloat dist = distance(vec2(0.5), coord);\n\r\n\t\t\t\tvec2 dist_coord = coord - vec2(0.5);\n\r\n\t\t\t\tfloat percent = 1.0 + ((0.5 - dist) / 0.5) * u_distortion;\n\r\n\t\t\t\tdist_coord *= percent;\n\r\n\t\t\t\tcoord = dist_coord + vec2(0.5);\n\r\n\t\t\t\tvec4 color = texture2D(u_texture,coord, u_blur * dist);\n\r\n\t\t\t\tcolor.r = texture2D(u_texture,vec2(0.5) + dist_coord * (1.0+0.01*u_aberration), u_blur * dist ).r;\n\r\n\t\t\t\tcolor.b = texture2D(u_texture,vec2(0.5) + dist_coord * (1.0-0.01*u_aberration), u_blur * dist ).b;\n\r\n\t\t\t\tgl_FragColor = color;\n\r\n\t\t\t}\n\r\n\t\t\t"; + c.registerNodeType("fx/lens", r); + v.LGraphFXLens = r; + g.title = "Bokeh"; + g.desc = "applies an Bokeh effect"; + g.widgets_info = {shape:{widget:"texture"}}; + g.prototype.onExecute = function() { + var c = this.getInputData(0), m = this.getInputData(1), r = this.getInputData(2); + if (c && r && this.properties.shape) { + m || (m = c); + var q = LGraphTexture.getTexture(this.properties.shape); + if (q) { + var v = this.properties.threshold; + this.isInputConnected(3) && (v = this.getInputData(3), this.properties.threshold = v); + var z = gl.UNSIGNED_BYTE; + this.properties.high_precision && (z = gl.half_float_ext ? gl.HALF_FLOAT_OES : gl.FLOAT); + this._temp_texture && this._temp_texture.type == z && this._temp_texture.width == c.width && this._temp_texture.height == c.height || (this._temp_texture = new GL.Texture(c.width, c.height, {type:z, format:gl.RGBA, filter:gl.LINEAR})); + var e = g._first_shader; + e || (e = g._first_shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, g._first_pixel_shader)); + var C = g._second_shader; + C || (C = g._second_shader = new GL.Shader(g._second_vertex_shader, g._second_pixel_shader)); + var D = this._points_mesh; + D && D._width == c.width && D._height == c.height && 2 == D._spacing || (D = this.createPointsMesh(c.width, c.height, 2)); + var u = Mesh.getScreenQuad(), G = this.properties.size, n = this.properties.alpha; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 gl.disable(gl.DEPTH_TEST); gl.disable(gl.BLEND); this._temp_texture.drawTo(function() { c.bind(0); +<<<<<<< HEAD h.bind(1); l.bind(2); C.uniforms({u_texture:0, u_texture_blur:1, u_mask:2, u_texsize:[c.width, c.height]}).draw(H); +======= + m.bind(1); + r.bind(2); + e.uniforms({u_texture:0, u_texture_blur:1, u_mask:2, u_texsize:[c.width, c.height]}).draw(u); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this._temp_texture.drawTo(function() { gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE); c.bind(0); +<<<<<<< HEAD m.bind(3); D.uniforms({u_texture:0, u_mask:2, u_shape:3, u_alpha:p, u_threshold:v, u_pointSize:n, u_itexsize:[1.0 / c.width, 1.0 / c.height]}).draw(u, gl.POINTS); +======= + q.bind(3); + C.uniforms({u_texture:0, u_mask:2, u_shape:3, u_alpha:n, u_threshold:v, u_pointSize:G, u_itexsize:[1.0 / c.width, 1.0 / c.height]}).draw(D, gl.POINTS); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._temp_texture); } @@ -8487,6 +10979,7 @@ $jscomp.polyfill("Object.values", function(v) { this.setOutputData(0, c); } }; +<<<<<<< HEAD r.prototype.createPointsMesh = function(c, h, l) { for (var m = Math.round(c / l), r = Math.round(h / l), e = new Float32Array(m * r * 2), q = -1, w = 2 / c * l, u = 2 / h * l, v = 0; v < r; ++v) { for (var n = -1, p = 0; p < m; ++p) { @@ -8542,12 +11035,70 @@ $jscomp.polyfill("Object.values", function(v) { c.bind(0); "noise" == r && u.bind(1); A.uniforms({u_texture:0, u_noise:1, u_size:[c.width, c.height], u_rand:[Math.random(), Math.random()], u_value1:l, u_value2:m, u_camera_planes:D}).draw(C); +======= + g.prototype.createPointsMesh = function(c, g, m) { + for (var l = Math.round(c / m), r = Math.round(g / m), q = new Float32Array(l * r * 2), e = -1, v = 2 / c * m, y = 2 / g * m, u = 0; u < r; ++u) { + for (var B = -1, n = 0; n < l; ++n) { + var p = u * l * 2 + 2 * n; + q[p] = B; + q[p + 1] = e; + B += v; + } + e += y; + } + this._points_mesh = GL.Mesh.load({vertices2D:q}); + this._points_mesh._width = c; + this._points_mesh._height = g; + this._points_mesh._spacing = m; + return this._points_mesh; + }; + g._first_pixel_shader = "precision highp float;\n\r\n\t\t\tprecision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform sampler2D u_texture_blur;\n\r\n\t\t\tuniform sampler2D u_mask;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tvec4 blurred_color = texture2D(u_texture_blur, v_coord);\n\r\n\t\t\t\tfloat mask = texture2D(u_mask, v_coord).x;\n\r\n\t\t\t gl_FragColor = mix(color, blurred_color, mask);\n\r\n\t\t\t}\n\r\n\t\t\t"; + g._second_vertex_shader = "precision highp float;\n\r\n\t\t\tattribute vec2 a_vertex2D;\n\r\n\t\t\tvarying vec4 v_color;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform sampler2D u_mask;\n\r\n\t\t\tuniform vec2 u_itexsize;\n\r\n\t\t\tuniform float u_pointSize;\n\r\n\t\t\tuniform float u_threshold;\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec2 coord = a_vertex2D * 0.5 + 0.5;\n\r\n\t\t\t\tv_color = texture2D( u_texture, coord );\n\r\n\t\t\t\tv_color += texture2D( u_texture, coord + vec2(u_itexsize.x, 0.0) );\n\r\n\t\t\t\tv_color += texture2D( u_texture, coord + vec2(0.0, u_itexsize.y));\n\r\n\t\t\t\tv_color += texture2D( u_texture, coord + u_itexsize);\n\r\n\t\t\t\tv_color *= 0.25;\n\r\n\t\t\t\tfloat mask = texture2D(u_mask, coord).x;\n\r\n\t\t\t\tfloat luminance = length(v_color) * mask;\n\r\n\t\t\t\t/*luminance /= (u_pointSize*u_pointSize)*0.01 */;\n\r\n\t\t\t\tluminance -= u_threshold;\n\r\n\t\t\t\tif(luminance < 0.0)\n\r\n\t\t\t\t{\n\r\n\t\t\t\t\tgl_Position.x = -100.0;\n\r\n\t\t\t\t\treturn;\n\r\n\t\t\t\t}\n\r\n\t\t\t\tgl_PointSize = u_pointSize;\n\r\n\t\t\t\tgl_Position = vec4(a_vertex2D,0.0,1.0);\n\r\n\t\t\t}\n\r\n\t\t\t"; + g._second_pixel_shader = "precision highp float;\n\r\n\t\t\tvarying vec4 v_color;\n\r\n\t\t\tuniform sampler2D u_shape;\n\r\n\t\t\tuniform float u_alpha;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec4 color = texture2D( u_shape, gl_PointCoord );\n\r\n\t\t\t\tcolor *= v_color * u_alpha;\n\r\n\t\t\t\tgl_FragColor = color;\n\r\n\t\t\t}\n"; + c.registerNodeType("fx/bokeh", g); + v.LGraphFXBokeh = g; + m.title = "FX"; + m.desc = "applies an FX from a list"; + m.widgets_info = {fx:{widget:"combo", values:["halftone", "pixelate", "lowpalette", "noise", "gamma"]}, precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; + m.shaders = {}; + m.prototype.onExecute = function() { + if (this.isOutputConnected(0)) { + var c = this.getInputData(0); + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { + this.setOutputData(0, c); + } else { + if (c) { + this._tex = LGraphTexture.getTargetTexture(c, this._tex, this.properties.precision); + var g = this.properties.value1; + this.isInputConnected(1) && (g = this.getInputData(1), this.properties.value1 = g); + var r = this.properties.value2; + this.isInputConnected(2) && (r = this.getInputData(2), this.properties.value2 = r); + var q = this.properties.fx, E = m.shaders[q]; + if (!E) { + var z = m["pixel_shader_" + q]; + if (!z) { + return; + } + E = m.shaders[q] = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, z); + } + gl.disable(gl.BLEND); + gl.disable(gl.DEPTH_TEST); + var e = Mesh.getScreenQuad(); + var C = v.LS && LS.Renderer._current_camera ? [LS.Renderer._current_camera.near, LS.Renderer._current_camera.far] : [1, 100]; + var D = null; + "noise" == q && (D = LGraphTexture.getNoiseTexture()); + this._tex.drawTo(function() { + c.bind(0); + "noise" == q && D.bind(1); + E.uniforms({u_texture:0, u_noise:1, u_size:[c.width, c.height], u_rand:[Math.random(), Math.random()], u_value1:g, u_value2:r, u_camera_planes:C}).draw(e); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._tex); } } } }; +<<<<<<< HEAD h.pixel_shader_halftone = "precision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform vec2 u_camera_planes;\n\r\n\t\t\tuniform vec2 u_size;\n\r\n\t\t\tuniform float u_value1;\n\r\n\t\t\tuniform float u_value2;\n\r\n\t\t\t\n\r\n\t\t\tfloat pattern() {\n\r\n\t\t\t\tfloat s = sin(u_value1 * 3.1415), c = cos(u_value1 * 3.1415);\n\r\n\t\t\t\tvec2 tex = v_coord * u_size.xy;\n\r\n\t\t\t\tvec2 point = vec2(\n\r\n\t\t\t\t c * tex.x - s * tex.y ,\n\r\n\t\t\t\t s * tex.x + c * tex.y \n\r\n\t\t\t\t) * u_value2;\n\r\n\t\t\t\treturn (sin(point.x) * sin(point.y)) * 4.0;\n\r\n\t\t\t}\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tfloat average = (color.r + color.g + color.b) / 3.0;\n\r\n\t\t\t\tgl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n\r\n\t\t\t}\n"; h.pixel_shader_pixelate = "precision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform vec2 u_camera_planes;\n\r\n\t\t\tuniform vec2 u_size;\n\r\n\t\t\tuniform float u_value1;\n\r\n\t\t\tuniform float u_value2;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec2 coord = vec2( floor(v_coord.x * u_value1) / u_value1, floor(v_coord.y * u_value2) / u_value2 );\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, coord);\n\r\n\t\t\t\tgl_FragColor = color;\n\r\n\t\t\t}\n"; h.pixel_shader_lowpalette = "precision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform vec2 u_camera_planes;\n\r\n\t\t\tuniform vec2 u_size;\n\r\n\t\t\tuniform float u_value1;\n\r\n\t\t\tuniform float u_value2;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tgl_FragColor = floor(color * u_value1) / u_value1;\n\r\n\t\t\t}\n"; @@ -8573,14 +11124,47 @@ $jscomp.polyfill("Object.values", function(v) { this._tex.drawTo(function() { c.bind(0); r.uniforms({u_texture:0, u_intensity:h, u_isize:[1 / c.width, 1 / c.height], u_invert:v ? 1 : 0}).draw(l); +======= + m.pixel_shader_halftone = "precision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform vec2 u_camera_planes;\n\r\n\t\t\tuniform vec2 u_size;\n\r\n\t\t\tuniform float u_value1;\n\r\n\t\t\tuniform float u_value2;\n\r\n\t\t\t\n\r\n\t\t\tfloat pattern() {\n\r\n\t\t\t\tfloat s = sin(u_value1 * 3.1415), c = cos(u_value1 * 3.1415);\n\r\n\t\t\t\tvec2 tex = v_coord * u_size.xy;\n\r\n\t\t\t\tvec2 point = vec2(\n\r\n\t\t\t\t c * tex.x - s * tex.y ,\n\r\n\t\t\t\t s * tex.x + c * tex.y \n\r\n\t\t\t\t) * u_value2;\n\r\n\t\t\t\treturn (sin(point.x) * sin(point.y)) * 4.0;\n\r\n\t\t\t}\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tfloat average = (color.r + color.g + color.b) / 3.0;\n\r\n\t\t\t\tgl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n\r\n\t\t\t}\n"; + m.pixel_shader_pixelate = "precision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform vec2 u_camera_planes;\n\r\n\t\t\tuniform vec2 u_size;\n\r\n\t\t\tuniform float u_value1;\n\r\n\t\t\tuniform float u_value2;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec2 coord = vec2( floor(v_coord.x * u_value1) / u_value1, floor(v_coord.y * u_value2) / u_value2 );\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, coord);\n\r\n\t\t\t\tgl_FragColor = color;\n\r\n\t\t\t}\n"; + m.pixel_shader_lowpalette = "precision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform vec2 u_camera_planes;\n\r\n\t\t\tuniform vec2 u_size;\n\r\n\t\t\tuniform float u_value1;\n\r\n\t\t\tuniform float u_value2;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tgl_FragColor = floor(color * u_value1) / u_value1;\n\r\n\t\t\t}\n"; + m.pixel_shader_noise = "precision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform sampler2D u_noise;\n\r\n\t\t\tuniform vec2 u_size;\n\r\n\t\t\tuniform float u_value1;\n\r\n\t\t\tuniform float u_value2;\n\r\n\t\t\tuniform vec2 u_rand;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tvec3 noise = texture2D(u_noise, v_coord * vec2(u_size.x / 512.0, u_size.y / 512.0) + u_rand).xyz - vec3(0.5);\n\r\n\t\t\t\tgl_FragColor = vec4( color.xyz + noise * u_value1, color.a );\n\r\n\t\t\t}\n"; + m.pixel_shader_gamma = "precision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform float u_value1;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tfloat gamma = 1.0 / u_value1;\n\r\n\t\t\t\tgl_FragColor = vec4( pow( color.xyz, vec3(gamma) ), color.a );\n\r\n\t\t\t}\n"; + c.registerNodeType("fx/generic", m); + v.LGraphFXGeneric = m; + q.title = "Vigneting"; + q.desc = "Vigneting"; + q.widgets_info = {precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; + q.prototype.onExecute = function() { + var c = this.getInputData(0); + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { + this.setOutputData(0, c); + } else { + if (c) { + this._tex = LGraphTexture.getTargetTexture(c, this._tex, this.properties.precision); + var g = this.properties.intensity; + this.isInputConnected(1) && (g = this.getInputData(1), this.properties.intensity = g); + gl.disable(gl.BLEND); + gl.disable(gl.DEPTH_TEST); + var m = Mesh.getScreenQuad(), r = q._shader, v = this.properties.invert; + this._tex.drawTo(function() { + c.bind(0); + r.uniforms({u_texture:0, u_intensity:g, u_isize:[1 / c.width, 1 / c.height], u_invert:v ? 1 : 0}).draw(m); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }); this.setOutputData(0, this._tex); } } }; +<<<<<<< HEAD m.pixel_shader = "precision highp float;\n\r\n\t\t\tprecision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform float u_intensity;\n\r\n\t\t\tuniform int u_invert;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tfloat luminance = 1.0 - length( v_coord - vec2(0.5) ) * 1.414;\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tif(u_invert == 1)\n\r\n\t\t\t\t\tluminance = 1.0 - luminance;\n\r\n\t\t\t\tluminance = mix(1.0, luminance, u_intensity);\n\r\n\t\t\t gl_FragColor = vec4( luminance * color.xyz, color.a);\n\r\n\t\t\t}\n\r\n\t\t\t"; c.registerNodeType("fx/vigneting", m); v.LGraphFXVigneting = m; +======= + q.pixel_shader = "precision highp float;\n\r\n\t\t\tprecision highp float;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform float u_intensity;\n\r\n\t\t\tuniform int u_invert;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tfloat luminance = 1.0 - length( v_coord - vec2(0.5) ) * 1.414;\n\r\n\t\t\t\tvec4 color = texture2D(u_texture, v_coord);\n\r\n\t\t\t\tif(u_invert == 1)\n\r\n\t\t\t\t\tluminance = 1.0 - luminance;\n\r\n\t\t\t\tluminance = mix(1.0, luminance, u_intensity);\n\r\n\t\t\t gl_FragColor = vec4( luminance * color.xyz, color.a);\n\r\n\t\t\t}\n\r\n\t\t\t"; + c.registerNodeType("fx/vigneting", q); + v.LGraphFXVigneting = q; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } })(this); (function(v) { @@ -8608,7 +11192,11 @@ $jscomp.polyfill("Object.values", function(v) { c._waiting = !1; }); } +<<<<<<< HEAD function h() { +======= + function g() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.addInput("send", u.EVENT); this.properties = {port:0}; var c = this; @@ -8664,7 +11252,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addOutput("out", u.EVENT); this.midi_event = new c; } +<<<<<<< HEAD function A() { +======= + function z() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.properties = {scale:"A,A#,B,C,C#,D,D#,E,F,F#,G,G#"}; this.addInput("note", u.ACTION); this.addInput("scale", "string"); @@ -8795,12 +11387,20 @@ $jscomp.polyfill("Object.values", function(v) { return Number(e); } }; +<<<<<<< HEAD c.toNoteString = function(e, h) { +======= + c.toNoteString = function(e, g) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e = Math.round(e); var k = Math.floor((e - 24) / 12 + 1); e = (e - 21) % 12; 0 > e && (e = 12 + e); +<<<<<<< HEAD return c.notes[e] + (h ? "" : k); +======= + return c.notes[e] + (g ? "" : k); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; c.NoteStringToPitch = function(e) { e = e.toUpperCase(); @@ -8851,8 +11451,13 @@ $jscomp.polyfill("Object.values", function(v) { c.commands = {128:"note off", 144:"note on", 160:"key pressure", 176:"controller change", 192:"program change", 208:"channel pressure", 224:"pitch bend", 240:"system", 242:"Song pos", 243:"Song select", 246:"Tune request", 248:"time tick", 250:"Start Song", 251:"Continue Song", 252:"Stop Song", 254:"Sensing", 255:"Reset"}; c.commands_short = {128:"NOTEOFF", 144:"NOTEOFF", 160:"KEYP", 176:"CC", 192:"PC", 208:"CP", 224:"PB", 240:"SYS", 242:"POS", 243:"SELECT", 246:"TUNEREQ", 248:"TT", 250:"START", 251:"CONTINUE", 252:"STOP", 254:"SENS", 255:"RESET"}; c.commands_reversed = {}; +<<<<<<< HEAD for (var H in c.commands) { c.commands_reversed[c.commands[H]] = H; +======= + for (var G in c.commands) { + c.commands_reversed[c.commands[G]] = G; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } q.input = null; q.MIDIEvent = c; @@ -8886,7 +11491,11 @@ $jscomp.polyfill("Object.values", function(v) { q.prototype.onMIDIFailure = function(c) { console.error("Failed to get MIDI access - " + c); }; +<<<<<<< HEAD q.prototype.openInputPort = function(e, h) { +======= + q.prototype.openInputPort = function(e, g) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e = this.input_ports.get("input-" + e); if (!e) { return !1; @@ -8896,7 +11505,11 @@ $jscomp.polyfill("Object.values", function(v) { e.onmidimessage = function(a) { var b = new c(a.data); k.updateState(b); +<<<<<<< HEAD h && h(a.data, b); +======= + g && g(a.data, b); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (q.on_message) { q.on_message(a.data, b); } @@ -8918,8 +11531,13 @@ $jscomp.polyfill("Object.values", function(v) { this.state.cc[e.getCC()] = e.getCCValue(); } }; +<<<<<<< HEAD q.prototype.sendMIDI = function(e, h) { h && (e = this.output_ports_info[e]) && (q.output = this, h.constructor === c ? e.send(h.data) : e.send(h)); +======= + q.prototype.sendMIDI = function(e, g) { + g && (e = this.output_ports_info[e]) && (q.output = this, g.constructor === c ? e.send(g.data) : e.send(g)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; m.MIDIInterface = q; m.title = "MIDI Input"; @@ -8938,12 +11556,21 @@ $jscomp.polyfill("Object.values", function(v) { m.prototype.onStart = function() { this._midi ? this._midi.openInputPort(this.properties.port, this.onMIDIEvent.bind(this)) : this._waiting = !0; }; +<<<<<<< HEAD m.prototype.onMIDIEvent = function(e, h) { this._last_midi_event = h; this.boxcolor = "#AFA"; this._last_time = u.getTime(); this.trigger("on_midi", h); h.cmd == c.NOTEON ? this.trigger("on_noteon", h) : h.cmd == c.NOTEOFF ? this.trigger("on_noteoff", h) : h.cmd == c.CONTROLLERCHANGE ? this.trigger("on_cc", h) : h.cmd == c.PROGRAMCHANGE ? this.trigger("on_pc", h) : h.cmd == c.PITCHBEND && this.trigger("on_pitchbend", h); +======= + m.prototype.onMIDIEvent = function(e, g) { + this._last_midi_event = g; + this.boxcolor = "#AFA"; + this._last_time = u.getTime(); + this.trigger("on_midi", g); + g.cmd == c.NOTEON ? this.trigger("on_noteon", g) : g.cmd == c.NOTEOFF ? this.trigger("on_noteoff", g) : g.cmd == c.CONTROLLERCHANGE ? this.trigger("on_cc", g) : g.cmd == c.PROGRAMCHANGE ? this.trigger("on_pc", g) : g.cmd == c.PITCHBEND && this.trigger("on_pitchbend", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; m.prototype.onDrawBackground = function(c) { this.boxcolor = "#AAA"; @@ -8981,20 +11608,36 @@ $jscomp.polyfill("Object.values", function(v) { return [["last_midi", "midi"], ["on_midi", u.EVENT], ["on_noteon", u.EVENT], ["on_noteoff", u.EVENT], ["on_cc", u.EVENT], ["on_pc", u.EVENT], ["on_pitchbend", u.EVENT]]; }; u.registerNodeType("midi/input", m); +<<<<<<< HEAD h.MIDIInterface = q; h.title = "MIDI Output"; h.desc = "Sends MIDI to output channel"; h.color = "#243"; h.prototype.onGetPropertyInfo = function(c) { +======= + g.MIDIInterface = q; + g.title = "MIDI Output"; + g.desc = "Sends MIDI to output channel"; + g.color = "#243"; + g.prototype.onGetPropertyInfo = function(c) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this._midi && "port" == c) { return {type:"enum", values:this.getMIDIOutputs()}; } }; +<<<<<<< HEAD h.default_ports = {0:"unknown"}; h.prototype.getMIDIOutputs = function() { var c = {}; if (!this._midi) { return h.default_ports; +======= + g.default_ports = {0:"unknown"}; + g.prototype.getMIDIOutputs = function() { + var c = {}; + if (!this._midi) { + return g.default_ports; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } if (this._midi.output_ports_info) { for (var e = 0; e < this._midi.output_ports_info.length; ++e) { @@ -9004,6 +11647,7 @@ $jscomp.polyfill("Object.values", function(v) { } return c; }; +<<<<<<< HEAD h.prototype.onAction = function(c, e) { this._midi && ("send" == c && this._midi.sendMIDI(this.properties.port, e), this.trigger("midi", e)); }; @@ -9014,14 +11658,31 @@ $jscomp.polyfill("Object.values", function(v) { return [["on_midi", u.EVENT]]; }; u.registerNodeType("midi/output", h); +======= + g.prototype.onAction = function(c, e) { + this._midi && ("send" == c && this._midi.sendMIDI(this.properties.port, e), this.trigger("midi", e)); + }; + g.prototype.onGetInputs = function() { + return [["send", u.ACTION]]; + }; + g.prototype.onGetOutputs = function() { + return [["on_midi", u.EVENT]]; + }; + u.registerNodeType("midi/output", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 r.title = "MIDI Show"; r.desc = "Shows MIDI in the graph"; r.color = "#243"; r.prototype.getTitle = function() { return this.flags.collapsed ? this._str : this.title; }; +<<<<<<< HEAD r.prototype.onAction = function(e, h) { h && (this._str = h.constructor === c ? h.toString() : "???"); +======= + r.prototype.onAction = function(e, g) { + g && (this._str = g.constructor === c ? g.toString() : "???"); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; r.prototype.onDrawForeground = function(c) { this._str && !this.flags.collapsed && (c.font = "30px Arial", c.fillText(this._str, 10, 0.8 * this.size[1])); @@ -9042,6 +11703,7 @@ $jscomp.polyfill("Object.values", function(v) { -1 != this.properties.min_value && -1 != this.properties.max_value && (e += " " + (this.properties.min_value == this.properties.max_value ? this.properties.max_value : this.properties.min_value + ".." + this.properties.max_value)); return "Filter: " + e; }; +<<<<<<< HEAD l.prototype.onPropertyChanged = function(e, h) { "cmd" == e && (e = Number(h), isNaN(e) && (e = c.commands[h] || 0), this.properties.cmd = e); }; @@ -9055,19 +11717,41 @@ $jscomp.polyfill("Object.values", function(v) { } } this.trigger("on_midi", h); +======= + l.prototype.onPropertyChanged = function(e, g) { + "cmd" == e && (e = Number(g), isNaN(e) && (e = c.commands[g] || 0), this.properties.cmd = e); + }; + l.prototype.onAction = function(e, g) { + if (g && g.constructor === c) { + if (this._learning) { + this._learning = !1, this.boxcolor = "#AAA", this.properties.channel = g.channel, this.properties.cmd = g.cmd, this.properties.min_value = this.properties.max_value = g.data[1]; + } else { + if (-1 != this.properties.channel && g.channel != this.properties.channel || -1 != this.properties.cmd && g.cmd != this.properties.cmd || -1 != this.properties.min_value && g.data[1] < this.properties.min_value || -1 != this.properties.max_value && g.data[1] > this.properties.max_value) { + return; + } + } + this.trigger("on_midi", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } }; u.registerNodeType("midi/filter", l); B.title = "MIDIEvent"; B.desc = "Create a MIDI Event"; B.color = "#243"; +<<<<<<< HEAD B.prototype.onAction = function(e, h) { "assign" == e ? (this.properties.channel = h.channel, this.properties.cmd = h.cmd, this.properties.value1 = h.data[1], this.properties.value2 = h.data[2], h.cmd == c.NOTEON ? this.gate = !0 : h.cmd == c.NOTEOFF && (this.gate = !1)) : (h = this.midi_event, h.channel = this.properties.channel, this.properties.cmd && this.properties.cmd.constructor === String ? h.setCommandFromString(this.properties.cmd) : h.cmd = this.properties.cmd, h.data[0] = h.cmd | h.channel, h.data[1] = Number(this.properties.value1), h.data[2] = Number(this.properties.value2), this.trigger("on_midi", h)); +======= + B.prototype.onAction = function(e, g) { + "assign" == e ? (this.properties.channel = g.channel, this.properties.cmd = g.cmd, this.properties.value1 = g.data[1], this.properties.value2 = g.data[2], g.cmd == c.NOTEON ? this.gate = !0 : g.cmd == c.NOTEOFF && (this.gate = !1)) : (g = this.midi_event, g.channel = this.properties.channel, this.properties.cmd && this.properties.cmd.constructor === String ? g.setCommandFromString(this.properties.cmd) : g.cmd = this.properties.cmd, g.data[0] = g.cmd | g.channel, g.data[1] = Number(this.properties.value1), + g.data[2] = Number(this.properties.value2), this.trigger("on_midi", g)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; B.prototype.onExecute = function() { var e = this.properties; if (this.inputs) { +<<<<<<< HEAD for (var h = 0; h < this.inputs.length; ++h) { var k = this.inputs[h]; if (-1 != k.link) { @@ -9086,13 +11770,38 @@ $jscomp.polyfill("Object.values", function(v) { break; case "value2": k = this.getInputData(h), null != k && (this.properties.value2 = Math.clamp(k | 0, 0, 127)); +======= + for (var g = 0; g < this.inputs.length; ++g) { + var k = this.inputs[g]; + if (-1 != k.link) { + switch(k.name) { + case "note": + k = this.getInputData(g); + null != k && (k.constructor === String && (k = c.NoteStringToPitch(k)), this.properties.value1 = (k | 0) % 255); + break; + case "cmd": + k = this.getInputData(g); + null != k && (this.properties.cmd = k); + break; + case "value1": + k = this.getInputData(g); + null != k && (this.properties.value1 = Math.clamp(k | 0, 0, 127)); + break; + case "value2": + k = this.getInputData(g), null != k && (this.properties.value2 = Math.clamp(k | 0, 0, 127)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } } if (this.outputs) { +<<<<<<< HEAD for (h = 0; h < this.outputs.length; ++h) { switch(this.outputs[h].name) { +======= + for (g = 0; g < this.outputs.length; ++g) { + switch(this.outputs[g].name) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 case "midi": k = new c; k.setup([e.cmd, e.value1, e.value2]); @@ -9125,12 +11834,21 @@ $jscomp.polyfill("Object.values", function(v) { default: continue; } +<<<<<<< HEAD null !== k && this.setOutputData(h, k); } } }; B.prototype.onPropertyChanged = function(e, h) { "cmd" == e && (this.properties.cmd = c.computeCommandFromString(h)); +======= + null !== k && this.setOutputData(g, k); + } + } + }; + B.prototype.onPropertyChanged = function(e, g) { + "cmd" == e && (this.properties.cmd = c.computeCommandFromString(g)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; B.prototype.onGetInputs = function() { return [["cmd", "number"], ["note", "number"], ["value1", "number"], ["value2", "number"]]; @@ -9152,9 +11870,15 @@ $jscomp.polyfill("Object.values", function(v) { w.color = "#243"; w.processScale = function(e) { e = e.split(","); +<<<<<<< HEAD for (var h = 0; h < e.length; ++h) { var k = e[h]; e[h] = 2 == k.length && "#" != k[1] || 2 < k.length ? -u.MIDIEvent.NoteStringToPitch(k) : c.note_to_index[k] || 0; +======= + for (var g = 0; g < e.length; ++g) { + var k = e[g]; + e[g] = 2 == k.length && "#" != k[1] || 2 < k.length ? -u.MIDIEvent.NoteStringToPitch(k) : c.note_to_index[k] || 0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } return e; }; @@ -9168,6 +11892,7 @@ $jscomp.polyfill("Object.values", function(v) { this.notes_pitches = w.processScale(c); } }; +<<<<<<< HEAD w.prototype.onAction = function(e, h) { var k = 0; h = this.notes_pitches.length; @@ -9179,6 +11904,19 @@ $jscomp.polyfill("Object.values", function(v) { h.setup([c.NOTEON, k, 10]); e = this.properties.duration || 1; this.trigger("note", h); +======= + w.prototype.onAction = function(e, g) { + var k = 0; + g = this.notes_pitches.length; + e = 0; + "sequence" == this.properties.mode ? e = this.sequence_index = (this.sequence_index + 1) % g : "random" == this.properties.mode && (e = Math.floor(Math.random() * g)); + g = this.notes_pitches[e]; + k = 0 <= g ? g + 12 * (this.properties.octave - 1) + 33 : -g; + g = new c; + g.setup([c.NOTEON, k, 10]); + e = this.properties.duration || 1; + this.trigger("note", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 setTimeout(function() { var a = new c; a.setup([c.NOTEOFF, k, 0]); @@ -9189,14 +11927,20 @@ $jscomp.polyfill("Object.values", function(v) { E.title = "MIDI Transpose"; E.desc = "Transpose a MIDI note"; E.color = "#243"; +<<<<<<< HEAD E.prototype.onAction = function(e, h) { h && h.constructor === c && (h.data[0] == c.NOTEON || h.data[0] == c.NOTEOFF ? (this.midi_event = new c, this.midi_event.setup(h.data), this.midi_event.data[1] = Math.round(this.midi_event.data[1] + this.properties.amount), this.trigger("out", this.midi_event)) : this.trigger("out", h)); +======= + E.prototype.onAction = function(e, g) { + g && g.constructor === c && (g.data[0] == c.NOTEON || g.data[0] == c.NOTEOFF ? (this.midi_event = new c, this.midi_event.setup(g.data), this.midi_event.data[1] = Math.round(this.midi_event.data[1] + this.properties.amount), this.trigger("out", this.midi_event)) : this.trigger("out", g)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 }; E.prototype.onExecute = function() { var c = this.getInputData(1); null != c && (this.properties.amount = c); }; u.registerNodeType("midi/transpose", E); +<<<<<<< HEAD A.title = "MIDI Quantize Pitch"; A.desc = "Transpose a MIDI note tp fit an scale"; A.color = "#243"; @@ -9204,6 +11948,15 @@ $jscomp.polyfill("Object.values", function(v) { "scale" == c && this.processScale(e); }; A.prototype.processScale = function(c) { +======= + z.title = "MIDI Quantize Pitch"; + z.desc = "Transpose a MIDI note tp fit an scale"; + z.color = "#243"; + z.prototype.onPropertyChanged = function(c, e) { + "scale" == c && this.processScale(e); + }; + z.prototype.processScale = function(c) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this._current_scale = c; this.notes_pitches = w.processScale(c); for (c = 0; 12 > c; ++c) { @@ -9226,6 +11979,7 @@ $jscomp.polyfill("Object.values", function(v) { } } }; +<<<<<<< HEAD A.prototype.onAction = function(e, h) { h && h.constructor === c && (h.data[0] == c.NOTEON || h.data[0] == c.NOTEOFF ? (this.midi_event = new c, this.midi_event.setup(h.data), this.midi_event.data[1] += this.offset_notes[c.note_to_index[h.note]], this.trigger("out", this.midi_event)) : this.trigger("out", h)); }; @@ -9234,6 +11988,16 @@ $jscomp.polyfill("Object.values", function(v) { null != c && c != this._current_scale && this.processScale(c); }; u.registerNodeType("midi/quantize", A); +======= + z.prototype.onAction = function(e, g) { + g && g.constructor === c && (g.data[0] == c.NOTEON || g.data[0] == c.NOTEOFF ? (this.midi_event = new c, this.midi_event.setup(g.data), this.midi_event.data[1] += this.offset_notes[c.note_to_index[g.note]], this.trigger("out", this.midi_event)) : this.trigger("out", g)); + }; + z.prototype.onExecute = function() { + var c = this.getInputData(1); + null != c && c != this._current_scale && this.processScale(c); + }; + u.registerNodeType("midi/quantize", z); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e.title = "MIDI fromFile"; e.desc = "Plays a MIDI file"; e.color = "#243"; @@ -9246,8 +12010,13 @@ $jscomp.polyfill("Object.values", function(v) { e.prototype.onExecute = function() { if (this._midi && this._playing) { this._current_time += this.graph.elapsed_time; +<<<<<<< HEAD for (var e = 100 * this._current_time, h = 0; h < this._midi.tracks; ++h) { var k = this._midi.track[h]; +======= + for (var e = 100 * this._current_time, g = 0; g < this._midi.tracks; ++g) { + var k = this._midi.track[g]; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 k._last_pos || (k._last_pos = 0, k._time = 0); var a = k.event[k._last_pos]; if (a && k._time + a.deltaTime <= e && (k._last_pos++, k._time += a.deltaTime, a.data)) { @@ -9286,6 +12055,7 @@ $jscomp.polyfill("Object.values", function(v) { C.title = "MIDI Play"; C.desc = "Plays a MIDI note"; C.color = "#243"; +<<<<<<< HEAD C.prototype.onAction = function(e, h) { if (h && h.constructor === c) { if (this.instrument && h.data[0] == c.NOTEON) { @@ -9296,6 +12066,18 @@ $jscomp.polyfill("Object.values", function(v) { this.instrument.play(e, h.octave, this.properties.duration, this.properties.volume); } this.trigger("note", h); +======= + C.prototype.onAction = function(e, g) { + if (g && g.constructor === c) { + if (this.instrument && g.data[0] == c.NOTEON) { + e = g.note; + if (!e || "undefined" == e || e.constructor !== String) { + return; + } + this.instrument.play(e, g.octave, this.properties.duration, this.properties.volume); + } + this.trigger("note", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } }; C.prototype.onExecute = function() { @@ -9317,11 +12099,19 @@ $jscomp.polyfill("Object.values", function(v) { c.globalAlpha = 1; for (var b = 0; 2 > b; b++) { for (var d = 0; d < e; ++d) { +<<<<<<< HEAD var g = D.keys[d % 12]; if (g.t == b) { var f = 7 * Math.floor(d / 12) * k + g.x * k; c.fillStyle = 0 == b ? this.keys[d] ? "#CCC" : "white" : this.keys[d] ? "#333" : "black"; c.fillRect(f + 1, 0, k * g.w - 2, a * g.h); +======= + var h = D.keys[d % 12]; + if (h.t == b) { + var f = 7 * Math.floor(d / 12) * k + h.x * k; + c.fillStyle = 0 == b ? this.keys[d] ? "#CCC" : "white" : this.keys[d] ? "#333" : "black"; + c.fillRect(f + 1, 0, k * h.w - 2, a * h.h); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } } } @@ -9332,9 +12122,15 @@ $jscomp.polyfill("Object.values", function(v) { for (var b = 0; b < this.keys.length; ++b) { var d = D.keys[b % 12]; if (d.t == a) { +<<<<<<< HEAD var g = 7 * Math.floor(b / 12) * e + d.x * e, f = e * d.w; d = k * d.h; if (!(c[0] < g || c[0] > g + f || c[1] > d)) { +======= + var h = 7 * Math.floor(b / 12) * e + d.x * e, f = e * d.w; + d = k * d.h; + if (!(c[0] < h || c[0] > h + f || c[1] > d)) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 return b; } } @@ -9342,6 +12138,7 @@ $jscomp.polyfill("Object.values", function(v) { } return -1; }; +<<<<<<< HEAD D.prototype.onAction = function(e, h) { if ("reset" == e) { for (h = 0; h < this.keys.length; ++h) { @@ -9360,10 +12157,31 @@ $jscomp.polyfill("Object.values", function(v) { if (!(0 > h[1] || -1 == this._last_key)) { this.setDirtyCanvas(!0); e = this.getKeyIndex(h); +======= + D.prototype.onAction = function(e, g) { + if ("reset" == e) { + for (g = 0; g < this.keys.length; ++g) { + this.keys[g] = !1; + } + } else { + g && g.constructor === c && (e = g.data[1] - (12 * (this.properties.start_octave - 1) + 29), 0 <= e && e < this.keys.length && (g.data[0] == c.NOTEON ? this.keys[e] = !0 : g.data[0] == c.NOTEOFF && (this.keys[e] = !1)), this.trigger("note", g)); + } + }; + D.prototype.onMouseDown = function(e, g) { + if (!(0 > g[1])) { + return e = this.getKeyIndex(g), this.keys[e] = !0, this._last_key = e, e = 12 * (this.properties.start_octave - 1) + 29 + e, g = new c, g.setup([c.NOTEON, e, 100]), this.trigger("note", g), !0; + } + }; + D.prototype.onMouseMove = function(e, g) { + if (!(0 > g[1] || -1 == this._last_key)) { + this.setDirtyCanvas(!0); + e = this.getKeyIndex(g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this._last_key == e) { return !0; } this.keys[this._last_key] = !1; +<<<<<<< HEAD h = 12 * (this.properties.start_octave - 1) + 29 + this._last_key; var k = new c; k.setup([c.NOTEOFF, h, 100]); @@ -9372,14 +12190,30 @@ $jscomp.polyfill("Object.values", function(v) { h = 12 * (this.properties.start_octave - 1) + 29 + e; k = new c; k.setup([c.NOTEON, h, 100]); +======= + g = 12 * (this.properties.start_octave - 1) + 29 + this._last_key; + var k = new c; + k.setup([c.NOTEOFF, g, 100]); + this.trigger("note", k); + this.keys[e] = !0; + g = 12 * (this.properties.start_octave - 1) + 29 + e; + k = new c; + k.setup([c.NOTEON, g, 100]); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.trigger("note", k); this._last_key = e; return !0; } }; +<<<<<<< HEAD D.prototype.onMouseUp = function(e, h) { if (!(0 > h[1])) { return e = this.getKeyIndex(h), this.keys[e] = !1, this._last_key = -1, e = 12 * (this.properties.start_octave - 1) + 29 + e, h = new c, h.setup([c.NOTEOFF, e, 100]), this.trigger("note", h), !0; +======= + D.prototype.onMouseUp = function(e, g) { + if (!(0 > g[1])) { + return e = this.getKeyIndex(g), this.keys[e] = !1, this._last_key = -1, e = 12 * (this.properties.start_octave - 1) + 29 + e, g = new c, g.setup([c.NOTEOFF, e, 100]), this.trigger("note", g), !0; +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } }; u.registerNodeType("midi/keys", D); @@ -9421,7 +12255,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addOutput("samples", "array"); this._time_bin = this._freq_bin = null; } +<<<<<<< HEAD function h() { +======= + function g() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.properties = {gain:1}; this.audionode = p.getAudioContext().createGain(); this.addInput("in", "audio"); @@ -9479,7 +12317,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addInput("time", "number"); this.addOutput("out", "audio"); } +<<<<<<< HEAD function A() { +======= + function z() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.properties = {frequency:350, detune:0, Q:1}; this.addProperty("type", "lowpass", "enum", {values:"lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ")}); this.audionode = p.getAudioContext().createBiquadFilter(); @@ -9517,7 +12359,11 @@ $jscomp.polyfill("Object.values", function(v) { this.addInput("in", "audio"); this.addOutput("out", "audio"); } +<<<<<<< HEAD function H() { +======= + function G() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.audionode = p.getAudioContext().destination; this.addInput("in", "audio"); } @@ -9570,8 +12416,13 @@ $jscomp.polyfill("Object.values", function(v) { } if (c.outputs) { for (b = 0; b < c.outputs.length; ++b) { +<<<<<<< HEAD for (var k = c.outputs[b], h = 0; h < k.links.length; ++h) { if (d = c.graph.links[k.links[h]]) { +======= + for (var k = c.outputs[b], g = 0; g < k.links.length; ++g) { + if (d = c.graph.links[k.links[g]]) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e = c.getAudioNodeInOutputSlot ? c.getAudioNodeInOutputSlot(b) : c.audionode; var l = c.graph.getNodeById(d.target_id); d = l.getAudioNodeInInputSlot ? l.getAudioNodeInInputSlot(d.target_slot) : l.audionode; @@ -9851,7 +12702,11 @@ $jscomp.polyfill("Object.values", function(v) { m.title = "Analyser"; m.desc = "Audio Analyser"; n.registerNodeType("audio/analyser", m); +<<<<<<< HEAD h.prototype.onExecute = function() { +======= + g.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.inputs && this.inputs.length) { for (var c = 1; c < this.inputs.length; ++c) { var a = this.inputs[c], b = this.getInputData(c); @@ -9859,10 +12714,17 @@ $jscomp.polyfill("Object.values", function(v) { } } }; +<<<<<<< HEAD p.createAudioNodeWrapper(h); h.title = "Gain"; h.desc = "Audio gain"; n.registerNodeType("audio/gain", h); +======= + p.createAudioNodeWrapper(g); + g.title = "Gain"; + g.desc = "Audio gain"; + n.registerNodeType("audio/gain", g); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 p.createAudioNodeWrapper(r); r.prototype.onRemove = function() { this._dropped_url && URL.revokeObjectURL(this._dropped_url); @@ -9943,8 +12805,13 @@ $jscomp.polyfill("Object.values", function(v) { y.desc = "Audio mixer"; n.registerNodeType("audio/mixer", y); w.prototype.onExecute = function() { +<<<<<<< HEAD var c = p.getAudioContext().currentTime, a = this.audionode.gain, b = this.getInputData(1), d = this.getInputOrProperty("A"), e = this.getInputOrProperty("D"), f = this.getInputOrProperty("S"), h = this.getInputOrProperty("R"); !this.gate && b ? (a.cancelScheduledValues(0), a.setValueAtTime(0, c), a.linearRampToValueAtTime(1, c + d), a.linearRampToValueAtTime(f, c + d + e)) : this.gate && !b && (a.cancelScheduledValues(0), a.setValueAtTime(a.value, c), a.linearRampToValueAtTime(0, c + h)); +======= + var c = p.getAudioContext().currentTime, a = this.audionode.gain, b = this.getInputData(1), d = this.getInputOrProperty("A"), e = this.getInputOrProperty("D"), f = this.getInputOrProperty("S"), g = this.getInputOrProperty("R"); + !this.gate && b ? (a.cancelScheduledValues(0), a.setValueAtTime(0, c), a.linearRampToValueAtTime(1, c + d), a.linearRampToValueAtTime(f, c + d + e)) : this.gate && !b && (a.cancelScheduledValues(0), a.setValueAtTime(a.value, c), a.linearRampToValueAtTime(0, c + g)); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 this.gate = b; }; w.prototype.onGetInputs = function() { @@ -9962,7 +12829,11 @@ $jscomp.polyfill("Object.values", function(v) { E.title = "Delay"; E.desc = "Audio delay"; n.registerNodeType("audio/delay", E); +<<<<<<< HEAD A.prototype.onExecute = function() { +======= + z.prototype.onExecute = function() { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 if (this.inputs && this.inputs.length) { for (var c = 1; c < this.inputs.length; ++c) { var a = this.inputs[c]; @@ -9973,6 +12844,7 @@ $jscomp.polyfill("Object.values", function(v) { } } }; +<<<<<<< HEAD A.prototype.onGetInputs = function() { return [["frequency", "number"], ["detune", "number"], ["Q", "number"]]; }; @@ -9980,6 +12852,15 @@ $jscomp.polyfill("Object.values", function(v) { A.title = "BiquadFilter"; A.desc = "Audio filter"; n.registerNodeType("audio/biquadfilter", A); +======= + z.prototype.onGetInputs = function() { + return [["frequency", "number"], ["detune", "number"], ["Q", "number"]]; + }; + p.createAudioNodeWrapper(z); + z.title = "BiquadFilter"; + z.desc = "Audio filter"; + n.registerNodeType("audio/biquadfilter", z); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 e.prototype.onStart = function() { if (!this.audionode.started) { this.audionode.started = !0; @@ -10109,9 +12990,15 @@ $jscomp.polyfill("Object.values", function(v) { u.title = "Script"; u.desc = "apply script to signal"; n.registerNodeType("audio/script", u); +<<<<<<< HEAD H.title = "Destination"; H.desc = "Audio output"; n.registerNodeType("audio/destination", H); +======= + G.title = "Destination"; + G.desc = "Audio output"; + n.registerNodeType("audio/destination", G); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 })(this); (function(v) { function c() { @@ -10173,6 +13060,7 @@ $jscomp.polyfill("Object.values", function(v) { console.log("ready"); c.boxcolor = "#6C6"; }; +<<<<<<< HEAD this._ws.onmessage = function(h) { c.boxcolor = "#AFA"; h = JSON.parse(h.data); @@ -10197,6 +13085,32 @@ $jscomp.polyfill("Object.values", function(v) { c.boxcolor = "#E88"; }; this._ws.onclose = function(h) { +======= + this._ws.onmessage = function(g) { + c.boxcolor = "#AFA"; + g = JSON.parse(g.data); + if (!g.room || g.room == c.properties.room) { + if (1 == g.type) { + if (g.data.object_class && m[g.data.object_class]) { + var l = null; + try { + l = new m[g.data.object_class](g.data), c.triggerSlot(0, l); + } catch (y) { + } + } else { + c.triggerSlot(0, g.data); + } + } else { + c._last_received_data[g.channel || 0] = g.data; + } + } + }; + this._ws.onerror = function(g) { + console.log("couldnt connect to websocket"); + c.boxcolor = "#E88"; + }; + this._ws.onclose = function(g) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 console.log("connection closed"); c.boxcolor = "#000"; }; @@ -10283,6 +13197,7 @@ $jscomp.polyfill("Object.values", function(v) { if (this._server = new SillyClient, this._server.on_ready = function() { console.log("ready"); c.boxcolor = "#6C6"; +<<<<<<< HEAD }, this._server.on_message = function(h, l) { h = null; try { @@ -10295,10 +13210,25 @@ $jscomp.polyfill("Object.values", function(v) { l = null; try { l = new m[h.data.object_class](h.data), c.triggerSlot(0, l); +======= + }, this._server.on_message = function(g, l) { + g = null; + try { + g = JSON.parse(l); + } catch (B) { + return; + } + if (1 == g.type) { + if (g.data.object_class && m[g.data.object_class]) { + l = null; + try { + l = new m[g.data.object_class](g.data), c.triggerSlot(0, l); +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 } catch (B) { return; } } else { +<<<<<<< HEAD c.triggerSlot(0, h.data); } } else { @@ -10309,6 +13239,18 @@ $jscomp.polyfill("Object.values", function(v) { console.log("couldnt connect to websocket"); c.boxcolor = "#E88"; }, this._server.on_close = function(h) { +======= + c.triggerSlot(0, g.data); + } + } else { + c._last_received_data[g.channel || 0] = g.data; + } + c.boxcolor = "#AFA"; + }, this._server.on_error = function(g) { + console.log("couldnt connect to websocket"); + c.boxcolor = "#E88"; + }, this._server.on_close = function(g) { +>>>>>>> 11a1026074c4a5e5b0d60e24f1cb7bfd89f21701 console.log("connection closed"); c.boxcolor = "#000"; }, this.properties.url && this.properties.room) { diff --git a/src/litegraph.js b/src/litegraph.js index 5d1d9dad2..eecee5d47 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -5590,8 +5590,8 @@ LGraphNode.prototype.executeAction = function(action) widgets_height += 8; } - if (this.resizing_node.size[1] < min_height) { var min_height = max_slots * LiteGraph.NODE_SLOT_HEIGHT + widgets_height; + if (this.resizing_node.size[1] < min_height) { this.resizing_node.size[1] = min_height; }